/// <summary> /// 获取体检单位总体价格详细信息 /// </summary> /// <param name="usercode"></param> /// <returns></returns> public Dictcustomerdiscounted GetDictcustomerdiscountedInfo(Dictcustomerdiscounted library) { //Dictcustomerdiscounted obj = null; //IList lst = this.selectIList("Dict.GetDictcustomerdiscountedInfo", library); //if (lst.Count > 0) // obj = (Dictcustomerdiscounted)lst[0]; //return obj; return(this.selectObj <Dictcustomerdiscounted>("Dict.GetDictcustomerdiscountedInfo", library)); }
///<summary> ///新增编辑后保存 ///</summary> ///<param name="library"></param> /// <returns></returns> public bool SaveDictcustomerdiscounted(Dictcustomerdiscounted library) { SortedList SQLlist = new SortedList(new MySort()); int nflag = 0; //新增 if (library.Dictcustomerdiscountid == 0 || library.Dictcustomerdiscountid == null) { try { library.Dictcustomerdiscountid = getSeqID("SEQ_DICTCUSTOMERDISCOUNTED"); insert("Dict.InsertDictcustomerdiscounted", library); SQLlist.Add(new Hashtable() { { "INSERT", "Dict.InsertDictcustomerdiscounted" } }, library); nflag = 1; List <LogInfo> logLst = getLogInfo <Dictcustomerdiscounted>(new Dictcustomerdiscounted(), library); Dictcustomer dictcustomer = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(library.Dictcustomerid)); AddMaintenanceLog("Dictcustomerdiscounted", int.Parse(library.Dictcustomerdiscountid.ToString()), logLst, "新增", dictcustomer.Customername.ToString(), library.Sendoutprice.ToString(), modulename); SQLlist.Add(new Hashtable() { { "INSERT", "dict.InsertMaintenancelog" } }, library); CacheHelper.RemoveAllCache("daan.SelectDictcustomerdiscountedresult"); } catch (Exception ex) { nflag = 0; throw new Exception(ex.Message); } } else//保存 { try { Dictcustomerdiscounted dictcustomer = GetDictcustomerdiscountedById(Convert.ToDouble(library.Dictcustomerdiscountid)); nflag = update("Dict.UpdateDictcustomerdiscounted", library); List <LogInfo> logLst = getLogInfo <Dictcustomerdiscounted>(dictcustomer, library); Dictcustomer dictcustomerUpdate = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(library.Dictcustomerid)); AddMaintenanceLog("Dictcustomerdiscounted", int.Parse(library.Dictcustomerdiscountid.ToString()), logLst, "修改", dictcustomerUpdate.Customername.ToString(), library.Sendoutprice.ToString(), modulename); CacheHelper.RemoveAllCache("daan.SelectDictcustomerdiscountedresult"); } catch (Exception ex) { throw new Exception(ex.Message); } } return(nflag > 0); }
public bool AuditDictcustomerdiscounted(string ids, string dictcustomerid, string active, double?auditby) { int nflag = 0; try { Hashtable ht = new Hashtable(); ht.Add("ids", ids); ht.Add("Active", active); ht.Add("AuditBy", auditby); ht.Add("AuditDate", DateTime.Now); nflag = update("Dict.AuditDictcustomerdiscounted", ht); string oldActice = string.Empty; if (active == "0") { oldActice = "1"; } else if (active == "1") { oldActice = "0"; } //添加基础资料修改日志 string[] arr = ids.Split(new char[] { ',' }); foreach (string id in arr) { Dictcustomerdiscounted dictcustomerNew = GetDictcustomerdiscountedById(Convert.ToDouble(id)); Dictcustomerdiscounted dictcustomerOld = GetDictcustomerdiscountedById(Convert.ToDouble(id)); dictcustomerOld.Active = oldActice; Dictcustomer dictcustomer = new DictCustomerService().GetDictCustomerById(Convert.ToDouble(dictcustomerid)); List <LogInfo> logLst = getLogInfo <Dictcustomerdiscounted>(dictcustomerOld, dictcustomerNew); AddMaintenanceLog("Dictcustomerdiscounted", int.Parse(id), logLst, "审核", dictcustomer.Customername.ToString(), "", modulename); } CacheHelper.RemoveAllCache("daan.SelectDictcustomerdiscountedresult"); } catch (Exception ex) { throw new Exception(ex.Message); } return(nflag > 0); }
//保存数据的逻辑 public bool SaveDictlibrary() { dictCounted = new Dictcustomerdiscounted(); if (gvList.SelectedRowIndexArray.Length > 0) { object[] objValue = gvList.DataKeys[gvList.SelectedRowIndexArray[0]]; dictCounted.Dictcustomerdiscountid = TypeParse.StrToDouble(objValue[0], 0); } dictCounted.Sendoutprice = 0; try { dictCounted.Discounted = Convert.ToDouble(tbxDiscounted.Text.Trim() == "" ? null : tbxDiscounted.Text.Trim()); if (this.DatePicker1.Text.Trim() != "") //开始时间 { Dictcustomerdiscounted dict = cs.GetDictcustomerdiscountedById(Convert.ToDouble(dictCounted.Dictcustomerdiscountid)); if (dict != null) { if (dict.Begindate != this.DatePicker1.SelectedDate || dict.Enddate != this.DatePicker2.SelectedDate) { #region if (this.DatePicker1.SelectedDate <= this.DatePicker2.SelectedDate) { Hashtable ht1 = new Hashtable(); ht1.Add("Enddate", this.DatePicker2.Text.Trim()); ht1.Add("begdate", this.DatePicker1.Text.Trim()); ht1.Add("Dictcustomerid", CustomerId); ht1.Add("DictId", Convert.ToDouble(dictCounted.Dictcustomerdiscountid)); ht1.Add("ProductID", dropProducts.SelectedValue); IList <Dictcustomerdiscounted> ds = cs.GetDictcustomerByTime(ht1); if (ds.Count == 0) { dictCounted.Begindate = Convert.ToDateTime(this.DatePicker1.Text.Trim()); } else { errreyType = "已存在重复时间段!"; return(false); } } else { errreyType = "开始时间应小于结束时间!"; return(false); } #endregion } else { if (this.DatePicker1.SelectedDate <= this.DatePicker2.SelectedDate) { dictCounted.Begindate = Convert.ToDateTime(this.DatePicker1.Text.Trim()); } else { errreyType = "开始时间应小于结束时间!"; return(false); } } } else { #region if (this.DatePicker1.SelectedDate <= this.DatePicker2.SelectedDate) { Hashtable ht1 = new Hashtable(); ht1.Add("Enddate", this.DatePicker2.Text.Trim()); ht1.Add("begdate", this.DatePicker1.Text.Trim()); ht1.Add("Dictcustomerid", CustomerId); ht1.Add("ProductID", dropProducts.SelectedValue); IList <Dictcustomerdiscounted> ds = cs.GetDictcustomerByTimeTo(ht1); if (ds.Count == 0) { dictCounted.Begindate = Convert.ToDateTime(this.DatePicker1.Text.Trim()); } else { errreyType = "已存在重复时间段!"; return(false); } } else { errreyType = "开始时间应小于结束时间"; return(false); } #endregion } } else { errreyType = "请输入开始时间!"; return(false); } if (this.DatePicker2.Text.Trim() != "") //结束时间 { dictCounted.Enddate = Convert.ToDateTime(this.DatePicker2.Text.Trim()); } else { errreyType = "请输入结束时间!"; return(false); } if (lblAuditStatus.Text == "已审核") { errreyType = "选择的单位套餐价格已审核,无法修改,请先取消审核后再修改!"; return(false); } dictCounted.Dictcustomerid = CustomerId; if (Userinfo.userId != 0) { dictCounted.Updateby = Userinfo.userId; } else { dictCounted.Updateby = 1; } dictCounted.Updatedate = DateTime.Now; if (dropProducts.SelectedValue == "-1") { errreyType = "请选择套餐!"; return(false); } else { dictCounted.Productid = Convert.ToDouble(dropProducts.SelectedValue);//套餐 } if (txtPrice.Text == "") { errreyType = "请输入标准价格!"; return(false); } else { dictCounted.Price = Convert.ToDouble(txtPrice.Text.ToString().Trim());//价格 } if (dropSubCompany.SelectedValue == "-1") { errreyType = "请选择签约子公司!"; return(false); } else { dictCounted.DictSubCompanyID = Convert.ToDouble(dropSubCompany.SelectedValue);//签约子公司 } if (dictCounted.Dictcustomerdiscountid == 0 || dictCounted.Dictcustomerdiscountid == null) { dictCounted.Createdate = DateTime.Now; } else { List <Dictcustomerdiscounted> dictcustomerdiscountedList = loginservice.GetDictcustomerdiscounted();//体检单位总体价格 Dictcustomerdiscounted dictcustomer = dictcustomerdiscountedList.Where <Dictcustomerdiscounted>(c => c.Dictcustomerdiscountid == dictCounted.Dictcustomerdiscountid).First <Dictcustomerdiscounted>(); dictCounted.Createdate = dictcustomer.Createdate; } return(cs.SaveDictcustomerdiscounted(dictCounted)); } catch (Exception ex) { throw ex; } }