/// <summary> /// Gets the categories. /// </summary> /// <returns></returns> public static ReportCategoryInfo[] GetCategories() { ArrayList retVal = new ArrayList(); using (IDataReader reader = DBReport.GetCategoryList()) { while (reader.Read()) { retVal.Add(new ReportCategoryInfo((int)reader["ReportCategoryId"], (string)reader["Name"])); } } return((ReportCategoryInfo[])retVal.ToArray(typeof(ReportCategoryInfo))); }
/// <summary> /// Gets the report. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> public ReportInfo GetReport(int id) { ReportInfo retVal = null; using (IDataReader reader = DBReport.GetById(this.ContainerKey, id)) { if (reader.Read()) { UserReportInfo info = UserReportConfig.GetConfig().Reports[(string)reader["Name"]]; if (info != null) { retVal = new ReportInfo((int)reader["ReportId"], info, (int)SqlHelper.DBNull2Null(reader["ReportCategoryId"], -1), (string)SqlHelper.DBNull2Null(reader["ReportCategoryName"])); } } } return(retVal); }
//Initiazet all presenters contorol private void InitailizetAllPresentersCtrls() { //set string connection from config var con = ConfigurationManager.ConnectionStrings["SqlProvider"].ConnectionString; //start controlAddDetails presenter DbAddDetails dbAdd = new DbAddDetails(); dbAdd.OpenConnection(con); _presenterCrtlAddDetails = new PresenterCrtlAddDetails(_mainMenu.CtrAddDet, dbAdd, _messageService, _userId, _userDep); //start controlDetailsOnDepartament presenter DbDetailstOnDep dBDetailstOnDep = new DbDetailstOnDep(); dBDetailstOnDep.OpenConnection(con); _presenterDetailsInUserDepartment = new PresenterDetailsInUserDepartment(_mainMenu.CtrlDetailOnDepartment, dBDetailstOnDep, _messageService, _userId, _userDep); //Start controlAllDetails DBAllDetails dBAllDetails = new DBAllDetails(); dBAllDetails.OpenConnection(con); _presenterCtrlAllDetails = new PresenterCtrlAllDetails(_mainMenu.CtrlAllDetails, _messageService, dBAllDetails); //Start controlCreateReport Presenter var bDReport = new DBReport(); bDReport.OpenConnection(con); _presenterCtrlCreateReport = new PresenterCtrlCreateReport(_mainMenu.CtrlReport, _messageService, bDReport, _userId, _userDep); //Start controlAdmin presenter DbAdmin bDAdmin = new DbAdmin(); bDAdmin.OpenConnection(con); new PresenterCtrlAdministration(_mainMenu.CtrlAdministrator, _messageService, bDAdmin); //Start controlAllDepartaments presenter DBdepartament dBdepartament = new DBdepartament(); dBdepartament.OpenConnection(con); new PresenterCtrlDepartaments(dBdepartament, _messageService, _mainMenu.CtrlDepartaments); }
/// <summary> /// Gets the reports. /// </summary> /// <returns></returns> public ReportInfo[] GetReports() { if (_hash != null) { return(_hash); } lock (this) { if (_hash != null) { return(_hash); } ArrayList retVal = new ArrayList(); foreach (UserReportInfo info in UserReportConfig.GetConfig().Reports) { using (IDataReader reader = DBReport.GetByName(this.ContainerKey, info.Name)) { if (reader.Read()) { // Existed report retVal.Add(new ReportInfo((int)reader["ReportId"], info, (int)SqlHelper.DBNull2Null(reader["ReportCategoryId"], -1), (string)SqlHelper.DBNull2Null(reader["ReportCategoryName"]))); continue; } } // A new report int ReportId = DBReport.Create(this.ContainerKey, info.Name); retVal.Add(new ReportInfo(ReportId, info, -1, null)); } _hash = (ReportInfo[])retVal.ToArray(typeof(ReportInfo)); } return(_hash); }
public bool CanUserRunAction(int UserId, int ReportId, string Action) { return(DBReport.CanUserRunAction(UserId, _ownerContainer.Key, ReportId, Action)); }
public static bool CanUserRunAction(int UserId, string ContainerKey, int ReportId, string Action) { return(DBReport.CanUserRunAction(UserId, ContainerKey, ReportId, Action)); }
public void SetReportCategory(int ReportId, int ReportCategoryId) { DBReport.SetReportCategory(ReportId, ReportCategoryId); ClearHash(); }
public ReportCategoryInfo CreateCategory(string CategoryName) { int id = DBReport.CreateCategory(CategoryName); return(new ReportCategoryInfo(id, CategoryName)); }