用例图:

前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChannelEdit.aspx.cs" Inherits="BioErpWeb.CRMSystem.CrmChannel.ChannelEdit"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<link href="../../Styles/CalenderStyle.css" rel="stylesheet" type="text/css" />
<script src="../../JS/CheckUserName.js" type="text/javascript"></script>
<script src="../../JS/ChannelChoose.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/validateExtender.js" type="text/javascript"></script>
<script src="../../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script>
<script src="../../Scripts/cld.js" type="text/javascript"></script>
<style type="text/css">
.style1
{
height: 22px;
}
.style3
{
width: 352px;
}
.style4
{
width: 114px;
}
.style5
{
width: 92px;
} .linkmantable{ width:100%; border:solid 1px; border-collapse:collapse; }
.linkmantable td{ border:solid 1px ;}
.linkmantable input{ width:70px;}
</style>
<script type="text/javascript">
var i = 0;
$(document).ready(function () {
$("#form1").validate();
jQuery("#btnAddNew").click(function () {
i++;
tr = '';
tr = tr + ' <tr id="tr' + i + '">';
tr = tr + ' <td><input name="txtLinkMan1" MaxLength="10"></input></td>';
tr = tr + ' <td>';
tr = tr + ' <select name="ddlSex1" > <option Value="0">男</option> <option Value="1">女</option></select>';
tr = tr + ' </td>';
tr = tr + ' <td>';
tr = tr + ' <input name="txtBirthday1" onfocus="setday(this)" onclick="setday(this)" MaxLength="20"></input></td>';
tr = tr + ' <td><select name="ddlMainLink1"> <option Value="1">是</option> <option Value="0">否</option> </select></td>';
tr = tr + ' <td> <input name="txtOfficePhone" MaxLength="20" ></input></td>';
tr = tr + ' <td> <input name="txtMobile1" MaxLength="20" ></input></td>';
tr = tr + ' <td> <input name="txtEmail11" MaxLength="20"></input></td>';
tr = tr + ' <td> <input name="txtAddress1" MaxLength="50" ></input></td>';
tr = tr + ' <td> <input name="txtQQ1" MaxLength="15"></input></td>';
tr = tr + ' <td> <input name="txtRemark1" MaxLength="200"></input></td>';
tr = tr + ' </tr>'; $("#caption").before(tr); }); jQuery("#btnDelete").click(function () {
$("#tr" + i).remove();
i--;
}); }); function Autoaddrows(count) {
for (var j = 0; j < count; j++) {
i++;
tr = '';
tr = tr + ' <tr id="tr' + i + '">';
tr = tr + ' <td><input name="txtLinkMan1" MaxLength="10"></input></td>';
tr = tr + ' <td>';
tr = tr + ' <select name="ddlSex1" > <option Value="0">男</option> <option Value="1">女</option></select>';
tr = tr + ' </td>';
tr = tr + ' <td>';
tr = tr + ' <input name="txtBirthday1" onfocus="setday(this)" onclick="setday(this)" MaxLength="20"></input></td>';
tr = tr + ' <td><select name="ddlMainLink1"> <option Value="1">是</option> <option Value="0">否</option> </select></td>';
tr = tr + ' <td> <input name="txtOfficePhone" MaxLength="20" ></input></td>';
tr = tr + ' <td> <input name="txtMobile1" MaxLength="20" ></input></td>';
tr = tr + ' <td> <input name="txtEmail11" MaxLength="20"></input></td>';
tr = tr + ' <td> <input name="txtAddress1" MaxLength="50" ></input></td>';
tr = tr + ' <td> <input name="txtQQ1" MaxLength="15"></input></td>';
tr = tr + ' <td> <input name="txtRemark1" MaxLength="200"></input></td>';
tr = tr + ' </tr>'; $("#caption").before(tr);
}
} //赋值
function setvalues(LinkMans, Sexs, Birthdays, MainLinks, OfficePhones, mobiles, emails, addresses, QQs, remarks)
{
var LinkMans0=LinkMans.split(',');
var Sexs0 = Sexs.split(',');
var Birthdays0 = Birthdays.split(',');
var MainLinks = MainLinks.split(',');
var OfficePhones = OfficePhones.split(',');
var mobiles = mobiles.split(',');
var emails = emails.split(',');
var addresses = addresses.split(',');
var QQs = QQs.split(',');
var remarks = remarks.split(',');
var txtLinkMan1s= document.getElementsByName("txtLinkMan1");
var txtBirthday1s = document.getElementsByName("txtBirthday1");
var ddlMainLink1s = document.getElementsByName("ddlMainLink1");
var txtOfficePhones = document.getElementsByName("txtOfficePhone");
var txtMobile1s = document.getElementsByName("txtMobile1");
var txtEmail11s = document.getElementsByName("txtEmail11");
var txtAddress1s = document.getElementsByName("txtAddress1");
var txtQQ1s = document.getElementsByName("txtQQ1");
var txtRemark1s = document.getElementsByName("txtRemark1");
var ddlSex1s = document.getElementsByName("ddlSex1"); for (var k = 0; k < LinkMans0.length; k++) {
txtLinkMan1s[k].value = LinkMans0[k];
ddlSex1s[k].value = Sexs0[k];
txtBirthday1s[k].value = Birthdays0[k];
ddlMainLink1s[k].value = MainLinks[k];
txtOfficePhones[k].value = OfficePhones[k];
txtMobile1s[k].value = mobiles[k];
txtEmail11s[k].value = emails[k];
txtAddress1s[k].value = addresses[k];
txtQQ1s[k].value = QQs[k];
txtRemark1s[k].value = remarks[k];
}
} </script> </head>
<body>
<form id="form1" runat="server"> <div style=" width:960px; margin:0px auto; height:550px; overflow:scroll;">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<table class="maintable" style=" width:900px;">
<tr>
<td colspan="4" class="titlebar">渠道<span>信息添加</span></td>
</tr>
<tr>
<td>渠道名</td><td><asp:TextBox ID="txtChannelName" CssClass="required" runat="server"></asp:TextBox></td>
<td>上级渠道</td><td><asp:TextBox ID="txtSuperChannelID" CssClass="number" runat="server"></asp:TextBox>
<input type="button" onclick="showChannel()" value="选择"/>
</td>
</tr>
<tr>
<td>注册时间</td><td><asp:TextBox ID="txtRegisterTime" CssClass="required dateISO" runat="server"></asp:TextBox> </td>
<td>渠道规模</td><td>
<asp:DropDownList ID="ddlChannelSize" runat="server">
<asp:ListItem>集团公司</asp:ListItem>
<asp:ListItem Selected="True">中等企业</asp:ListItem>
<asp:ListItem>小型企业</asp:ListItem>
<asp:ListItem>微型企业</asp:ListItem>
<asp:ListItem>个体工商户</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>开户银行</td><td><asp:TextBox ID="txtBank" runat="server"></asp:TextBox></td>
<td>银行账号</td><td><asp:TextBox ID="txtAccounts" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>公司网址</td><td><asp:TextBox ID="txtWebSite" runat="server"></asp:TextBox></td>
<td>企业地址</td><td><asp:TextBox ID="txtAddress" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Email邮件</td><td><asp:TextBox ID="txtEmail" CssClass="email" runat="server"></asp:TextBox></td>
<td>传真</td><td><asp:TextBox ID="txtFax" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>电话号码1</td><td><asp:TextBox ID="txtTel1" CssClass="required isTel" runat="server"></asp:TextBox></td>
<td>电话号码2</td><td><asp:TextBox ID="txtTel2" CssClass="isTel" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>渠道等级</td><td>
<asp:DropDownList ID="ddlLevel" runat="server">
<asp:ListItem>一级</asp:ListItem>
<asp:ListItem>二级</asp:ListItem>
<asp:ListItem>三级</asp:ListItem>
<asp:ListItem>四级</asp:ListItem>
</asp:DropDownList>
</td>
<td>信用级别</td><td><asp:TextBox ID="txtCredit" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>税号</td><td><asp:TextBox ID="txtTaxNumber" runat="server"></asp:TextBox></td>
<td>下次联系时间</td><td><asp:TextBox ID="txtNextTime" CssClass="required dateISO" runat="server"></asp:TextBox> </td>
</tr>
<tr>
<td>客户状态</td><td>
<asp:DropDownList ID="ddlState" runat="server">
<asp:ListItem>良好</asp:ListItem>
<asp:ListItem>一般</asp:ListItem>
</asp:DropDownList>
</td>
<td>所属行业</td><td>
<asp:DropDownList ID="ddlVocation" runat="server">
<asp:ListItem>制造</asp:ListItem>
<asp:ListItem>服务</asp:ListItem>
<asp:ListItem>教育</asp:ListItem>
<asp:ListItem>医疗</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style1">客户类型</td><td class="style1">
<asp:DropDownList ID="ddlType" runat="server">
<asp:ListItem>国有</asp:ListItem>
<asp:ListItem>民营</asp:ListItem>
<asp:ListItem>外资</asp:ListItem>
<asp:ListItem>合资</asp:ListItem>
<asp:ListItem>个体</asp:ListItem>
</asp:DropDownList>
</td>
<td class="style1">是否删除</td><td class="style1">
<asp:CheckBox ID="cbDelete" Text="是" runat="server" />
</td>
</tr>
<tr>
<td colspan="4"> <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table style=" width:100%; border:0px;">
<tr>
<td class="style5">省份</td><td class="style3">
<asp:DropDownList ID="ddlProvince" runat="server" Width="150px" AutoPostBack="True"
onselectedindexchanged="ddlProvince_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td class="style4">城市</td>
<td>
<asp:DropDownList ID="ddlCity" CssClass="required" Width="150px" runat="server">
</asp:DropDownList>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel> </td>
</tr> <tr>
<td>所属代表</td><td><asp:TextBox ID="txtUserName" CssClass="required" runat="server"></asp:TextBox><input type="button" style=" width:60px" value="选择" onclick="showDialog2()"/></td>
<td>所属区域</td><td>
<asp:DropDownList ID="ddlArea" runat="server" Width="150px"
>
<asp:ListItem>东</asp:ListItem>
<asp:ListItem>西</asp:ListItem>
<asp:ListItem>南</asp:ListItem>
<asp:ListItem>北</asp:ListItem>
</asp:DropDownList>
</td>
</tr> <tr>
<td>公司概要:</td><td colspan="3">
<asp:TextBox ID="txtCoSummary" runat="server" Rows="2" TextMode="MultiLine"
Width="580px"></asp:TextBox>
</td>
</tr> <tr>
<td>主要业务:</td><td colspan="3">
<asp:TextBox ID="txtCoreOperttion" runat="server" Rows="2" TextMode="MultiLine"
Width="580px"></asp:TextBox>
</td>
</tr> <tr>
<td colspan="4">
<table class="linkmantable">
<tr>
<td>联系人</td>
<td>性别</td>
<td>生日</td>
<td>是否主联系人</td>
<td>办公室电话</td>
<td>个人手机</td>
<td>Email</td>
<td>地址</td>
<td>QQ</td>
<td>备注</td>
</tr>
<tr>
<td><input name="txtLinkMan1" class="required" MaxLength="10"></input></td>
<td>
<select name="ddlSex1" >
<option Value="0">男</option>
<option Value="1">女</option>
</select>
</td>
<td>
<input name="txtBirthday1" onfocus="setday(this)" onclick="setday(this)" MaxLength="20"></input></td>
<td><select name="ddlMainLink1">
<option Value="1">是</option>
<option Value="0">否</option>
</select></td>
<td> <input name="txtOfficePhone" MaxLength="20" ></input></td>
<td> <input name="txtMobile1" class="required isMobile" MaxLength="20" ></input></td>
<td> <input name="txtEmail11" class="email" MaxLength="20"></input></td>
<td> <input name="txtAddress1" MaxLength="50" ></input></td>
<td> <input name="txtQQ1" MaxLength="15"></input></td>
<td> <input name="txtRemark1" MaxLength="200"></input></td>
</tr>
<tr id="caption">
<td colspan="10" style="text-align: right; padding-right: 20px;">
<input type="button" value="删除一行" id="btnDelete" /><input type="button" value="添加一行" id="btnAddNew" />
</td>
</tr> </table> </td>
</tr> <tr>
<td colspan="4" class="bottomtd"> <asp:Button ID="btnReturn" UseSubmitBehavior="false" runat="server" Text="返回列表"
onclick="btnReturn_Click" /> <asp:Button ID="btnSubmit" runat="server" Text="渠道资料编辑"
onclick="btnSubmit_Click" />
</td>
</tr> </table> </div>
</form>
</body>
</html>

后台代码:

  protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["ChannelID"] == null)
{ Response.Redirect("ChannelListShow.aspx");
return;
} if (!IsPostBack)
{
ddlProvinceBind();
pageInfobind();
}
} private void pageInfobind()
{
if (Request.QueryString["ChannelID"] == null)
{
Response.Redirect("ChannelListShow.aspx");
return;
}
string channelid = Request.QueryString["ChannelID"].ToString();
ViewCRMChannelInfo viewchannel = new ViewCRMChannelInfo();
BioErpCrmManageChannelBLL channelbll = new BioErpCrmManageChannelBLL();
viewchannel = channelbll.BioErpCrmManagerChannelViewByID(channelid);
this.txtChannelName.Text = viewchannel.ChannelName;
this.txtSuperChannelID.Text = viewchannel.SuperiorChannelID.ToString();
if (viewchannel.NextContactTime.ToString() != "1970/1/1 0:00:00")
{
this.txtNextTime.Text =Convert.ToDateTime( viewchannel.NextContactTime.ToString()).ToString("yyyy-MM-dd");
}
if (viewchannel.EnrollTime.ToString() != "1970/1/1 0:00:00")
{
this.txtRegisterTime.Text =Convert.ToDateTime( viewchannel.EnrollTime.ToString()).ToString("yyyy-MM-dd");
}
this.ddlChannelSize.Text = viewchannel.ChannelSize.ToString();
this.txtAccounts.Text = viewchannel.Accounts;
this.txtBank.Text = viewchannel.Accounts;
this.txtWebSite.Text = viewchannel.NetAddress;
this.txtAddress.Text = viewchannel.Address;
this.txtEmail.Text = viewchannel.Email;
this.txtFax.Text = viewchannel.Fax;
this.txtTel1.Text = viewchannel.Tel1;
this.txtTel2.Text = viewchannel.Tel2;
this.ddlLevel.Text = viewchannel.ChannelLevel;
this.txtCredit.Text = viewchannel.CreditStanding;
this.txtTaxNumber.Text = viewchannel.TaxNumber;
this.ddlState.SelectedItem.Text = viewchannel.Status;
this.ddlType.SelectedItem.Text = viewchannel.ChannelType;
this.ddlVocation.SelectedItem.Text = viewchannel.Vocation;
this.ddlProvince.SelectedItem.Text = viewchannel.Province;
this.ddlCity.Items.Add(new ListItem(viewchannel.City, viewchannel.City));
this.txtUserName.Text = viewchannel.UserID.ToString();
this.ddlArea.SelectedItem.Text = viewchannel.Areal;
this.txtCoSummary.Text = viewchannel.CoSummary;
this.txtCoreOperttion.Text = viewchannel.CoreOperttion; System.Data.DataTable dt= SqlComm.GetDataByCondition("BioErpCrmChannelLinkMan", "*", " ChannelID=" + Request.QueryString["ChannelID"].ToString()).Tables[0];
int count = dt.Rows.Count;
if (count != 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "Autoaddrows", "Autoaddrows(" + (count-1) + ");", true);
}
string LinkMans = "";
string Sexs = "";
string Birthdays = "";
string MainLinks = "";
string OfficePhones = "";
string mobiles = "";
string emails="", addresses="", QQs="", remarks=""; for (int i = 0; i < dt.Rows.Count; i++)
{
LinkMans+=dt.Rows[i]["LinkmanName"].ToString() + ",";
if (dt.Rows[i]["Sex"] != null)
{
if (Convert.ToBoolean(dt.Rows[i]["Sex"].ToString()))
{
Sexs += "1" + ","; }
else
{
Sexs += "0" + ",";
}
} Birthdays += Convert.ToDateTime(dt.Rows[i]["Birthday"]).ToString("yyyy-MM-dd") +",";
if (dt.Rows[i]["IsMainLinkman"] != null)
{
if (Convert.ToBoolean(dt.Rows[i]["IsMainLinkman"].ToString()))
{
MainLinks += "1" + ",";
}
else
{
MainLinks += "0" + ","; }
}
OfficePhones += dt.Rows[i]["OfficialPhone"].ToString() + ",";
mobiles += dt.Rows[i]["MobilePhone"].ToString() + ",";
emails += dt.Rows[i]["Email"].ToString() + ",";
addresses += dt.Rows[i]["Address"].ToString() + ",";
QQs += dt.Rows[i]["QQ"].ToString() + ",";
remarks += dt.Rows[i]["Remark"].ToString() + ",";
} ScriptManager.RegisterStartupScript(this, this.GetType(), "setvalues", "setvalues('" + LinkMans + "','" + Sexs + "','" + Birthdays + "','" + MainLinks + "','" + OfficePhones + "','" + mobiles + "','" + emails + "','" + addresses + "','" + QQs + "','" + remarks + "');", true);
} public void ddlProvinceBind()
{
this.ddlProvince.DataSource = SqlComm.getProvinceInfoList();
this.ddlProvince.DataTextField = "ProvinceInfoName";
this.ddlProvince.DataValueField = "ProvinceInfoID";
this.ddlProvince.DataBind();
this.ddlProvince.Items.Add(new ListItem("--请选择省份--", "0"));
this.ddlProvince.SelectedValue = "0";
} protected void btnSubmit_Click(object sender, EventArgs e)
{
BioErpCrmManageChannel channel = new BioErpCrmManageChannel()
{
ChannelID=int.Parse(Request.QueryString["ChannelID"].ToString()),
ChannelName = this.txtChannelName.Text,
AccountName = this.txtBank.Text,
Accounts = this.txtAccounts.Text,
Address = this.txtAddress.Text,
Areal = this.ddlArea.SelectedItem.Text,
ChannelLevel = this.ddlLevel.Text,
ChannelSize = this.ddlChannelSize.SelectedItem.Text,
ChannelType = this.ddlType.Text,
City = this.ddlCity.SelectedItem.Text,
Province = this.ddlProvince.SelectedItem.Text,
CoreOperttion = this.txtCoreOperttion.Text,
Tel1 = this.txtTel1.Text,
Tel2 = this.txtTel2.Text,
TaxNumber = this.txtTaxNumber.Text,
CoSummary = this.txtCoSummary.Text,
Email = this.txtEmail.Text,
Fax = this.txtFax.Text,
NetAddress = this.txtNextTime.Text,
Vocation = this.ddlVocation.SelectedItem.Text,
SuperiorChannel = this.txtSuperChannelID.Text == "" ? 0 : int.Parse(this.txtSuperChannelID.Text),
UserID = int.Parse(this.txtUserName.Text),
NextContactTime = Convert.ToDateTime(this.txtNextTime.Text),
Status = this.ddlState.SelectedItem.Text,
CreditStanding = this.txtCredit.Text,
EnrollTime = Convert.ToDateTime(this.txtRegisterTime.Text),
DeleteState=this.cbDelete.Checked
};
BioErpCrmManageChannelBLL channelbll = new BioErpCrmManageChannelBLL();
BioErpCrmChannelLinkManBLL linkmanbll = new BioErpCrmChannelLinkManBLL();
int count = channelbll.BioErpCrmManageChannelUpdate(channel);
//渠道基本信息添加成功,才能添加联系人基本信息
if (count != 0)
{
string linkman = Request["txtLinkMan1"].ToString();
string ddlSex = Request["ddlSex1"].ToString();
string Birthday = Request["txtBirthday1"].ToString();
string MainLink = Request["ddlMainLink1"].ToString();
string OfficePhone = Request["txtOfficePhone"].ToString();
string Mobile = Request["txtMobile1"].ToString();
string Email = Request["txtEmail11"].ToString();
string Address = Request["txtAddress1"].ToString();
string QQ = Request["txtQQ1"].ToString();
string Remark = Request["txtRemark1"].ToString(); string[] linkmans = linkman.Split(',');
string[] ddlSexs = ddlSex.Split(',');
string[] Birthdays = Birthday.Split(',');
string[] MainLinks = MainLink.Split(',');
string[] OfficePhones = OfficePhone.Split(',');
string[] Mobiles = Mobile.Split(',');
string[] Emails = Email.Split(',');
string[] Addresses = Address.Split(',');
string[] QQs = QQ.Split(',');
string[] Remarks = Remark.Split(','); //先删除原来联系人记录表中的关于此渠道的所有联系人
SqlComm.DeleteTableByCondition("BioErpCrmChannelLinkMan", " where ChannelID=" + channel.ChannelID); //再添加新的联系人
BioErpCrmChannelLinkMan linkmanobj = null;
for (int i = 0; i < linkmans.Length; i++)
{
linkmanobj = new BioErpCrmChannelLinkMan()
{
LinkmanName = linkmans[i],
Address = Addresses[i],
Email = Emails[i],
Remark = Remarks[i],
Sex = ddlSexs[i] == "0" ? false : true,
QQ = QQs[i].ToString(),
OfficialPhone = OfficePhones[i],
MobilePhone = Mobiles[i],
Birthday = Convert.ToDateTime(Birthdays[i]),
ChannelID = channel.ChannelID,
IsMainLinkman = MainLinks[i] == "0" ? false : true
};
linkmanbll.BioErpCrmChannelLinkManADD(linkmanobj);
}
}
Response.Redirect("ChannelListShow.aspx");
} protected void ddlProvince_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.ddlProvince.SelectedValue != "0")
{
string ProvinceId = this.ddlProvince.SelectedValue.ToString();
ddlCity.DataSource = SqlComm.getCityListByProvinceID(ProvinceId);
ddlCity.DataTextField = "CityInfoName";
ddlCity.DataValueField = "CityInfoID";
ddlCity.DataBind();
}
} protected void btnReturn_Click(object sender, EventArgs e)
{
Response.Redirect("ChannelListShow.aspx");
}

权限控制:

 private void pageInfobind()
{
if (Request.QueryString["ID"] == null)
{
Response.Redirect("ChannelListShow.aspx");
return;
}
if (Session["Userid"] == null)
{
Response.Redirect("../../web/UserLogin.aspx");
} string userid = Session["Userid"].ToString(); string channelid = Request.QueryString["ID"].ToString();
ViewCRMChannelInfo viewchannel=new ViewCRMChannelInfo();
BioErpCrmManageChannelBLL channelbll=new BioErpCrmManageChannelBLL();
viewchannel= channelbll.BioErpCrmManagerChannelViewByID(channelid); //如果当前渠道的所属员工是当前登录用户,或则 当前登录用户的角色为“市场部经理(6)”则显示此按钮
if (userid == viewchannel.UserID.ToString() || Web.UserLogin.user.RoleId==6)
{
this.btnSubmit.Visible = true;
}
else
{
this.btnSubmit.Visible = false;
} this.txtChannelName.Text = viewchannel.ChannelName;
this.txtSuperChannelID.Text = viewchannel.SuperiorChannel;
if (viewchannel.NextContactTime.ToString() != "1970/1/1 0:00:00")
{
this.txtNextTime.Text = viewchannel.NextContactTime.ToString();
}
if (viewchannel.EnrollTime.ToString() != "1970/1/1 0:00:00")
{
this.txtRegisterTime.Text = viewchannel.EnrollTime.ToString();
}
this.ddlChannelSize.Text = viewchannel.ChannelSize.ToString();
this.txtAccounts.Text = viewchannel.Accounts;
this.txtBank.Text = viewchannel.Accounts;
this.txtWebSite.Text = viewchannel.NetAddress;
this.txtAddress.Text = viewchannel.Address;
this.txtEmail.Text = viewchannel.Email;
this.txtFax.Text=viewchannel.Fax;
this.txtTel1.Text=viewchannel.Tel1;
this.txtTel2.Text=viewchannel.Tel2;
this.ddlLevel.Text=viewchannel.ChannelLevel;
this.txtCredit.Text=viewchannel.CreditStanding;
this.txtTaxNumber.Text=viewchannel.TaxNumber; this.ddlState.Text=viewchannel.Status;
this.ddlType.Text=viewchannel.ChannelType;
this.ddlVocation.Text=viewchannel.Vocation;
this.ddlProvince.Text=viewchannel.Province;
this.ddlCity.Text=viewchannel.City;
this.txtUserName.Text=viewchannel.UserName;
this.ddlArea.Text=viewchannel.Areal;
this.txtCoSummary.Text=viewchannel.CoSummary;
this.txtCoreOperttion.Text=viewchannel.CoreOperttion; this.GridView1.DataSource = SqlComm.GetDataByCondition("ViewCrmChannelLinkManInfo", "*", " 渠道编号="+viewchannel.ChannelID); this.GridView1.DataBind();
}

渠道联系记录管理:

存储过程:

ALTER PROCEDURE [dbo].[BioErpCrmChannelContactNote_ADD]
@ChannelID int,
@RelationRecord nvarchar(1000),
@RelationTime datetime,
@LinkmanID int,
@RelationType nvarchar(50),
@LinkMethod nvarchar(50),
@Userid int AS
INSERT INTO [BioErpCrmChannelContactNote](
[ChannelID],[RelationRecord],[RelationTime],[LinkmanID],[RelationType],[LinkMethod],[Userid]
)VALUES(
@ChannelID,@RelationRecord,@RelationTime,@LinkmanID,@RelationType,@LinkMethod,@Userid
)

修改的存储过程:

ALTER PROCEDURE [dbo].[BioErpCrmChannelContactNote_Update]
@RelationID int,
@ChannelID int,
@RelationRecord nvarchar(1000),
@RelationTime datetime,
@LinkmanID int,
@RelationType nvarchar(50),
@LinkMethod nvarchar(50),
@Userid int,
@DeleteState bit
AS
UPDATE [BioErpCrmChannelContactNote] SET
[ChannelID] = @ChannelID,[RelationRecord] = @RelationRecord,[RelationTime] = @RelationTime,[LinkmanID] = @LinkmanID,[RelationType] = @RelationType,[LinkMethod] = @LinkMethod,[Userid] = @Userid,[DeleteState] = @DeleteState
WHERE RelationID=@RelationID

创建视图:

SELECT   dbo.BioErpCrmChannelContactNote.RelationID, dbo.BioErpCrmChannelContactNote.ChannelID,
dbo.BioErpCrmChannelContactNote.RelationRecord, dbo.BioErpCrmChannelContactNote.RelationTime,
dbo.BioErpCrmChannelContactNote.LinkmanID, dbo.BioErpCrmChannelContactNote.RelationType,
dbo.BioErpCrmChannelContactNote.LinkMethod, dbo.BioErpCrmChannelContactNote.Userid,
dbo.BioErpCrmChannelContactNote.DeleteState, dbo.BioErpCrmManageChannel.ChannelName,
dbo.BioErpCrmChannelLinkMan.LinkmanName, dbo.UserManager.UserName
FROM dbo.BioErpCrmChannelContactNote INNER JOIN
dbo.BioErpCrmManageChannel ON
dbo.BioErpCrmChannelContactNote.ChannelID = dbo.BioErpCrmManageChannel.ChannelID INNER JOIN
dbo.UserManager ON dbo.BioErpCrmChannelContactNote.Userid = dbo.UserManager.UserId INNER JOIN
dbo.BioErpCrmChannelLinkMan ON
dbo.BioErpCrmChannelContactNote.LinkmanID = dbo.BioErpCrmChannelLinkMan.LinkmanID

BLL层代码:

 public class BioErpCrmChannelContactNoteBLL
{
/// <summary>
/// 添加一条联系记录
/// </summary>
/// <param name="contactnode"></param>
/// <returns></returns>
public int ChannelNoteAdd(BioErpCrmChannelContactNote contactnode)
{
SqlParameter[] parameters = {
new SqlParameter("@ChannelID", SqlDbType.Int,4),
new SqlParameter("@RelationRecord", SqlDbType.NVarChar,1000),
new SqlParameter("@RelationTime", SqlDbType.DateTime),
new SqlParameter("@LinkmanID", SqlDbType.Int,4),
new SqlParameter("@RelationType", SqlDbType.NVarChar,50),
new SqlParameter("@LinkMethod", SqlDbType.NVarChar,50),
new SqlParameter("@Userid", SqlDbType.Int,4),
}; parameters[0].Value = contactnode.ChannelID;
parameters[1].Value = contactnode.RelationRecord;
parameters[2].Value = contactnode.RelationTime;
parameters[3].Value = contactnode.LinkmanID;
parameters[4].Value = contactnode.RelationType;
parameters[5].Value = contactnode.LinkMethod;
parameters[6].Value = contactnode.Userid;
return DataBaseHelper.ExcuteSqlReturnInt("BioErpCrmChannelContactNote_ADD", CommandType.StoredProcedure, parameters); } /// <summary>
/// 修改一条联系记录
/// </summary>
/// <param name="contactnode"></param>
/// <returns></returns>
public int ChannelNoteUpdate(BioErpCrmChannelContactNote contactnode)
{
SqlParameter[] parameters = {
new SqlParameter("@RelationID", SqlDbType.Int,4),
new SqlParameter("@ChannelID", SqlDbType.Int,4),
new SqlParameter("@RelationRecord", SqlDbType.NVarChar,1000),
new SqlParameter("@RelationTime", SqlDbType.DateTime),
new SqlParameter("@LinkmanID", SqlDbType.Int,4),
new SqlParameter("@RelationType", SqlDbType.NVarChar,50),
new SqlParameter("@LinkMethod", SqlDbType.NVarChar,50),
new SqlParameter("@Userid", SqlDbType.Int,4),
new SqlParameter("@DeleteState", SqlDbType.Bit,1)};
parameters[0].Value = contactnode.RelationID;
parameters[1].Value = contactnode.ChannelID;
parameters[2].Value = contactnode.RelationRecord;
parameters[3].Value = contactnode.RelationTime;
parameters[4].Value = contactnode.LinkmanID;
parameters[5].Value = contactnode.RelationType;
parameters[6].Value = contactnode.LinkMethod;
parameters[7].Value = contactnode.Userid;
parameters[8].Value = contactnode.DeleteState;
return DataBaseHelper.ExcuteSqlReturnInt("BioErpCrmChannelContactNote_Update", CommandType.StoredProcedure, parameters); } /// <summary>
/// 根据id获取联系记录对象
/// </summary>
/// <param name="noteid"></param>
/// <returns></returns>
public ViewChannelNoteInfo getChannelContactNoteByNoteID(string noteid)
{
SqlDataReader reader=SqlComm.GetDataReaderByCondition("View_ChannelNoteInfo", "*", " RelationID="+noteid);
ViewChannelNoteInfo viewnote= null;
while (reader.Read())
{
viewnote = new ViewChannelNoteInfo()
{
ChannelID = int.Parse(reader["ChannelID"].ToString()),
RelationID = int.Parse(reader["RelationID"].ToString()),
Userid = int.Parse(reader["Userid"].ToString()),
RelationType = reader["RelationType"].ToString(),
RelationTime = Convert.ToDateTime(reader["RelationTime"].ToString()),
RelationRecord = reader["RelationRecord"].ToString(),
LinkMethod = reader["LinkMethod"].ToString(),
LinkmanID = int.Parse(reader["LinkmanID"].ToString()),
DeleteState = Convert.ToBoolean(reader["DeleteState"].ToString()) }; }
reader.Close();
return viewnote; }

后台代码:

  public partial class ChannelFeedback : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{ Session["Userid"] = "29";
if (Session["Userid"] == null)
{
Response.Redirect("~/Web/Desk.aspx");
} } protected void btnSubmit_Click(object sender, EventArgs e)
{
if (this.txtSuperChannelID.Text == "" || this.txtSuperChannelID.Text == "0")
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('必须选择所属渠道')", true);
return;
}
if(this.txtUserName.Text=="" || this.txtUserName.Text=="0")
{
ClientScript.RegisterStartupScript(this.GetType(),"test","alert('必须选择所属业务员')",true);
return ;
} if (this.ddlLinkMan.Items.Count == 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('没有联系人不能添加联系记录')", true);
return;
} BioErpCrmChannelContactNote contacknote = new BioErpCrmChannelContactNote()
{
ChannelID = int.Parse(this.txtSuperChannelID.Text),
Userid = int.Parse(this.txtUserName.Text),
RelationType = this.ddlType.Text,
LinkMethod = this.ddlMethod.Text,
RelationTime = Convert.ToDateTime(this.txtInvestigateTime.Text),
LinkmanID = int.Parse(this.ddlLinkMan.SelectedValue),
RelationRecord = this.txtRemark.Text
}; BioErpCrmChannelContactNoteBLL notebll = new BioErpCrmChannelContactNoteBLL();
int count= notebll.ChannelNoteAdd(contacknote);
if (count != 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('记录添加成功')", true);
return;
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "alert('记录添加失败')", true);
return;
}
} protected void btnReturn_Click(object sender, EventArgs e)
{ } protected void txtSuperChannelID_TextChanged(object sender, EventArgs e)
{
if (this.txtSuperChannelID.Text != "" && this.txtSuperChannelID.Text.Trim() != "0")
{
this.ddlLinkMan.DataSource=SqlComm.GetDataByCondition("BioErpCrmChannelLinkMan", "LinkmanID,LinkmanName", " ChannelID=" + this.txtSuperChannelID.Text);
this.ddlLinkMan.DataTextField = "LinkmanName";
this.ddlLinkMan.DataValueField = "LinkmanID";
this.ddlLinkMan.DataBind(); }

}
}

综合查询业务:

渠道信息查询、联系时间查询、渠道联系人查询、是否删除  

渠道联系记录查询的前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChannelFeedback.aspx.cs"
Inherits="BioErpWeb.CRMSystem.CrmChannelNotes.ChannelFeedback" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<link href="../../Styles/CalenderStyle.css" rel="stylesheet" type="text/css" />
<script src="../../JS/CheckUserName.js" type="text/javascript"></script> <script src="../../JS/ChannelChoose.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/ValidateMessage_ZW.js" type="text/javascript"></script>
<script src="../../Scripts/validateExtender.js" type="text/javascript"></script>
<script src="../../Scripts/cld.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.metadata.js" type="text/javascript"></script>
<link href="../../Scripts/jquery-ui-1.7.custom.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-ui-1.7.custom.min.js" type="text/javascript"></script>
<style type="text/css">
.style1
{
height: 22px;
}
</style> <script type="text/javascript">
$().ready(function () {
$("#form1").validate();
$("#txtInvestigateTime").datepicker({dateFormat:'yy-mm-dd'});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="maintable">
<tr>
<td colspan="2" class="titlebar">
渠道反馈信息记录
</td>
</tr>
<tr>
<td class="style1">
反馈信息渠道
</td>
<td class="style1">
<asp:TextBox ID="txtSuperChannelID" CssClass="{required:true, number:true, min:1}" runat="server"
ontextchanged="txtSuperChannelID_TextChanged"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="选择渠道" CausesValidation="false" UseSubmitBehavior="false" OnClientClick="showChannel()" />
</td>
</tr>
<tr>
<td class="style1">
反馈联系人</td>
<td class="style1">
<asp:DropDownList ID="ddlLinkMan" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
联系时间
</td>
<td>
<asp:TextBox ID="txtInvestigateTime" CssClass="required dateISO" runat="server"></asp:TextBox> </td>
</tr>
<tr>
<td>
反馈类型</td>
<td>
<asp:DropDownList ID="ddlType" runat="server">
<asp:ListItem>邮寄</asp:ListItem>
<asp:ListItem>即时通讯</asp:ListItem>
</asp:DropDownList> </td>
</tr>
<tr>
<td>
反馈方法</td>
<td>
<asp:DropDownList ID="ddlMethod" runat="server">
<asp:ListItem>快递</asp:ListItem>
<asp:ListItem>电话</asp:ListItem>
<asp:ListItem>短信</asp:ListItem>
<asp:ListItem>Email</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
所属业务员
</td>
<td>
<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
<input type="button" onclick="showDialog2()" value="选择"/>
</td>
</tr>
<tr>
<td>
备注
</td>
<td>
<asp:TextBox ID="txtRemark" Width="552px" Height="101px" CssClass="required" runat="server"></asp:TextBox>
</td>
</tr> <tr>
<td colspan="2" class="bottomtd">
<asp:Button ID="btnSubmit" runat="server" Text="渠道反馈信息记录保存" OnClick="btnSubmit_Click" />
<asp:Button ID="btnReturn" runat="server" Text="返回列表" OnClick="btnReturn_Click" />
</td>
</tr>
</table>
<br />
</div>
</form>
</body>
</html>

后台查询代码:

    protected void imgbutnSearch_Click(object sender, ImageClickEventArgs e)
{
pageindex = 0;
condition = "";
if (txtName.Text.Trim() != null && this.txtName.Text.Trim().Length != 0)
{
condition = condition + " and ChannelName like '" + txtName.Text + "%'";
} if (this.txtUserName.Text.Trim() != null && this.txtUserName.Text.Trim().Length != 0)
{
condition = condition + " and LinkmanName like '" + txtUserName.Text + "%'";
} if (this.ddlState.SelectedValue == "1")
{
condition = condition + " and DeleteState ='True'";
}
else
{
condition = condition + " and DeleteState ='False'";
} if (this.txtNoteTime.Text.Trim() != null && this.txtNoteTime.Text.Trim().Length != 0)
{
condition = condition + " and (RelationTime>= '" + this.txtNoteTime.Text + "' and RelationTime<'" + Convert.ToDateTime(this.txtNoteTime.Text).AddDays(1) + "')";
} getallCustomerList();
}

显示详情的界面:

protected void Page_Load(object sender, EventArgs e)
{ Session["Userid"] = "29";
if (Session["Userid"] == null)
{
Response.Redirect("~/Web/Desk.aspx"); }
pageinfobind(); } /// <summary>
/// 页面信息绑定
/// </summary>
protected void pageinfobind()
{
if (Request.QueryString["ID"]== null)
{
Response.Redirect("ChannelNotesListShow.aspx");
return;
}
string id = Request.QueryString["ID"].ToString();
BioErpCrmChannelContactNoteBLL notebll = new BioErpCrmChannelContactNoteBLL(); ViewChannelNoteInfo view = new ViewChannelNoteInfo();
view= notebll.getChannelContactNoteByNoteID(id);
lbChannelName.Text = view.ChannelName;
lbLinkMan.Text = view.LinkmanName;
lbNote.Text = view.RelationRecord;
lbType.Text = view.RelationType;
lbMethod.Text = view.LinkMethod;
lbUser.Text = view.UserName;
lbNoteTime.Text = Convert.ToDateTime(view.RelationTime).ToString("yyyy-MM-dd"); }

ERP渠道信息的修改和渠道联系记录(二十三)的更多相关文章

  1. 通信录分组并且分组标签悬停划入划出(包含错误信息及修改)--第三方开源--PinnedSectionListView

    PinnedSectionListView在github上的链接地址是:https://github.com/beworker/pinned-section-listview . 下载下来后直接将Pi ...

  2. ASP.NET MVC+EF框架+EasyUI实现权限管理系列(19)-用户信息的修改和浏览

    原文:ASP.NET MVC+EF框架+EasyUI实现权限管理系列(19)-用户信息的修改和浏览  ASP.NET MVC+EF框架+EasyUI实现权限管系列 (开篇)   (1):框架搭建    ...

  3. 已知数据库中存在表tb_book2,通过在图书信息界面填写书本的基本信息,然后提交后写入数据库中的表格中。需要对提交的信息进行修改,信息填入不能为空,为空则则有提示。

    jsp结合SQLSERVER向数据库中的表添加图书信息. 已知数据库中存在表tb_book2,通过在图书信息界面填写书本的基本信息,然后提交后写入数据库中的表格中.需要对提交的信息进行修改,信息填入不 ...

  4. 修改Android系统字号(二)

    /*********************************************************************** * 修改Android系统字号(二) * 说明: * ...

  5. SVN修改已经提交过记录的日志和作者

    原 SVN修改已经提交过记录的日志和作者 使用TortoiseSVN管理代码,对于已经提交的记录,可以修改提交作者和提交日志,不过会报如下错误: Repository has not been ena ...

  6. SQL-修改: 将日期修改为空NULL、修改为空的记录

    1.将日期修改为空NULL update 表 set 字段=null where 字段='' 如果设置为‘’,会默认1900-01-01 2.修改为空的记录 update [dbo].[pub_ite ...

  7. 孤荷凌寒自学python第五十三天使用python写入和修改Firebase数据库中记录

     孤荷凌寒自学python第五十三天使用python写入和修改Firebase数据库中记录 (完整学习过程屏幕记录视频地址在文末) 今天继续研究Firebase数据库,利用google免费提供的这个数 ...

  8. Dynamics CRM 修改Excel 最大导出记录限制及 最大上传文件限制

    CRM默认的Excel最大导出记录是10000条,最大上传文件限制为5m. 这样的限制可以满足少量数据的批量更新,但是如果数据量比较大的话需要修改最大的导出记录限制,和上传文件的大小,网上有的是直接修 ...

  9. JavaWeb_day03_员工信息添加修改删除

    day03员工的添加,修改,删除 修改功能 思路 : 点击修改员工数据之后,跳转到单行文本,查询要修改的员工id的全部信息,主键id设置为readonly,其余的都可以修改, 修改之后,提交按钮,提交 ...

随机推荐

  1. 【转】fiddler抓包时出现了tunnel to ......443 解密HTTPS数据

    转: 1.在抓取https的数据包时,fiddler会话栏目会显示“Tunnel to….443”的信息,这个是什么原因呢? connect表示https的握手(也就是认证信息,只要是https就要进 ...

  2. 【codevs1690】开关灯 (线段树 区间修改+区间求和 (标记))

    [codevs1690]开关灯 2014年2月15日4930 题目描述 Description YYX家门前的街上有N(2<=N<=100000)盏路灯,在晚上六点之前,这些路灯全是关着的 ...

  3. 【NOIP 2018】保卫王国(动态dp / 倍增)

    题目链接 这个$dark$题,嗯,不想说了. 法一:动态$dp$ 虽然早有听闻动态$dp$,但到最近才学,如果你了解动态$dp$,那就能很轻松做出这道题了.故利用这题在这里科普一下动态$dp$的具体内 ...

  4. POJ 3268 Silver Cow Party (最短路径)

    POJ 3268 Silver Cow Party (最短路径) Description One cow from each of N farms (1 ≤ N ≤ 1000) convenientl ...

  5. node.js原生后台进阶(二)

    上一章讲到怎么样用原生node.js来获取GET.POST(urlencoded,formData)的参数,这一次我们更进一步,讲一下以下的点: 1.压缩(zlib) 2.流(stream) 3.路由 ...

  6. Hadoop生态圈-zookeeper的API用法详解

    Hadoop生态圈-zookeeper的API用法详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.测试前准备 1>.开启集群 [yinzhengjie@s101 ~] ...

  7. Golang的文件处理方式-常见的读写姿势

    Golang的文件处理方式-常见的读写姿势 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在 Golang 语言中,文件使用指向 os.File 类型的指针来表示的,也叫做文件句柄 ...

  8. 笔记 freemark list标签迭代Map<Map<String,Object>集合排序问题

    本博客是自己在学习和工作途中的积累与总结,仅供自己参考,也欢迎大家转载,转载时请注明出处. 工作中出现一个比较特殊的问题,在模板ftl文件中,一般用list迭代map 举例: 后台: // 传入的参数 ...

  9. SQL记录-PLSQL记录

    PL/SQL记录   PL/SQL记录就是可以容纳不同类型的数据项的数据结构.记录由不同字段,类似于数据库表的行. 例如,要保留跟踪图书馆中的书籍.可能要跟踪有关每本书下面的属性类似:标题,作者,主题 ...

  10. UVALive - 4636 Cubist Artwork(贪心)

    题目链接 题意 给出正视图和侧视图,判断最少用几个立方体 分析 若存在高度相同的立方块,则以数目多的那面为准. #include <iostream> #include <cstdi ...