示例#1
0
        /// <summary>删除一条数据
        ///
        /// </summary>
        /// <param name="User_Id">主键ID</param>
        /// <returns>返回受影响的行数</returns>
        public bool Delete(int User_Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from Bse_User ");
            strSql.Append(" where User_Id=@User_Id ");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelper();
            h.CreateCommand(strSql.ToString());
            h.AddParameter("@User_Id", User_Id);
            return(h.ExecuteNonQuery());
        }
示例#2
0
        /// <summary>删除一条数据
        ///
        /// </summary>
        /// <param name="KeyId">主键ID</param>
        /// <returns>返回受影响的行数</returns>
        public bool Delete(int KeyId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from Sys_Roles ");
            strSql.Append(" where KeyId=@KeyId ");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            h.AddParameter("@KeyId", KeyId);
            return(h.ExecuteNonQuery());
        }
示例#3
0
        /// <summary>增加一条数据
        ///
        /// </summary>
        /// <param name="model">实体对象</param>
        /// <returns>返回新增实体ID</returns>
        public int Add(Nikita.Assist.CodeMaker.Model.Sys_Roles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Sys_Roles(");
            strSql.Append("RoleName, Sortnum, Remark, isDefault  )");
            strSql.Append(" values (");
            strSql.Append("@RoleName, @Sortnum, @Remark, @isDefault  )");
            strSql.Append(";select @@IDENTITY");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            if (model.RoleName == null)
            {
                h.AddParameter("@RoleName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@RoleName", model.RoleName);
            }
            if (model.Sortnum == null)
            {
                h.AddParameter("@Sortnum", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Sortnum", model.Sortnum);
            }
            if (model.Remark == null)
            {
                h.AddParameter("@Remark", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Remark", model.Remark);
            }
            if (model.isDefault == null)
            {
                h.AddParameter("@isDefault", DBNull.Value);
            }
            else
            {
                h.AddParameter("@isDefault", model.isDefault);
            }

            int    intResult;
            string strObj = h.ExecuteScalar();

            if (!int.TryParse(strObj, out intResult))
            {
                return(0);
            }
            return(intResult);
        }
示例#4
0
        /// <summary>计算记录数
        ///
        /// </summary>
        /// <param name="strCond">条件</param>
        /// <returns>总数量</returns>
        public int CalcCount(string strCond)
        {
            string strSql = "select count(1) from Sys_Roles";

            if (!string.IsNullOrEmpty(strCond))
            {
                strSql += " where " + strCond;
            }
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql);
            return(int.Parse(h.ExecuteScalar()));
        }
示例#5
0
        /// <summary>更新一条数据
        ///
        /// </summary>
        /// <param name="model">实体对象</param>
        /// <returns>返回受影响的行数</returns>
        public bool Update(Nikita.Assist.CodeMaker.Model.Sys_Roles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Sys_Roles set ");
            strSql.Append("RoleName=@RoleName, Sortnum=@Sortnum, Remark=@Remark, isDefault=@isDefault  ");
            strSql.Append(" where KeyId=@KeyId ");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            if (model.KeyId == null)
            {
                h.AddParameter("@KeyId", DBNull.Value);
            }
            else
            {
                h.AddParameter("@KeyId", model.KeyId);
            }
            if (model.RoleName == null)
            {
                h.AddParameter("@RoleName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@RoleName", model.RoleName);
            }
            if (model.Sortnum == null)
            {
                h.AddParameter("@Sortnum", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Sortnum", model.Sortnum);
            }
            if (model.Remark == null)
            {
                h.AddParameter("@Remark", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Remark", model.Remark);
            }
            if (model.isDefault == null)
            {
                h.AddParameter("@isDefault", DBNull.Value);
            }
            else
            {
                h.AddParameter("@isDefault", model.isDefault);
            }

            return(h.ExecuteNonQuery());
        }
示例#6
0
        /// <summary>根据条件删除数据
        ///
        /// </summary>
        /// <param name="strCond">条件</param>
        /// <returns>返回受影响的行数</returns>
        public bool DeleteByCond(string strCond)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from Sys_Roles ");
            if (!string.IsNullOrEmpty(strCond))
            {
                strSql.Append(" where " + strCond);
            }
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            return(h.ExecuteNonQuery());
        }
示例#7
0
        /// <summary>更新一一个字段
        ///
        /// </summary>
        public bool Update(string strFieldWithValue, string strCond)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update  Sys_Roles  set ");
            strSql.Append(strFieldWithValue);
            if (!string.IsNullOrEmpty(strCond))
            {
                strSql.Append(" where " + strCond);
            }
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            return(h.ExecuteNonQuery());
        }
示例#8
0
        /// <summary>增加一条数据
        ///
        /// </summary>
        public int Add(Nikita.Assist.CodeMaker.Model.OrderMaster model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OrderMaster(");
            strSql.Append("OrderNumber, Status, CreateDate  )");
            strSql.Append(" values (");
            strSql.Append("@OrderNumber, @Status, @CreateDate  )");
            strSql.Append(";select @@IDENTITY");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            if (model.OrderNumber == null)
            {
                h.AddParameter("@OrderNumber", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OrderNumber", model.OrderNumber);
            }
            if (model.Status == null)
            {
                h.AddParameter("@Status", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Status", model.Status);
            }
            if (model.CreateDate == null)
            {
                h.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateDate", model.CreateDate);
            }

            int    intResult;
            string obj = h.ExecuteScalar();

            if (!int.TryParse(obj, out intResult))
            {
                return(0);
            }
            return(intResult);
        }
示例#9
0
        /// <summary>获得指定字段的数据列表(字段间用逗号隔开)
        ///
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <param name="strFields">字段</param>
        /// <returns>返回符合条件的DataSet数据集</returns>
        public DataSet GetList(string strWhere, string strFields)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select " + strFields + " ");
            strSql.Append(" FROM Sys_Roles ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            DataTable dt = h.ExecuteQuery();
            DataSet   ds = new DataSet();

            ds.Tables.Add(dt);
            return(ds);
        }
示例#10
0
        /// <summary>更新一条数据
        ///
        /// </summary>
        public bool Update(Nikita.Assist.CodeMaker.Model.OrderMaster model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update OrderMaster set ");
            strSql.Append("OrderNumber=@OrderNumber, Status=@Status, CreateDate=@CreateDate  ");
            strSql.Append(" where OrderId=@OrderId ");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            if (model.OrderId == null)
            {
                h.AddParameter("@OrderId", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OrderId", model.OrderId);
            }
            if (model.OrderNumber == null)
            {
                h.AddParameter("@OrderNumber", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OrderNumber", model.OrderNumber);
            }
            if (model.Status == null)
            {
                h.AddParameter("@Status", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Status", model.Status);
            }
            if (model.CreateDate == null)
            {
                h.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateDate", model.CreateDate);
            }

            return(h.ExecuteNonQuery());
        }
示例#11
0
        /// <summary>得到一个对象实体
        ///
        /// </summary>
        /// <param name="KeyId">主键</param>
        /// <returns>返回对象实体</returns>
        public Nikita.Assist.CodeMaker.Model.Sys_Roles GetModel(int KeyId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from Sys_Roles ");
            strSql.Append(" where KeyId=@KeyId ");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            h.AddParameter("@KeyId", KeyId);
            Nikita.Assist.CodeMaker.Model.Sys_Roles model = null;
            using (IDataReader dataReader = h.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                h.CloseConn();
            }
            return(model);
        }
示例#12
0
        /// <summary>根据条件得到一个对象实体
        ///
        /// </summary>
        /// <param name="strCond">条件</param>
        /// <returns>返回对象实体</returns>
        public Nikita.Assist.CodeMaker.Model.Sys_Roles GetModelByCond(string strCond)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 * from Sys_Roles ");
            if (!string.IsNullOrEmpty(strCond))
            {
                strSql.Append(" where " + strCond);
            }
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            Nikita.Assist.CodeMaker.Model.Sys_Roles model = null;
            using (IDataReader dataReader = h.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                h.CloseConn();
            }
            return(model);
        }
示例#13
0
        /// <summary>获得数据列表(比DataSet效率高,推荐使用)
        ///
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <returns>返回符合条件的对象集合</returns>
        public List <Nikita.Assist.CodeMaker.Model.Sys_Roles> GetListArray(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * ");
            strSql.Append(" FROM Sys_Roles ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List <Nikita.Assist.CodeMaker.Model.Sys_Roles> list = new List <Nikita.Assist.CodeMaker.Model.Sys_Roles>();

            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            using (IDataReader dataReader = h.ExecuteReader())
            {
                while (dataReader.Read())
                {
                    list.Add(ReaderBind(dataReader));
                }
                h.CloseConn();
            }
            return(list);
        }
示例#14
0
        /// <summary>增加一条数据
        ///
        /// </summary>
        public int Add(Nikita.Assist.CodeMaker.Model.OrderDetail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OrderDetail(");
            strSql.Append("OrderId, Customer, ProductName, Amount, SumMoney, Status  )");
            strSql.Append(" values (");
            strSql.Append("@OrderId, @Customer, @ProductName, @Amount, @SumMoney, @Status  )");
            strSql.Append(";select @@IDENTITY");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            if (model.OrderId == null)
            {
                h.AddParameter("@OrderId", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OrderId", model.OrderId);
            }
            if (model.Customer == null)
            {
                h.AddParameter("@Customer", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Customer", model.Customer);
            }
            if (model.ProductName == null)
            {
                h.AddParameter("@ProductName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ProductName", model.ProductName);
            }
            if (model.Amount == null)
            {
                h.AddParameter("@Amount", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Amount", model.Amount);
            }
            if (model.SumMoney == null)
            {
                h.AddParameter("@SumMoney", DBNull.Value);
            }
            else
            {
                h.AddParameter("@SumMoney", model.SumMoney);
            }
            if (model.Status == null)
            {
                h.AddParameter("@Status", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Status", model.Status);
            }

            int    intResult;
            string obj = h.ExecuteScalar();

            if (!int.TryParse(obj, out intResult))
            {
                return(0);
            }
            return(intResult);
        }
示例#15
0
        /// <summary>更新一条数据
        ///
        /// </summary>
        public bool Update(Nikita.Assist.CodeMaker.Model.OrderDetail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update OrderDetail set ");
            strSql.Append("OrderId=@OrderId, Customer=@Customer, ProductName=@ProductName, Amount=@Amount, SumMoney=@SumMoney, Status=@Status  ");
            strSql.Append(" where DetailId=@DetailId ");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            if (model.DetailId == null)
            {
                h.AddParameter("@DetailId", DBNull.Value);
            }
            else
            {
                h.AddParameter("@DetailId", model.DetailId);
            }
            if (model.OrderId == null)
            {
                h.AddParameter("@OrderId", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OrderId", model.OrderId);
            }
            if (model.Customer == null)
            {
                h.AddParameter("@Customer", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Customer", model.Customer);
            }
            if (model.ProductName == null)
            {
                h.AddParameter("@ProductName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ProductName", model.ProductName);
            }
            if (model.Amount == null)
            {
                h.AddParameter("@Amount", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Amount", model.Amount);
            }
            if (model.SumMoney == null)
            {
                h.AddParameter("@SumMoney", DBNull.Value);
            }
            else
            {
                h.AddParameter("@SumMoney", model.SumMoney);
            }
            if (model.Status == null)
            {
                h.AddParameter("@Status", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Status", model.Status);
            }

            return(h.ExecuteNonQuery());
        }
示例#16
0
        /// <summary>更新一条数据
        ///
        /// </summary>
        /// <param name="model">实体对象</param>
        /// <returns>返回受影响的行数</returns>
        public bool Update(Nikita.Assist.CodeMaker.Model.Bse_User model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Bse_User set ");
            strSql.Append("UserName=@UserName, Password=@Password, TrueName=@TrueName, Company=@Company, CreateDate=@CreateDate, State=@State  ");
            strSql.Append(" where User_Id=@User_Id ");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelper();
            h.CreateCommand(strSql.ToString());
            if (model.User_Id == null)
            {
                h.AddParameter("@User_Id", DBNull.Value);
            }
            else
            {
                h.AddParameter("@User_Id", model.User_Id);
            }
            if (model.UserName == null)
            {
                h.AddParameter("@UserName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UserName", model.UserName);
            }
            if (model.Password == null)
            {
                h.AddParameter("@Password", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Password", model.Password);
            }
            if (model.TrueName == null)
            {
                h.AddParameter("@TrueName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@TrueName", model.TrueName);
            }
            if (model.Company == null)
            {
                h.AddParameter("@Company", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Company", model.Company);
            }
            if (model.CreateDate == null)
            {
                h.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateDate", model.CreateDate);
            }
            if (model.State == null)
            {
                h.AddParameter("@State", DBNull.Value);
            }
            else
            {
                h.AddParameter("@State", model.State);
            }

            return(h.ExecuteNonQuery());
        }
示例#17
0
        /// <summary>增加一条数据
        ///
        /// </summary>
        /// <param name="model">实体对象</param>
        /// <returns>返回新增实体ID</returns>
        public int Add(Nikita.Assist.CodeMaker.Model.Bse_User model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Bse_User(");
            strSql.Append("UserName, Password, TrueName, Company, CreateDate, State  )");
            strSql.Append(" values (");
            strSql.Append("@UserName, @Password, @TrueName, @Company, @CreateDate, @State  )");
            strSql.Append(";select @@IDENTITY");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelper();
            h.CreateCommand(strSql.ToString());
            if (model.UserName == null)
            {
                h.AddParameter("@UserName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UserName", model.UserName);
            }
            if (model.Password == null)
            {
                h.AddParameter("@Password", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Password", model.Password);
            }
            if (model.TrueName == null)
            {
                h.AddParameter("@TrueName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@TrueName", model.TrueName);
            }
            if (model.Company == null)
            {
                h.AddParameter("@Company", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Company", model.Company);
            }
            if (model.CreateDate == null)
            {
                h.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateDate", model.CreateDate);
            }
            if (model.State == null)
            {
                h.AddParameter("@State", DBNull.Value);
            }
            else
            {
                h.AddParameter("@State", model.State);
            }

            int    intResult;
            string strObj = h.ExecuteScalar();

            if (!int.TryParse(strObj, out intResult))
            {
                return(0);
            }
            return(intResult);
        }
示例#18
0
        /// <summary>增加一条数据
        ///
        /// </summary>
        public int Add(Nikita.Assist.CodeMaker.Model.TreeListDemo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TreeListDemo(");
            strSql.Append("ParentId, Name, Value, OnLevel, OwerCompanyId, Status, Remark, Dept_Id, Company_Id, CreateUser, CreateDate, EditUser, EditDate  )");
            strSql.Append(" values (");
            strSql.Append("@ParentId, @Name, @Value, @OnLevel, @OwerCompanyId, @Status, @Remark, @Dept_Id, @Company_Id, @CreateUser, @CreateDate, @EditUser, @EditDate  )");
            strSql.Append(";select @@IDENTITY");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            if (model.ParentId == null)
            {
                h.AddParameter("@ParentId", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ParentId", model.ParentId);
            }
            if (model.Name == null)
            {
                h.AddParameter("@Name", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Name", model.Name);
            }
            if (model.Value == null)
            {
                h.AddParameter("@Value", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Value", model.Value);
            }
            if (model.OnLevel == null)
            {
                h.AddParameter("@OnLevel", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OnLevel", model.OnLevel);
            }
            if (model.OwerCompanyId == null)
            {
                h.AddParameter("@OwerCompanyId", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OwerCompanyId", model.OwerCompanyId);
            }
            if (model.Status == null)
            {
                h.AddParameter("@Status", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Status", model.Status);
            }
            if (model.Remark == null)
            {
                h.AddParameter("@Remark", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Remark", model.Remark);
            }
            if (model.Dept_Id == null)
            {
                h.AddParameter("@Dept_Id", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Dept_Id", model.Dept_Id);
            }
            if (model.Company_Id == null)
            {
                h.AddParameter("@Company_Id", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Company_Id", model.Company_Id);
            }
            if (model.CreateUser == null)
            {
                h.AddParameter("@CreateUser", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateUser", model.CreateUser);
            }
            if (model.CreateDate == null)
            {
                h.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateDate", model.CreateDate);
            }
            if (model.EditUser == null)
            {
                h.AddParameter("@EditUser", DBNull.Value);
            }
            else
            {
                h.AddParameter("@EditUser", model.EditUser);
            }
            if (model.EditDate == null)
            {
                h.AddParameter("@EditDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@EditDate", model.EditDate);
            }

            int    intResult;
            string obj = h.ExecuteScalar();

            if (!int.TryParse(obj, out intResult))
            {
                return(0);
            }
            return(intResult);
        }
示例#19
0
        /// <summary>更新一条数据
        ///
        /// </summary>
        public bool Update(Nikita.Assist.CodeMaker.Model.TreeListDemo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TreeListDemo set ");
            strSql.Append("ParentId=@ParentId, Name=@Name, Value=@Value, OnLevel=@OnLevel, OwerCompanyId=@OwerCompanyId, Status=@Status, Remark=@Remark, Dept_Id=@Dept_Id, Company_Id=@Company_Id, CreateUser=@CreateUser, CreateDate=@CreateDate, EditUser=@EditUser, EditDate=@EditDate  ");
            strSql.Append(" where Id=@Id ");
            DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo();
            h.CreateCommand(strSql.ToString());
            if (model.Id == null)
            {
                h.AddParameter("@Id", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Id", model.Id);
            }
            if (model.ParentId == null)
            {
                h.AddParameter("@ParentId", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ParentId", model.ParentId);
            }
            if (model.Name == null)
            {
                h.AddParameter("@Name", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Name", model.Name);
            }
            if (model.Value == null)
            {
                h.AddParameter("@Value", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Value", model.Value);
            }
            if (model.OnLevel == null)
            {
                h.AddParameter("@OnLevel", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OnLevel", model.OnLevel);
            }
            if (model.OwerCompanyId == null)
            {
                h.AddParameter("@OwerCompanyId", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OwerCompanyId", model.OwerCompanyId);
            }
            if (model.Status == null)
            {
                h.AddParameter("@Status", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Status", model.Status);
            }
            if (model.Remark == null)
            {
                h.AddParameter("@Remark", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Remark", model.Remark);
            }
            if (model.Dept_Id == null)
            {
                h.AddParameter("@Dept_Id", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Dept_Id", model.Dept_Id);
            }
            if (model.Company_Id == null)
            {
                h.AddParameter("@Company_Id", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Company_Id", model.Company_Id);
            }
            if (model.CreateUser == null)
            {
                h.AddParameter("@CreateUser", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateUser", model.CreateUser);
            }
            if (model.CreateDate == null)
            {
                h.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateDate", model.CreateDate);
            }
            if (model.EditUser == null)
            {
                h.AddParameter("@EditUser", DBNull.Value);
            }
            else
            {
                h.AddParameter("@EditUser", model.EditUser);
            }
            if (model.EditDate == null)
            {
                h.AddParameter("@EditDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@EditDate", model.EditDate);
            }

            return(h.ExecuteNonQuery());
        }