Example #1
0
        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();
            }
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (context.Request.QueryString["aTyp"] != null && context.Request.QueryString["aTyp"].ToString() == "del")
            {
                h_HouseTelList hh = h_HouseTelList.FindByKey(context.Request.QueryString["LSH"]);
                hh.DelEmployeeID = Employee.Current.EmployeeID;
                hh.DelType       = true;
                hh.Update();
                h_FollowUp hfo = new h_FollowUp();
                hfo.HouseID      = hh.HouseID;
                hfo.EmployeeID   = Employee.Current.EmployeeID;
                hfo.FollowUpText = "电话删除";
                hfo.Insert();

                // 电话修改记录
                string    oldTel = hh.Tel2;
                TelChange tc     = new TelChange();
                tc.AddEmployeeID = Employee.Current.EmployeeID;
                tc.HouseID       = hh.HouseID;
                tc.NewTel        = "";
                tc.OldTel        = oldTel.TelDecrypt((Int32)hh.HouseID, 0);
                tc.Insert();

                context.Response.Write("del");
            }
            else if (context.Request.QueryString["LSH"] != null)
            {
                h_HouseTelList hh     = h_HouseTelList.FindByKey(context.Request.QueryString["LSH"]);
                string         result = "";
                int            ii     = i_InternetTel.FindCount(new string[] { "EmployeeID", "IsDel" }, new string[] { Employee.Current.EmployeeID.ToString(), "0" });
                if (ii > 0)
                {
                    string tel = "";
                    //隐号拔打
                    string houseTel = hh.Tel2.TelDecrypt((Int32)hh.HouseID, TelDecPoint.PC_HouseForm_TelPhone);
                    if (context.Request.QueryString["mytel"] != null)
                    {
                        tel = context.Request.QueryString["mytel"].ToString();
                        i_InternetPhone iip = new i_InternetPhone();
                        iip.employeeID   = Employee.Current.EmployeeID;
                        iip.houseID      = hh.HouseID;
                        iip.dateCreated  = DateTime.Now.ToString();
                        iip.fromTel      = tel;
                        iip.toTel        = houseTel;
                        iip.recordUrlDel = 2;
                        iip.orgID        = Convert.ToInt32(Employee.Current.OrgID);
                        iip.isPcCallTel  = 1;
                        iip.createTime   = DateTime.Now;
                        iip.Source       = 2;
                        iip.CallSystem   = 0;
                        iip.RecrodType   = 1;
                        iip.Insert();

                        Common.InterPhoneCall             ip  = new Common.InterPhoneCall();
                        Common.InterPhoneCall.CallBackMsg cbm = new Common.InterPhoneCall.CallBackMsg();

                        s_SysParam model   = s_SysParam.Find(Share_Personinfo._.ID, 1279);
                        string     sqlnum  = @"select COUNT(*)AS Num from i_InternetPhone
                                            where createTime > DATEADD(minute, -15, GETDATE())
                                            and datediff(dd, createTime, GETDATE())= 0
                                            and employeeID =" + Employee.Current.EmployeeID + @"
                                            and houseID =" + hh.HouseID + @"
                                            and  callSid !=''";
                        int        CallNum = int.Parse(EntityUtils.DBUtility.DbHelperSQL.Query(sqlnum).Tables[0].Rows[0][0].ToString());
                        if (CallNum >= int.Parse(model.Value) && int.Parse(model.Value) > 0)
                        {
                            result = "1";
                        }
                        else
                        {
                            cbm         = ip.Call(tel, houseTel, iip.phoneID.ToString());
                            iip.callSid = cbm.taskId;
                            iip.Update();
                            result = cbm.errcode;
                        }
                    }
                    else
                    {
                        tel = i_InternetTel.Find("EmployeeID=" + Employee.Current.EmployeeID + " and IsDel=0").MyTel;
                        i_InternetPhone iip = new i_InternetPhone();
                        iip.employeeID   = Employee.Current.EmployeeID;
                        iip.houseID      = hh.HouseID;
                        iip.dateCreated  = DateTime.Now.ToString();
                        iip.fromTel      = tel;
                        iip.toTel        = houseTel;
                        iip.recordUrlDel = 2;
                        iip.orgID        = Convert.ToInt32(Employee.Current.OrgID);
                        iip.isPcCallTel  = 1;
                        iip.createTime   = DateTime.Now;
                        iip.Source       = 2;
                        iip.CallSystem   = 0;
                        iip.RecrodType   = 1;
                        iip.Insert();
                        Common.InterPhoneCall             ip  = new Common.InterPhoneCall();
                        Common.InterPhoneCall.CallBackMsg cbm = new Common.InterPhoneCall.CallBackMsg();

                        s_SysParam model   = s_SysParam.Find(Share_Personinfo._.ID, 1279);
                        string     sqlnum  = @"select COUNT(*)AS Num from i_InternetPhone
                                          where createTime > DATEADD(minute, -15, GETDATE()) and datediff(dd, createTime, GETDATE())= 0 and employeeID =" + Employee.Current.EmployeeID + "and houseID =" + hh.HouseID + "AND  callSid !=''";
                        int        CallNum = int.Parse(HouseMIS.EntityUtils.DBUtility.DbHelperSQL.Query(sqlnum).Tables[0].Rows[0][0].ToString());
                        if (CallNum >= int.Parse(model.Value) && int.Parse(model.Value) > 0)
                        {
                            result = "1";
                        }
                        else
                        {
                            cbm         = ip.Call(tel, houseTel, iip.phoneID.ToString());
                            iip.callSid = cbm.taskId;
                            iip.Update();
                            result = cbm.errcode;
                        }
                    }
                    if (result == "0")
                    {
                        context.Response.Write("连接成功!连接手机号:" + tel);
                    }
                    else if (result == "1")
                    {
                        string   timesql = @"select top 1 datediff(SECOND , DATEADD(minute, -15, GETDATE()),createTime)time from i_InternetPhone where datediff(dd, createTime, GETDATE())= 0 and employeeID=" + Employee.Current.EmployeeID + "and callSid !='' and createTime > DATEADD(minute, -15, GETDATE()) and houseID=" + hh.HouseID;
                        int      time    = int.Parse(EntityUtils.DBUtility.DbHelperSQL.Query(timesql).Tables[0].Rows[0][0].ToString());
                        TimeSpan ts      = new TimeSpan(0, 0, time);
                        string   times;
                        if (ts.Minutes > 0)
                        {
                            times = ts.Minutes + "分钟" + ts.Seconds + "秒";
                        }
                        else
                        {
                            times = ts.Seconds + "秒";
                        }

                        context.Response.Write("您拨打的太频繁了!</br>请稍作休息!请" + times + "后再试!");
                    }
                    else
                    {
                        context.Response.Write("连接失败!请联系管理员");
                    }
                }
                else
                {
                    context.Response.Write("1," + Employee.Current.EmployeeID.ToString());
                }
            }
            else if (context.Request.QueryString["EmpTelFrom"] != null && context.Request.QueryString["EmpTelTo"] != null)
            {
                string result = string.Empty;

                string telFrom = context.Request.QueryString["EmpTelFrom"];
                string telTo   = context.Request.QueryString["EmpTelTo"];

                i_InternetPhone iip = new i_InternetPhone();
                iip.employeeID   = Employee.Current.EmployeeID;
                iip.houseID      = 0;
                iip.dateCreated  = DateTime.Now.ToString();
                iip.fromTel      = telFrom;
                iip.toTel        = telTo;
                iip.recordUrlDel = 2;
                iip.orgID        = Convert.ToInt32(Employee.Current.OrgID);
                iip.isPcCallTel  = 1;
                iip.createTime   = DateTime.Now;
                iip.Source       = 2;
                iip.CallSystem   = 0;
                iip.RecrodType   = 4;
                iip.Insert();

                Common.InterPhoneCall             ip  = new Common.InterPhoneCall();
                Common.InterPhoneCall.CallBackMsg cbm = new Common.InterPhoneCall.CallBackMsg();

                s_SysParam model   = s_SysParam.Find(Share_Personinfo._.ID, 1279);
                string     sqlnum  = @"select COUNT(*)AS Num from i_InternetPhone
                                          where createTime > DATEADD(minute, -15, GETDATE()) and datediff(dd, createTime, GETDATE())= 0 and employeeID =" + Employee.Current.EmployeeID + "and houseID =0  and callSid !=''";
                int        CallNum = int.Parse(HouseMIS.EntityUtils.DBUtility.DbHelperSQL.Query(sqlnum).Tables[0].Rows[0][0].ToString());
                if (CallNum >= int.Parse(model.Value) && int.Parse(model.Value) > 0)
                {
                    result = "1";
                }
                else
                {
                    cbm         = ip.Call(telFrom, telTo, iip.phoneID.ToString());
                    iip.callSid = cbm.taskId;
                    iip.Update();
                    result = cbm.errcode;
                }
                if (result == "0")
                {
                    context.Response.Write("连接成功!连接手机号:" + telFrom);
                }
                else if (result == "1")
                {
                    string   timesql = @"select top 1 datediff(SECOND , DATEADD(minute, -15, GETDATE()),createTime)time from i_InternetPhone where datediff(dd, createTime, GETDATE())= 0 and employeeID=" + Employee.Current.EmployeeID + "and callSid !='' and createTime > DATEADD(minute, -15, GETDATE()) and houseID=0";
                    int      time    = int.Parse(HouseMIS.EntityUtils.DBUtility.DbHelperSQL.Query(timesql).Tables[0].Rows[0][0].ToString());
                    TimeSpan ts      = new TimeSpan(0, 0, time);
                    string   times;
                    if (ts.Minutes > 0)
                    {
                        times = ts.Minutes + "分钟" + ts.Seconds + "秒";
                    }
                    else
                    {
                        times = ts.Seconds + "秒";
                    }

                    context.Response.Write("您拨打的太频繁了!</br>请稍作休息!请" + times + "后再试!");
                }
                else
                {
                    context.Response.Write("连接失败!请联系管理员");
                }
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string act = string.Empty;
                if (CheckRolePermission("还原"))
                {
                    act += "<li><a class=\"add\" href=\"House/HouseRecover.aspx?NavTabId=" + NavTabId + "&doAjax=true&doType=del&ID={ID}\" rel=\"ids\" target=\"selectedTodo\" title=\"确定要还原房源吗?\"><span>房源还原</span></a></li>";
                }
                this.LiteralID.Text = act;
                if (Request.QueryString["doType"] != null)
                {
                    if (Request.QueryString["doType"] == "del")
                    {
                        if (CheckRolePermission("还原"))
                        {
                            if (!String.IsNullOrEmpty(Request["ids"]))
                            {
                                foreach (string s in Request["ids"].Split(','))
                                {
                                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                                    H_houseinfor h = H_houseinfor.FindByHouseID(Convert.ToDecimal(s));
                                    if (h != null && CheckRolePermission("还原", h.OwnerEmployeeID.ToDecimal()))
                                    {
                                        h.DelType = false;
                                        h.Update();
                                    }
                                }
                            }
                            JSDo_UserCallBack_Success(" formFind();$(\".HouseRecover:eq(0)\").submit();", "操作成功");
                        }
                        else
                        {
                            JSDo_UserCallBack_Success(" formFind();$(\".HouseRecover:eq(0)\").submit();", "操作失败,您没有还原房源的权限!");
                        }
                    }
                }
                FullDropListData(typeof(h_State), this.ffrmStateID, "Name", "StateID", null, null);
                FullAreaDropListData(mysfrmAreaID, "-请选择-", "");
                FullDropListData(typeof(h_Year), this.ffrmYearID, "Name", "YearID", "");
                FullDropListData(typeof(h_Fitment), this.myffrmFitmentID, "Name", "FitmentID", "");
                FullDropListData(typeof(h_Type), this.ffrmTypeCode, "Name", "TypeCode", "");
                string OperType = Request.QueryString["OperTypes"];
                if (OperType != null)
                {
                    string HouseID = Request["HouseID"];
                    if (HouseID == null)
                    {
                        HouseID = "";
                    }
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    switch (OperType)
                    {
                    case "3":     //推见房源
                        s_SysParam ss = s_SysParam.FindByParamCode("RecommendNum");
                        TCode.DataAccessLayer.SelectBuilder sbs = new TCode.DataAccessLayer.SelectBuilder();
                        sbs.Table = "h_Recommend";
                        sbs.Where = "CONVERT(varchar,exe_date,112)=CONVERT(varchar,getdate(),112) and EmployeeID=" + Employee.Current.EmployeeID.ToString();
                        int hrs = h_Recommend.Meta.QueryCount(sbs);
                        if (hrs < Convert.ToInt32(ss.Value))
                        {
                            H_houseinfor.Meta.Query("update h_houseInfor set update_date=getdate() where HouseID = " + HouseID);
                            h_Recommend Hr = new h_Recommend();
                            Hr.EmployeeID = Employee.Current.EmployeeID;
                            Hr.HouseID    = Convert.ToDecimal(HouseID);
                            Hr.Insert();
                        }
                        else
                        {
                            sb.Append("{\r\n");
                            sb.Append("   \"statusCode\":\"300\", \r\n");
                            sb.Append("   \"message\":\"操作失败,您今天房源的推荐数已满请明天再试!\" \r\n");
                            sb.Append("}\r\n");
                            Response.Write(sb.ToString());
                            Response.End();
                        }
                        break;

                    case "4":     //收藏房源
                        H_houseinfor.Meta.Query("if not exists(select 1 from h_HouseCollect where HouseID=" +
                                                HouseID + " and EmployeeID=" +
                                                HouseMIS.EntityUtils.Employee.Current.EmployeeID.ToString() + ") insert into h_HouseCollect(HouseID,EmployeeID) Values(" +
                                                HouseID + "," + HouseMIS.EntityUtils.Employee.Current.EmployeeID.ToString() + ")");
                        break;

                    case "5":     //取消收藏房源
                        H_houseinfor.Meta.Query("delete from h_HouseCollect where HouseID=" +
                                                HouseID + " and EmployeeID=" +
                                                HouseMIS.EntityUtils.Employee.Current.EmployeeID.ToString());
                        break;
                        //case "6": //查看钥匙
                        //    DataTable dt = h_HouseKey.Meta.Query("SELECT TOP 1 H.IsIn,S.Name,H.InOhterCompany FROM h_HouseKey H LEFT JOIN s_Organise S ON S.OrgID = H.OrgID WHERE H.HouseID = " + HouseID + " ORDER BY H.exe_date DESC").Tables[0];

                        //    if (dt.Rows.Count > 0)
                        //    {
                        //        if (Convert.ToBoolean(dt.Rows[0][0]) == true)
                        //        {
                        //            if (dt.Rows[0]["InOhterCompany"].ToString() == "True")
                        //                //Response.Write("<script>alertMsg.correct('钥匙在其他中介')</script>");
                        //                JSDo_UserCallBack_Success("", "钥匙在其他中介");
                        //            else
                        //                //Response.Write("<script>alertMsg.correct('钥匙在" + dt.Rows[0][1] + "')</script>");
                        //                JSDo_UserCallBack_Success("", "钥匙在" + dt.Rows[0][1]);
                        //        }
                        //        else
                        //            //Response.Write("<script>alertMsg.correct('该房源没有拿钥匙!')</script>");
                        //            JSDo_UserCallBack_Error("", "该房源没有拿钥匙");
                        //    }
                        //    else
                        //    {
                        //        //Response.Write("<script>alertMsg.correct('该房源没有拿钥匙!')</script>");
                        //        JSDo_UserCallBack_Error("", "该房源没有拿钥匙");
                        //    }

                        //    //Response.End();
                        //    break;
                    }
                    sb.Append("{\r\n");
                    sb.Append("   \"statusCode\":\"200\", \r\n");
                    sb.Append("   \"message\":\"操作成功!\" \r\n");
                    sb.Append("}\r\n");
                    Response.Write(sb.ToString());
                    Response.End();
                }
                if (Request.QueryString["doType"] != null)
                {
                    if (Request.QueryString["doType"] == "del")
                    {
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        H_houseinfor.Meta.Query("delete from h_houseinfor where HouseID=" + Request["HouseID"]);
                        sb.Append("{\r\n");
                        sb.Append("   \"statusCode\":\"200\", \r\n");
                        sb.Append("   \"message\":\"操作成功!\" \r\n");
                        sb.Append("}\r\n");
                        Response.Write(sb.ToString());
                        Response.End();
                    }
                }
            }
        }
Example #4
0
        public string GetRepeat()
        {
            s_SysParam ss = s_SysParam.FindByParamCode("HouseRepeat");

            return(ss.Value);
        }
Example #5
0
        //public s_SysParam hsc = s_SysParam.FindByParamCode("HouseStateColor");

        //protected String GetColStyle(object SeeHouseType)
        //{
        //    if (hsc != null)
        //    {
        //        string[] ss = hsc.Value.Split(',');
        //        foreach (string sv in ss)
        //        {
        //            string[] str = sv.Split('|');
        //            if (str[0] == SeeHouseType.ToString() && str[1] != "")
        //            {
        //                return " style=\"color:#" + str[1] + "\" ";
        //            }
        //        }
        //    }
        //    return null;
        //}

        /// <summary>
        /// 页面状态下拉框绑定
        /// </summary>
        /// <returns></returns>
        //public void HouseState()
        //{
        //    IEntityList ls = h_State.FindAll();
        //    this.ffrmState.Items.Clear();
        //    ffrmState.Items.Add(new ListItem("请选择", ""));
        //    if (ls != null)
        //    {
        //        for (int i = 0; i < ls.Count; i++)
        //        {
        //            ffrmState.Items.Add(new ListItem(ls[i]["Name"].ToString(), ls[i]["StateID"].ToString()));
        //        }
        //    }
        //}

        //protected void FullSubGroup()
        //{
        //EntityList<e_SubGroup> list = e_SubGroup.FindAll();
        //myffrmSubGroupID.Items.Add(new ListItem("", ""));
        //foreach (e_SubGroup es in list)
        //{
        //    myffrmSubGroupID.Items.Add(new ListItem(es.People, es.SubGroupID.ToString()));
        //}
        //}

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(HouseCheck), this.Page);
                if (!CheckRolePermission("查看"))
                {
                    Response.End();
                }

                //if (Request.QueryString["AssessStateID"] != null)
                //{
                //    if (!String.IsNullOrEmpty(Request["hcids"]))
                //        foreach (string s in Request["hcids"].Split(','))
                //        {
                //            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                //            H_houseinfor hh = H_houseinfor.FindByHouseID(Convert.ToDecimal(s));
                //            h_AssessState ha = h_AssessState.Find(h_AssessState._.AssessStateID, Request.QueryString["AssessStateID"]);
                //            if (ha != null && hh != null && ha.aType == hh.aType)
                //            {
                //                hh.AssessStateID = Request.QueryString["AssessStateID"].ToInt32();
                //                hh.Update();

                //                #region 刷新当前页[抓取当页导航数字onclick事件]

                //                // 当前页
                //                // 翻页  dwzPageBreak({ targetType: targetType, rel: rel, data: { pageNum: event.data.pageNum} });
                //                //String JavaScript = "alert('" + Request["selectPage"] + "');";
                //                String JavaScript = " dwzPageBreak({ targetType: \"navTab\", rel: \"\", data: { pageNum: " + Request["selectPage"] + "},callback:ShowNote });";
                //                JSDo_UserCallBack_Success(JavaScript, "操作成功");

                //                #endregion 刷新当前页[抓取当页导航数字onclick事件]
                //            }
                //            else
                //            {
                //                JSDo_UserCallBack_Error("", "租售状态不一致");
                //            }
                //        }
                //}
                FullDropListData(typeof(h_State), this.ffrmStateID, "Name", "StateID", "");

                string OperType = Request.QueryString["OperTypes"];
                if (OperType != null)
                {
                    string HouseID = Request["HouseID"];
                    if (HouseID == null)
                    {
                        HouseID = "";
                    }
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    switch (OperType)
                    {
                    case "3":     //推见房源
                        s_SysParam ss  = s_SysParam.FindByParamCode("RecommendNum");
                        int        hrs = Convert.ToInt32(DbHelperSQL.GetSingle("select count(*) from h_Recommend where CONVERT(varchar,exe_date,112)=CONVERT(varchar,getdate(),112)"));
                        if (hrs < Convert.ToInt32(ss.Value))
                        {
                            DbHelperSQL.ExecuteSql(string.Format("update h_houseInfor set update_date=getdate() where HouseID = {0}", HouseID));
                            h_Recommend Hr = new h_Recommend();
                            Hr.EmployeeID = Employee.Current.EmployeeID;
                            Hr.HouseID    = Convert.ToDecimal(HouseID);
                            Hr.Insert();
                        }
                        else
                        {
                            sb.Append("{\r\n");
                            sb.Append("   \"statusCode\":\"300\", \r\n");
                            sb.Append("   \"message\":\"操作失败,您今天房源的推荐数已满请明天再试!\", \r\n");
                            sb.Append("   \"navTabId\":\"" + NavTabId + "\", \r\n");
                            sb.Append("   \"rel\":\"1\", \r\n");
                            sb.Append("   \"forwardUrl\":\"\"\r\n");
                            sb.Append("}\r\n");
                            Response.Write(sb.ToString());
                            Response.End();
                        }
                        break;

                    case "4":     //收藏房源
                        string sql = string.Format(@"if NOT EXISTS
                                                            (SELECT 1
                                                            FROM h_HouseCollect
                                                            WHERE HouseID={0}
                                                                    AND EmployeeID={1}) insert into h_HouseCollect(HouseID,EmployeeID) Values({0},{1})", HouseID, Employee.Current.EmployeeID);
                        DbHelperSQL.ExecuteSql(sql);
                        break;

                    case "5":     //取消收藏房源
                        h_HouseCollect houseCollect = h_HouseCollect.Find(new String[] { "HouseID", "EmployeeID" }, new Object[] { HouseID, Employee.Current.EmployeeID });
                        if (houseCollect != null)
                        {
                            houseCollect.Delete();
                        }
                        break;

                    case "6":     //查看钥匙
                        DataTable dt = DbHelperSQL.Query(string.Format(@"SELECT TOP 1 H.IsIn
                                                                                FROM h_HouseKey H
                                                                                WHERE H.HouseID ={0}
                                                                                        AND h.isDel=0
                                                                                ORDER BY  H.exe_date DESC",
                                                                       HouseID)).Tables[0];
                        sb.Append("{\r\n");
                        sb.Append("   \"statusCode\":\"200\", \r\n");
                        if (dt.Rows.Count > 0)
                        {
                            if (Convert.ToBoolean(dt.Rows[0][0]) == true)
                            {
                                sb.Append("   \"message\":\"该房源已经拿到钥匙\", \r\n");
                            }
                            else
                            {
                                sb.Append("   \"message\":\"该房源没有拿钥匙\", \r\n");
                            }
                        }
                        else
                        {
                            sb.Append("   \"message\":\"该房源没有拿钥匙\", \r\n");
                        }
                        sb.Append("}\r\n");
                        Response.Write(sb.ToString());
                        Response.End();
                        break;
                    }
                    sb.Append("{\r\n");
                    sb.Append("   \"statusCode\":\"200\", \r\n");
                    sb.Append("   \"message\":\"操作成功!\", \r\n");
                    sb.Append("}\r\n");
                    Response.Write(sb.ToString());
                    Response.End();
                }
                if (Request.QueryString["doType"] != null)
                {
                    if (Request.QueryString["doType"] == "del")
                    {
                        if (CheckRolePermission("删除房源"))
                        {
                            if (!String.IsNullOrEmpty(Request["hcids"]))
                            {
                                foreach (string s in Request["hcids"].Split(','))
                                {
                                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                                    H_houseinfor h = H_houseinfor.FindByHouseID(Convert.ToDecimal(s));
                                    if (h != null && CheckRolePermission("删除房源", h.OwnerEmployeeID.ToDecimal()))
                                    {
                                        //删除房源进入回收站
                                        h.DelType       = true;
                                        h.DelEmployeeID = Convert.ToInt32(Employee.Current.EmployeeID);
                                        h.DelDate       = System.DateTime.Now;
                                        h.Update();
                                    }
                                }
                            }
                            JSDo_UserCallBack_Success(" formFind();$(\".houseCheck:eq(0)\").submit();", "操作成功");
                        }
                        else
                        {
                            JSDo_UserCallBack_Success(" formFind();$(\".houseCheck:eq(0)\").submit();", "操作失败,您没有删除该房源的权限!");
                        }
                    }
                }
                if (Request.QueryString["StateID"] != null)
                {
                    if (!String.IsNullOrEmpty(Request["hcids"]))
                    {
                        foreach (string s in Request["hcids"].Split(','))
                        {
                            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                            H_houseinfor hh = H_houseinfor.FindByHouseID(Convert.ToDecimal(s));

                            if (H_houseinfor.Meta.Execute("exec dbo.h_update_HouseState " + Request.QueryString["StateID"] + ", " + hh.HouseID + ", " + Employee.Current.EmployeeID.ToString()) > 0)
                            {
                                string StateName = h_State.Find("StateID", Request.QueryString["StateID"]).Name;

                                #region 大积分添加处

                                //if (s_SysParam.FindByParamCode("UseBigPoint").Value == "1")
                                //{
                                //    //无效房源减分
                                //    if (StateName != "有效" && StateName != "我售")
                                //    {
                                //        I_IntegralLog.DeleteLog("添加房源积分", "h_houseinfor", hh.HouseID.ToString());
                                //    }
                                //    else
                                //    {
                                //        if (hh.SeeHouseType != "有效" && hh.SeeHouseType != "我售")
                                //        {
                                //            H_houseinfor.UpdateJF(hh.Sum_price, hh.OwnerEmployeeID, hh.HouseID, "添加房源积分");
                                //        }
                                //    }
                                //}

                                #endregion 大积分添加处

                                if (hh.Shi_id.IndexOf("KZ") > 0 || hh.Shi_id.IndexOf("MWZ") > 0)
                                {
                                }
                                else
                                {
                                    if (StateName == "重复")
                                    {
                                        if (hh.StateID.ToString() != Request.QueryString["StateID"].ToString())
                                        {
                                            TimeSpan ts = DateTime.Now - hh.Exe_date;
                                            if (ts.Days == 0)
                                            {
                                                e_Rewards er = new e_Rewards();
                                                er.AwardTypeID = 15;
                                                er.Cause       = "重复房源扣款暂存-房源号:" + hh.Shi_id;
                                                //e_SubGroupDetail es = e_SubGroupDetail.Find("OrgID", hh.OrgID);
                                                er.EmployeeID   = 0;
                                                er.OperID       = 2;
                                                er.OrgID        = hh.OrgID;
                                                er.Moneys       = 5;
                                                er.Rewards_Date = DateTime.Now;
                                                er.Active_Date  = DateTime.Now;
                                                er.Insert();
                                                e_Rewards ers = new e_Rewards();
                                                ers.AwardTypeID  = 15;
                                                ers.Cause        = "重复房源扣款-房源号:" + hh.Shi_id;
                                                ers.EmployeeID   = hh.OperatorID;
                                                ers.OperID       = 2;
                                                ers.OrgID        = hh.OrgID;
                                                ers.Moneys       = -5;
                                                ers.Rewards_Date = DateTime.Now;
                                                ers.Active_Date  = DateTime.Now;
                                                ers.Insert();
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (h_State.Find("StateID", hh.StateID).Name == "重复")
                                        {
                                            TimeSpan ts = DateTime.Now - hh.Exe_date;
                                            if (ts.Days == 0)
                                            {
                                                DataSet ds = e_Rewards.Meta.Query("select * from e_Rewards where Cause ='重复房源扣款暂存-房源号:" + hh.Shi_id + "'");
                                                if (ds.Tables[0].Rows.Count > 0)
                                                {
                                                    e_Rewards er = e_Rewards.Find("RewardsID", ds.Tables[0].Rows[0]["RewardsID"]);
                                                    if (er != null)
                                                    {
                                                        er.Delete();
                                                    }
                                                }
                                                DataSet dsa = e_Rewards.Meta.Query("select * from e_Rewards where Cause ='重复房源扣款-房源号:" + hh.Shi_id + "'");
                                                if (dsa.Tables[0].Rows.Count > 0)
                                                {
                                                    e_Rewards er = e_Rewards.Find("RewardsID", dsa.Tables[0].Rows[0]["RewardsID"]);
                                                    if (er != null)
                                                    {
                                                        er.Delete();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            H_houseinfor.Meta.Execute("update h_houseinfor set update_date=getdate() where HouseID=" + hh.HouseID);
                        }
                    }

                    //保存搜索条件再刷一次列表
                    //JSDo_UserCallBack_Success(" $(\".houseCheck:eq(0)\").submit();", "操作成功");

                    #region  刷列表,只刷新状态单元格

                    //h_State state = h_State.FindByStateID(Request.QueryString["StateID"].ToDecimal().Value);
                    //String JavaScript = "$(\"#check_" + Request.QueryString["HouseID"] + "\").html('"+state.Name+"');";
                    //JavaScript += "ReloadHouseCheck('" + Request.QueryString["HouseID"] + "')";
                    //JSDo_UserCallBack_Success(JavaScript, "操作成功");

                    #endregion  刷列表,只刷新状态单元格

                    #region 刷新当前页[抓取当页导航数字onclick事件]

                    // 当前页
                    // 翻页  dwzPageBreak({ targetType: targetType, rel: rel, data: { pageNum: event.data.pageNum} });
                    //String JavaScript = "alert('" + Request["selectPage"] + "');";
                    String JavaScript = " dwzPageBreak({ targetType: \"navTab\", rel: \"\", data: { pageNum: " + Request["selectPage"] + "} });";
                    JSDo_UserCallBack_Success(JavaScript, "操作成功");

                    #endregion 刷新当前页[抓取当页导航数字onclick事件]

                    //System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    //sb.Append("{\r\n");
                    //sb.Append("   \"statusCode\":\"200\", \r\n");
                    //sb.Append("   \"message\":\"操作成功!\", \r\n");
                    //sb.Append("   \"navTabId\":\"" + NavTabId + "\", \r\n");
                    //sb.Append("   \"rel\":\"1\", \r\n");
                    //sb.Append("   \"forwardUrl\":\"\"\r\n");
                    //sb.Append("}\r\n");
                    //Response.Write(sb.ToString());
                    //Response.End();
                }
            }
        }
Example #6
0
        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();
            }
        }
Example #7
0
        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);
        }