protected override void OnSaveSuccess(object sender, EntityFormEventArgs e) { //拿入并且不是其他中介,则增加排序积分 if (rdin.Checked && !Entity.InOhterCompany) { //增加排序积分 s_SysParam ss = s_SysParam.FindByParamCode("houseKey"); //获取分隔符的值,第一个为分值,第二是否有 有效期,第三为有效期值 string[] ssValue = ss.Value.Split('|'); e_Integral ei = new e_Integral(); ei.employeeID = Convert.ToInt32(Current.EmployeeID); ei.Type = (int)integral_Type.房源与经纪人; ei.tableName = "h_houseinfor"; ei.coloumnName = "HouseID"; ei.keyID = Convert.ToInt32(Entity.HouseID); ei.integralParam = "houseKey"; ei.integralValue = ssValue[0].ToInt32(); ei.integralDay = ssValue[1] == "1" ? ssValue[2].ToInt32() : 0; ei.exe_Date = DateTime.Now; ei.Insert(); } }
protected override void OnOtherSaveForm(object sender, EntityFormEventArgs e) { //验证数据合法性 if (Entity.NewPrice == 0 || Entity.NewPrice_Sum == 0) { ShowMsg(AlertType.error, "跟进实价或总价不能为0!"); return; } //经纪人必须上传录音 if (Current.RoleNames.Contains("经纪人") && (Request.Form["rb1"] == null || Request.Form["rb1"] == "")) { ShowMsg(AlertType.error, "请选择压价录音!"); return; } h_PriceFollowUp.Meta.BeginTrans(); try { //改房源实价和平均价格 decimal NewPrice = Entity.NewPrice; decimal NewPrice_Sum = Entity.NewPrice_Sum; if (NewPrice > Entity.House.Sum_price) { NewPrice_Sum = NewPrice; } //写一条房源跟进 h_FollowUp hfo = new h_FollowUp(); hfo.HouseID = Entity.HouseID; hfo.EmployeeID = Employee.Current.EmployeeID; hfo.FollowUpText = "压价跟进[实价]:" + Entity.House.Min_price + "→" + NewPrice + ",[总价]:" + Entity.House.Sum_price + "→" + NewPrice_Sum; hfo.exe_Date = DateTime.Now; hfo.Insert(); Entity.OldPrice = Entity.House.Min_price; Entity.OldPrice_Sum = Entity.House.Sum_price; //decimal AddIntegral = Math.Abs(Math.Round(((Entity.NewPrice - Entity.OldPrice) * 10000 / 1000), 0)); //保存 Entity.EmployeeID = hfo.EmployeeID; Entity.AddDate = hfo.exe_Date; //Entity.Integral = AddIntegral.ToInt32().Value; Entity.Integral = 0; Entity.State = 0; if (Current.RoleNames.Contains("经纪人")) { //获取此房源历史最低价格,如果新实价比历史最低价降低3%,则更改价格维护人 decimal minNewPrice = DbHelperSQL.GetSingle(string.Format(@"select isnull(min(NewPrice),0) from h_PriceFollowUp where HouseID ={0}", Entity.HouseID)).ToDecimal().Value; if ((minNewPrice - NewPrice) >= (minNewPrice * 0.03.ToDecimal())) { Entity.State = 1; //增加排序积分 s_SysParam ss = s_SysParam.FindByParamCode("housePrice"); //获取分隔符的值,第一个为分值,第二是否有 有效期,第三为有效期值 string[] ssValue = ss.Value.Split('|'); e_Integral ei = new e_Integral(); ei.employeeID = Convert.ToInt32(Current.EmployeeID); ei.Type = (int)integral_Type.房源与经纪人; ei.tableName = "h_houseinfor"; ei.coloumnName = "HouseID"; ei.keyID = Convert.ToInt32(Entity.HouseID); ei.integralParam = "housePrice"; ei.integralValue = ssValue[0].ToInt32(); ei.integralDay = ssValue[1] == "1" ? ssValue[2].ToInt32() : 0; ei.exe_Date = DateTime.Now; ei.Insert(); } } if (Request.Form["rb1"] != null && Request.Form["rb1"] != "") { Entity.RecFilePath = Request.Form["rb1"].ToString(); } //单价 int Ohter2ID = Convert.ToInt32(Entity.NewPrice_Sum * 10000 / Entity.House.Build_area); string sql = string.Format(@"update h_houseinfor set Min_price={0},Ohter2ID={1},Sum_price={2} where HouseID={3}", NewPrice, Ohter2ID, NewPrice_Sum, Entity.HouseID); h_PriceFollowUp.Meta.Execute(sql); Entity.Save(); h_PriceFollowUp.Meta.Commit(); //判断是否修改价格维护人,需要推送给原价格维护人 if (Entity.State == 1) { sql = string.Format(@"SELECT TOP 1 employeeid FROM h_pricefollowup WHERE state = 1 AND employeeid != {0} AND houseid = {1} ORDER BY adddate DESC ", Entity.EmployeeID, Entity.HouseID); object empID = DbHelperSQL.GetSingle(sql); //判断此房源是否有前一个价格维护人 if (empID != null) { string msg = "房源编号:【" + Entity.House.Shi_id + "】的价格维护人修改为【" + Current.Em_name + "】"; h_PriceComplaint hpc = new h_PriceComplaint(); hpc.h_PriceFollowUpID = Entity.ID; hpc.houseID = Entity.HouseID.ToInt32().Value; hpc.createTime = DateTime.Now; hpc.Context = msg; hpc.priceEditEmpID = Entity.EmployeeID.ToInt32().Value; hpc.priceEmpID = empID.ToInt32().Value; hpc.Insert(); Common.MsgPush.PushMsg(msg, new string[] { Entity.EmployeeID.ToString() }, (int)Common.msgType.价格维护); } } } catch { h_PriceFollowUp.Meta.Rollback(); } }
protected override void OnSaveSuccess(object sender, EntityFormEventArgs e) { if (Request.Form["txtRemark"] != null) { H_houseinfor hh = H_houseinfor.FindByHouseID(Entity.houseID); //总部认证状态 hh.state_ZBCheck = Request.QueryString["StateID"].ToInt32(); //更新日期 hh.Update_date = DateTime.Now; //认证通过 if (Request.QueryString["StateID"].ToInt32() == (int)CheckState.合格) { //当房源首录人和申请认证的人不一致时,修改首录人和门店 if (Entity.employeeID.HasValue && hh.OwnerEmployeeID != Entity.employeeID.Value) { Employee ee = Employee.FindByEmployeeID(Entity.employeeID.Value); hh.OwnerEmployeeID = (int)ee.EmployeeID; hh.OrgID = (int)ee.OrgID; } //hh.Exe_date = Entity.exe_Date.Value; //找出此房源所有未审核,未上传开盘录音的记录,将其清空 List <h_houseinfor_ZBCheck> listZB = h_houseinfor_ZBCheck.FindAll(string.Format(@"select * from h_houseinfor_ZBCheck where houseid={0} and phoneID is null and employee_auditID is null and isDel=0" , Entity.houseID)); if (listZB.Count > 0) { DbHelperSQL.ExecuteSql("update h_houseinfor_ZBCheck set isdel=1 where id in(" + string.Join(",", listZB.Select(x => x.ID).ToArray()) + ")"); } if (Entity.phoneID.HasValue) { h_RecordClose hrc = h_RecordClose.Find(h_RecordClose._.phoneID, Entity.phoneID.Value); if (hrc != null) { hrc.IsCheck = true; hrc.Update(); } else { hrc = new h_RecordClose(); i_InternetPhone iip = i_InternetPhone.FindByKey(Entity.phoneID.Value); hrc.EmployeeID = iip.employeeID; hrc.phoneID = Entity.phoneID.Value; hrc.aType = 0; hrc.CheckEmployeeID = iip.employeeID; hrc.IsCheck = true; hrc.CheckDate = DateTime.Now; hrc.exe_date = DateTime.Now; hrc.ComID = Current.ComID; hrc.Insert(); } } //增加排序积分 s_SysParam ss = s_SysParam.FindByParamCode("houseKP"); //获取分隔符的值,第一个为分值,第二是否有 有效期,第三为有效期值 string[] ssValue = ss.Value.Split('|'); e_Integral ei = new e_Integral(); ei.employeeID = Entity.employeeID.Value; ei.Type = (int)integral_Type.房源与经纪人; ei.tableName = "h_houseinfor"; ei.coloumnName = "HouseID"; ei.keyID = Entity.houseID; ei.integralParam = "houseKP"; ei.integralValue = ssValue[0].ToInt32(); ei.integralDay = ssValue[1] == "1" ? ssValue[2].ToInt32() : 0; ei.exe_Date = DateTime.Now; ei.Insert(); } //认证驳回 else if (Request.QueryString["StateID"].ToInt32() == (int)CheckState.驳回) { h_houseinfor_ZBCheck hhz = new h_houseinfor_ZBCheck(); hhz.houseID = Entity.houseID; hhz.employeeID = Entity.employeeID; hhz.exe_Date = DateTime.Now; hhz.state_ZBCheck = (int)CheckState.待认证; hhz.rejectNum = Entity.rejectNum.Value + 1; hhz.comID = Current.ComID; hhz.Insert(); } //认证 虚位以待 else if (Request.QueryString["StateID"].ToInt32() == (int)CheckState.虚位以待) { hh.OwnerEmployeeID = 0; hh.OrgID = 0; //修改为无效状态 hh.StateID = 10; hh.CurrentEmployee = Current.EmployeeID; //找出此房源所有未审核,未上传开盘录音的记录,将其清空 List <h_houseinfor_ZBCheck> listZB = h_houseinfor_ZBCheck.FindAll(string.Format(@"select * from h_houseinfor_ZBCheck where houseid={0} and phoneID is null and employee_auditID is null and isDel=0" , Entity.houseID)); if (listZB.Count > 0) { DbHelperSQL.ExecuteSql("update h_houseinfor_ZBCheck set isdel=1 where id in(" + string.Join(",", listZB.Select(x => x.ID).ToArray()) + ")"); } } hh.Update(); } ShowMsg(AlertType.correct, "保存成功"); //base.OnSaveSuccess(sender, e); }