/// <summary>获得数据列表 /// /// </summary> public DataSet GetList(string strWhere) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); DataSet ds = new DataSet(); try { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" FROM Bse_Menu "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } h.CreateCommand(strSql.ToString()); DataTable dt = h.ExecuteQuery(); ds.Tables.Add(dt); } catch (Exception ex) { throw ex; } return(ds); }
/// <summary>获得数据列表 /// /// </summary> public DataSet GetMenusRibbon() { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); h.CreateStoredCommand("Sp_GetMenus_Ribbon"); DataSet ds = h.ExecuteQueryDataSet(); return(ds); }
/// <summary>删除一条数据 /// /// </summary> public bool Delete(int Account_Id) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("delete from Bse_Role_Menu "); strSql.Append(" where Account_Id=@Account_Id "); h.CreateCommand(strSql.ToString()); h.AddParameter("@Account_Id", Account_Id); return(h.ExecuteNonQuery()); }
/// <summary>计算记录数 /// /// </summary> /// <param name="p"></param> /// <returns></returns> public int CalcCount(string cond) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); string sql = "select count(1) from Bse_Role_Menu"; if (!string.IsNullOrEmpty(cond)) { sql += " where " + cond; } h.CreateCommand(sql); return(int.Parse(h.ExecuteScalar())); }
/// <summary>删除一条数据 /// /// </summary> public bool Delete(int User_Organize_Id) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("delete from Bse_User_Organize "); strSql.Append(" where User_Organize_Id=@User_Organize_Id "); h.CreateCommand(strSql.ToString()); h.AddParameter("@User_Organize_Id", User_Organize_Id); return(h.ExecuteNonQuery()); }
/// <summary>获得数据列表 /// /// </summary> public DataSet GetList(string Realname, string Number, string Name, string Sex, string Role_Id) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM dbo.Bse_User A INNER JOIN Bse_User_Role B ON A.User_Id=B.UserId WHERE A.State=1 and ( A.Realname LIKE '%" + Realname + "%' OR '" + Realname + "'='') AND ( A.Number LIKE '%" + Number + "%' OR '" + Number + "'='') AND ( A.UserName LIKE '%" + Name + "%' OR '" + Name + "'='') AND ( A.Sex LIKE '%" + Sex + "%' OR '" + Sex + "'='') AND B.RoleId=" + Role_Id + ""); h.CreateCommand(strSql.ToString()); DataTable dt = h.ExecuteQuery(); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>根据条件删除数据 /// /// </summary> public bool DeleteByCond(string cond) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("delete from Bse_Role_Menu "); if (!string.IsNullOrEmpty(cond)) { strSql.Append(" where " + cond); } h.CreateCommand(strSql.ToString()); return(h.ExecuteNonQuery()); }
public bool AddMenuToRole(Dictionary <string, string> moduleIds, string roleId, string createUserId, string deptId, string companyId, string blocId, string systemId) { IMsSqlDataAccessService _h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); foreach (KeyValuePair <string, string> item in moduleIds) { strSql.AppendLine(" insert into Bse_Role_Menu([Module_Id] ,[Role_Id],CreateUserId,Dept_Id,Company_Id,Bloc_Id,SystemId,[Allowed_Operator])Values (" + item.Key + ",'" + roleId + "','" + createUserId + "' ,'" + deptId + "' ,'" + companyId + "' ,'" + blocId + "' ,'" + systemId + "',+'" + item.Value + "') "); } _h.CreateCommand(strSql.ToString()); bool flag = _h.ExecuteNonQuery(); return(flag); }
/// <summary>获得用户所属机构 /// /// </summary> public DataSet GetListUserOrganize(string strWhere) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT b.Name as BlockName,c.Name as CompanyName ,d.Name as DeptName FROM dbo.Bse_User a INNER JOIN dbo.Bse_Organize b ON a.Bloc_Id=b.Organize_Id INNER JOIN dbo.Bse_Organize c ON a.Company_Id=c.Organize_Id INNER JOIN dbo.Bse_Organize d ON a.Dept_Id=d.Organize_Id "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } h.CreateCommand(strSql.ToString()); DataTable dt = h.ExecuteQuery(); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(int State, string User_Id) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_User set state=@state "); strSql.Append(" where User_Id=@User_Id "); h.CreateCommand(strSql.ToString()); h.AddParameter("@User_Id", User_Id); h.AddParameter("@State", State); return(h.ExecuteNonQuery()); }
/// <summary>批量插入 /// /// </summary> public bool AddUserToOrganize(string UserIds, string RoleId, string CreateUserId, string Dept_Id, string Company_Id, string Bloc_Id, string SystemId, string strWhere) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append(" insert into Bse_User_Organize([User_Id] ,[Organize_Id],CreateUserId,Dept_Id,Company_Id,Bloc_Id,SystemId) " + "Select B.Id,'" + RoleId + "','" + CreateUserId + "' ,'" + Dept_Id + "' ,'" + Company_Id + "' ,'" + Bloc_Id + "' ,'" + SystemId + "' FROM Fun_StringSplitToTable('" + UserIds + "',',') B "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } h.CreateCommand(strSql.ToString()); bool flag = h.ExecuteNonQuery(); return(flag); }
/// <summary>获得用户所属角色 /// /// </summary> public DataSet GetListUserRoleIds(string strWhere) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append(" SELECT CAST ( f.Role_Id as VARCHAR) Role_Id INTO #TEMP FROM dbo.Bse_User a INNER JOIN dbo.Bse_User_Role e ON e.UserId=a.User_Id INNER JOIN dbo.Bse_Role f ON f.Role_Id=e.RoleId "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } strSql.Append(" EXEC [Sp_TableToString] 'Role_Id','#TEMP','' DROP TABLE #TEMP"); h.CreateCommand(strSql.ToString()); DataTable dt = h.ExecuteQuery(); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>分页获取数据列表 /// /// </summary> public DataSet GetList(string fileds, string order, string ordertype, int PageSize, int PageIndex, string strWhere) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); h.CreateStoredCommand("[proc_SplitPage]"); h.AddParameter("@tblName", "Bse_Role_Menu"); h.AddParameter("@strFields", fileds); h.AddParameter("@strOrder", order); h.AddParameter("@strOrderType", ordertype); h.AddParameter("@PageSize", PageSize); h.AddParameter("@PageIndex", PageIndex); h.AddParameter("@strWhere", strWhere); DataTable dt = h.ExecuteQuery(); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>获得数据列表 /// /// </summary> public DataSet GetUserByOrganizeId(string strWhere) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("select a.User_Organize_Id,b.* "); strSql.Append(" FROM Bse_User_Organize a inner join Bse_User b on a.User_Id=B.User_Id"); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } h.CreateCommand(strSql.ToString()); DataTable dt = h.ExecuteQuery(); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>获得数据列表 /// /// </summary> public DataSet GetList(string strWhere, string Filds) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("select " + Filds + " "); strSql.Append(" FROM Bse_Role_Menu "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } h.CreateCommand(strSql.ToString()); DataTable dt = h.ExecuteQuery(); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
public static IMsSqlDataAccessService GetMsSqlDataAccessService() { ChannelFactory <IMsSqlDataAccessService> factory = null; IMsSqlDataAccessService channel = null; try { //非负载均衡、集群 //factory = new ChannelFactory<IMsSqlDataAccessService>(new NetTcpBinding(), "net.tcp://localhost:13125/MsSqlDataAccessService/MsSqlDataAccessService"); //集群,考虑负载均衡的时候,按服务器配置情况,设置服务权重,随机分配服务地址 string strRetService = WcfConfigHelper.ReturnOneService("3"); factory = new ChannelFactory <IMsSqlDataAccessService>(new NetTcpBinding(), strRetService); channel = factory.CreateChannel(); } catch (Exception) { if (factory != null) { factory.Abort(); } } return(channel); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Permission.Model.Bse_Role_Menu model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_Role_Menu set "); strSql.Append("Module_Id=@Module_Id, Role_Id=@Role_Id, Allowed_Operator=@Allowed_Operator, 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, State=@State, SystemId=@SystemId "); strSql.Append(" where Account_Id=@Account_Id "); h.CreateCommand(strSql.ToString()); if (model.Account_Id == null) { h.AddParameter("@Account_Id", DBNull.Value); } else { h.AddParameter("@Account_Id", model.Account_Id); } if (model.Module_Id == null) { h.AddParameter("@Module_Id", DBNull.Value); } else { h.AddParameter("@Module_Id", model.Module_Id); } if (model.Role_Id == null) { h.AddParameter("@Role_Id", DBNull.Value); } else { h.AddParameter("@Role_Id", model.Role_Id); } if (model.Allowed_Operator == null) { h.AddParameter("@Allowed_Operator", DBNull.Value); } else { h.AddParameter("@Allowed_Operator", model.Allowed_Operator); } 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.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_User_Organize model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_User_Organize("); strSql.Append("User_Id, Organize_Id, DeletionStateCode, Sort, Dept_Id, DeptName, Company_Id, CompanyName, Bloc_Id, BlocName, CreateUserId, CreateName, CreateDate, EditUserId, EditUserName, EditDate, Remark, State, SystemId )"); strSql.Append(" values ("); strSql.Append("@User_Id, @Organize_Id, @DeletionStateCode, @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.User_Id == null) { h.AddParameter("@User_Id", DBNull.Value); } else { h.AddParameter("@User_Id", model.User_Id); } if (model.Organize_Id == null) { h.AddParameter("@Organize_Id", DBNull.Value); } else { h.AddParameter("@Organize_Id", model.Organize_Id); } if (model.DeletionStateCode == null) { h.AddParameter("@DeletionStateCode", DBNull.Value); } else { h.AddParameter("@DeletionStateCode", model.DeletionStateCode); } 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); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Permission.Model.Bse_Menu model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_Menu set "); strSql.Append("ParentId=@ParentId, Number=@Number, Name=@Name, Category=@Category, GroupTxt=@GroupTxt, ImagUrl=@ImagUrl, ImageIndex=@ImageIndex, SelectedImageIndex=@SelectedImageIndex, NavigateUrl=@NavigateUrl, Target=@Target, FormName=@FormName, DeletionStateCode=@DeletionStateCode, IsPublic=@IsPublic, Expand=@Expand, AllowEdit=@AllowEdit, AllowDelete=@AllowDelete, 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, TileItemSize=@TileItemSize, SystemId=@SystemId , ControlPower=@ControlPower "); strSql.Append(" where Module_Id=@Module_Id "); h.CreateCommand(strSql.ToString()); if (model.Module_Id == null) { h.AddParameter("@Module_Id", DBNull.Value); } else { h.AddParameter("@Module_Id", model.Module_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.Category == null) { h.AddParameter("@Category", DBNull.Value); } else { h.AddParameter("@Category", model.Category); } if (model.GroupTxt == null) { h.AddParameter("@GroupTxt", DBNull.Value); } else { h.AddParameter("@GroupTxt", model.GroupTxt); } if (model.ImagUrl == null) { h.AddParameter("@ImagUrl", DBNull.Value); } else { h.AddParameter("@ImagUrl", model.ImagUrl); } if (model.ImageIndex == null) { h.AddParameter("@ImageIndex", DBNull.Value); } else { h.AddParameter("@ImageIndex", model.ImageIndex); } if (model.SelectedImageIndex == null) { h.AddParameter("@SelectedImageIndex", DBNull.Value); } else { h.AddParameter("@SelectedImageIndex", model.SelectedImageIndex); } if (model.NavigateUrl == null) { h.AddParameter("@NavigateUrl", DBNull.Value); } else { h.AddParameter("@NavigateUrl", model.NavigateUrl); } if (model.Target == null) { h.AddParameter("@Target", DBNull.Value); } else { h.AddParameter("@Target", model.Target); } if (model.FormName == null) { h.AddParameter("@FormName", DBNull.Value); } else { h.AddParameter("@FormName", model.FormName); } if (model.DeletionStateCode == null) { h.AddParameter("@DeletionStateCode", DBNull.Value); } else { h.AddParameter("@DeletionStateCode", model.DeletionStateCode); } if (model.IsPublic == null) { h.AddParameter("@IsPublic", DBNull.Value); } else { h.AddParameter("@IsPublic", model.IsPublic); } if (model.Expand == null) { h.AddParameter("@Expand", DBNull.Value); } else { h.AddParameter("@Expand", model.Expand); } if (model.AllowEdit == null) { h.AddParameter("@AllowEdit", DBNull.Value); } else { h.AddParameter("@AllowEdit", model.AllowEdit); } if (model.AllowDelete == null) { h.AddParameter("@AllowDelete", DBNull.Value); } else { h.AddParameter("@AllowDelete", model.AllowDelete); } 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.TileItemSize == null) { h.AddParameter("@TileItemSize", DBNull.Value); } else { h.AddParameter("@TileItemSize", model.TileItemSize); } if (model.SystemId == null) { h.AddParameter("@SystemId", DBNull.Value); } else { h.AddParameter("@SystemId", model.SystemId); } if (model.ControlPower == null) { h.AddParameter("@ControlPower", DBNull.Value); } else { h.AddParameter("@ControlPower", model.ControlPower); } return(h.ExecuteNonQuery()); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Permission.Model.Bse_User_Organize model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_User_Organize set "); strSql.Append("User_Id=@User_Id, Organize_Id=@Organize_Id, DeletionStateCode=@DeletionStateCode, 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 User_Organize_Id=@User_Organize_Id "); h.CreateCommand(strSql.ToString()); if (model.User_Organize_Id == null) { h.AddParameter("@User_Organize_Id", DBNull.Value); } else { h.AddParameter("@User_Organize_Id", model.User_Organize_Id); } if (model.User_Id == null) { h.AddParameter("@User_Id", DBNull.Value); } else { h.AddParameter("@User_Id", model.User_Id); } if (model.Organize_Id == null) { h.AddParameter("@Organize_Id", DBNull.Value); } else { h.AddParameter("@Organize_Id", model.Organize_Id); } if (model.DeletionStateCode == null) { h.AddParameter("@DeletionStateCode", DBNull.Value); } else { h.AddParameter("@DeletionStateCode", model.DeletionStateCode); } 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_SetOrd model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_SetOrd("); strSql.Append("SetOrd_Key, Name, PY, Sort, Dept_Id, Company_Id, Bloc_Id, CreateName, CreateUserId, CreateDate, Remark, State, SystemId )"); strSql.Append(" values ("); strSql.Append("@SetOrd_Key, @Name, @PY, @Sort, @Dept_Id, @Company_Id, @Bloc_Id, @CreateName, @CreateUserId, @CreateDate, @Remark, @State, @SystemId )"); strSql.Append(";select @@IDENTITY"); h.CreateCommand(strSql.ToString()); if (model.SetOrd_Key == null) { h.AddParameter("@SetOrd_Key", DBNull.Value); } else { h.AddParameter("@SetOrd_Key", model.SetOrd_Key); } if (model.Name == null) { h.AddParameter("@Name", DBNull.Value); } else { h.AddParameter("@Name", model.Name); } 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.Company_Id == null) { h.AddParameter("@Company_Id", DBNull.Value); } else { h.AddParameter("@Company_Id", model.Company_Id); } if (model.Bloc_Id == null) { h.AddParameter("@Bloc_Id", DBNull.Value); } else { h.AddParameter("@Bloc_Id", model.Bloc_Id); } if (model.CreateName == null) { h.AddParameter("@CreateName", DBNull.Value); } else { h.AddParameter("@CreateName", model.CreateName); } if (model.CreateUserId == null) { h.AddParameter("@CreateUserId", DBNull.Value); } else { h.AddParameter("@CreateUserId", model.CreateUserId); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } 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); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Permission.Model.Bse_SetOrd model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_SetOrd set "); strSql.Append("SetOrd_Key=@SetOrd_Key, Name=@Name, PY=@PY, Sort=@Sort, Dept_Id=@Dept_Id, Company_Id=@Company_Id, Bloc_Id=@Bloc_Id, CreateName=@CreateName, CreateUserId=@CreateUserId, CreateDate=@CreateDate, Remark=@Remark, State=@State, SystemId=@SystemId "); strSql.Append(" where SetOrd_Id=@SetOrd_Id "); h.CreateCommand(strSql.ToString()); if (model.SetOrd_Id == null) { h.AddParameter("@SetOrd_Id", DBNull.Value); } else { h.AddParameter("@SetOrd_Id", model.SetOrd_Id); } if (model.SetOrd_Key == null) { h.AddParameter("@SetOrd_Key", DBNull.Value); } else { h.AddParameter("@SetOrd_Key", model.SetOrd_Key); } if (model.Name == null) { h.AddParameter("@Name", DBNull.Value); } else { h.AddParameter("@Name", model.Name); } 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.Company_Id == null) { h.AddParameter("@Company_Id", DBNull.Value); } else { h.AddParameter("@Company_Id", model.Company_Id); } if (model.Bloc_Id == null) { h.AddParameter("@Bloc_Id", DBNull.Value); } else { h.AddParameter("@Bloc_Id", model.Bloc_Id); } if (model.CreateName == null) { h.AddParameter("@CreateName", DBNull.Value); } else { h.AddParameter("@CreateName", model.CreateName); } if (model.CreateUserId == null) { h.AddParameter("@CreateUserId", DBNull.Value); } else { h.AddParameter("@CreateUserId", model.CreateUserId); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } 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 bool Update(Nikita.Permission.Model.Bse_System model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_System set "); strSql.Append("System_Name=@System_Name, System_Type=@System_Type, System_Version=@System_Version, System_Language=@System_Language, CustNumber=@CustNumber, LimitNumber=@LimitNumber, 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 "); strSql.Append(" where System_Id=@System_Id "); h.CreateCommand(strSql.ToString()); if (model.System_Id == null) { h.AddParameter("@System_Id", DBNull.Value); } else { h.AddParameter("@System_Id", model.System_Id); } if (model.System_Name == null) { h.AddParameter("@System_Name", DBNull.Value); } else { h.AddParameter("@System_Name", model.System_Name); } if (model.System_Type == null) { h.AddParameter("@System_Type", DBNull.Value); } else { h.AddParameter("@System_Type", model.System_Type); } if (model.System_Version == null) { h.AddParameter("@System_Version", DBNull.Value); } else { h.AddParameter("@System_Version", model.System_Version); } if (model.System_Language == null) { h.AddParameter("@System_Language", DBNull.Value); } else { h.AddParameter("@System_Language", model.System_Language); } if (model.CustNumber == null) { h.AddParameter("@CustNumber", DBNull.Value); } else { h.AddParameter("@CustNumber", model.CustNumber); } if (model.LimitNumber == null) { h.AddParameter("@LimitNumber", DBNull.Value); } else { h.AddParameter("@LimitNumber", model.LimitNumber); } 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); } return(h.ExecuteNonQuery()); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Permission.Model.Bse_User model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_User set "); strSql.Append("Number=@Number, UserName=@UserName, Realname=@Realname, NiName=@NiName, UserFrom=@UserFrom, Password=@Password, ChangePasswordDate=@ChangePasswordDate, Duty=@Duty, Title=@Title, Email=@Email, Lang=@Lang, Sex=@Sex, Birthday=@Birthday, Mobile=@Mobile, Telephone=@Telephone, QQ=@QQ, SFZNumber=@SFZNumber, HomeAddress=@HomeAddress, HomeTel=@HomeTel, WorkAddress=@WorkAddress, WorkTel=@WorkTel, Theme=@Theme, AllowStartTime=@AllowStartTime, AllowEndTime=@AllowEndTime, LockStartDate=@LockStartDate, LockEndDate=@LockEndDate, FirstVisit=@FirstVisit, PreviousVisit=@PreviousVisit, LastVisit=@LastVisit, LogOnCount=@LogOnCount, IsStaff=@IsStaff, IsVisible=@IsVisible, IPAddress=@IPAddress, MACAddress=@MACAddress, Question=@Question, AnswerQuestion=@AnswerQuestion, UserAddressId=@UserAddressId, AuditStatus=@AuditStatus, 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 User_Id=@User_Id "); 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.Number == null) { h.AddParameter("@Number", DBNull.Value); } else { h.AddParameter("@Number", model.Number); } if (model.UserName == null) { h.AddParameter("@UserName", DBNull.Value); } else { h.AddParameter("@UserName", model.UserName); } if (model.Realname == null) { h.AddParameter("@Realname", DBNull.Value); } else { h.AddParameter("@Realname", model.Realname); } if (model.NiName == null) { h.AddParameter("@NiName", DBNull.Value); } else { h.AddParameter("@NiName", model.NiName); } if (model.UserFrom == null) { h.AddParameter("@UserFrom", DBNull.Value); } else { h.AddParameter("@UserFrom", model.UserFrom); } if (model.Password == null) { h.AddParameter("@Password", DBNull.Value); } else { h.AddParameter("@Password", model.Password); } if (model.ChangePasswordDate == null) { h.AddParameter("@ChangePasswordDate", DBNull.Value); } else { h.AddParameter("@ChangePasswordDate", model.ChangePasswordDate); } if (model.Duty == null) { h.AddParameter("@Duty", DBNull.Value); } else { h.AddParameter("@Duty", model.Duty); } if (model.Title == null) { h.AddParameter("@Title", DBNull.Value); } else { h.AddParameter("@Title", model.Title); } if (model.Email == null) { h.AddParameter("@Email", DBNull.Value); } else { h.AddParameter("@Email", model.Email); } if (model.Lang == null) { h.AddParameter("@Lang", DBNull.Value); } else { h.AddParameter("@Lang", model.Lang); } if (model.Sex == null) { h.AddParameter("@Sex", DBNull.Value); } else { h.AddParameter("@Sex", model.Sex); } if (model.Birthday == null) { h.AddParameter("@Birthday", DBNull.Value); } else { h.AddParameter("@Birthday", model.Birthday); } if (model.Mobile == null) { h.AddParameter("@Mobile", DBNull.Value); } else { h.AddParameter("@Mobile", model.Mobile); } if (model.Telephone == null) { h.AddParameter("@Telephone", DBNull.Value); } else { h.AddParameter("@Telephone", model.Telephone); } if (model.QQ == null) { h.AddParameter("@QQ", DBNull.Value); } else { h.AddParameter("@QQ", model.QQ); } if (model.SFZNumber == null) { h.AddParameter("@SFZNumber", DBNull.Value); } else { h.AddParameter("@SFZNumber", model.SFZNumber); } if (model.HomeAddress == null) { h.AddParameter("@HomeAddress", DBNull.Value); } else { h.AddParameter("@HomeAddress", model.HomeAddress); } if (model.HomeTel == null) { h.AddParameter("@HomeTel", DBNull.Value); } else { h.AddParameter("@HomeTel", model.HomeTel); } if (model.WorkAddress == null) { h.AddParameter("@WorkAddress", DBNull.Value); } else { h.AddParameter("@WorkAddress", model.WorkAddress); } if (model.WorkTel == null) { h.AddParameter("@WorkTel", DBNull.Value); } else { h.AddParameter("@WorkTel", model.WorkTel); } if (model.Theme == null) { h.AddParameter("@Theme", DBNull.Value); } else { h.AddParameter("@Theme", model.Theme); } if (model.AllowStartTime == null) { h.AddParameter("@AllowStartTime", DBNull.Value); } else { h.AddParameter("@AllowStartTime", model.AllowStartTime); } if (model.AllowEndTime == null) { h.AddParameter("@AllowEndTime", DBNull.Value); } else { h.AddParameter("@AllowEndTime", model.AllowEndTime); } if (model.LockStartDate == null) { h.AddParameter("@LockStartDate", DBNull.Value); } else { h.AddParameter("@LockStartDate", model.LockStartDate); } if (model.LockEndDate == null) { h.AddParameter("@LockEndDate", DBNull.Value); } else { h.AddParameter("@LockEndDate", model.LockEndDate); } if (model.FirstVisit == null) { h.AddParameter("@FirstVisit", DBNull.Value); } else { h.AddParameter("@FirstVisit", model.FirstVisit); } if (model.PreviousVisit == null) { h.AddParameter("@PreviousVisit", DBNull.Value); } else { h.AddParameter("@PreviousVisit", model.PreviousVisit); } if (model.LastVisit == null) { h.AddParameter("@LastVisit", DBNull.Value); } else { h.AddParameter("@LastVisit", model.LastVisit); } if (model.LogOnCount == null) { h.AddParameter("@LogOnCount", DBNull.Value); } else { h.AddParameter("@LogOnCount", model.LogOnCount); } if (model.IsStaff == null) { h.AddParameter("@IsStaff", DBNull.Value); } else { h.AddParameter("@IsStaff", model.IsStaff); } if (model.IsVisible == null) { h.AddParameter("@IsVisible", DBNull.Value); } else { h.AddParameter("@IsVisible", model.IsVisible); } if (model.IPAddress == null) { h.AddParameter("@IPAddress", DBNull.Value); } else { h.AddParameter("@IPAddress", model.IPAddress); } if (model.MACAddress == null) { h.AddParameter("@MACAddress", DBNull.Value); } else { h.AddParameter("@MACAddress", model.MACAddress); } if (model.Question == null) { h.AddParameter("@Question", DBNull.Value); } else { h.AddParameter("@Question", model.Question); } if (model.AnswerQuestion == null) { h.AddParameter("@AnswerQuestion", DBNull.Value); } else { h.AddParameter("@AnswerQuestion", model.AnswerQuestion); } if (model.UserAddressId == null) { h.AddParameter("@UserAddressId", DBNull.Value); } else { h.AddParameter("@UserAddressId", model.UserAddressId); } if (model.AuditStatus == null) { h.AddParameter("@AuditStatus", DBNull.Value); } else { h.AddParameter("@AuditStatus", model.AuditStatus); } 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_User model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_User("); strSql.Append("Number, UserName, Realname, NiName, UserFrom, Password, ChangePasswordDate, Duty, Title, Email, Lang, Sex, Birthday, Mobile, Telephone, QQ, SFZNumber, HomeAddress, HomeTel, WorkAddress, WorkTel, Theme, AllowStartTime, AllowEndTime, LockStartDate, LockEndDate, FirstVisit, PreviousVisit, LastVisit, LogOnCount, IsStaff, IsVisible, IPAddress, MACAddress, Question, AnswerQuestion, UserAddressId, AuditStatus, 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("@Number, @UserName, @Realname, @NiName, @UserFrom, @Password, @ChangePasswordDate, @Duty, @Title, @Email, @Lang, @Sex, @Birthday, @Mobile, @Telephone, @QQ, @SFZNumber, @HomeAddress, @HomeTel, @WorkAddress, @WorkTel, @Theme, @AllowStartTime, @AllowEndTime, @LockStartDate, @LockEndDate, @FirstVisit, @PreviousVisit, @LastVisit, @LogOnCount, @IsStaff, @IsVisible, @IPAddress, @MACAddress, @Question, @AnswerQuestion, @UserAddressId, @AuditStatus, @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.Number == null) { h.AddParameter("@Number", DBNull.Value); } else { h.AddParameter("@Number", model.Number); } if (model.UserName == null) { h.AddParameter("@UserName", DBNull.Value); } else { h.AddParameter("@UserName", model.UserName); } if (model.Realname == null) { h.AddParameter("@Realname", DBNull.Value); } else { h.AddParameter("@Realname", model.Realname); } if (model.NiName == null) { h.AddParameter("@NiName", DBNull.Value); } else { h.AddParameter("@NiName", model.NiName); } if (model.UserFrom == null) { h.AddParameter("@UserFrom", DBNull.Value); } else { h.AddParameter("@UserFrom", model.UserFrom); } if (model.Password == null) { h.AddParameter("@Password", DBNull.Value); } else { h.AddParameter("@Password", model.Password); } if (model.ChangePasswordDate == null) { h.AddParameter("@ChangePasswordDate", DBNull.Value); } else { h.AddParameter("@ChangePasswordDate", model.ChangePasswordDate); } if (model.Duty == null) { h.AddParameter("@Duty", DBNull.Value); } else { h.AddParameter("@Duty", model.Duty); } if (model.Title == null) { h.AddParameter("@Title", DBNull.Value); } else { h.AddParameter("@Title", model.Title); } if (model.Email == null) { h.AddParameter("@Email", DBNull.Value); } else { h.AddParameter("@Email", model.Email); } if (model.Lang == null) { h.AddParameter("@Lang", DBNull.Value); } else { h.AddParameter("@Lang", model.Lang); } if (model.Sex == null) { h.AddParameter("@Sex", DBNull.Value); } else { h.AddParameter("@Sex", model.Sex); } if (model.Birthday == null) { h.AddParameter("@Birthday", DBNull.Value); } else { h.AddParameter("@Birthday", model.Birthday); } if (model.Mobile == null) { h.AddParameter("@Mobile", DBNull.Value); } else { h.AddParameter("@Mobile", model.Mobile); } if (model.Telephone == null) { h.AddParameter("@Telephone", DBNull.Value); } else { h.AddParameter("@Telephone", model.Telephone); } if (model.QQ == null) { h.AddParameter("@QQ", DBNull.Value); } else { h.AddParameter("@QQ", model.QQ); } if (model.SFZNumber == null) { h.AddParameter("@SFZNumber", DBNull.Value); } else { h.AddParameter("@SFZNumber", model.SFZNumber); } if (model.HomeAddress == null) { h.AddParameter("@HomeAddress", DBNull.Value); } else { h.AddParameter("@HomeAddress", model.HomeAddress); } if (model.HomeTel == null) { h.AddParameter("@HomeTel", DBNull.Value); } else { h.AddParameter("@HomeTel", model.HomeTel); } if (model.WorkAddress == null) { h.AddParameter("@WorkAddress", DBNull.Value); } else { h.AddParameter("@WorkAddress", model.WorkAddress); } if (model.WorkTel == null) { h.AddParameter("@WorkTel", DBNull.Value); } else { h.AddParameter("@WorkTel", model.WorkTel); } if (model.Theme == null) { h.AddParameter("@Theme", DBNull.Value); } else { h.AddParameter("@Theme", model.Theme); } if (model.AllowStartTime == null) { h.AddParameter("@AllowStartTime", DBNull.Value); } else { h.AddParameter("@AllowStartTime", model.AllowStartTime); } if (model.AllowEndTime == null) { h.AddParameter("@AllowEndTime", DBNull.Value); } else { h.AddParameter("@AllowEndTime", model.AllowEndTime); } if (model.LockStartDate == null) { h.AddParameter("@LockStartDate", DBNull.Value); } else { h.AddParameter("@LockStartDate", model.LockStartDate); } if (model.LockEndDate == null) { h.AddParameter("@LockEndDate", DBNull.Value); } else { h.AddParameter("@LockEndDate", model.LockEndDate); } if (model.FirstVisit == null) { h.AddParameter("@FirstVisit", DBNull.Value); } else { h.AddParameter("@FirstVisit", model.FirstVisit); } if (model.PreviousVisit == null) { h.AddParameter("@PreviousVisit", DBNull.Value); } else { h.AddParameter("@PreviousVisit", model.PreviousVisit); } if (model.LastVisit == null) { h.AddParameter("@LastVisit", DBNull.Value); } else { h.AddParameter("@LastVisit", model.LastVisit); } if (model.LogOnCount == null) { h.AddParameter("@LogOnCount", DBNull.Value); } else { h.AddParameter("@LogOnCount", model.LogOnCount); } if (model.IsStaff == null) { h.AddParameter("@IsStaff", DBNull.Value); } else { h.AddParameter("@IsStaff", model.IsStaff); } if (model.IsVisible == null) { h.AddParameter("@IsVisible", DBNull.Value); } else { h.AddParameter("@IsVisible", model.IsVisible); } if (model.IPAddress == null) { h.AddParameter("@IPAddress", DBNull.Value); } else { h.AddParameter("@IPAddress", model.IPAddress); } if (model.MACAddress == null) { h.AddParameter("@MACAddress", DBNull.Value); } else { h.AddParameter("@MACAddress", model.MACAddress); } if (model.Question == null) { h.AddParameter("@Question", DBNull.Value); } else { h.AddParameter("@Question", model.Question); } if (model.AnswerQuestion == null) { h.AddParameter("@AnswerQuestion", DBNull.Value); } else { h.AddParameter("@AnswerQuestion", model.AnswerQuestion); } if (model.UserAddressId == null) { h.AddParameter("@UserAddressId", DBNull.Value); } else { h.AddParameter("@UserAddressId", model.UserAddressId); } if (model.AuditStatus == null) { h.AddParameter("@AuditStatus", DBNull.Value); } else { h.AddParameter("@AuditStatus", model.AuditStatus); } 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); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Permission.Model.Bse_Role_Menu model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_Role_Menu("); strSql.Append("Module_Id, Role_Id, Allowed_Operator, Dept_Id, DeptName, Company_Id, CompanyName, Bloc_Id, BlocName, CreateUserId, CreateName, CreateDate, EditUserId, EditUserName, EditDate, State, SystemId )"); strSql.Append(" values ("); strSql.Append("@Module_Id, @Role_Id, @Allowed_Operator, @Dept_Id, @DeptName, @Company_Id, @CompanyName, @Bloc_Id, @BlocName, @CreateUserId, @CreateName, @CreateDate, @EditUserId, @EditUserName, @EditDate, @State, @SystemId )"); strSql.Append(";select @@IDENTITY"); h.CreateCommand(strSql.ToString()); if (model.Module_Id == null) { h.AddParameter("@Module_Id", DBNull.Value); } else { h.AddParameter("@Module_Id", model.Module_Id); } if (model.Role_Id == null) { h.AddParameter("@Role_Id", DBNull.Value); } else { h.AddParameter("@Role_Id", model.Role_Id); } if (model.Allowed_Operator == null) { h.AddParameter("@Allowed_Operator", DBNull.Value); } else { h.AddParameter("@Allowed_Operator", model.Allowed_Operator); } 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.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); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Permission.Model.Bse_Role model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_Role("); strSql.Append("SystemId, RoleNumber, Name, Type, AllowEdit, AllowDelete, IsVisible, OwnerCompany, PY, Sort, Dept_Id, DeptName, Company_Id, CompanyName, Bloc_Id, BlocName, CreateUserId, CreateName, CreateDate, EditUserId, EditUserName, EditDate, Remark, State )"); strSql.Append(" values ("); strSql.Append("@SystemId, @RoleNumber, @Name, @Type, @AllowEdit, @AllowDelete, @IsVisible, @OwnerCompany, @PY, @Sort, @Dept_Id, @DeptName, @Company_Id, @CompanyName, @Bloc_Id, @BlocName, @CreateUserId, @CreateName, @CreateDate, @EditUserId, @EditUserName, @EditDate, @Remark, @State )"); strSql.Append(";select @@IDENTITY"); h.CreateCommand(strSql.ToString()); if (model.SystemId == null) { h.AddParameter("@SystemId", DBNull.Value); } else { h.AddParameter("@SystemId", model.SystemId); } if (model.RoleNumber == null) { h.AddParameter("@RoleNumber", DBNull.Value); } else { h.AddParameter("@RoleNumber", model.RoleNumber); } if (model.Name == null) { h.AddParameter("@Name", DBNull.Value); } else { h.AddParameter("@Name", model.Name); } if (model.Type == null) { h.AddParameter("@Type", DBNull.Value); } else { h.AddParameter("@Type", model.Type); } if (model.AllowEdit == null) { h.AddParameter("@AllowEdit", DBNull.Value); } else { h.AddParameter("@AllowEdit", model.AllowEdit); } if (model.AllowDelete == null) { h.AddParameter("@AllowDelete", DBNull.Value); } else { h.AddParameter("@AllowDelete", model.AllowDelete); } if (model.IsVisible == null) { h.AddParameter("@IsVisible", DBNull.Value); } else { h.AddParameter("@IsVisible", model.IsVisible); } if (model.OwnerCompany == null) { h.AddParameter("@OwnerCompany", DBNull.Value); } else { h.AddParameter("@OwnerCompany", model.OwnerCompany); } 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); } int result; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out result)) { return(0); } return(result); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Permission.Model.Bse_Menu model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_Menu("); strSql.Append("ParentId, Number, Name, Category, GroupTxt, ImagUrl, ImageIndex, SelectedImageIndex, NavigateUrl, Target, FormName, DeletionStateCode, IsPublic, Expand, AllowEdit, AllowDelete, PY, Sort, Dept_Id, DeptName, Company_Id, CompanyName, Bloc_Id, BlocName, CreateUserId, CreateName, CreateDate, EditUserId, EditUserName, EditDate, Remark, State, TileItemSize, SystemId,ControlPower )"); strSql.Append(" values ("); strSql.Append("@ParentId, @Number, @Name, @Category, @GroupTxt, @ImagUrl, @ImageIndex, @SelectedImageIndex, @NavigateUrl, @Target, @FormName, @DeletionStateCode, @IsPublic, @Expand, @AllowEdit, @AllowDelete, @PY, @Sort, @Dept_Id, @DeptName, @Company_Id, @CompanyName, @Bloc_Id, @BlocName, @CreateUserId, @CreateName, @CreateDate, @EditUserId, @EditUserName, @EditDate, @Remark, @State, @TileItemSize, @SystemId , @ControlPower)"); 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.Category == null) { h.AddParameter("@Category", DBNull.Value); } else { h.AddParameter("@Category", model.Category); } if (model.GroupTxt == null) { h.AddParameter("@GroupTxt", DBNull.Value); } else { h.AddParameter("@GroupTxt", model.GroupTxt); } if (model.ImagUrl == null) { h.AddParameter("@ImagUrl", DBNull.Value); } else { h.AddParameter("@ImagUrl", model.ImagUrl); } if (model.ImageIndex == null) { h.AddParameter("@ImageIndex", DBNull.Value); } else { h.AddParameter("@ImageIndex", model.ImageIndex); } if (model.SelectedImageIndex == null) { h.AddParameter("@SelectedImageIndex", DBNull.Value); } else { h.AddParameter("@SelectedImageIndex", model.SelectedImageIndex); } if (model.NavigateUrl == null) { h.AddParameter("@NavigateUrl", DBNull.Value); } else { h.AddParameter("@NavigateUrl", model.NavigateUrl); } if (model.Target == null) { h.AddParameter("@Target", DBNull.Value); } else { h.AddParameter("@Target", model.Target); } if (model.FormName == null) { h.AddParameter("@FormName", DBNull.Value); } else { h.AddParameter("@FormName", model.FormName); } if (model.DeletionStateCode == null) { h.AddParameter("@DeletionStateCode", DBNull.Value); } else { h.AddParameter("@DeletionStateCode", model.DeletionStateCode); } if (model.IsPublic == null) { h.AddParameter("@IsPublic", DBNull.Value); } else { h.AddParameter("@IsPublic", model.IsPublic); } if (model.Expand == null) { h.AddParameter("@Expand", DBNull.Value); } else { h.AddParameter("@Expand", model.Expand); } if (model.AllowEdit == null) { h.AddParameter("@AllowEdit", DBNull.Value); } else { h.AddParameter("@AllowEdit", model.AllowEdit); } if (model.AllowDelete == null) { h.AddParameter("@AllowDelete", DBNull.Value); } else { h.AddParameter("@AllowDelete", model.AllowDelete); } 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.TileItemSize == null) { h.AddParameter("@TileItemSize", DBNull.Value); } else { h.AddParameter("@TileItemSize", model.TileItemSize); } if (model.SystemId == null) { h.AddParameter("@SystemId", DBNull.Value); } else { h.AddParameter("@SystemId", model.SystemId); } if (model.ControlPower == null) { h.AddParameter("@ControlPower", DBNull.Value); } else { h.AddParameter("@ControlPower", model.ControlPower); } int result; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out result)) { return(0); } return(result); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Permission.Model.Bse_Role model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_Role set "); strSql.Append("SystemId=@SystemId, RoleNumber=@RoleNumber, Name=@Name, Type=@Type, AllowEdit=@AllowEdit, AllowDelete=@AllowDelete, IsVisible=@IsVisible, OwnerCompany=@OwnerCompany, 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 "); strSql.Append(" where Role_Id=@Role_Id "); h.CreateCommand(strSql.ToString()); if (model.Role_Id == null) { h.AddParameter("@Role_Id", DBNull.Value); } else { h.AddParameter("@Role_Id", model.Role_Id); } if (model.SystemId == null) { h.AddParameter("@SystemId", DBNull.Value); } else { h.AddParameter("@SystemId", model.SystemId); } if (model.RoleNumber == null) { h.AddParameter("@RoleNumber", DBNull.Value); } else { h.AddParameter("@RoleNumber", model.RoleNumber); } if (model.Name == null) { h.AddParameter("@Name", DBNull.Value); } else { h.AddParameter("@Name", model.Name); } if (model.Type == null) { h.AddParameter("@Type", DBNull.Value); } else { h.AddParameter("@Type", model.Type); } if (model.AllowEdit == null) { h.AddParameter("@AllowEdit", DBNull.Value); } else { h.AddParameter("@AllowEdit", model.AllowEdit); } if (model.AllowDelete == null) { h.AddParameter("@AllowDelete", DBNull.Value); } else { h.AddParameter("@AllowDelete", model.AllowDelete); } if (model.IsVisible == null) { h.AddParameter("@IsVisible", DBNull.Value); } else { h.AddParameter("@IsVisible", model.IsVisible); } if (model.OwnerCompany == null) { h.AddParameter("@OwnerCompany", DBNull.Value); } else { h.AddParameter("@OwnerCompany", model.OwnerCompany); } 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); } return(h.ExecuteNonQuery()); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Permission.Model.Bse_System model) { IMsSqlDataAccessService h = ServiceHelper.GetMsSqlDataAccessService(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Bse_System("); strSql.Append("System_Name, System_Type, System_Version, System_Language, CustNumber, LimitNumber, PY, Sort, Dept_Id, DeptName, Company_Id, CompanyName, Bloc_Id, BlocName, CreateUserId, CreateName, CreateDate, EditUserId, EditUserName, EditDate, Remark, State )"); strSql.Append(" values ("); strSql.Append("@System_Name, @System_Type, @System_Version, @System_Language, @CustNumber, @LimitNumber, @PY, @Sort, @Dept_Id, @DeptName, @Company_Id, @CompanyName, @Bloc_Id, @BlocName, @CreateUserId, @CreateName, @CreateDate, @EditUserId, @EditUserName, @EditDate, @Remark, @State )"); strSql.Append(";select @@IDENTITY"); h.CreateCommand(strSql.ToString()); if (model.System_Name == null) { h.AddParameter("@System_Name", DBNull.Value); } else { h.AddParameter("@System_Name", model.System_Name); } if (model.System_Type == null) { h.AddParameter("@System_Type", DBNull.Value); } else { h.AddParameter("@System_Type", model.System_Type); } if (model.System_Version == null) { h.AddParameter("@System_Version", DBNull.Value); } else { h.AddParameter("@System_Version", model.System_Version); } if (model.System_Language == null) { h.AddParameter("@System_Language", DBNull.Value); } else { h.AddParameter("@System_Language", model.System_Language); } if (model.CustNumber == null) { h.AddParameter("@CustNumber", DBNull.Value); } else { h.AddParameter("@CustNumber", model.CustNumber); } if (model.LimitNumber == null) { h.AddParameter("@LimitNumber", DBNull.Value); } else { h.AddParameter("@LimitNumber", model.LimitNumber); } 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); } int result; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out result)) { return(0); } return(result); }