ERP渠道信息的修改和渠道联系记录(二十三)

 

用例图:

 

前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChannelEdit.aspx.cs" Inherits="BioErpWeb.CRMSystem.CrmChannel.ChannelEdit"  %>


渠道信息添加
渠道名上级渠道
注册时间渠道规模集团公司中等企业小型企业微型企业个体工商户
开户银行银行账号
公司网址企业地址
Email邮件传真
电话号码1电话号码2
渠道等级一级二级三级四级信用级别
税号下次联系时间
客户状态良好一般所属行业制造服务教育医疗
客户类型国有民营外资合资个体是否删除
省份城市
所属代表所属区域西
公司概要:
主要业务:
联系人性别生日是否主联系人办公室电话个人手机Email地址QQ备注

 后台代码:

  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 intAS 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 bitAS UPDATE [BioErpCrmChannelContactNote] SET [ChannelID] = @ChannelID,[RelationRecord] = @RelationRecord,[RelationTime] = @RelationTime,[LinkmanID] = @LinkmanID,[RelationType] = @RelationType,[LinkMethod] = @LinkMethod,[Userid] = @Userid,[DeleteState] = @DeleteStateWHERE 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 JOINdbo.BioErpCrmManageChannel ON dbo.BioErpCrmChannelContactNote.ChannelID = dbo.BioErpCrmManageChannel.ChannelID INNER JOINdbo.UserManager ON dbo.BioErpCrmChannelContactNote.Userid = dbo.UserManager.UserId INNER JOINdbo.BioErpCrmChannelLinkMan ON dbo.BioErpCrmChannelContactNote.LinkmanID = dbo.BioErpCrmChannelLinkMan.LinkmanID

 BLL层代码:

 public class BioErpCrmChannelContactNoteBLL{/// /// 添加一条联系记录/// /// /// 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);}/// /// 修改一条联系记录/// /// /// 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);}/// /// 根据id获取联系记录对象/// /// /// 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" %>




渠道反馈信息记录
反馈信息渠道
反馈联系人
联系时间
反馈类型邮寄即时通讯
反馈方法快递电话短信Email
所属业务员
备注

 后台查询代码:

    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();}/// /// 页面信息绑定/// 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");}  

 

转载于:https://www.cnblogs.com/sunliyuan/p/7029453.html


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部