/// <summary> /// 获取公司名称 /// </summary> /// <param name="customerId"></param> /// <returns></returns> public string GetCompany(int customerId) { BLL.Customer bllCustomer = new BLL.Customer(); Model.Customer model = bllCustomer.GetModel(customerId); if (model.ParentId == 0) { return(model.CompanyName == "" ? "--" : model.CompanyName); } else { return(bllCustomer.GetModel(model.ParentId).CompanyName); } }
/// <summary> /// 绑定供应商详细信息 /// </summary> /// <param name="id"></param> void BindDetail(int id) { model = bll.GetModel(id); txtCompanyName.Text = model.CompanyName; txtAddress.Text = model.Addressinfo; txtEmail.Text = model.Email; txtExplain.Text = model.Explain; txtNameInfo.Text = model.NameInfo; txtPhone.Text = model.Phone; txtQQ.Text = model.QQNum; txtWechat.Text = model.WeChat; ddlParentID.SelectedValue = model.ParentId.ToString(); }
private bool DoEdit(int _id) { bool result = false; BLL.Customer bll = new BLL.Customer(); Model.Customer model = bll.GetModel(_id); model.TypeName = ddlTypeName.SelectedValue; model.ShortName = txtShortName.Text.Trim(); model.FullName = txtFullName.Text.Trim(); model.Category = ddlCategory.SelectedValue; model.Code = string.IsNullOrEmpty(txtCode.Text.Trim()) ? "" : txtCode.Text.Trim(); model.LinkMan = txtLinkMan.Text.Trim(); model.LinkTel = txtLinkTel.Text.Trim(); model.LinkAddress = txtLinkAddress.Text.Trim(); model.MobileNumber = txtMobileNumber.Text.Trim(); model.TaxRegistrationNumber = txtTaxRegistrationNumber.Text.Trim(); model.Remarks = txtRemarks.Text.Trim(); if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改客户信息:" + model.ShortName); //记录日志 result = true; } return(result); }
/// <summary> /// 获取客户名称 /// </summary> /// <returns></returns> public string GetCustomerName(int customer) { BLL.Customer bllCustomer = new BLL.Customer(); Model.Customer model = bllCustomer.GetModel(customer); if (string.IsNullOrEmpty(model.CompanyName)) { return("--"); } else { return(model.CompanyName); } }
protected void ddlReceiver_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ddlReceiver.SelectedValue)) { BLL.Customer bll = new BLL.Customer(); Model.Customer m = bll.GetModel(Convert.ToInt32(ddlReceiver.SelectedValue)); if (m != null) { txtReceiverLinkMan.Text = m.LinkMan; txtReceiverLinkTel.Text = m.LinkTel; } } }
private void ShowInfo(int _id) { BLL.Customer bll = new BLL.Customer(); Model.Customer model = bll.GetModel(_id); txtCode.Text = model.Code; txtName.Text = model.Name; txtLinkMan.Text = model.LinkMan; txtLinkTel.Text = model.LinkTel; txtLinkAddress.Text = model.LinkAddress; txtEmail.Text = model.Email; txtFax.Text = model.Fax; rblStatus.SelectedValue = model.Status.ToString(); txtRemark.Text = model.Remark; }
public void ProcessRequest(HttpContext context) { BLL.CustomerAddress blladdreess = new BLL.CustomerAddress(); BLL.Customer bllCustomer = new BLL.Customer(); BLL.PublicVersion bllVersion = new BLL.PublicVersion(); JsonData jd = new JsonData(); StringBuilder strAddress = new StringBuilder(); StringBuilder strVersion = new StringBuilder(); context.Response.ContentType = "text/plain"; string customerId = context.Request["cid"]; DataSet dsAddress = new DataSet(); Model.Customer model = bllCustomer.GetModel(int.Parse(customerId)); if (model.ParentId == 0) { dsAddress = blladdreess.GetList("StateInfo=1 and CustimerId=" + model.Id); } else { dsAddress = blladdreess.GetList("StateInfo=1 and CustimerId=" + model.ParentId); } strAddress.Append("<option value=''>请选择收货地址</option>"); foreach (DataRow item in dsAddress.Tables[0].Rows) { strAddress.Append("<option value='" + item["Id"].ToString() + "'>" + item["NameInfo"].ToString() + ", " + item["Addressinfo"].ToString() + ", " + item["Phone"].ToString() + "</option>"); } jd["stateInfo"] = 1; jd["strAddress"] = strAddress.ToString(); DataSet dsVersion = bllVersion.GetList("StateInfo=1 and CustomerId=" + customerId); strVersion.Append("<option value=''>请选择客户公版</option>"); foreach (DataRow item in dsVersion.Tables[0].Rows) { strVersion.Append("<option value='" + item["Id"].ToString() + "'>" + item["NameInfo"].ToString() + "</option>"); } jd["strVersion"] = strVersion.ToString(); context.Response.Write(jd.ToJson()); }
private string DoEdit(int _id) { BLL.Customer bll = new BLL.Customer(); Model.Customer model = bll.GetModel(_id); manager = GetAdminInfo(); string _content = string.Empty; if (model.c_name != txtName.Text.Trim()) { _content += "客户名称:" + model.c_name + "→<font color='red'>" + txtName.Text.Trim() + "<font><br/>"; } byte oldtype = model.c_type.Value; model.c_name = txtName.Text.Trim(); if (model.c_type != 3) { if (model.c_type != Utils.ObjToByte(ddltype.SelectedValue)) { _content += "客户类别:" + Common.BusinessDict.customerType()[model.c_type] + "→<font color='red'>" + Common.BusinessDict.customerType()[Utils.ObjToByte(ddltype.SelectedValue)] + "<font><br/>"; } model.c_type = Utils.ObjToByte(ddltype.SelectedValue); } if (model.c_num != txtNum.Text.Trim()) { _content += "信用代码(税号):" + model.c_num + "→<font color='red'>" + txtNum.Text.Trim() + "<font><br/>"; } model.c_num = txtNum.Text.Trim(); if (model.c_isUse != cbIsUse.Checked) { _content += "启用状态:" + Common.BusinessDict.isUseStatus()[model.c_isUse] + "→<font color='red'>" + Common.BusinessDict.isUseStatus()[cbIsUse.Checked] + "<font><br/>"; } model.c_isUse = cbIsUse.Checked; if (model.c_remarks != txtRemark.Text.Trim()) { _content += "备注:" + model.c_remarks + "→<font color='red'>" + txtRemark.Text.Trim() + "<font><br/>"; } model.c_remarks = txtRemark.Text.Trim(); if (model.c_business != txtBusinessScope.Text.Trim()) { _content += "业务范围:" + model.c_business + "→<font color='red'>" + txtBusinessScope.Text.Trim() + "<font><br/>"; } model.c_business = txtBusinessScope.Text.Trim(); return(bll.Update(oldtype, model, manager, _content)); }
private void ShowInfo(int _id) { BLL.Customer bll = new BLL.Customer(); Model.Customer model = bll.GetModel(_id); ddlTypeName.SelectedValue = model.TypeName; txtShortName.Text = model.ShortName; txtFullName.Text = model.FullName; ddlCategory.SelectedValue = model.Category; txtCode.Text = model.Code; txtLinkMan.Text = model.LinkMan; txtLinkTel.Text = model.LinkTel; txtLinkAddress.Text = model.LinkAddress; txtMobileNumber.Text = model.MobileNumber; txtTaxRegistrationNumber.Text = model.TaxRegistrationNumber; txtRemarks.Text = model.Remarks; }
/// <summary> /// 获取所属公司名称 /// </summary> /// <param name="pid"></param> /// <returns></returns> public string GetPartentCompany(int pid) { if (string.Equals(pid, 0)) { return("直接客户"); } else { model = bll.GetModel(pid); if (model != null) { return(model.CompanyName); } else { return("未找到所属公司"); } } }
/// <summary> /// 绑定客户下拉列表 /// </summary> void BindCustomer(int fid) { Model.FatherOrder model = bllFathrt.GetModel(fid); Model.Customer modelcustomer = bllCustomer.GetModel(int.Parse(model.CustomerId.ToString())); DataSet ds = bllCustomer.GetList(0, "ParentId=" + modelcustomer.Id + " and StateInfo=1", "AddTime asc,Id asc"); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow item in ds.Tables[0].Rows) { ddlCustomer.Items.Add(new ListItem(item["CompanyName"].ToString(), item["Id"].ToString())); } } else { ddlCustomer.Items.Add(new ListItem(modelcustomer.CompanyName, modelcustomer.Id.ToString())); } }
/// <summary> /// 添加公司订单 /// </summary> /// <returns></returns> int AddFathrtNum() { Model.Customer modelCustomer = bllCustomer.GetModel(int.Parse(ddlCustomer.SelectedValue)); int fathrtId; //直接客户当天订单好 int customerId; //获取直接客户编号 if (modelCustomer.ParentId == 0) //直接客户下单 { customerId = modelCustomer.Id; } else//非直接客户下单 { customerId = modelCustomer.ParentId; } DataSet ds = bllFathrt.GetList("CustomerId=" + customerId + " and AddTime>Convert(datetime,'" + DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00" + "') and Convert(datetime,AddTime) <= Convert(datetime,'" + DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59" + "')"); //" and O_AddTime " if (ds.Tables[0].Rows.Count > 0)//已经存在订单了 { fathrtId = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString()); } else//不存在订单 { Model.FatherOrder modelFather = new Model.FatherOrder(); modelFather.NumId = SetFathrtNumID(); if (!string.IsNullOrEmpty(ddlAddress.SelectedValue)) { modelFather.AddressId = int.Parse(ddlAddress.SelectedValue); } modelFather.AddTime = DateTime.Now; modelFather.CustomerId = customerId; modelFather.StateInfo = 10022; modelFather.WorkersId = int.Parse(Session["AdminId"].ToString()); fathrtId = bllFathrt.Add(modelFather); } return(fathrtId); }
private bool DoEdit(int _id) { bool result = false; BLL.Customer bll = new BLL.Customer(); Model.Customer model = bll.GetModel(_id); model.Code = txtCode.Text; model.Name = txtName.Text; model.LinkMan = txtLinkMan.Text; model.LinkTel = txtLinkTel.Text; model.LinkAddress = txtLinkAddress.Text; model.Email = txtEmail.Text; model.Fax = txtFax.Text; model.Status = Convert.ToInt32(rblStatus.SelectedValue); model.Remark = txtRemark.Text; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改客户:" + model.Name); //记录日志 result = true; } return(result); }
private bool DoEdit(int _id) { bool result = false; BLL.Customer bll = new BLL.Customer(); Model.Customer model = bll.GetModel(_id); model.Code = txtCode.Text; model.Name = txtName.Text; model.LinkMan = txtLinkMan.Text; model.LinkTel = txtLinkTel.Text; model.LinkAddress = txtLinkAddress.Text; model.Email = txtEmail.Text; model.Fax = txtFax.Text; model.Status = Convert.ToInt32(rblStatus.SelectedValue); model.Remark = txtRemark.Text; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改客户:" + model.Name); //记录日志 result = true; } return result; }
private void ShowInfo(int _id) { BLL.Customer bll = new BLL.Customer(); Model.Customer model = bll.GetModel(_id); txtCode.Text = model.Code; txtName.Text = model.Name; txtLinkMan.Text = model.LinkMan; txtLinkTel.Text = model.LinkTel; txtLinkAddress.Text = model.LinkAddress; txtEmail.Text = model.Email; txtFax.Text = model.Fax; rblStatus.SelectedValue = model.Status.ToString(); txtRemark.Text = model.Remark; }
protected void ddlReceiver_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ddlReceiver.SelectedValue)) { BLL.Customer bll = new BLL.Customer(); Model.Customer m = bll.GetModel(Convert.ToInt32(ddlReceiver.SelectedValue)); if (m != null) { txtReceiverLinkMan.Text = m.LinkMan; txtReceiverLinkTel.Text = m.LinkTel; } } }
private void ShowInfo(int _id) { BLL.Customer bll = new BLL.Customer(); model = bll.GetModel(_id); txtName.Text = model.c_name; ddltype.SelectedValue = model.c_type.ToString(); if (model.c_type == 3) { ddltype.Visible = false; labtype.Text = Common.BusinessDict.customerType()[model.c_type.Value]; btnDelete.Visible = false; btnDelBank.Visible = false; liAdd.Visible = false; } txtNum.Text = model.c_num; txtBusinessScope.Text = model.c_business; txtRemark.Text = model.c_remarks; if (model.c_isUse.Value) { cbIsUse.Checked = true; } else { cbIsUse.Checked = false; } btnSubmit.Visible = false; BtnContact.Visible = false; BtnBank.Visible = false; //已审核通过的不能再修改 if (model.c_flag == 2) { btnSubmit.Visible = false; BtnContact.Visible = false; BtnBank.Visible = false; } else { if (manager.user_name == model.c_owner) { btnSubmit.Visible = true; BtnContact.Visible = true; BtnBank.Visible = true; } else { if (new MettingSys.BLL.permission().checkHasPermission(manager, "0301")) { btnSubmit.Visible = true; BtnContact.Visible = true; BtnBank.Visible = true; } } } Mdl1.Visible = false; Mdl2.Visible = false; //绑定联系人 this.rptList.DataSource = new BLL.Contacts().GetList(0, "co_cid=" + _id + "", "co_flag desc,co_id asc"); this.rptList.DataBind(); //绑定银行账号 this.bankrptList.DataSource = new BLL.customerBank().GetList(0, "cb_cid=" + _id + "", "cb_id asc"); this.bankrptList.DataBind(); }
/// <summary> /// 保存数据字典数据 /// </summary> /// <returns></returns> public ActionResult Save(Model.Customer model) { JsonObject json = new JsonObject(); StringBuilder sbErro = new StringBuilder(); if (string.IsNullOrEmpty(model.CustomerName)) { sbErro.Append(",客户名称不能为空"); } if (sbErro.Length > 0) { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = sbErro.ToString().Substring(1); return(Json(json)); } //如果ID为空,则是添加 if (string.IsNullOrEmpty(model.CustomerID)) { //DepartmentName 唯一 List <Model.Customer> modelExistsList = BLL.GetModelList("CustomerName='" + model.CustomerName + "'"); if (modelExistsList != null && modelExistsList.Count > 0) { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = "添加失败,此数据已存在"; return(Json(json)); } model.CreateTime = DateTime.Now; model.CreateBy = CurrentUser.User.Userinfo.UserID; model.CustomerID = Guid.NewGuid().ToString(); bool res = BLL.Add(model); if (res) { json.Status = JsonObject.STATUS_SUCCESS; json.Message = "添加成功"; return(Json(json)); } else { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = "添加失败"; return(Json(json)); } } else { //value 和 type 唯一确定一个text值 List <Model.Customer> modelExistsList = BLL.GetModelList("CustomerName='" + model.CustomerName + "' and CustomerID!='" + model.CustomerID + "'"); if (modelExistsList != null && modelExistsList.Count > 0) { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = "添加失败,此数据已存在"; return(Json(json)); } Model.Customer modelOld = BLL.GetModel(model.CustomerID); if (modelOld == null) { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = "数据不存在"; return(Json(json)); } modelOld.CustomerName = model.CustomerName; modelOld.Linkman = model.Linkman; modelOld.Telephone = model.Telephone; modelOld.OrderBy = model.OrderBy; modelOld.Remark = model.Remark; modelOld.UpdateTime = DateTime.Now; modelOld.UpdateBy = CurrentUser.User.Userinfo.UserID; bool res = BLL.Update(modelOld); if (res) { json.Status = JsonObject.STATUS_SUCCESS; json.Message = "修改成功"; return(Json(json)); } else { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = "修改失败"; return(Json(json)); } } }