コード例 #1
0
        //获取PRI中继
        private Dictionary<DB_Talk.Model.m_PRIInterface, DB_Talk.Model.m_PRIInterface> GetLstPRIInterface()
        {
            Dictionary<DB_Talk.Model.m_PRIInterface, DB_Talk.Model.m_PRIInterface> dic = new Dictionary<DB_Talk.Model.m_PRIInterface, DB_Talk.Model.m_PRIInterface>();
            List<DB_Talk.Model.m_PRIInterface> lst = new List<DB_Talk.Model.m_PRIInterface>();
            for (int i = 0; i < this.dgvPRI.Rows.Count; i++)
            {
                DB_Talk.Model.m_PRIInterface model = new DB_Talk.Model.m_PRIInterface();
                DB_Talk.Model.m_PRIInterface modelTag = dgvPRI.Rows[i].Tag as DB_Talk.Model.m_PRIInterface;
                if (modelTag != null)
                    model.ID = modelTag.ID;
                //PRI索引
                if (dgvPRI.Rows[i].Cells["colPRIID"].Value == null || dgvPRI.Rows[i].Cells["colPRIID"].Value.ToString() == "")
                    throw new Exception("PRI编号不能为空!");
                int num = 0;
                if (dgvPRI.Rows[i].Cells["colPRIID"].Value != null && int.TryParse(dgvPRI.Rows[i].Cells["colPRIID"].Value.ToString(), out num) && num > 0 && num <= 32)
                    model.PRIID = num;
                else
                    throw new Exception("PRI中继编号取值范围为1~32");  //实际是1-32
                List<DB_Talk.Model.m_PRIInterface> lstTemp = new DB_Talk.BLL.m_PRIInterface().GetModelList(
                   string.Format("i_Flag=0 and BoxID={0} and PRIID={1} ", Global.Params.BoxID, model.PRIID));
                if (lstTemp.Count > 0 && model.ID != lstTemp[0].ID)
                    throw new Exception("PRI中继编号【" + model.PRIID + "】已经存在");

                #region 市话长途判断


                bool sh = !(dgvPRI.Rows[i].Cells["colPriOutSub"].Value == null || dgvPRI.Rows[i].Cells["colPriOutSub"].Value.ToString() == "");
                bool ct = !(dgvPRI.Rows[i].Cells["colPriOut"].Value == null || dgvPRI.Rows[i].Cells["colPriOut"].Value.ToString() == "");

                if (sh == false && ct == false)
                {
                    throw new Exception("市话出局号码前缀和长途出局号码前缀必须要填写一个!");
                }
                if (sh == true)
                {
                    ////市话出局引导码
                    //if (dgvPRI.Rows[i].Cells["colPriOutSub"].Value == null || dgvPRI.Rows[i].Cells["colPriOutSub"].Value.ToString() == "")
                    //    throw new Exception("市话出局号码前缀不能为空!");
                    string strOutLocal = dgvPRI.Rows[i].Cells["colPriOutSub"].Value.ToString();
                    string[] strArrayLocal = strOutLocal.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string str in strArrayLocal)
                    {
                        num = 0;
                        if (!int.TryParse(str, out num))
                            throw new Exception("市话出局号码前缀格式错误!必须是以英文逗号隔开的数字!");
                    }
                    model.vc_OutNumberLocal = strOutLocal;
                }
                if ( ct == true)
                {
                    ////长途出局引导码
                    //if (dgvPRI.Rows[i].Cells["colPriOut"].Value == null || dgvPRI.Rows[i].Cells["colPriOut"].Value.ToString() == "")
                    //    throw new Exception("长途出局号码前缀不能为空!");
                    string strOut = dgvPRI.Rows[i].Cells["colPriOut"].Value.ToString();
                    string[] strArray = strOut.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string str in strArray)
                    {
                        num = 0;
                        if (!int.TryParse(str, out num))
                            throw new Exception("长途出局号码前缀格式错误!必须是以英文逗号隔开的数字!");
                    }
                    model.vc_OutNumber = strOut;
                }
                #endregion

                string mes = "";
                if (model.vc_OutNumberLocal != null && model.vc_OutNumber != null)
                {
                    if (Global.Methods.checkNumOutIsSame(model.vc_OutNumberLocal, model.vc_OutNumber, out mes))
                    {
                        throw new Exception("市话与长途出局号码前缀有重复号码【" + mes + "】!");
                    }
                }

                //E1端口号
                if (dgvPRI.Rows[i].Cells["colE1Number"].Value == null || dgvPRI.Rows[i].Cells["colE1Number"].Value.ToString() == "")
                    throw new Exception("E1端口号不能为空!");
                num = 0;
                if (dgvPRI.Rows[i].Cells["colE1Number"].Value != null && int.TryParse(dgvPRI.Rows[i].Cells["colE1Number"].Value.ToString(), out num) && num >= 1 && num <= E1Max)
                    model.i_E1Port = num;  
                else
                    throw new Exception("E1端口号取值范围为1~" + E1Max);
                List<DB_Talk.Model.m_PRIInterface> lstTempE1 = new DB_Talk.BLL.m_PRIInterface().GetModelList(
                  string.Format("i_Flag=0 and BoxID={0} and i_E1Port={1} ", Global.Params.BoxID, model.i_E1Port));
                if (lstTempE1.Count > 0 && model.ID != lstTempE1[0].ID)
                    throw new Exception("E1端口号【" + model.i_E1Port + "】已经存在");
                //LinkID
                if (dgvPRI.Rows[i].Cells["colPriLinkID"].Value == null || dgvPRI.Rows[i].Cells["colPriLinkID"].Value.ToString() == "")
                    throw new Exception("LinkID不能为空!");
                num = 0;
                if (dgvPRI.Rows[i].Cells["colPriLinkID"].Value != null && int.TryParse(dgvPRI.Rows[i].Cells["colPriLinkID"].Value.ToString(), out num) && num >= 1 && num <= 16)
                    model.i_LinkID = num;  
                else
                    throw new Exception("LinkID取值范围为1~16");
                
                //交换机类型1: unknown(1) 2: avaya(2)3: nortel(3)4: alcatel(4) 5: siemens(5) 6: oulian(6)7: shenou(7) 8: utstarcom(8) 9: microxel(9)
                if (dgvPRI.Rows[i].Cells["colSwitchType"].Value.ToString() == "")
                    throw new Exception("交换机类型不能为空");
                model.i_SwitchType = dgvPRI.Rows[i].Cells["colSwitchType"].Value.ToString() == "Hitotek" ? 9 : 1;
                //用户侧:1,网络侧:2,默认1
                if (dgvPRI.Rows[i].Cells["colUNIType"].Value.ToString() == "")
                    throw new Exception("信令信道UNI类型不能为空");
                model.i_UNIType = dgvPRI.Rows[i].Cells["colUNIType"].Value.ToString() == "用户侧" ? 1 : 2; 
                model.i_Type = 2;         //接口类型,内部(1),外部(2),默认外部
                model.i_Level = 1;        //优先级,主(1),从(2),默认主
                model.i_LinkType = 1;     //链路类型 E1(1),T1(2)
                model.i_State = 2;  //激活
                model.i_Operate = 1; //up(2)运行 down(1)停止
                model.BoxID = Global.Params.BoxID;

                if (modelTag != null &&
                    modelTag.PRIID == model.PRIID &&
                    modelTag.vc_OutNumber == model.vc_OutNumber &&
                    modelTag.BoxID == model.BoxID &&
                    modelTag.i_E1Port == model.i_E1Port &&
                    modelTag.i_LinkID == model.i_LinkID &&
                    modelTag.i_SwitchType == model.i_SwitchType &&
                    modelTag.i_UNIType == model.i_UNIType)
                {
                    modelTag = null;  //没有变化,则什么都不做
                    continue;
                }
                lst.Add(model);
                dic.Add(model, modelTag);
            }
            return dic;
        }
コード例 #2
0
        private void Loaddata(int dgvNum) //0全部加载,1只刷新SIP,2只刷新PRI
        {
            if (dgvNum == 0 || dgvNum == 1)  
            {
                List<DB_Talk.Model.m_SIPInterface> lstSip = new List<DB_Talk.Model.m_SIPInterface>();
                string strWhere = string.Format("i_Flag=0 and BoxID='{0}' order by SIPID", Global.Params.BoxID);
                lstSip = new DB_Talk.BLL.m_SIPInterface().GetModelList(strWhere);
                dgvSIP.Rows.Clear();
                Global.Params.frmMain.getStateSipPri.lstPreSip = lstSip;
                //获取sip状态
                //GetSipState(ref lstSip);
                for (int i = 0; i < lstSip.Count; i++)
                {
                    dgvSIP.Rows[dgvSIP.Rows.Add(lstSip[i].ID,
                                     lstSip[i].SIPID,
                                     lstSip[i].vc_OutNumberLocal,
                                     lstSip[i].vc_OutNumber,
                                     lstSip[i].i_Port,
                                     lstSip[i].vc_OppositeIP,
                                     lstSip[i].i_OppositePort,
                                     lstSip[i].i_PlaySound == 1 ? "是" : "否",  // //是否放音,是(1),否(2),默认1
                                     lstSip[i].i_State == 2 ? "激活" : "未激活",        //unconfigured(0) 2: deactive(1) 3: active(2) 4: deactivePending(3)
                                     lstSip[i].i_OperateState == 2 ? "运行" : "停止"  //up(2) down(1)
                                    )].Tag = lstSip[i];
                    dgvSIP.Rows[i].ReadOnly = true;

                }
                dgvSIP.ClearSelection();

            }
            if (dgvNum == 0 || dgvNum == 2)
            {
                List<DB_Talk.Model.m_PRIInterface> lstPri = new List<DB_Talk.Model.m_PRIInterface>();
                string strWherePri = string.Format("i_Flag=0 and BoxID='{0}' order by PRIID", Global.Params.BoxID);
                lstPri = new DB_Talk.BLL.m_PRIInterface().GetModelList(strWherePri);
                dgvPRI.Rows.Clear();
                Global.Params.frmMain.getStateSipPri.lstPrePri = lstPri;
                //获取pri状态
                //GetPriState(ref lstPri);
                for (int i = 0; i < lstPri.Count; i++)
                {

                    dgvPRI.Rows[dgvPRI.Rows.Add(lstPri[i].ID,
                                     lstPri[i].PRIID,
                                     lstPri[i].vc_OutNumberLocal,
                                     lstPri[i].vc_OutNumber,
                                     lstPri[i].i_E1Port,
                                     lstPri[i].i_LinkID,
                                     lstPri[i].i_SwitchType == 9 ? "Hitotek" : "其他",    //交换机类型1: unknown(1) 2: avaya(2)3: nortel(3)4: alcatel(4) 5: siemens(5) 6: oulian(6)7: shenou(7) 8: utstarcom(8) 9: microxel(9)
                                     lstPri[i].i_UNIType == 1 ? "用户侧" : "网络侧",  // 信令信道UNI类型 //用户侧:1,网络侧:2,默认1
                                     lstPri[i].i_State == 2 ? "激活" : "未激活",        //unconfigured(0) 2: deactive(1) 3: active(2) 4: deactivePending(3)
                                     lstPri[i].i_Operate == 2 ? "运行" : "停止"    //up(2)运行 down(1)停止
                                    )].Tag = lstPri[i];
                   
                    dgvPRI.Rows[i].ReadOnly = true;
                }
                dgvPRI.ClearSelection();
            }
        }
コード例 #3
0
        //同步数据库数据 PRI SIP中继
        public static void UpdateDBSIPPRI()
        {
            try
            {
                //CommControl.Tools.WriteLog.AppendLog("同步SipPri ,boxID:" + Global.Params.BoxID.ToString());
                //同步路由组信息
                List<DB_Talk.Model.m_RouteGroup> lstRGroup = new List<DB_Talk.Model.m_RouteGroup>();
                QueryRouteGroup(out lstRGroup);
                new DB_Talk.BLL.m_RouteGroup().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
                foreach (DB_Talk.Model.m_RouteGroup m in lstRGroup)
                {
                    new DB_Talk.BLL.m_RouteGroup().Add(m);
                }
                //同步路由
                List<DB_Talk.Model.m_Route> lstRoute = new List<DB_Talk.Model.m_Route>();
                QueryRoute(out lstRoute);
                new DB_Talk.BLL.m_Route().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
                foreach (DB_Talk.Model.m_Route m in lstRoute)
                {
                    new DB_Talk.BLL.m_Route().Add(m);
                }

                //同步SAP接入点
                List<DB_Talk.Model.m_SAPPoint> lstSAPPoint = new List<DB_Talk.Model.m_SAPPoint>();
                GetSipSap(out lstSAPPoint);
                new DB_Talk.BLL.m_SAPPoint().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
                foreach (DB_Talk.Model.m_SAPPoint m in lstSAPPoint)
                {
                    new DB_Talk.BLL.m_SAPPoint().Add(m);
                }

                //同步被叫规则
                UpdateDB_CallRule();

                //同步SIP中继
                List<DB_Talk.Model.m_SIPInterface> lstSIPInterface = new List<DB_Talk.Model.m_SIPInterface>();
                GetSipTrunk(out lstSIPInterface);
                if (lstSIPInterface.Count == 0)
                    new DB_Talk.BLL.m_SIPInterface().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));


                foreach (DB_Talk.Model.m_SIPInterface m in lstSIPInterface)
                {
                    //m.vc_OutNumber = getCalledNumbers(MBoxSDK.ConfigSDK.CALLED_RULE_TYPE.出局, " and i_SIPID='" + m.SIPID + "'");
                    DB_Talk.Model.m_SIPInterface sip = new DB_Talk.BLL.m_SIPInterface().GetModel(
                                  string.Format("i_Flag=0 and BoxID={0} and SIPID='{1}'", Global.Params.BoxID, m.SIPID));
                    if (sip != null)
                    {
                        m.vc_OutNumber = sip.vc_OutNumber;
                        m.vc_OutNumberLocal = sip.vc_OutNumberLocal;
                        m.i_Port = sip.i_Port;
                      //  m.i_OperateState = sip.i_OperateState;
                     //   m.i_State = sip.i_State;

                        new DB_Talk.BLL.m_SIPInterface().Delete(string.Format("i_Flag=0 and BoxID={0} and SIPID='{1}'", Global.Params.BoxID, m.SIPID));
                        new DB_Talk.BLL.m_SIPInterface().Add(m);
                    }
                    else
                        DeleteSIP(m);
                }
                /*
                //同步承载信道
                List<DB_Talk.Model.m_PRIChannel> lstPRIChannel = new List<DB_Talk.Model.m_PRIChannel>();
                GetT1Channels(out lstPRIChannel);
                new DB_Talk.BLL.m_SAPPoint().Delete("");
                foreach (DB_Talk.Model.m_PRIChannel m in lstPRIChannel)
                {
                    new DB_Talk.BLL.m_PRIChannel().Add(m);
                }

                //同步信令信道
                List<DB_Talk.Model.m_PRISigLink> lstPRISigLink = new List<DB_Talk.Model.m_PRISigLink>();
                GetSigChannel(out lstPRISigLink);
                new DB_Talk.BLL.m_PRISigLink().Delete("");
                foreach (DB_Talk.Model.m_PRISigLink m in lstPRISigLink)
                {
                    new DB_Talk.BLL.m_PRISigLink().Add(m);
                }
                */
                //同步PRI中继
                List<DB_Talk.Model.m_PRIInterface> lstPRIInterface = new List<DB_Talk.Model.m_PRIInterface>();
                GetPriTrunk(out lstPRIInterface);
                if (lstPRIInterface.Count == 0)
                    new DB_Talk.BLL.m_PRIInterface().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
                foreach (DB_Talk.Model.m_PRIInterface m in lstPRIInterface)
                {
                    //m.vc_OutNumber = getCalledNumbers(MBoxSDK.ConfigSDK.CALLED_RULE_TYPE.出局, " and i_SIPID='" + m.SIPID + "'");
                    DB_Talk.Model.m_PRIInterface pri = new DB_Talk.BLL.m_PRIInterface().GetModel(
                                  string.Format("i_Flag=0 and BoxID={0} and PRIID='{1}'", Global.Params.BoxID, m.PRIID));
                    if (pri != null)
                    {
                        m.vc_OutNumber = pri.vc_OutNumber;
                        m.vc_OutNumberLocal = pri.vc_OutNumberLocal;
                        m.i_E1Port = pri.i_E1Port;
                        m.i_LinkID = pri.i_LinkID;
                        m.i_UNIType = pri.i_UNIType;
                      //  m.i_Operate = pri.i_Operate;
                      //  m.i_State = pri.i_State;
                        new DB_Talk.BLL.m_PRIInterface().Delete(string.Format("i_Flag=0 and BoxID={0} and PRIID='{1}'", Global.Params.BoxID, m.PRIID));
                        new DB_Talk.BLL.m_PRIInterface().Add(m);
                    }
                    else
                        DeletePRI(m);
                }

            }
            catch (Exception ex)
            {
                CommControl.Tools.WriteLog.AppendErrorLog(ex);
            }
            

        }
コード例 #4
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (dgvList.CurrentRow != null)
            {
                bool delete = false;
                Bestway.Windows.Forms.ProgressBarDialog procDlg = new Bestway.Windows.Forms.ProgressBarDialog();
                try
                {
                    DB_Talk.Model.m_CalledRule model = dgvList.CurrentRow.Tag as DB_Talk.Model.m_CalledRule;
                    if (model != null)
                    {
                        CheckDeleteCondition(model);
                        List<DB_Talk.Model.m_Member> lstMember=new DB_Talk.BLL.m_Member().GetModelList(
                           string.Format(" i_Flag=0 and i_Number like '{0}%' and BoxID='{1}' ", model.vc_CalledNumber, Global.Params.BoxID));
                          // string.Format(" i_Flag=0 and i_Number like '{0}%' and BoxID='{1}' and i_IsDispatch!=1", model.vc_CalledNumber, Global.Params.BoxID));

                        if (lstMember.Count > 0)
                        {
                            CommControl.MessageBoxEx.MessageBoxEx.Show("用户号码中引用了此呼叫规则,不允许删除,要想删除,请先删除用户号码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        procDlg.Show(Bestway.Windows.Forms.EnumDisplayType.LoadData, "      正在删除被叫规则【" + model.vc_CalledNumber + "】,请稍等...");
                        List<DB_Talk.Model.m_CalledRule> lstAdd = new List<DB_Talk.Model.m_CalledRule>();
                        List<DB_Talk.Model.m_CalledRule> lstDelete = new List<DB_Talk.Model.m_CalledRule>();
                        lstDelete.Add(model);
                        DB_Talk.Model.m_SIPInterface modelSip = null;
                        DB_Talk.Model.m_PRIInterface modelPri = null;

                        if (model.i_SIPID > 0)
                            modelSip = new DB_Talk.BLL.m_SIPInterface().GetModel(
                                 string.Format(" i_Flag=0 and SIPID='{0}' and BoxID='{1}'", model.i_SIPID, Global.Params.BoxID));
                        if (modelSip != null)
                        {
                            List<DB_Talk.Model.m_CalledRule> lstm = new DB_Talk.BLL.m_CalledRule().GetModelList(
                               string.Format(" i_Flag=0 and i_SIPID='{0}' and BoxID='{1}' and ID!='{2}'",
                               model.i_SIPID, Global.Params.BoxID, model.ID));
                            if (lstm.Count > 0)  //只删除呼叫规则(还存在引用此中继的呼叫规则)
                            {
                                if (Tools.MBoxOperate.Delete_Rule(lstAdd, lstDelete))
                                {
                                    delete = true;
                                    if (model.i_CalledSubType == MBoxSDK.ConfigSDK.CALLED_SUB_RULE_TYPE.市话.GetHashCode())
                                    {
                                        modelSip.vc_OutNumberLocal = modelSip.vc_OutNumberLocal.Replace(model.vc_CalledNumber, "").Replace(",,",",").Trim(','); ;
                                    }
                                    else if (model.i_CalledSubType == MBoxSDK.ConfigSDK.CALLED_SUB_RULE_TYPE.长途.GetHashCode())
                                    {
                                        modelSip.vc_OutNumber = modelSip.vc_OutNumber.Replace(model.vc_CalledNumber, "").Replace(",,", ",").Trim(','); ;
                                    }
                                     new DB_Talk.BLL.m_SIPInterface().Update(modelSip);
                                }
                            }
                            else  //连中继一起删除
                            {
                                if (Tools.MBoxOperate.DeleteSIP(modelSip, lstAdd, lstDelete) && new DB_Talk.BLL.m_SIPInterface().Delete(modelSip.ID))
                                {
                                    delete = true;
                                }
                            }
                        }

                        if (model.i_PRIID > 0)
                            modelPri = new DB_Talk.BLL.m_PRIInterface().GetModel(
                                 string.Format(" i_Flag=0 and PRIID='{0}' and BoxID='{1}'", model.i_PRIID, Global.Params.BoxID));

                        if (modelPri != null)
                        {
                            List<DB_Talk.Model.m_CalledRule> lstm = new DB_Talk.BLL.m_CalledRule().GetModelList(
                                string.Format(" i_Flag=0 and i_PRIID='{0}' and BoxID='{1}' and ID!='{2}'",
                                model.i_PRIID, Global.Params.BoxID, model.ID));
                            if (lstm.Count > 0 && Tools.MBoxOperate.Delete_Rule(lstAdd, lstDelete))  //只删除呼叫规则
                            {
                                if (model.i_CalledSubType == MBoxSDK.ConfigSDK.CALLED_SUB_RULE_TYPE.市话.GetHashCode())
                                {
                                    //modelPri.vc_OutNumberLocal = modelPri.vc_OutNumberLocal.Replace(model.vc_CalledNumber, "").Replace(",,", ",").Trim(',');
                                    modelPri.vc_OutNumberLocal = ReplaceString(modelPri.vc_OutNumberLocal, model.vc_CalledNumber);
                                }
                                else if (model.i_CalledSubType == MBoxSDK.ConfigSDK.CALLED_SUB_RULE_TYPE.长途.GetHashCode())
                                {
                                   // modelPri.vc_OutNumber = modelPri.vc_OutNumber.Replace(model.vc_CalledNumber, "").Replace(",,", ",").Trim(',');
                                    modelPri.vc_OutNumber = ReplaceString(modelPri.vc_OutNumber, model.vc_CalledNumber);
                                }
                                 new DB_Talk.BLL.m_PRIInterface().Update(modelPri);
                                delete = true;
                            }
                            else  //连中继一起删除
                            {
                                if (Tools.MBoxOperate.DeletePRI(modelPri, lstAdd, lstDelete) && new DB_Talk.BLL.m_PRIInterface().Delete(modelPri.ID))
                                {
                                    delete = true;
                                }
                            }
                        }

                        if (modelSip == null && modelPri == null)  //删除的入局规则
                        {

                            if (Tools.MBoxOperate.Delete_Rule(lstAdd, lstDelete))
                            {
                                DB_Talk.Model.m_Box BoxModel = new DB_Talk.BLL.m_Box().GetModel(Global.Params.BoxID);
                                if (BoxModel != null && BoxModel.vc_NumberHead!=null)  
                                {

                                    BoxModel.vc_NumberHead = BoxModel.vc_NumberHead.Replace(lstDelete[0].vc_CalledNumber, "").Replace(",,", ",").Trim(',');
                                    
                                    new DB_Talk.BLL.m_Box().Update(BoxModel);
                                }
                                delete = true;
                            }
                        }
                    }
                    else  //还未添加 直接删除
                        delete = true;


                    if (delete)
                    {
                        MBoxSDK.ConfigSDK.MBOX_SaveHaveDoneCfg(Global.Params.BoxHandle);
                        procDlg.Hide();
                        Loaddata();
                        //dgvList.Rows.Remove(dgvList.CurrentRow);
                        CommControl.MessageBoxEx.MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    }
                    else
                    {
                        procDlg.Hide();
                        CommControl.MessageBoxEx.MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    }
                }
                catch (Exception ex)
                {
                    procDlg.Hide();
                    CommControl.MessageBoxEx.MessageBoxEx.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    //CommControl.Tools.WriteLog.AppendErrorLog(ex);
                }
                finally
                {
                    procDlg.Dispose();
                }
            }
            else
            {
                CommControl.MessageBoxEx.MessageBoxEx.Show("请选择要删除的呼叫规则!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
コード例 #5
0
        private void Add()
        {
            if (_BLL.GetModelList(string.Format(" i_flag=0 and  vc_CalledNumber='{0}'", _mModel.vc_CalledNumber)).Count > 0)
            {
                CommControl.MessageBoxEx.MessageBoxEx.Show(string.Format("被叫号码【{0}】已存在!", _mModel.vc_CalledNumber), "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                txtNumber.Focus();
                throw new Exception("");
            }

            if (Tools.MBoxOperate.CreateCalledRule(_mModel) && _BLL.Add(_mModel) == 1)
            {
                if (_mModel.i_CalledType == MBoxSDK.ConfigSDK.CALLED_RULE_TYPE.入局.GetHashCode())
                {
                    DB_Talk.Model.m_Box modelBox = new DB_Talk.BLL.m_Box().GetModel(
                               string.Format(" i_Flag=0 and ID='{0}'", Global.Params.BoxID));

                    modelBox.vc_NumberHead = modelBox.vc_NumberHead + "," + _mModel.vc_CalledNumber;
                    modelBox.vc_NumberHead = modelBox.vc_NumberHead.Replace(",,", ",").Trim(',');
                    new DB_Talk.BLL.m_Box().Update(modelBox);
                }
                 
                if (_mModel.i_SIPID > 0)
                {
                    DB_Talk.Model.m_SIPInterface modelSip = new DB_Talk.BLL.m_SIPInterface().GetModel(
                             string.Format(" i_Flag=0 and SIPID='{0}' and BoxID='{1}'", _mModel.i_SIPID, Global.Params.BoxID));
                 
                    if(_mModel.i_CalledSubType==MBoxSDK.ConfigSDK.CALLED_SUB_RULE_TYPE.市话.GetHashCode())
                    {
                        modelSip.vc_OutNumberLocal = modelSip.vc_OutNumberLocal + "," + _mModel.vc_CalledNumber;
                        modelSip.vc_OutNumberLocal = modelSip.vc_OutNumberLocal.Replace(",,", ",").Trim(','); 
                    }
                    else if (_mModel.i_CalledSubType == MBoxSDK.ConfigSDK.CALLED_SUB_RULE_TYPE.长途.GetHashCode())
                    {
                        modelSip.vc_OutNumber = modelSip.vc_OutNumber + "," + _mModel.vc_CalledNumber;
                        modelSip.vc_OutNumber = modelSip.vc_OutNumber.Replace(",,", ",").Trim(','); 
                    }
                        
                   
                    new DB_Talk.BLL.m_SIPInterface().Update(modelSip);
                }
                if (_mModel.i_PRIID > 0)
                {
                    DB_Talk.Model.m_PRIInterface modelPri = new DB_Talk.BLL.m_PRIInterface().GetModel(
                                string.Format(" i_Flag=0 and PRIID='{0}' and BoxID='{1}'", _mModel.i_PRIID, Global.Params.BoxID));

                    if (_mModel.i_CalledSubType == MBoxSDK.ConfigSDK.CALLED_SUB_RULE_TYPE.市话.GetHashCode())
                    {
                        modelPri.vc_OutNumberLocal = modelPri.vc_OutNumberLocal + "," + _mModel.vc_CalledNumber;
                        modelPri.vc_OutNumberLocal = modelPri.vc_OutNumberLocal.Replace(",,", ",").Trim(','); 
                    }
                    else if (_mModel.i_CalledSubType == MBoxSDK.ConfigSDK.CALLED_SUB_RULE_TYPE.长途.GetHashCode())
                    {
                        modelPri.vc_OutNumber = modelPri.vc_OutNumber + "," + _mModel.vc_CalledNumber;
                        modelPri.vc_OutNumber = modelPri.vc_OutNumber.Replace(",,", ",").Trim(','); 
                    }
                   
                    new DB_Talk.BLL.m_PRIInterface().Update(modelPri);
                }
                CommControl.MessageBoxEx.MessageBoxEx.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                CommControl.MessageBoxEx.MessageBoxEx.Show("添加失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            
        }