예제 #1
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("连接失败!请联系管理员");
                }
            }
        }
예제 #2
0
        protected override void OnPreInit(EventArgs e)
        {
            //保存
            if (Request.Form["doAjax"] == "true")
            {
                HttpWebRequest hwq = (HttpWebRequest)WebRequest.Create("http://120.27.150.137:8080/softswitch/internal/getDisplayNum.jsp?e164=" + Current.UserName);

                HttpWebResponse responseSorce = (HttpWebResponse)hwq.GetResponse();
                StreamReader    reader        = new StreamReader(responseSorce.GetResponseStream(), Encoding.UTF8);
                string          content       = reader.ReadToEnd();
                responseSorce.Close();
                responseSorce = null;
                reader        = null;

                CallBackMsg cm = JsonConvert.DeserializeObject <CallBackMsg>(content);
                if (cm.errcode != "0")
                {
                    ShowMsg(AlertType.error, "没有绑定隐号,请联系人事部绑定隐号");
                }
                else
                {
                    h_HouseTelList hTel = h_HouseTelList.FindByLSH(Convert.ToDecimal(Request.Form["LSH"]));
                    if (hTel != null)
                    {
                        string tel = hTel.TelDe;
                        if (!tel.IsNullOrWhiteSpace())
                        {
                            i_InternetPhone ip = i_InternetPhone.Find("toTel='" + tel + "' and CONVERT(varchar,createTime,112)='" + DateTime.Now.ToString("yyyyMMdd") + "'");
                            if (ip == null)
                            {
                                ShowMsg(AlertType.error, "请先拨打电话后再发送短信");
                            }
                            else
                            {
                                List <e_SmsLog> listSMS = e_SmsLog.FindAll("select * from e_SmsLog where phone='" + tel + "' and CONVERT(varchar,datetime,112)='" + DateTime.Now.ToString("yyyyMMdd") + "'");
                                if (listSMS.Count > 5)
                                {
                                    ShowMsg(AlertType.error, "该房东今天已发送5次短信,请明天再试");
                                }
                                else
                                {
                                    if (listSMS.Count(x => x.Phone == Current.UserName && x.Datetime.ToShortDateString() == DateTime.Now.ToShortDateString()) > 0)
                                    {
                                        ShowMsg(AlertType.error, "你今天已经给该房东发送过信息,请明天再试");
                                    }
                                    else
                                    {
                                        string txtMsg = Request.Form["txtMsg"];
                                        txtMsg += ",请回电:" + cm.displayNum + ",回T退订【" + (Current.OrgName.Contains("易房") ? "易房网房产" : "中山房产") + "】";
                                        string errMsg = e_SmsLog.SendSMS(Employee.Current.EmployeeID, tel, txtMsg, hTel.HouseID, hTel.LSH);

                                        ShowMsg(AlertType.info, errMsg);
                                    }
                                }
                            }
                        }
                        else
                        {
                            ShowMsg(AlertType.error, "电话号码错误");
                        }
                    }
                }
            }
        }
예제 #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string          telFrom = string.Empty;
            string          telTo   = string.Empty;
            string          result  = string.Empty;
            decimal         houseID = 0;
            i_InternetPhone iip     = new i_InternetPhone();

            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");
                return;
            }
            //房源电话拨打
            else if (context.Request.QueryString["LSH"] != null)
            {
                int ii = i_InternetTel.FindCount(new string[] { "EmployeeID", "IsDel" }, new string[] { Employee.Current.EmployeeID.ToString(), "0" });
                if (ii > 0)
                {
                    iip.RecrodType = 1;
                    h_HouseTelList hh = h_HouseTelList.FindByKey(context.Request.QueryString["LSH"]);
                    houseID = hh.HouseID;
                    telTo   = hh.Tel2.TelDecrypt((Int32)hh.HouseID, TelDecPoint.PC_HouseForm_TelPhone);
                    if (context.Request.QueryString["mytel"] != null)
                    {
                        telFrom = context.Request.QueryString["mytel"].ToString();
                    }
                    else
                    {
                        telFrom = i_InternetTel.Find("EmployeeID=" + Employee.Current.EmployeeID + " and IsDel=0").MyTel;
                    }
                }
                else
                {
                    context.Response.Write("1," + Employee.Current.EmployeeID.ToString());
                    return;
                }
            }
            //装修拨打买家电话
            else if (context.Request.QueryString["bTel"] != null)
            {
                int ii = i_InternetTel.FindCount(new string[] { "EmployeeID", "IsDel" }, new string[] { Employee.Current.EmployeeID.ToString(), "0" });
                if (ii > 0)
                {
                    iip.RecrodType = 5;
                    telTo          = context.Request.QueryString["bTel"];
                    houseID        = Convert.ToDecimal(context.Request.QueryString["HouseID"]);
                    if (context.Request.QueryString["mytel"] != null)
                    {
                        telFrom = context.Request.QueryString["mytel"].ToString();
                    }
                    else
                    {
                        telFrom = i_InternetTel.Find("EmployeeID=" + Employee.Current.EmployeeID + " and IsDel=0").MyTel;
                    }
                }
                else
                {
                    context.Response.Write("1," + Employee.Current.EmployeeID.ToString());
                    return;
                }
            }
            //员工通讯录拨打
            else if (context.Request.QueryString["EmpTelFrom"] != null && context.Request.QueryString["EmpTelTo"] != null)
            {
                iip.RecrodType = 4;
                telFrom        = context.Request.QueryString["EmpTelFrom"];
                telTo          = context.Request.QueryString["EmpTelTo"];
                houseID        = 0;
            }

            iip.employeeID   = Employee.Current.EmployeeID;
            iip.houseID      = houseID;
            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       = 0;
            iip.CallSystem   = 0;

            iip.Insert();

            InterPhoneCall ip = new InterPhoneCall();

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

            //是否大众员工
            if (Employee.Current.MyTopOrgA.OrgID == 1062)
            {
                cbm = ip.Call_Mobile(telFrom, telTo, iip.phoneID.ToString(), 1);
            }
            else
            {
                cbm = ip.Call_Mobile(telFrom, telTo, iip.phoneID.ToString());
            }

            iip.callSid = cbm.taskId;
            iip.Update();
            result = cbm.errcode;

            if (result == "0")
            {
                context.Response.Write("连接成功!连接手机号:" + telFrom);
            }
            else
            {
                context.Response.Write("连接失败!请联系人事-检查是否绑定隐号!");
            }
        }
예제 #4
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);
        }