コード例 #1
0
        //恢复出厂设置时清空数据库
        private void ClearDB()
        {
            //路由
            new DB_Talk.BLL.m_Route().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            new DB_Talk.BLL.m_RouteGroup().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            new DB_Talk.BLL.m_RouteRule().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            //中继
            new DB_Talk.BLL.m_SAPPoint().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            new DB_Talk.BLL.m_SIPInterface().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));

            new DB_Talk.BLL.m_PRIChannel().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            new DB_Talk.BLL.m_PRIInterface().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            new DB_Talk.BLL.m_PRISigLink().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));

            //号码规则
            new DB_Talk.BLL.m_CalinglSourceRule().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            new DB_Talk.BLL.m_CalledRule().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            new DB_Talk.BLL.m_CallingSource().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));

            //box
            DB_Talk.Model.m_Box model = new DB_Talk.Model.m_Box();
            model.ID = Global.Params.BoxID;
            model.i_DispatchNumber = 0;
            model.i_EmergencyNumber = 0;
            model.vc_NumberHead = "";
            model.i_NumberLen = 0;
            model.i_Flag = 1;
            new DB_Talk.BLL.m_Box().Update(model);

            //删除所有号码
            new DB_Talk.BLL.m_Member().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));
            //new DB_Talk.BLL.m_Member().Delete(" i_Flag=0 and BoxID='" + Global.Params.BoxID + "' and i_IsDispatch=1");
            //删除组成员
            new DB_Talk.BLL.m_GroupMembers().Delete(string.Format(" BoxID='{0}'", Global.Params.BoxID));

            //删除组,常用人员组不删除
            new DB_Talk.BLL.m_Group().Delete(string.Format(" BoxID='{0}' and vc_Name!='{1}'",
                Global.Params.BoxID, Global.Params.gruopNormalName));

            //删除部门信息,zhj说要删除的,多个站点时删除会有问题
            new DB_Talk.BLL.m_Departments().Delete("");

            //清日志,zhj说要删除的,多个站点时删除会有问题
           // new DB_Talk.BLL.Data_SystemLog().Delete("boxid=" + Global.Params.BoxID);
            new DB_Talk.BLL.Data_Alarm().Delete("boxid=" + Global.Params.BoxID);
            new DB_Talk.BLL.Data_DispatchLog().Delete("boxid=" + Global.Params.BoxID);

            //时钟源恢复为默认值
            DB_Talk.BLL.m_PRIClock BLL = new DB_Talk.BLL.m_PRIClock();
            List<DB_Talk.Model.m_PRIClock> lst = BLL.GetModelList(
                          string.Format(" i_Flag=0 and BoxID='{0}' ", Global.Params.BoxID));
            foreach (DB_Talk.Model.m_PRIClock modelClock in lst)
            {
                modelClock.i_Type = MBoxSDK.ConfigSDK.EnumPriClockType.内部.GetHashCode();
                modelClock.i_Port = 0;
                BLL.Update(modelClock);
            }
        }
コード例 #2
0
 private void AddPRIClolck(DB_Talk.Model.m_Box boxmodel)
 {
     DB_Talk.BLL.m_PRIClock BLL=new DB_Talk.BLL.m_PRIClock();
     for (int i = 0; i < 4; i++)
     {
         List<DB_Talk.Model.m_PRIClock> lst = BLL.GetModelList(
             string.Format(" i_Flag=0 and BoxID='{0}' and i_Level='{1}'",boxmodel.ID,i));
         if (lst.Count == 0)
         {
             DB_Talk.Model.m_PRIClock model = new DB_Talk.Model.m_PRIClock();
             model.BoxID = boxmodel.ID;
             model.i_Level = i;
             model.i_Type = MBoxSDK.ConfigSDK.EnumPriClockType.内部.GetHashCode();
             model.i_Port =0;
             BLL.Add(model);
         }
     }
 }