public static IQueryable <UserProductionUnit> GetProductionUnitsByUserId(SmizeeContext db, Guid?userId) { IQueryable <UserProductionUnit> query = db.UserProductionUnits; query = query.Where(p => (userId == null | (p.UserID == userId))); return(query); }
public static Country GetCountry(int?CountryId) { Country Country = null; using (SmizeeContext Context = new SmizeeContext()) { Country = Context.Countries.FirstOrDefault(cp => cp.CountryID == CountryId); } return(Country); }
public static IQueryable <FinancialSDZEEForm> GetUserFormsInQueue(SmizeeContext db, string userName, int?functionalAreaId) { IQueryable <FinancialSDZEEForm> fefInQueue = from f in db.FinancialSDZEEForms where (functionalAreaId == null | f.Form.FormType.FunctionalAreaID == functionalAreaId) & ((f.SubmitUserName == null & f.StateID == 1) | (f.SubmitUserName == userName & (f.StateID == 2 | f.StateID == 5))) select f; return(fefInQueue); }
public static User GetUserById(Guid userId) { User user = null; using (SmizeeContext Context = new SmizeeContext()) { user = Context.Users.FirstOrDefault(Usr => Usr.UserId == userId); } return(user); }
public static ProductionUnit GetProductionUnit(int?ProductionUnitId) { ProductionUnit ProductionUnit = null; using (SmizeeContext Context = new SmizeeContext()) { ProductionUnit = Context.ProductionUnits.FirstOrDefault(cp => cp.ProductionUnitID == ProductionUnitId); } return(ProductionUnit); }
public static FunctionalArea GetFunctionalArea(int?FunctionalAreaId) { FunctionalArea FunctionalArea = null; using (SmizeeContext Context = new SmizeeContext()) { FunctionalArea = Context.FunctionalAreas.FirstOrDefault(cp => cp.FunctionalAreaID == FunctionalAreaId); } return(FunctionalArea); }
public static Company GetCompany(int?companyId) { Company company = null; using (SmizeeContext Context = new SmizeeContext()) { company = Context.Companies.FirstOrDefault(cp => cp.CompanyID == companyId); } return(company); }
public static IQueryable <OperationalForm> GetUserFormsInQueue(SmizeeContext db, string userName, int?functionalAreaId) { //var db = new Models.SmizeeContext(); IQueryable <OperationalForm> fefInQueue = from f in db.OperationalForms where (functionalAreaId == null | f.Form.FormType.FunctionalAreaID == functionalAreaId) & ((f.SubmitUserName == null & f.StateID == 1) | (f.SubmitUserName == userName & (f.StateID == 2 | f.StateID == 5))) select f; return(fefInQueue); }
public static IQueryable <FinancialForm> GetFormsForApproval(SmizeeContext db, string userName, int?companyId, int?productionUnitId, int?functionalAreaId) { IQueryable <FinancialForm> fefInQueue = from f in db.FinancialForms where (productionUnitId == null | f.ProductionUnitID == productionUnitId) & (functionalAreaId == null | f.Form.FormType.FunctionalAreaID == functionalAreaId) & (companyId == 0 | f.ProductionUnit.CompanyID == companyId) & (f.StateID == 3) select f; return(fefInQueue); }
public static IQueryable <HumanResourceForm> GetFormsForApproval(SmizeeContext db, string userName, int?companyId, int?productionUnitId, int?functionalAreaId) { //var db = new Models.SmizeeContext(); IQueryable <HumanResourceForm> fefInQueue = from f in db.HumanResourceForms where (productionUnitId == null | f.ProductionUnitID == productionUnitId) & (functionalAreaId == null | f.Form.FormType.FunctionalAreaID == functionalAreaId) & (companyId == 0 | f.ProductionUnit.CompanyID == companyId) & (f.StateID == 3) select f; return(fefInQueue); }
public static IQueryable <FinancialExportForm> GetUserFormsInQueue(SmizeeContext db, string userName, int?companyId, int?productionUnitId, int?functionalAreaId) { IQueryable <FinancialExportForm> fefInQueue = from f in db.FinancialExportForms where (productionUnitId == null | f.ProductionUnitID == productionUnitId) & (functionalAreaId == null | f.Form.FormType.FunctionalAreaID == functionalAreaId) & (companyId == 0 | f.ProductionUnit.CompanyID == companyId) & ((f.SubmitUserName == null & f.StateID == 1) | (f.SubmitUserName == userName & (f.StateID == 2 | f.StateID == 5))) select f; return(fefInQueue); }
public void BindPeriodicity(DropDownList ddl2Bind) { var db = new Models.SmizeeContext(); IQueryable <Periodicity> periodicities = db.Periodicities; List <Periodicity> listEntities = periodicities.ToList(); ddl2Bind.DataSource = listEntities; ddl2Bind.DataTextField = "Description"; ddl2Bind.DataValueField = "PeriodicityID"; ddl2Bind.DataBind(); ddl2Bind.Items.Insert(0, new ListItem(Resources.Resource.lSelectOne, "0")); }
public static OperationalForm GetFormById(int operationalFormId) { OperationalForm entity = null; using (SmizeeContext Context = new SmizeeContext()) { entity = Context.OperationalForms.FirstOrDefault(f => f.OperationalFormID == operationalFormId); // force context to get Form string code = entity.Form.Periodicity.Code; int functionalAreaID = entity.Form.FormType.FunctionalAreaID; } return(entity); }
public static IQueryable <Audit> GetList(SmizeeContext db, int pageNumber, string applicationPage, string userName, DateTime?startTimestamp, DateTime?endTimestamp) { int numberOfObjectsPerPage = 10; IQueryable <Audit> query = db.Audits; query = query.Where(p => (applicationPage == null | (p.ApplicationPage == applicationPage)) & (startTimestamp == null | (p.Timestamp >= startTimestamp)) & (endTimestamp == null | (p.Timestamp <= endTimestamp)) & (userName == null | (p.UserName == userName))) .OrderByDescending(p => p.AuditID).Skip(numberOfObjectsPerPage * (pageNumber - 1)).Take(numberOfObjectsPerPage + 1); return(query); }
public static void Create(string userName, string applicationPage, int operationId, string result) { using (var db = new SmizeeContext()) { Audit entity = new Audit(); entity.UserName = userName; entity.ApplicationPage = applicationPage; entity.OperationID = operationId; entity.Timestamp = DateTime.Now; entity.Result = result; db.Audits.Add(entity); db.SaveChanges(); } }
public static bool CheckFormsByFormDate(int formId, int productionUnitId, DateTime formDate) { bool result = false; OperationalForm entity = null; using (SmizeeContext Context = new SmizeeContext()) { entity = Context.OperationalForms.FirstOrDefault(fef => (fef.FormID == formId) & (fef.FormDate == formDate)); if (entity != null) { result = true; } } return(result); }
public static int?GetFormDevelopmentPhase(int operationalLicensesFormID, int developmentPhaseID) { int?productionUnitsNumber; var db = new Models.SmizeeContext(); using (SmizeeContext Context = new SmizeeContext()) { OperationalLicensesFormPhase formDevPhase = Context.OperationalLicensesFormPhases.FirstOrDefault(o => o.OperationalLicensesFormID == operationalLicensesFormID & o.DevelopmentPhaseID == developmentPhaseID); if (formDevPhase == null) { return(null); } productionUnitsNumber = formDevPhase.ProductionUnitsNumber; } return(productionUnitsNumber); }
public static MembershipCreateStatus Register(string Username, string Password, string Email, bool IsApproved, string FirstName, string LastName, int?companyId) { MembershipCreateStatus CreateStatus; MembershipUser user = Membership.CreateUser(Username, Password, Email, null, null, IsApproved, Guid.NewGuid(), out CreateStatus); if (CreateStatus == MembershipCreateStatus.Success) { using (SmizeeContext Context = new SmizeeContext()) { User User = Context.Users.FirstOrDefault(Usr => Usr.Username == Username); User.CompanyID = companyId; User.FirstName = FirstName; User.LastName = LastName; Context.SaveChanges(); } } return(CreateStatus); }
public static IQueryable <Service> GetServices(SmizeeContext db) { IQueryable <Service> query = db.Services; return(query); }