コード例 #1
0
ファイル: CallTel_mobile.ashx.cs プロジェクト: gcenss/ERP
        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("连接失败!请联系人事-检查是否绑定隐号!");
            }
        }
コード例 #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("连接失败!请联系管理员");
                }
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.HTFpagerForm.ID += House.HouseID;

                #region 1.显示 [查看电话] 按钮

                if (!IsShowTel) //如果不显示电话
                {
                    //判断调电权限
                    //if (H_houseinfor.NeedTelPower(Convert.ToDecimal(Request["HouseID"]), Convert.ToInt32(Employee.Current.EmployeeID)))
                    //{
                    //    LokTelButa.Visible = IsCanShowTel;
                    //}
                    //if (LokTelButa.Visible == true)
                    //{
                    //    LokTelButa.Attributes.Add("onclick", "return LookTelClick('" + House.HouseID + "')");
                    //}
                }
                else
                {
                    //LokTelButa.Visible = false;

                    #region 插入调电记录

                    if (CheckRolePermission("不隐号") || IsCanShowTel)
                    {
                        h_SeeTelLog hs = new h_SeeTelLog();
                        hs.EmployeeID = Employee.Current.EmployeeID;
                        hs.HouseID    = Convert.ToDecimal(HouseID.Value);
                        hs.IsPower    = H_houseinfor.NeedTelPower(House.HouseID, Employee.Current.EmployeeID.ToString().ToInt32());
                        hs.Insert();
                    }

                    #endregion 插入调电记录

                    //显示室号
                    room.Value = House.Build_room;
                }
                cbTel.DataSource     = i_InternetTel.FindAll(new string[] { "EmployeeID", "IsDel" }, new string[] { Employee.Current.EmployeeID.ToString(), "0" });
                cbTel.DataTextField  = "MyTel";
                cbTel.DataValueField = "MyTel";
                cbTel.DataBind();
                #endregion 1.显示 [查看电话] 按钮
            }

            if (Request.Form["LSH"] != null && Request.Form["LSH"] != "")
            {
                #region 编辑电话

                h_HouseTelList hh = h_HouseTelList.Find("LSH", Request.Form["LSH"]);
                hh.EmployeeID = Employee.Current.EmployeeID;
                if (Request.Form["HouseID"] != "0")
                {
                    hh.HouseID = Convert.ToDecimal(Request.Form["HouseID"]);
                }
                else
                {
                    hh.HouseID = 0;
                    hh.GU_ID   = Request.Form["GU_ID"].ToString();
                }
                hh.landlord_name = Request.Form["frmName"].ToString();
                hh.Tel1          = H_houseinfor.TelDispose(Request.Form["Tel"]);
                string oldTel = hh.Tel2;
                hh.Tel2    = Request.Form["Tel"].TelEncrypt();
                hh.TelType = Request.Form["TelType"].ToString();
                hh.Update();

                #region 插入跟进

                h_FollowUp hfo = new h_FollowUp();
                hfo.HouseID      = hh.HouseID;
                hfo.EmployeeID   = Employee.Current.EmployeeID;
                hfo.FollowUpText = "电话修改";
                hfo.Insert();

                #endregion 插入跟进

                #region 电话修改记录

                TelChange tc = new TelChange();
                tc.AddEmployeeID = Employee.Current.EmployeeID;
                tc.HouseID       = hh.HouseID;
                tc.NewTel        = Request.Form["Tel"];
                tc.OldTel        = oldTel.TelDecrypt((Int32)hh.HouseID, 0);
                tc.Insert();
                LSH.Value = "";

                #endregion 电话修改记录

                #endregion 编辑电话
            }
            else if (Request.Form["frmName"] != null && Request.Form["frmName"] != "")
            {
                #region 添加电话

                h_HouseTelList hh = new h_HouseTelList();
                hh.EmployeeID = Employee.Current.EmployeeID;
                if (Request.Form["HouseID"] != "0")
                {
                    hh.HouseID = Convert.ToDecimal(Request.Form["HouseID"]);
                }
                else
                {
                    hh.HouseID = 0;
                    hh.GU_ID   = Request.Form["GU_ID"].ToString();
                }
                hh.landlord_name = Request.Form["frmName"].ToString();
                hh.Tel1          = H_houseinfor.TelDispose(Request.Form["Tel"]);
                hh.Tel2          = Request.Form["Tel"].TelEncrypt();
                hh.TelType       = Request.Form["TelType"].ToString();
                hh.Insert();
                if (hh.HouseID > 0)
                {
                    h_FollowUp hfo = new h_FollowUp();
                    hfo.HouseID      = hh.HouseID;
                    hfo.EmployeeID   = Employee.Current.EmployeeID;
                    hfo.FollowUpText = "添加新电话,编号:" + hh.LSH;
                    hfo.Insert();
                }

                #endregion 添加电话

                Response.Write("<script>alertMsg.correct(\"操作成功请点调电拨打电话!\");</script>");
            }
            if (!CheckRolePermission("不隐号"))
            {
                //if (!CheckRolePermission("添加电话", Convert.ToDecimal(House.OwnerEmployeeID)))
                //hTelAdd.Visible = false;
            }
            else
            {
                if (CheckRolePermission("不隐号"))
                {
                    h_SeeTelLog hs = new h_SeeTelLog();
                    hs.EmployeeID = Employee.Current.EmployeeID;
                    hs.HouseID    = Convert.ToDecimal(HouseID.Value);
                    hs.IsPower    = false;
                    hs.Insert();
                }
            }
        }