/// <summary> /// 获得职务信息列表 /// </summary> /// <param name="CompanyId">公司编号</param> /// <param name="PageSize">页面数据总记录数</param> /// <param name="PageIndex">当前页数</param> /// <param name="RecordCount">每页显示的记录数</param> /// <returns></returns> public IList <Model.GovStructure.MGovPosition> GetGovPositionList(string CompanyId, int PageSize, int PageIndex, ref int RecordCount) { if (CompanyId.Trim() == "") { return(null); } IList <Model.GovStructure.MGovPosition> ResultList = null; string tableName = "tbl_GovPosition"; string identityColumnName = "PositionId"; string fields = " PositionId,CompanyId,Title,Description,OperatorId,IssueTime "; string query = string.Format("CompanyId='{0}'", CompanyId); string orderByString = " PositionId DESC"; using (IDataReader dr = EyouSoft.Toolkit.DAL.DbHelper.ExecuteReader(_db, PageSize, PageIndex, ref RecordCount, tableName, identityColumnName, fields, query, orderByString)) { ResultList = new List <Model.GovStructure.MGovPosition>(); while (dr.Read()) { EyouSoft.Model.GovStructure.MGovPosition model = new EyouSoft.Model.GovStructure.MGovPosition() { PositionId = dr.GetInt32(dr.GetOrdinal("PositionId")), CompanyId = dr.GetString(dr.GetOrdinal("CompanyId")), Title = dr.GetString(dr.GetOrdinal("Title")), Description = dr.IsDBNull(dr.GetOrdinal("Description")) ? "" : dr.GetString(dr.GetOrdinal("Description")), OperatorId = dr.GetString(dr.GetOrdinal("OperatorId")), IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime")) }; ResultList.Add(model); model = null; } }; return(ResultList); }
/// <summary> /// 获得职务实体 /// </summary> /// <param name="PositionId">职务ID</param> /// <returns></returns> public EyouSoft.Model.GovStructure.MGovPosition GetGovPositionModel(int PositionId, string CompanyId) { EyouSoft.Model.GovStructure.MGovPosition model = null; if (!string.IsNullOrEmpty(CompanyId)) { model = new EyouSoft.Model.GovStructure.MGovPosition(); return(dal.GetGovPositionModel(PositionId, CompanyId)); } return(model); }
/// <summary> /// 更新一条职务信息 /// </summary> /// <param name="model">职务model</param> /// <returns></returns> public bool UpdateGovPosition(EyouSoft.Model.GovStructure.MGovPosition model) { string StrSql = "UPDATE tbl_GovPosition SET Title=@Title,Description=@Description,OperatorId=@OperatorId,IssueTime=@IssueTime WHERE PositionId=@PositionId AND CompanyId=@CompanyId"; DbCommand dc = this._db.GetSqlStringCommand(StrSql); this._db.AddInParameter(dc, "PositionId", DbType.Int32, model.PositionId); this._db.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, model.CompanyId); this._db.AddInParameter(dc, "Title", DbType.String, model.Title); this._db.AddInParameter(dc, "Description", DbType.String, model.Description); this._db.AddInParameter(dc, "OperatorId", DbType.AnsiStringFixedLength, model.OperatorId); this._db.AddInParameter(dc, "IssueTime", DbType.DateTime, model.IssueTime); return(EyouSoft.Toolkit.DAL.DbHelper.ExecuteSql(dc, this._db) > 0 ? true : false); }
/// <summary> /// 更新一条职务信息 /// </summary> /// <param name="model">职务model</param> /// <returns></returns> public bool UpdateGovPosition(EyouSoft.Model.GovStructure.MGovPosition model) { if (model != null && !string.IsNullOrEmpty(model.CompanyId) && !string.IsNullOrEmpty(model.Title) && !string.IsNullOrEmpty(model.OperatorId)) { bool result = dal.UpdateGovPosition(model); if (result) { SysStructure.BSysLogHandle.Insert("更新一条职务信息:编号为:" + model.PositionId); } return(result); } return(false); }
/// <summary> /// 增加一条职务信息 /// </summary> /// <param name="model">职务model</param> /// <returns></returns> public bool AddGovPosition(EyouSoft.Model.GovStructure.MGovPosition model) { if (model != null && !string.IsNullOrEmpty(model.CompanyId) && !string.IsNullOrEmpty(model.Title) && !string.IsNullOrEmpty(model.OperatorId)) { int identity = dal.AddGovPosition(model); if (identity != 0) { SysStructure.BSysLogHandle.Insert("增加一条职务信息:编号为:" + identity); return(true); } } return(false); }
/// <summary> /// 增加一条职务信息 /// </summary> /// <param name="model">职务model</param> /// <returns></returns> public int AddGovPosition(EyouSoft.Model.GovStructure.MGovPosition model) { string StrSql = "INSERT INTO tbl_GovPosition([CompanyId],[Title],[Description],[OperatorId],[IssueTime]) VALUES(@CompanyId,@Title,@Description,@OperatorId,@IssueTime) select @@identity"; DbCommand dc = this._db.GetSqlStringCommand(StrSql); this._db.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, model.CompanyId); this._db.AddInParameter(dc, "Title", DbType.String, model.Title); this._db.AddInParameter(dc, "Description", DbType.String, model.Description); this._db.AddInParameter(dc, "OperatorId", DbType.AnsiStringFixedLength, model.OperatorId); this._db.AddInParameter(dc, "IssueTime", DbType.DateTime, model.IssueTime); using (IDataReader dr = EyouSoft.Toolkit.DAL.DbHelper.ExecuteReader(dc, _db)) { if (dr.Read()) { return(EyouSoft.Toolkit.Utils.GetInt(dr[0].ToString())); } } return(0); // return EyouSoft.Toolkit.DAL.DbHelper.ExecuteSql(dc, this._db) > 0 ? true : false; }
/// <summary> /// 获得职务实体 /// </summary> /// <param name="PositionId">职务ID</param> /// <param name="CompanyId">公司编号ID</param> /// <returns></returns> public EyouSoft.Model.GovStructure.MGovPosition GetGovPositionModel(int PositionId, string CompanyId) { EyouSoft.Model.GovStructure.MGovPosition model = null; DbCommand dc = this._db.GetSqlStringCommand("SELECT PositionId,CompanyId,Title,Description,OperatorId,IssueTime FROM tbl_GovPosition WHERE PositionId=@PositionId AND CompanyId=@CompanyId"); this._db.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, CompanyId); this._db.AddInParameter(dc, "PositionId", DbType.Int32, PositionId); using (IDataReader dr = EyouSoft.Toolkit.DAL.DbHelper.ExecuteReader(dc, this._db)) { if (dr.Read()) { model = new EyouSoft.Model.GovStructure.MGovPosition() { PositionId = dr.GetInt32(dr.GetOrdinal("PositionId")), CompanyId = dr.GetString(dr.GetOrdinal("CompanyId")), Title = dr.GetString(dr.GetOrdinal("Title")), Description = dr.IsDBNull(dr.GetOrdinal("Description")) ? "" : dr.GetString(dr.GetOrdinal("Description")), OperatorId = dr.GetString(dr.GetOrdinal("OperatorId")), IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime")) }; } } return(model); }