Beispiel #1
0
        public frmBox(DB_Talk.Model.m_Box model, int operate)
         {
            InitializeComponent();

            _operate = operate;
            if (operate == 0)
            {
                _mModelOld = null;
                this.FormTitle = "添加";
                btnOK.Text = "添加";
                this.txtIP.Text = "172.21.0.2";
                //this.txtNetIP.Text= "10.21.0.2";
                //this.txtMask.Text = "255.255.255.0";
               
                this.txtNetIP.Enabled=false;
                this.txtMask.Enabled = false;

                this.txtDispatchIP1.Text = "172.21.0.41";
                this.txtDispatchIP2.Text = "172.21.0.42";
                this.txtRecordServerIP.Text = "172.21.0.21";
                this.txtTimerIP.Text = "";
            }
            else
            {
                btnTest.Visible = false;
                _mModel = model;
                _mModelOld = (DB_Talk.Model.m_Box)model.Clone();
                this.FormTitle = "编辑";
                btnOK.Text = "编辑";
                ShowModel();
            }
            //this.txtName.MaxLength = Global.Params.NameLen;
        }
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(DB_Talk.Model.m_StaticRoute model,bool IsReturnID)   
		{
		    int Result=0;
		    StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();	
			if(model.BoxID!=null)
		    {
			   strSql1.Append("BoxID,");	
			   strSql2.Append("'"+ model.BoxID +"',");	
			} 
            if(model.vc_NetIP!=null)
		    {
			   strSql1.Append("vc_NetIP,");	
			   strSql2.Append("'"+ model.vc_NetIP +"',");	
			} 
            if(model.vc_Mask!=null)
		    {
			   strSql1.Append("vc_Mask,");	
			   strSql2.Append("'"+ model.vc_Mask +"',");	
			} 
            if(model.vc_GateWayIP!=null)
		    {
			   strSql1.Append("vc_GateWayIP,");	
			   strSql2.Append("'"+ model.vc_GateWayIP +"',");	
			} 
            if(model.vc_Memo!=null)
		    {
			   strSql1.Append("vc_Memo,");	
			   strSql2.Append("'"+ model.vc_Memo +"',");	
			} 
            if(model.i_Flag!=null)
		    {
			   strSql1.Append("i_Flag,");	
			   strSql2.Append("'"+ model.i_Flag +"',");	
			} 
            strSql.Append("insert into m_StaticRoute(");	
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));	
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");  
			strSql.Append(";select @@IDENTITY");
			if (IsReturnID)
            {
                DataSet ds=GetDataSet(strSql.ToString());
                if(ds!=null && ds.Tables[0].Rows.Count>0)
                {
                   Result = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                }
                else
                  Result=-1;
            }
            else  
            {
                Result = ExecuteSql(strSql.ToString());
            }
            return Result; 
		}
 //删除路由组
 private static bool DeleteRouteGroup(DB_Talk.Model.m_RouteGroup model)
 {
     bool b = false;
     if (!IsBoxExitRouteGroup(model)) return true;
     if (model.ID > 0 && model.vc_Name != "")
     {
         b = MBoxSDK.ConfigSDK.MBOX_DeleteRouteGroup(Global.Params.BoxHandle, (uint)model.ID, model.vc_Name);
     }
     return b;
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(DB_Talk.Model.m_RegionRelation model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update m_RegionRelation set ");
     if (model.BoxID != null)
     {
         strSql.Append("BoxID=" + model.BoxID + ",");
     }
     else
     {
         strSql.Append("BoxID= null ,");
     }
     if (model.RegionID != null)
     {
         strSql.Append("RegionID='" + model.RegionID + "',");
     }
     else
     {
         strSql.Append("RegionID= null ,");
     }
     if (model.i_RelationType != null)
     {
         strSql.Append("i_RelationType=" + model.i_RelationType + ",");
     }
     else
     {
         strSql.Append("i_RelationType= null ,");
     }
     if (model.RelationID != null)
     {
         strSql.Append("RelationID=" + model.RelationID + ",");
     }
     else
     {
         strSql.Append("RelationID= null ,");
     }
     int n = strSql.ToString().LastIndexOf(",");
     strSql.Remove(n, 1);
     strSql.Append(" where ID=" + model.ID + "");
     int rowsAffected = DB.OleDbHelper.ExecuteSql(strSql.ToString());
     if (rowsAffected > 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
        //创建路由组
        private static bool CreateRouteGroup(DB_Talk.Model.m_RouteGroup model,out int RouteGroupID)
        {
            //创建路由组只传入名称,没有ID
            bool b = false;
            RouteGroupID = 0;
            List<DB_Talk.Model.m_RouteGroup> lst = new List<DB_Talk.Model.m_RouteGroup>();
            QueryRouteGroup(out lst);
            if (lst != null && lst.Count > 0)
            {
                DB_Talk.Model.m_RouteGroup temp = lst.Find(item => item.vc_Name == model.vc_Name);
                if (temp != null) //存在相同名称的,直接返回相同名称的路由组ID
                {
                    RouteGroupID = temp.ID;
                    return true;  //存在的不再添加
                }
                else
                {
                    model.ID = lst[lst.Count - 1].ID +1;  //不存在相同名称的,需要新建,ID为目前最大ID+1
                }
            }
            else
            {
                model.ID = 1; //没有路由的情况下ID从1开始
            }
            if (model.ID > 0 && model.vc_Name != "")
            {
                RouteGroupID = model.ID;
                b = MBoxSDK.ConfigSDK.MBOX_CreateRouteGroup(Global.Params.BoxHandle, (uint)model.ID, model.vc_Name);
            }
            return b;

            /*
            bool b = false;
            List<DB_Talk.Model.m_RouteGroup> lst = new List<DB_Talk.Model.m_RouteGroup>();
            QueryRouteGroup(out lst);
            if (lst != null && lst.Count > 0)
            {
                    if (lst.Contains(model))
                    {
                        return true;  //存在的不再添加
                    }
            }
            if (model.ID > 0 && model.vc_Name != "")
            {
                b = MBoxSDK.ConfigSDK.MBOX_CreateRouteGroup(Global.Params.BoxHandle, (uint)model.ID, model.vc_Name);
            }
            return b;
             */
        }
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(DB_Talk.Model.m_CameraInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update m_CameraInfo set ");
			if (model.BoxID != null)
			{
				strSql.Append("BoxID="+model.BoxID+",");
			}
			else
			{
				strSql.Append("BoxID= null ,");
			}
			if (model.vc_Name != null)
			{
				strSql.Append("vc_Name='"+model.vc_Name+"',");
			}
			else
			{
				strSql.Append("vc_Name= null ,");
			}
			if (model.vc_Memo != null)
			{
				strSql.Append("vc_Memo='"+model.vc_Memo+"',");
			}
			else
			{
				strSql.Append("vc_Memo= null ,");
			}
			if (model.i_ChanelID != null)
			{
				strSql.Append("i_ChanelID="+model.i_ChanelID+",");
			}
			else
			{
				strSql.Append("i_ChanelID= null ,");
			}
			int n = strSql.ToString().LastIndexOf(",");
			strSql.Remove(n, 1);
			strSql.Append(" where ID="+ model.ID+"");
			int rowsAffected=DB.OleDbHelper.ExecuteSql(strSql.ToString());
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(DB_Talk.Model.Data_MemberState model,bool IsReturnID)   
		{
		    int Result=0;
		    StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();	
			if(model.i_DispatchNumber!=null)
		    {
			   strSql1.Append("i_DispatchNumber,");	
			   strSql2.Append("'"+ model.i_DispatchNumber +"',");	
			} 
            if(model.i_Number!=null)
		    {
			   strSql1.Append("i_Number,");	
			   strSql2.Append("'"+ model.i_Number +"',");	
			} 
            if(model.i_PeerNumber!=null)
		    {
			   strSql1.Append("i_PeerNumber,");	
			   strSql2.Append("'"+ model.i_PeerNumber +"',");	
			} 
            if(model.i_State!=null)
		    {
			   strSql1.Append("i_State,");	
			   strSql2.Append("'"+ model.i_State +"',");	
			} 
            strSql.Append("insert into Data_MemberState(");	
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));	
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");  
			strSql.Append(";select @@IDENTITY");
			if (IsReturnID)
            {
                DataSet ds=GetDataSet(strSql.ToString());
                if(ds!=null && ds.Tables[0].Rows.Count>0)
                {
                   Result = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                }
                else
                  Result=-1;
            }
            else  
            {
                Result = ExecuteSql(strSql.ToString());
            }
            return Result; 
		}
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(DB_Talk.Model.m_GroupMembers model,bool IsReturnID)   
		{
		    int Result=0;
		    StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();	
			if(model.BoxID!=null)
		    {
			   strSql1.Append("BoxID,");	
			   strSql2.Append("'"+ model.BoxID +"',");	
			} 
            if(model.GroupID!=null)
		    {
			   strSql1.Append("GroupID,");	
			   strSql2.Append("'"+ model.GroupID +"',");	
			} 
            if(model.MemberID!=null)
		    {
			   strSql1.Append("MemberID,");	
			   strSql2.Append("'"+ model.MemberID +"',");	
			} 
            strSql.Append("insert into m_GroupMembers(");	
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));	
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");  
			strSql.Append(";select @@IDENTITY");
			if (IsReturnID)
            {
                DataSet ds=GetDataSet(strSql.ToString());
                if(ds!=null && ds.Tables[0].Rows.Count>0)
                {
                   Result = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                }
                else
                  Result=-1;
            }
            else  
            {
                Result = ExecuteSql(strSql.ToString());
            }
            return Result; 
		}
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(DB_Talk.Model.m_CameraInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();
			if (model.BoxID != null)
			{
				strSql1.Append("BoxID,");
				strSql2.Append(""+model.BoxID+",");
			}
			if (model.vc_Name != null)
			{
				strSql1.Append("vc_Name,");
				strSql2.Append("'"+model.vc_Name+"',");
			}
			if (model.vc_Memo != null)
			{
				strSql1.Append("vc_Memo,");
				strSql2.Append("'"+model.vc_Memo+"',");
			}
			if (model.i_ChanelID != null)
			{
				strSql1.Append("i_ChanelID,");
				strSql2.Append(""+model.i_ChanelID+",");
			}
			strSql.Append("insert into m_CameraInfo(");
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");
			strSql.Append(";select @@IDENTITY");
            object obj = DB.OleDbHelper.ExecuteSql(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(DB_Talk.Model.m_RegionRelation model)
 {
     StringBuilder strSql = new StringBuilder();
     StringBuilder strSql1 = new StringBuilder();
     StringBuilder strSql2 = new StringBuilder();
     if (model.BoxID != null)
     {
         strSql1.Append("BoxID,");
         strSql2.Append("" + model.BoxID + ",");
     }
     if (model.RegionID != null)
     {
         strSql1.Append("RegionID,");
         strSql2.Append("'" + model.RegionID + "',");
     }
     if (model.i_RelationType != null)
     {
         strSql1.Append("i_RelationType,");
         strSql2.Append("" + model.i_RelationType + ",");
     }
     if (model.RelationID != null)
     {
         strSql1.Append("RelationID,");
         strSql2.Append("" + model.RelationID + ",");
     }
     strSql.Append("insert into m_RegionRelation(");
     strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
     strSql.Append(")");
     strSql.Append(" values (");
     strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
     strSql.Append(")");
     strSql.Append(";select @@IDENTITY");
     object obj = DB.OleDbHelper.ExecuteSql(strSql.ToString());
     if (obj == null)
     {
         return 0;
     }
     else
     {
         return Convert.ToInt32(obj);
     }
 }
        public frmDepartment(DB_Talk.Model.m_Departments model, int operate)
         {
            InitializeComponent();
            if (Global.Params.ConfigModel.SystemConfig.MaxNameTextLengh != 0)
                this.txtName.MaxLength = Global.Params.ConfigModel.SystemConfig.MaxNameTextLengh;// Global.Params.NameLen;

            if (operate == 0)
            {
                this.FormTitle = "添加";
                btnOK.Text = "添加";
            }
            else
            {

                _mModel = model;
                this.FormTitle = "编辑";
                btnOK.Text = "编辑";
                ShowModel();
            }
           
        }
        public frmCalledRule(DB_Talk.Model.m_CalledRule m, int operate)
        {
            InitializeComponent();
           
            _operate = operate;
            if (operate == 0)
            {
                this.FormTitle = "添加";
                btnOK.Text = "添加";
               
            }
            else
            {
                _mModel = m;
                this.FormTitle = "编辑";
                btnOK.Text = "编辑";
               // ShowModel();
            }

            this.Load += new EventHandler(frmCalledRule_Load);
           
            
        }
        public frmGroup(DB_Talk.Model.m_Group model, int operate)
         {
            InitializeComponent();
            _mModel = model;
            if (_mModel.GroupTypeID == CommControl.PublicEnums.EnumGroupType.Normal.GetHashCode())
                GroupType = "调度";
            else if((_mModel.GroupTypeID == CommControl.PublicEnums.EnumGroupType.Meeting.GetHashCode()))
                GroupType = "会议";

            if (operate == 0)
            {
                this.FormTitle = "添加";
                btnOK.Text = "添加";
            }
            else
            {
                this.FormTitle = "编辑";
                btnOK.Text = "编辑";
                ShowModel();
            }
            if (Global.Params.ConfigModel.SystemConfig.MaxNameTextLengh != 0)
               this.txtName.MaxLength = Global.Params.ConfigModel.SystemConfig.MaxNameTextLengh;//  Global.Params.NameLen;
            
        }
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(DB_Talk.Model.m_CalinglSourceRule model,bool IsReturnID)   
		{
		    int Result=0;
		    StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();
            //if (model.ID != null)
            //{
            //    strSql1.Append("ID,");
            //    strSql2.Append("'" + model.ID + "',");
            //} 
			if(model.BoxID>0)
		    {
			   strSql1.Append("BoxID,");	
			   strSql2.Append("'"+ model.BoxID +"',");	
			} 
            if(model.vc_Code!=null)
		    {
			   strSql1.Append("vc_Code,");	
			   strSql2.Append("'"+ model.vc_Code +"',");	
			} 
            if(model.vc_Name!=null)
		    {
			   strSql1.Append("vc_Name,");	
			   strSql2.Append("'"+ model.vc_Name +"',");	
			} 
            if(model.CallingOrigID!=null)
		    {
			   strSql1.Append("CallingOrigID,");	
			   strSql2.Append("'"+ model.CallingOrigID +"',");	
			} 
            if(model.i_ServerType!=null)
		    {
			   strSql1.Append("i_ServerType,");	
			   strSql2.Append("'"+ model.i_ServerType +"',");	
			} 
            if(model.i_MinReLength!=null)
		    {
			   strSql1.Append("i_MinReLength,");	
			   strSql2.Append("'"+ model.i_MinReLength +"',");	
			} 
            if(model.OriRouteID!=null)
		    {
			   strSql1.Append("OriRouteID,");	
			   strSql2.Append("'"+ model.OriRouteID +"',");	
			} 
            if(model.CalledRuleID!=null)
		    {
			   strSql1.Append("CalledRuleID,");	
			   strSql2.Append("'"+ model.CalledRuleID +"',");	
			} 
            if(model.vc_Memo!=null)
		    {
			   strSql1.Append("vc_Memo,");	
			   strSql2.Append("'"+ model.vc_Memo +"',");	
			} 
            if(model.i_Flag!=null)
		    {
			   strSql1.Append("i_Flag,");	
			   strSql2.Append("'"+ model.i_Flag +"',");	
			} 
            strSql.Append("insert into m_CalinglSourceRule(");	
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));	
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");  
			strSql.Append(";select @@IDENTITY");
			if (IsReturnID)
            {
                DataSet ds=GetDataSet(strSql.ToString());
                if(ds!=null && ds.Tables[0].Rows.Count>0)
                {
                   Result = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                }
                else
                  Result=-1;
            }
            else  
            {
                Result = ExecuteSql(strSql.ToString());
            }
            return Result; 
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(DB_Talk.Model.m_CalinglSourceRule model,string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update m_CalinglSourceRule set ");
			if(model.BoxID!=null)
		    {
			   strSql.Append("BoxID='"+ model.BoxID +"',");	
			} 
			if(model.vc_Code!=null)
		    {
			   strSql.Append("vc_Code='"+ model.vc_Code +"',");	
			} 
			if(model.vc_Name!=null)
		    {
			   strSql.Append("vc_Name='"+ model.vc_Name +"',");	
			} 
			if(model.CallingOrigID!=null)
		    {
			   strSql.Append("CallingOrigID='"+ model.CallingOrigID +"',");	
			} 
			if(model.i_ServerType!=null)
		    {
			   strSql.Append("i_ServerType='"+ model.i_ServerType +"',");	
			} 
			if(model.i_MinReLength!=null)
		    {
			   strSql.Append("i_MinReLength='"+ model.i_MinReLength +"',");	
			} 
			if(model.OriRouteID!=null)
		    {
			   strSql.Append("OriRouteID='"+ model.OriRouteID +"',");	
			} 
			if(model.CalledRuleID!=null)
		    {
			   strSql.Append("CalledRuleID='"+ model.CalledRuleID +"',");	
			} 
			if(model.vc_Memo!=null)
		    {
			   strSql.Append("vc_Memo='"+ model.vc_Memo +"',");	
			} 
			if(model.i_Flag!=null)
		    {
			   strSql.Append("i_Flag='"+ model.i_Flag +"',");	
			} 
			int n = strSql.ToString().LastIndexOf(",");
			strSql.Remove(n, 1);
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			else
			    strSql.Append(" where ID=" + model.ID +"");	         
            int rows=ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
Beispiel #16
0
        /// <summary>
		/// 增加一条数据
		/// </summary>
		public int  Add(DB_Talk.Model.m_FAP model)
		{
			return Add(model,false);		
		}
Beispiel #17
0
        /// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(DB_Talk.Model.m_FAP model)
		{
			return Update(model,"");
		}
        /// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(DB_Talk.Model.Data_MemberState model)
		{
			return Update(model,"");
		}
        /// <summary>
		/// 增加一条数据
		/// </summary>
		public int  Add(DB_Talk.Model.Data_MemberState model)
		{
			return Add(model,false);		
		}
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(DB_Talk.Model.SubscriberProfile model)
		{
			return dal.Add(model);
		}
Beispiel #21
0
		/// <summary>
		/// 增加一条数据,并返回ID
		/// </summary>
		public int  Add(DB_Talk.Model.m_FAP model,bool IsReturnID)   
		{
			return dal.Add(model,IsReturnID);
						
		}
		/// <summary>
		/// 增加一条数据,并返回ID
		/// </summary>
		public int  Add(DB_Talk.Model.m_Departments model,bool IsReturnID)   
		{
			return dal.Add(model,IsReturnID);
						
		}
Beispiel #23
0
		/// <summary>
		/// 根据条件更新数据
		/// </summary>
		public bool Update(DB_Talk.Model.m_FAP model,string strWhere)
		{
			return dal.Update(model,strWhere);
		}
        /// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(DB_Talk.Model.m_Departments model)
		{
			return Update(model,"");
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(DB_Talk.Model.SubscriberProfile model)
		{
			return dal.Update(model);
		}
		/// <summary>
		/// 根据条件更新数据
		/// </summary>
		public bool Update(DB_Talk.Model.m_Departments model,string strWhere)
		{
			return dal.Update(model,strWhere);
		}
		/// <summary>
		/// 增加一条数据,并返回ID
		/// </summary>
		public int  Add(DB_Talk.Model.Data_MemberState model,bool IsReturnID)   
		{
			return dal.Add(model,IsReturnID);
						
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(DB_Talk.Model.m_CalledRule model,string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update m_CalledRule set ");
			if(model.CalledID!=null)
		    {
			   strSql.Append("CalledID='"+ model.CalledID +"',");	
			} 
			if(model.BoxID!=null)
		    {
			   strSql.Append("BoxID='"+ model.BoxID +"',");	
			} 
			if(model.vc_Code!=null)
		    {
			   strSql.Append("vc_Code='"+ model.vc_Code +"',");	
			} 
			if(model.vc_Name!=null)
		    {
			   strSql.Append("vc_Name='"+ model.vc_Name +"',");	
			} 
			if(model.CallingOriID!=null)
		    {
			   strSql.Append("CallingOriID='"+ model.CallingOriID +"',");	
			} 
			if(model.vc_CalledNumber!=null)
		    {
			   strSql.Append("vc_CalledNumber='"+ model.vc_CalledNumber +"',");	
			} 
			if(model.i_CalledType!=null)
		    {
			   strSql.Append("i_CalledType='"+ model.i_CalledType +"',");	
			} 
			if(model.i_CalledSubType!=null)
		    {
			   strSql.Append("i_CalledSubType='"+ model.i_CalledSubType +"',");	
			} 
			if(model.DestRouteID!=null)
		    {
			   strSql.Append("DestRouteID='"+ model.DestRouteID +"',");	
			} 
			if(model.i_CalledChangeType!=null)
		    {
			   strSql.Append("i_CalledChangeType='"+ model.i_CalledChangeType +"',");	
			} 
			if(model.i_CalledChangePosition!=null)
		    {
			   strSql.Append("i_CalledChangePosition='"+ model.i_CalledChangePosition +"',");	
			} 
			if(model.i_CalledChangeLength!=null)
		    {
			   strSql.Append("i_CalledChangeLength='"+ model.i_CalledChangeLength +"',");	
			} 
			if(model.vc_CalledChangeTarget!=null)
		    {
			   strSql.Append("vc_CalledChangeTarget='"+ model.vc_CalledChangeTarget +"',");	
			} 
			if(model.vc_Memo!=null)
		    {
			   strSql.Append("vc_Memo='"+ model.vc_Memo +"',");	
			} 
			if(model.i_SIPID!=null)
		    {
			   strSql.Append("i_SIPID='"+ model.i_SIPID +"',");	
			} 
			if(model.i_PRIID!=null)
		    {
			   strSql.Append("i_PRIID='"+ model.i_PRIID +"',");	
			} 
			if(model.i_Flag!=null)
		    {
			   strSql.Append("i_Flag='"+ model.i_Flag +"',");	
			} 
			int n = strSql.ToString().LastIndexOf(",");
			strSql.Remove(n, 1);
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			else
			    strSql.Append(" where ID=" + model.ID +"");	         
            int rows=ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 根据条件更新数据
		/// </summary>
		public bool Update(DB_Talk.Model.Data_MemberState model,string strWhere)
		{
			return dal.Update(model,strWhere);
		}
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(DB_Talk.Model.m_CalledRule model,bool IsReturnID)   
		{
		    int Result=0;
		    StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();	
			if(model.CalledID!=null)
		    {
			   strSql1.Append("CalledID,");	
			   strSql2.Append("'"+ model.CalledID +"',");	
			} 
            if(model.BoxID!=null)
		    {
			   strSql1.Append("BoxID,");	
			   strSql2.Append("'"+ model.BoxID +"',");	
			} 
            if(model.vc_Code!=null)
		    {
			   strSql1.Append("vc_Code,");	
			   strSql2.Append("'"+ model.vc_Code +"',");	
			} 
            if(model.vc_Name!=null)
		    {
			   strSql1.Append("vc_Name,");	
			   strSql2.Append("'"+ model.vc_Name +"',");	
			} 
            if(model.CallingOriID!=null)
		    {
			   strSql1.Append("CallingOriID,");	
			   strSql2.Append("'"+ model.CallingOriID +"',");	
			} 
            if(model.vc_CalledNumber!=null)
		    {
			   strSql1.Append("vc_CalledNumber,");	
			   strSql2.Append("'"+ model.vc_CalledNumber +"',");	
			} 
            if(model.i_CalledType!=null)
		    {
			   strSql1.Append("i_CalledType,");	
			   strSql2.Append("'"+ model.i_CalledType +"',");	
			} 
            if(model.i_CalledSubType!=null)
		    {
			   strSql1.Append("i_CalledSubType,");	
			   strSql2.Append("'"+ model.i_CalledSubType +"',");	
			} 
            if(model.DestRouteID!=null)
		    {
			   strSql1.Append("DestRouteID,");	
			   strSql2.Append("'"+ model.DestRouteID +"',");	
			} 
            if(model.i_CalledChangeType!=null)
		    {
			   strSql1.Append("i_CalledChangeType,");	
			   strSql2.Append("'"+ model.i_CalledChangeType +"',");	
			} 
            if(model.i_CalledChangePosition!=null)
		    {
			   strSql1.Append("i_CalledChangePosition,");	
			   strSql2.Append("'"+ model.i_CalledChangePosition +"',");	
			} 
            if(model.i_CalledChangeLength!=null)
		    {
			   strSql1.Append("i_CalledChangeLength,");	
			   strSql2.Append("'"+ model.i_CalledChangeLength +"',");	
			} 
            if(model.vc_CalledChangeTarget!=null)
		    {
			   strSql1.Append("vc_CalledChangeTarget,");	
			   strSql2.Append("'"+ model.vc_CalledChangeTarget +"',");	
			} 
            if(model.vc_Memo!=null)
		    {
			   strSql1.Append("vc_Memo,");	
			   strSql2.Append("'"+ model.vc_Memo +"',");	
			} 
            if(model.i_SIPID!=null)
		    {
			   strSql1.Append("i_SIPID,");	
			   strSql2.Append("'"+ model.i_SIPID +"',");	
			} 
            if(model.i_PRIID!=null)
		    {
			   strSql1.Append("i_PRIID,");	
			   strSql2.Append("'"+ model.i_PRIID +"',");	
			} 
            if(model.i_Flag!=null)
		    {
			   strSql1.Append("i_Flag,");	
			   strSql2.Append("'"+ model.i_Flag +"',");	
			} 
            strSql.Append("insert into m_CalledRule(");	
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));	
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");  
			strSql.Append(";select @@IDENTITY");
			if (IsReturnID)
            {
                DataSet ds=GetDataSet(strSql.ToString());
                if(ds!=null && ds.Tables[0].Rows.Count>0)
                {
                   Result = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                }
                else
                  Result=-1;
            }
            else  
            {
                Result = ExecuteSql(strSql.ToString());
            }
            return Result; 
		}