protected void btnDelAll_Click(object sender, EventArgs e) { try { StringBuilder sb = new StringBuilder(); foreach (int row in gvList.SelectedRowIndexArray) { sb.Append(gvList.DataKeys[row][0].ToString()); sb.Append(","); } var library = new DictCustomerService(); int nflag = new DictcustomertestdiscountService().DelDictcustomerdiscountByID(sb.ToString().TrimEnd(',')); if (nflag > 0) { MessageBoxShow("所选项已成功删除", MessageBoxIcon.Information); BindGrid(); gvList.SelectedRowIndexArray = new int[] { }; //this.Drop_DictTestItemId.SelectedValue = "-1"; this.tbxFinalprice.Text = string.Empty; this.DatePicker1.Text = string.Empty; this.DatePicker2.Text = string.Empty; } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
/// <summary> /// 查询所有客户 /// </summary> /// <returns></returns> public List <Dictcustomer> GetDictcustomer() { if (CacheHelper.GetCache("Dict.SelectDictcustomer") != null) { return((List <Dictcustomer>)CacheHelper.GetCache("Dict.SelectDictcustomer")); } else { List <Dictcustomer> list = new DictCustomerService().GetDictCustomerList().ToList <Dictcustomer>(); CacheHelper.SetCache("Dict.SelectDictcustomer", list); return(list); } }
private void BindDrop() { DictCustomerService dictcustomerService = new DictCustomerService(); IEnumerator <Dictcustomer> enumerator = dictcustomerService.GetDictCustomerListByType(this.CustomerType).GetEnumerator(); ddlcustomer.Items.Add(new ExtAspNet.ListItem("请选择", "-1")); while (enumerator.MoveNext()) { ddlcustomer.Items.Add(new ExtAspNet.ListItem(enumerator.Current.Customername, enumerator.Current.Dictcustomerid.ToString())); } ddlcustomer.Items.Remove(new ExtAspNet.ListItem("请选择", "-1")); // ddlcustomer.Items.RemoveAt(0); ddlcustomer.Items[0].EnableSelect = true; }
private void SelectCustomer() { string cusName = tbxmember.Text.Trim(); if (string.IsNullOrEmpty(cusName)) { //体检单位初始化 BinddropDictcustomer(dropDictLab.SelectedValue); } else { string labid = string.Empty; if (dropDictLab.SelectedValue == "-1") { labid = Userinfo.joinLabidstr; } else { labid = dropDictLab.SelectedValue; } Hashtable htPara = new Hashtable(); htPara.Add("labid", labid); htPara.Add("customername", cusName); DataTable dtList = new DictCustomerService().GetCustomerListBySearchBox(htPara); if (dtList == null || dtList.Rows.Count == 0) { MessageBoxShow("没有搜索到匹配的体检单位!"); tbxmember.Text = string.Empty; tbxmember.Focus(); return; } else if (dtList.Rows.Count == 1) { dropDictcustomer.SelectedValue = dtList.Rows[0]["dictcustomerid"].ToString(); tbxmember.Text = string.Empty; } else { dropDictcustomer.DataSource = dtList; dropDictcustomer.DataValueField = "Dictcustomerid"; dropDictcustomer.DataTextField = "Customername"; dropDictcustomer.DataBind(); tbxmember.Text = string.Empty; } } }
//绑定单位详细信息 protected void gvList_RowClick(object sender, GridRowClickEventArgs e) { try { Dictcustomer dictCustomer = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(gvList.DataKeys[e.RowIndex][0])); this.radlActive.SelectedValue = dictCustomer.Active; this.radlCustomerType.SelectedValue = dictCustomer.Customertype; this.tbxAddress.Text = dictCustomer.Address; this.tbxContactman.Text = dictCustomer.Contactman; this.tbxContactPhone.Text = dictCustomer.Contactphone; this.tbxCoustomerCode.Text = dictCustomer.Customercode; this.tbxCoustomerName.Text = dictCustomer.Customername; this.tbxDisplayOrder.Text = dictCustomer.Displayorder.ToString(); this.tbxDocumentCode.Text = dictCustomer.Documentcode; this.tbxDocumentType.Text = dictCustomer.Documenttype; this.tbxEmail.Text = dictCustomer.Email; this.tbxEnAddress.Text = dictCustomer.Engaddress; this.tbxEnErpCode.Text = dictCustomer.Erpcode; this.tbxEnName.Text = dictCustomer.Customerengname; this.tbxErpName.Text = dictCustomer.Erpname; this.tbxFastCode.Text = dictCustomer.Fastcode; this.tbxFax.Text = dictCustomer.Fax; this.tbxPostCode.Text = dictCustomer.Postcode; this.tbxReporTitle.Text = dictCustomer.Reporttitle; this.tbxTelePhone.Text = dictCustomer.Telephone; this.tbxCoustomerName2.Text = dictCustomer.Customername2; this.TxaRemark.Text = dictCustomer.Remark; this.dropDictcheckBillId.SelectedValue = dictCustomer.Dictcheckbillid.ToString(); this.dropDictlab2.SelectedValue = dictCustomer.Dictlabid.ToString(); this.dropDictsalemanId.SelectedValue = dictCustomer.Dictsalemanid.ToString(); this.dropStatus.SelectedValue = dictCustomer.Status; if (dictCustomer.Issms == "1") { this.chkIssms.Checked = true; } else { this.chkIssms.Checked = false; } this.radIsPub.SelectedValue = dictCustomer.IsPublic; } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
/// <summary> /// 绑定测试项 /// </summary> private void BindDrop() { try { Dictcustomer dictcustomer = new DictCustomerService().GetDictCustomerById(CustomerId); Hashtable ht = new Hashtable(); ht.Add("dictlabId", dictcustomer.Dictlabid); this.Drop_DictTestItemId.DataSource = new DictlabandtestService().GetTestItem(ht); this.Drop_DictTestItemId.DataTextField = "Testname"; this.Drop_DictTestItemId.DataValueField = "Dicttestitemid"; this.Drop_DictTestItemId.DataBind(); this.Drop_DictTestItemId.Items.Insert(0, new ExtAspNet.ListItem("请选择", "-1")); } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
// 删除 protected void btnDelAll_Click(object sender, EventArgs e) { try { StringBuilder sb = new StringBuilder(); foreach (int row in gvList.SelectedRowIndexArray) { sb.Append(gvList.DataKeys[row][0].ToString()); sb.Append(","); } var library = new DictCustomerService(); int nflag = dictCustomerService.DelDictcustomerByID(sb.ToString().TrimEnd(',')); if (nflag > 0) { MessageBoxShow("所选项已成功删除", MessageBoxIcon.Information); btSearch_Trigger2Click(null, null); } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
/// <summary>//保存数据的逻辑 /// /// </summary> /// <returns></returns> public bool SaveDictlibrary() { if (radlActive.SelectedValue == "1") { erreyType = "该单位信息已审核,无法编辑单位信息,请取消审核再修改单位信息"; return(false); } if (tbxCoustomerCode.Text.Trim() == "" || tbxCoustomerName.Text.Trim() == "") //单位代码 { erreyType = "单位代码或单位名称不能为空!"; return(false); } dictCustomer.Active = this.radlActive.SelectedValue; if (tbxAddress.Text.Trim() != "") { dictCustomer.Address = this.tbxAddress.Text.Trim(); //公司地址 } else { erreyType = "公司地址不能为空!"; return(false); } if (tbxContactman.Text.Trim() != "") { dictCustomer.Contactman = this.tbxContactman.Text.Trim(); //联系人 } else { erreyType = "联系人不能为空!"; return(false); } dictCustomer.Contactphone = this.tbxContactPhone.Text.Trim(); //联系人电话 dictCustomer.Customerengname = this.tbxEnName.Text.Trim(); //公司英文名称 dictCustomer.Customertype = this.radlCustomerType.SelectedValue; //公司类型 if (this.dropDictcheckBillId.SelectedValue != "-1") //财务人员 { dictCustomer.Dictcheckbillid = Convert.ToDouble(this.dropDictcheckBillId.SelectedValue); } else { erreyType = "财务人员不能为空!"; return(false); } if (this.dropDictLab.SelectedValue != "-1") //所属分点 { dictCustomer.Dictlabid = Convert.ToDouble(this.dropDictLab.SelectedValue); } else { erreyType = "所属分点不能为空!"; return(false); } if (this.dropDictsalemanId.SelectedValue != "-1") //销售人员 { dictCustomer.Dictsalemanid = Convert.ToDouble(this.dropDictsalemanId.SelectedValue); } else { erreyType = "销售人员不能为空!"; return(false); } if (this.dropStatus.SelectedValue != "" && this.dropStatus.SelectedValue != null) { dictCustomer.Status = this.dropStatus.SelectedValue; //客户状态 } else { erreyType = "客户状态不能为空!"; return(false); } dictCustomer.Dictcustomerid = 0; if (gvList.SelectedRowIndexArray.Count() > 0) { dictCustomer.Dictcustomerid = Convert.ToDouble(gvList.DataKeys[gvList.SelectedRowIndexArray[0]][0]); dictCustomer.YGSyncStatus = "2"; dictCustomer.DZSyncStatus = "2"; } else { dictCustomer.Dictcustomerid = 0; dictCustomer.YGSyncStatus = "0"; dictCustomer.DZSyncStatus = "0"; } #region 单位名称或单位代码唯一性检验 Hashtable ht = new Hashtable(); ht.Add("value", tbxCoustomerCode.Text.Trim()); ht.Add("Customername", tbxCoustomerName.Text.Trim()); ht.Add("Dictcustomerid", dictCustomer.Dictcustomerid); List <Dictcustomer> listDictcustomer = new DictCustomerService().GetDictCustomerByCode(ht); if (listDictcustomer.Count > 0) { erreyType = "已存在相同的单位代码或单位名称,请重新填写!"; return(false); } #endregion dictCustomer.Customername = this.tbxCoustomerName.Text.Trim(); dictCustomer.Customercode = this.tbxCoustomerCode.Text.Trim(); dictCustomer.Displayorder = Convert.ToInt32(this.tbxDisplayOrder.Text.Trim() == "" ? 0 : Convert.ToInt32(this.tbxDisplayOrder.Text.Trim())); //排序 Convert.ToInt32(this.tbxDISPLAYORDER.Text.Trim() == "" ? 0 : Convert.ToInt32(this.tbxDISPLAYORDER.Text.Trim())); dictCustomer.Documentcode = this.tbxDocumentCode.Text.Trim(); //证件代号 dictCustomer.Documenttype = this.tbxDocumentType.Text.Trim(); //证件类型 dictCustomer.Engaddress = this.tbxEnAddress.Text.Trim(); //英文地址 dictCustomer.Erpcode = this.tbxEnErpCode.Text.Trim(); //ERP代号 dictCustomer.Erpname = this.tbxErpName.Text.Trim(); //ERP客户名称 dictCustomer.Fastcode = this.tbxFastCode.Text.Trim(); //助记符 dictCustomer.Fax = this.tbxFax.Text.Trim(); //传真 dictCustomer.Postcode = this.tbxPostCode.Text.Trim(); //邮编 dictCustomer.Customername2 = this.tbxCoustomerName2.Text.Trim(); dictCustomer.Remark = this.TxaRemark.Text.Trim(); //备注 dictCustomer.Reporttitle = this.tbxReporTitle.Text.Trim(); //报告单抬头 if (tbxTelePhone.Text.Trim() != "") { dictCustomer.Telephone = this.tbxTelePhone.Text.Trim(); //电话 } else { erreyType = "电话不能为空!"; return(false); } dictCustomer.Lastupdatedate = DateTime.Now; dictCustomer.Issms = chkIssms.Checked ? "1" : "0"; dictCustomer.IsPublic = radIsPub.SelectedValue;//是否公用单位 return(dictCustomerService.SaveDictcustomer(dictCustomer)); }