/// <summary> /// 转账汇款审核 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSh_Click(object sender, EventArgs e) { string shId = this.hidShId.Value; //调用model,对属性进行赋值 Hi.Model.PAY_PrePayment shModel = new Hi.BLL.PAY_PrePayment().GetModel(Convert.ToInt32(shId)); shModel.AuditState = 2; //调用修改方法 Hi.BLL.PAY_PrePayment shUpdate = new Hi.BLL.PAY_PrePayment(); bool shUp = shUpdate.Update(shModel); if (shUp == bool.Parse("true")) { int hidShIds = shModel.DisID; Hi.BLL.PAY_PrePayment prePayModel = new Hi.BLL.PAY_PrePayment(); //sum代理商全部录入,冲正以及审核通过的转账汇款金额 decimal sums = prePayModel.sums(hidShIds, shModel.CompID); //修改代理商的企业钱包金额 //调用model,对属性进行赋值 Hi.Model.BD_Distributor disSumModel = new Hi.BLL.BD_Distributor().GetModel(Convert.ToInt32(hidShIds)); disSumModel.DisAccount = sums; disSumModel.ID = shModel.ID; //调用修改方法 Hi.BLL.BD_Distributor disupdate = new Hi.BLL.BD_Distributor(); bool disup = disupdate.Update(disSumModel); if (disup) { JScript.AlertMethod(this, "审核成功", JScript.IconOption.笑脸, "function (){ location.replace('" + ("PayExamineList.aspx") + "'); }"); } } }
/// <summary> ///核心企业修改经销商信息 /// </summary> /// <param name="JSon"></param> /// <returns></returns> public ReseltResellerEdit EditReseller(string JSon) { string UserID = string.Empty; string CompID = string.Empty; string DisID = string.Empty; try { #region//JSon取值 JsonData JInfo = JsonMapper.ToObject(JSon); if (JInfo["UserID"].ToString().Trim() == "" || JInfo["CompID"].ToString().Trim() == "" || JInfo["Reseller"].ToString().Trim() == "") { return new ReseltResellerEdit() { Result = "F", Description = "参数异常" } } ; UserID = JInfo["UserID"].ToString(); CompID = JInfo["CompID"].ToString(); JsonData Reseller = JInfo["Reseller"]; //判断登录信息是否异常 Hi.Model.SYS_Users one = new Hi.Model.SYS_Users(); if (!new Common().IsLegitUser(int.Parse(UserID), out one, Int32.Parse(CompID))) { return(new ReseltResellerEdit() { Result = "F", Description = "登录信息异常" }); } //判断核心企业信息是否异常 Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Int32.Parse(CompID)); if (comp == null || comp.dr == 1 || comp.IsEnabled == 0 || comp.AuditState == 0) { return new ReseltResellerEdit() { Result = "F", Description = "核心企业信息异常" } } ; #endregion //判断经销商信息是否正常 DisID = Reseller["ResellerID"].ToString(); Hi.BLL.BD_Distributor bll_dis = new Hi.BLL.BD_Distributor(); Hi.Model.BD_Distributor dis = bll_dis.GetModel(Int32.Parse(DisID)); if (dis == null) { return new ReseltResellerEdit() { Result = "F", Description = "经销商信息异常" } } ; if (dis.dr == 1) { return new ReseltResellerEdit() { Result = "F", Description = "经销商已被删除" } } ; if (Reseller["ts"].ToString() != dis.ts.ToString()) { return new ReseltResellerEdit() { Result = "F", Description = "经销商信息已被他人修改,请稍后再试" } } ; string resellername = Common.NoHTML(Reseller["ResellerName"].ToString().Trim()); string resellercode = Common.NoHTML(Reseller["ResellerCode"].ToString().Trim()); string address = Common.NoHTML(Reseller["Address"].ToString().Trim()); //判断经销商修改的必填项 if (resellername == "") { return new ReseltResellerEdit() { Result = "F", Description = "请输入经销商名称" } } ; //判断经销商名字是否已存在 //if (Common.DisExistsAttribute("DisName", Reseller["ResellerName"].ToString(), CompID.ToString())) //List<Hi.Model.BD_Distributor> list_dis = bll_dis.GetList("", "DisName = '" + resellername + "' and ID <> " + dis.ID + "", ""); //if(list_dis!=null&&list_dis.Count>0) if (Common.DisExistsAttribute("DisName", resellername, CompID.ToString(), dis.ID.ToString())) { return new ReseltResellerEdit() { Result = "F", Description = "经销商名称已经存在" } } ; if (Reseller["ResellerProvince"].ToString().Trim() == "") { return new ReseltResellerEdit() { Result = "F", Description = "请选择经销商地址中的省" } } ; if (Reseller["ResellerCity"].ToString().Trim() == "") { return new ReseltResellerEdit() { Result = "F", Description = "请选择经销商地址中的市" } } ; if (Reseller["ResellerArea"].ToString().Trim() == "") { return new ReseltResellerEdit() { Result = "F", Description = "请选择经销商地址中的区" } } ; if (address == "") { return new ReseltResellerEdit() { Result = "F", Description = "请输入经销商地址中的详细地址" } } ; //修改经销商信息 dis.ts = DateTime.Now; dis.modifyuser = one.ID; dis.DisCode = resellercode; dis.DisName = resellername; //Int32 classifyid= Reseller["ResellerClassifyID"].ToString().Trim() == "" ? 0 : Int32.Parse(Reseller["ResellerClassifyID"].ToString().Trim()); //传入分类ID的话,判断分类ID是否正确 if (Reseller["ResellerClassifyID"].ToString().Trim() != "" && Reseller["ResellerClassifyID"].ToString() != "0") { Hi.Model.BD_DisType distpye = new Hi.BLL.BD_DisType().GetModel(Int32.Parse(Reseller["ResellerClassifyID"].ToString().Trim())); if (distpye == null || distpye.CompID != comp.ID) { return new ReseltResellerEdit() { Result = "F", Description = "经销商分类异常" } } ; if (distpye.dr == 1) { return new ReseltResellerEdit() { Result = "F", Description = "此经销商分类已被删除" } } ; //if (distpye.IsEnabled !=0) // return new ReseltResellerEdit() { Result = "F", Description = "此经销商分类已被禁用" }; dis.DisTypeID = distpye.ID; } else { dis.DisTypeID = 0; } //dis.AreaID = Reseller["AreaID"].ToString().Trim() == "" ? 0 : Int32.Parse(Reseller["AreaID"].ToString().Trim()); //传入区域ID的话,判断区域ID是否正确 if (Reseller["AreaID"].ToString().Trim() != "" && Reseller["AreaID"].ToString() != "0") { Hi.Model.BD_DisArea disarea = new Hi.BLL.BD_DisArea().GetModel(Int32.Parse(Reseller["AreaID"].ToString().Trim())); if (disarea == null || disarea.CompanyID != comp.ID) { return new ReseltResellerEdit() { Result = "F", Description = "经销商区域异常" } } ; if (disarea.dr == 1) { return new ReseltResellerEdit() { Result = "F", Description = "此经销商区域已被删除" } } ; dis.AreaID = disarea.ID; } else { dis.AreaID = 0; } dis.Province = Reseller["ResellerProvince"].ToString(); dis.City = Reseller["ResellerCity"].ToString(); dis.Area = Reseller["ResellerArea"].ToString(); dis.Address = address; dis.Zip = Common.NoHTML(Reseller["Zip"].ToString()); dis.Tel = Common.NoHTML(Reseller["Tel"].ToString()); dis.Fax = Common.NoHTML(Reseller["Fax"].ToString()); string principal = Common.NoHTML(Reseller["Principal"].ToString().Trim()); string phone = Common.NoHTML(Reseller["Phone"].ToString().Trim()); //如果联系人或联系人手机没输入,需要将登陆信息的联系人或手机号,赋值给联系人或手机 if (principal == "" || phone == "") { //先获取sys_compuser表中disid对应的数据,一对一关系 List <Hi.Model.SYS_CompUser> compuser = new Hi.BLL.SYS_CompUser().GetList("UserID", "DisID=" + dis.ID + " and UType = 5 and isnull(dr,0)=0 and isnull(IsEnabled,0)=1 and isnull(IsAudit,0)=2", ""); //通过Userid获取sys_users表数据 Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(compuser[0].ID); if (user != null && user.AuditState == 2 && user.IsEnabled == 1 && user.dr == 0) { //需要判断到底是传入的联系人为空,还是手机为空 if (principal == "") { dis.Principal = user.TrueName; } else { dis.Principal = principal; } if (phone == "") { dis.Phone = user.Phone; } else { dis.Phone = phone; } } } else { dis.Principal = principal; dis.Phone = phone; } //更新数据库 if (bll_dis.Update(dis)) { return new ReseltResellerEdit() { Result = "T", Description = "修改成功" } } ; else { return new ReseltResellerEdit() { Result = "F", Description = "修改失败" } }; } catch (Exception ex) { Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "EditReseller:" + JSon); return(new ReseltResellerEdit() { Result = "F", Description = "修改失败" }); } }