/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Permission.Model.Bse_Organize model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_Organize set "); strSql.Append("ParentId=@ParentId, Number=@Number, Name=@Name, ShortName=@ShortName, Category=@Category, OuterPhone=@OuterPhone, InnerPhone=@InnerPhone, Fax=@Fax, Postalcode=@Postalcode, Address=@Address, Web=@Web, Bank=@Bank, BankAccount=@BankAccount, Layer=@Layer, IsInnerOrganize=@IsInnerOrganize, DeletionStateCode=@DeletionStateCode, PY=@PY, Sort=@Sort, Dept_Id=@Dept_Id, DeptName=@DeptName, Company_Id=@Company_Id, CompanyName=@CompanyName, Bloc_Id=@Bloc_Id, BlocName=@BlocName, CreateUserId=@CreateUserId, CreateName=@CreateName, CreateDate=@CreateDate, EditUserId=@EditUserId, EditUserName=@EditUserName, EditDate=@EditDate, Remark=@Remark, State=@State, SystemId=@SystemId "); strSql.Append(" where Organize_Id=@Organize_Id "); h.CreateCommand(strSql.ToString()); if (model.Organize_Id == null) { h.AddParameter("@Organize_Id", DBNull.Value); } else { h.AddParameter("@Organize_Id", model.Organize_Id); } if (model.ParentId == null) { h.AddParameter("@ParentId", DBNull.Value); } else { h.AddParameter("@ParentId", model.ParentId); } if (model.Number == null) { h.AddParameter("@Number", DBNull.Value); } else { h.AddParameter("@Number", model.Number); } if (model.Name == null) { h.AddParameter("@Name", DBNull.Value); } else { h.AddParameter("@Name", model.Name); } if (model.ShortName == null) { h.AddParameter("@ShortName", DBNull.Value); } else { h.AddParameter("@ShortName", model.ShortName); } if (model.Category == null) { h.AddParameter("@Category", DBNull.Value); } else { h.AddParameter("@Category", model.Category); } if (model.OuterPhone == null) { h.AddParameter("@OuterPhone", DBNull.Value); } else { h.AddParameter("@OuterPhone", model.OuterPhone); } if (model.InnerPhone == null) { h.AddParameter("@InnerPhone", DBNull.Value); } else { h.AddParameter("@InnerPhone", model.InnerPhone); } if (model.Fax == null) { h.AddParameter("@Fax", DBNull.Value); } else { h.AddParameter("@Fax", model.Fax); } if (model.Postalcode == null) { h.AddParameter("@Postalcode", DBNull.Value); } else { h.AddParameter("@Postalcode", model.Postalcode); } if (model.Address == null) { h.AddParameter("@Address", DBNull.Value); } else { h.AddParameter("@Address", model.Address); } if (model.Web == null) { h.AddParameter("@Web", DBNull.Value); } else { h.AddParameter("@Web", model.Web); } if (model.Bank == null) { h.AddParameter("@Bank", DBNull.Value); } else { h.AddParameter("@Bank", model.Bank); } if (model.BankAccount == null) { h.AddParameter("@BankAccount", DBNull.Value); } else { h.AddParameter("@BankAccount", model.BankAccount); } if (model.Layer == null) { h.AddParameter("@Layer", DBNull.Value); } else { h.AddParameter("@Layer", model.Layer); } if (model.IsInnerOrganize == null) { h.AddParameter("@IsInnerOrganize", DBNull.Value); } else { h.AddParameter("@IsInnerOrganize", model.IsInnerOrganize); } if (model.DeletionStateCode == null) { h.AddParameter("@DeletionStateCode", DBNull.Value); } else { h.AddParameter("@DeletionStateCode", model.DeletionStateCode); } if (model.PY == null) { h.AddParameter("@PY", DBNull.Value); } else { h.AddParameter("@PY", model.PY); } if (model.Sort == null) { h.AddParameter("@Sort", DBNull.Value); } else { h.AddParameter("@Sort", model.Sort); } if (model.Dept_Id == null) { h.AddParameter("@Dept_Id", DBNull.Value); } else { h.AddParameter("@Dept_Id", model.Dept_Id); } if (model.DeptName == null) { h.AddParameter("@DeptName", DBNull.Value); } else { h.AddParameter("@DeptName", model.DeptName); } if (model.Company_Id == null) { h.AddParameter("@Company_Id", DBNull.Value); } else { h.AddParameter("@Company_Id", model.Company_Id); } if (model.CompanyName == null) { h.AddParameter("@CompanyName", DBNull.Value); } else { h.AddParameter("@CompanyName", model.CompanyName); } if (model.Bloc_Id == null) { h.AddParameter("@Bloc_Id", DBNull.Value); } else { h.AddParameter("@Bloc_Id", model.Bloc_Id); } if (model.BlocName == null) { h.AddParameter("@BlocName", DBNull.Value); } else { h.AddParameter("@BlocName", model.BlocName); } if (model.CreateUserId == null) { h.AddParameter("@CreateUserId", DBNull.Value); } else { h.AddParameter("@CreateUserId", model.CreateUserId); } if (model.CreateName == null) { h.AddParameter("@CreateName", DBNull.Value); } else { h.AddParameter("@CreateName", model.CreateName); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.EditUserId == null) { h.AddParameter("@EditUserId", DBNull.Value); } else { h.AddParameter("@EditUserId", model.EditUserId); } if (model.EditUserName == null) { h.AddParameter("@EditUserName", DBNull.Value); } else { h.AddParameter("@EditUserName", model.EditUserName); } if (model.EditDate == null) { h.AddParameter("@EditDate", DBNull.Value); } else { h.AddParameter("@EditDate", model.EditDate); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.State == null) { h.AddParameter("@State", DBNull.Value); } else { h.AddParameter("@State", model.State); } if (model.SystemId == null) { h.AddParameter("@SystemId", DBNull.Value); } else { h.AddParameter("@SystemId", model.SystemId); } return(h.ExecuteNonQuery()); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Permission.Model.Bse_Organize model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_Organize("); strSql.Append("ParentId, Number, Name, ShortName, Category, OuterPhone, InnerPhone, Fax, Postalcode, Address, Web, Bank, BankAccount, Layer, IsInnerOrganize, DeletionStateCode, PY, Sort, Dept_Id, DeptName, Company_Id, CompanyName, Bloc_Id, BlocName, CreateUserId, CreateName, CreateDate, EditUserId, EditUserName, EditDate, Remark, State, SystemId )"); strSql.Append(" values ("); strSql.Append("@ParentId, @Number, @Name, @ShortName, @Category, @OuterPhone, @InnerPhone, @Fax, @Postalcode, @Address, @Web, @Bank, @BankAccount, @Layer, @IsInnerOrganize, @DeletionStateCode, @PY, @Sort, @Dept_Id, @DeptName, @Company_Id, @CompanyName, @Bloc_Id, @BlocName, @CreateUserId, @CreateName, @CreateDate, @EditUserId, @EditUserName, @EditDate, @Remark, @State, @SystemId )"); strSql.Append(";select @@IDENTITY"); h.CreateCommand(strSql.ToString()); if (model.ParentId == null) { h.AddParameter("@ParentId", DBNull.Value); } else { h.AddParameter("@ParentId", model.ParentId); } if (model.Number == null) { h.AddParameter("@Number", DBNull.Value); } else { h.AddParameter("@Number", model.Number); } if (model.Name == null) { h.AddParameter("@Name", DBNull.Value); } else { h.AddParameter("@Name", model.Name); } if (model.ShortName == null) { h.AddParameter("@ShortName", DBNull.Value); } else { h.AddParameter("@ShortName", model.ShortName); } if (model.Category == null) { h.AddParameter("@Category", DBNull.Value); } else { h.AddParameter("@Category", model.Category); } if (model.OuterPhone == null) { h.AddParameter("@OuterPhone", DBNull.Value); } else { h.AddParameter("@OuterPhone", model.OuterPhone); } if (model.InnerPhone == null) { h.AddParameter("@InnerPhone", DBNull.Value); } else { h.AddParameter("@InnerPhone", model.InnerPhone); } if (model.Fax == null) { h.AddParameter("@Fax", DBNull.Value); } else { h.AddParameter("@Fax", model.Fax); } if (model.Postalcode == null) { h.AddParameter("@Postalcode", DBNull.Value); } else { h.AddParameter("@Postalcode", model.Postalcode); } if (model.Address == null) { h.AddParameter("@Address", DBNull.Value); } else { h.AddParameter("@Address", model.Address); } if (model.Web == null) { h.AddParameter("@Web", DBNull.Value); } else { h.AddParameter("@Web", model.Web); } if (model.Bank == null) { h.AddParameter("@Bank", DBNull.Value); } else { h.AddParameter("@Bank", model.Bank); } if (model.BankAccount == null) { h.AddParameter("@BankAccount", DBNull.Value); } else { h.AddParameter("@BankAccount", model.BankAccount); } if (model.Layer == null) { h.AddParameter("@Layer", DBNull.Value); } else { h.AddParameter("@Layer", model.Layer); } if (model.IsInnerOrganize == null) { h.AddParameter("@IsInnerOrganize", DBNull.Value); } else { h.AddParameter("@IsInnerOrganize", model.IsInnerOrganize); } if (model.DeletionStateCode == null) { h.AddParameter("@DeletionStateCode", DBNull.Value); } else { h.AddParameter("@DeletionStateCode", model.DeletionStateCode); } if (model.PY == null) { h.AddParameter("@PY", DBNull.Value); } else { h.AddParameter("@PY", model.PY); } if (model.Sort == null) { h.AddParameter("@Sort", DBNull.Value); } else { h.AddParameter("@Sort", model.Sort); } if (model.Dept_Id == null) { h.AddParameter("@Dept_Id", DBNull.Value); } else { h.AddParameter("@Dept_Id", model.Dept_Id); } if (model.DeptName == null) { h.AddParameter("@DeptName", DBNull.Value); } else { h.AddParameter("@DeptName", model.DeptName); } if (model.Company_Id == null) { h.AddParameter("@Company_Id", DBNull.Value); } else { h.AddParameter("@Company_Id", model.Company_Id); } if (model.CompanyName == null) { h.AddParameter("@CompanyName", DBNull.Value); } else { h.AddParameter("@CompanyName", model.CompanyName); } if (model.Bloc_Id == null) { h.AddParameter("@Bloc_Id", DBNull.Value); } else { h.AddParameter("@Bloc_Id", model.Bloc_Id); } if (model.BlocName == null) { h.AddParameter("@BlocName", DBNull.Value); } else { h.AddParameter("@BlocName", model.BlocName); } if (model.CreateUserId == null) { h.AddParameter("@CreateUserId", DBNull.Value); } else { h.AddParameter("@CreateUserId", model.CreateUserId); } if (model.CreateName == null) { h.AddParameter("@CreateName", DBNull.Value); } else { h.AddParameter("@CreateName", model.CreateName); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.EditUserId == null) { h.AddParameter("@EditUserId", DBNull.Value); } else { h.AddParameter("@EditUserId", model.EditUserId); } if (model.EditUserName == null) { h.AddParameter("@EditUserName", DBNull.Value); } else { h.AddParameter("@EditUserName", model.EditUserName); } if (model.EditDate == null) { h.AddParameter("@EditDate", DBNull.Value); } else { h.AddParameter("@EditDate", model.EditDate); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.State == null) { h.AddParameter("@State", DBNull.Value); } else { h.AddParameter("@State", model.State); } if (model.SystemId == null) { h.AddParameter("@SystemId", DBNull.Value); } else { h.AddParameter("@SystemId", model.SystemId); } int result; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out result)) { return(0); } return(result); }