public List <UserModel> GetAllUsers() { var db = new TableBasedSp(RunSpName); var dt = db.GetFirstTableOfData("uspGetUsers", ConnectionString); var users = new DataTableToList().Convert <UserModel>(dt); return(users); }
public DataTable GetMenu(int userId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "UserId", userId.ToString() } }; return(db.GetFirstTableOfData("uspGetUserMenu", ConnectionString, parameters)); }
public List <UserModel> GetProgramUsers(UserStatusEnum userStatusEnum = UserStatusEnum.All) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "Enable", ((int)userStatusEnum).ToString() } }; var dt = db.GetFirstTableOfData("uspGetProgramUsers", ConnectionString, parameters); var users = new DataTableToList().Convert <UserModel>(dt); return(users); }
public List<ProgramsModel> GetPrograms() { var db = new TableBasedSp(RunSpName); try { var dt = db.GetFirstTableOfData("uspGetPrograms", ConnectionString); var programs = new DataTableToList().Convert<ProgramsModel>(dt); return programs; } catch (Exception ex) { throw ex; } }
public List <ProgramRoleModel> GetProgramRoles(int programId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() } }; try { var dt = db.GetFirstTableOfData("uspGetProgramRoles", ConnectionString, parameters); var roles = new DataTableToList().Convert <ProgramRoleModel>(dt); return(roles); } catch (Exception ex) { throw ex; } }
public DataTable GetFullElementWithSetting(ElementTypeEnum elementType, int userId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "ElementTypeId", ((int)elementType).ToStringVar() }, { "UserId", userId.ToString() } }; try { return(db.GetFirstTableOfData("uspVisibleElementDataForUser", ConnectionString, parameters)); } catch (Exception ex) { throw ex; } }
public UserModel Login(string userId, string password) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "UserId", userId }, { "Password", password } }; var dt = db.GetFirstTableOfData("uspLoginInProgram", ConnectionString, parameters); if (dt == null || dt.Rows.Count < 1) { return(null); } var user = new DataTableToList().Convert <UserModel>(dt); return(user[0]); }
public List <ElementAccessModel> GetElementAccess(ElementTypeEnum elementType, int userId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "ElementTypeId", ((int)elementType).ToStringVar() }, { "UserId", userId.ToString() } }; try { var dt = db.GetFirstTableOfData("uspVisibleElementDataForUser", ConnectionString, parameters); var elements = new DataTableToList().Convert <ElementAccessModel>(dt); return(elements); } catch (Exception ex) { throw ex; } }
public ElementAccessModel GetElementAccess(int elementId, int userId) { var db = new TableBasedSp(RunSpName); var parameters = new Dictionary <string, string> { { "ProgramId", ProgramId.ToString() }, { "ElementId", elementId.ToString() }, { "UserId", userId.ToString() } }; try { var dt = db.GetFirstTableOfData("[uspGetUserAccessForElement]", ConnectionString, parameters); var elements = new DataTableToList().Convert <ElementAccessModel>(dt); return(elements[0]); } catch (Exception ex) { throw ex; } }
private static void Main(string[] args) { //var conn = // new SqlConnection( // "Data Source=HRMS;Initial Catalog=laboratory;Persist Security Info=True;User ID=sa;Password=S@334sai334@Sxxx"); //var command = new SqlCommand("sp_GetStuffRegistration2ORMTest", conn); //command.CommandType = CommandType.StoredProcedure; //command.Parameters.Add("@mainTestRegistrationId", 640); //conn.Open(); //reader = command.ExecuteReader(); //var dt = new DataTable(); //dt.Load(reader); //var list = new DataTableToList().Convert<StuffTestRegisterVM>(dt); //var tableBased = new TableBasedSp("RunSp").GetFirstTableOfData("uspGetElementData", // "Data Source=FROSH;Initial Catalog=UM;User ID=saleadmin;Password=H2389*x;", // new Dictionary<string, string> // { // {"ProgramId", "2"}, // {"ElementId", "36"} // } // ); //var t2 = new TableBasedSp("RunSp").GetAllTablesOfData("uspGetElementData", // "Data Source=FROSH;Initial Catalog=UM;User ID=saleadmin;Password=H2389*x;", // new Dictionary<string, string> // { // {"ProgramId", "2"}, // {"ElementId", "36"} // } // ); //var t3 = new TableBasedSp("RunSp").RunSp("uspGetElementData", // "Data Source=FROSH;Initial Catalog=UM;User ID=saleadmin;Password=H2389*x;", // new Dictionary<string, string> // { // {"ProgramId", "2"}, // {"ElementId", "36"} // } // ); //var list = new DataTableToList().Convert<MenuVm>(tableBased); //var list2 = new DataTableToList().Convert<MenuVm>(t2.Tables[0]); try { var db = new TableBasedSp("Business.uspRunSp"); DataSet ds = db.GetAllTablesOfData("[Business].[uspGetWorkorders]", @"Data Source=cmms;Initial Catalog=WorkorderManagement;Integrated Security=True", new Dictionary <string, string> { { "_CD", "2016-02-13 09:36:05.677" }, { "_Username", "890012" }, { "_Password", "123" }, { "_ExecutingVersion", "1.3.1.0" }, { "_RequestId", Guid.NewGuid().ToString() }, { "ReportSectionId", "1" }, { "PropertyNames", "SelectedRequesterUnits;" }, { "PropertyValues", "1,2;" }, { "WorkorderIds", "342" }, { "CheckId", "2" }, { "CheckResult", "p0" }, { "WorkorderDetailIds", "234,239,240,241" }, { "ScheduleStart", "2015-06-27 10:00:00.000" }, { "ScheduleFinish", "2015-07-01 09:00:00.000" }, { "WorkorderId", "330" }, { "Modes", "0" }, { "FromDate", "2010-06-23 14:25:44.267" }, { "ToDate", "2020-06-23 14:25:44.267" }, { "PreferredRole", "-1" }, { "Requester", "930682" }, { "RequestDate", "2015-09-05 08:53:37.315" }, { "NeedDate", "2015-09-06 08:53:37.315" }, { "WorkUnitId", "147" }, { "RequesterUnitId", "126" }, { "Description", "" }, { "DeviceCode", "" }, { "WorkorderDetails", "<DocumentElement> <WorkorderDetails> <OrderToPerform>0</OrderToPerform> <JobToDo>تست درخواست</JobToDo> </WorkorderDetails></DocumentElement>" } }); var a = 1; } catch (Shoniz.Common.Data.SqlServer.DataException ex) { } }