コード例 #1
0
        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);
        }
コード例 #2
0
        public static Country GetCountry(int?CountryId)
        {
            Country Country = null;

            using (SmizeeContext Context = new SmizeeContext())
            {
                Country = Context.Countries.FirstOrDefault(cp => cp.CountryID == CountryId);
            }
            return(Country);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: User.cs プロジェクト: apedro-silva/Work
        public static User GetUserById(Guid userId)
        {
            User user = null;

            using (SmizeeContext Context = new SmizeeContext())
            {
                user = Context.Users.FirstOrDefault(Usr => Usr.UserId == userId);
            }
            return(user);
        }
コード例 #5
0
        public static ProductionUnit GetProductionUnit(int?ProductionUnitId)
        {
            ProductionUnit ProductionUnit = null;

            using (SmizeeContext Context = new SmizeeContext())
            {
                ProductionUnit = Context.ProductionUnits.FirstOrDefault(cp => cp.ProductionUnitID == ProductionUnitId);
            }
            return(ProductionUnit);
        }
コード例 #6
0
        public static FunctionalArea GetFunctionalArea(int?FunctionalAreaId)
        {
            FunctionalArea FunctionalArea = null;

            using (SmizeeContext Context = new SmizeeContext())
            {
                FunctionalArea = Context.FunctionalAreas.FirstOrDefault(cp => cp.FunctionalAreaID == FunctionalAreaId);
            }
            return(FunctionalArea);
        }
コード例 #7
0
ファイル: Company.cs プロジェクト: apedro-silva/Work
        public static Company GetCompany(int?companyId)
        {
            Company company = null;

            using (SmizeeContext Context = new SmizeeContext())
            {
                company = Context.Companies.FirstOrDefault(cp => cp.CompanyID == companyId);
            }
            return(company);
        }
コード例 #8
0
ファイル: OperationalForm.cs プロジェクト: apedro-silva/Work
        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);
        }
コード例 #9
0
ファイル: FinancialForm.cs プロジェクト: apedro-silva/Work
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        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"));
        }
コード例 #13
0
ファイル: OperationalForm.cs プロジェクト: apedro-silva/Work
        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);
        }
コード例 #14
0
ファイル: Audit.cs プロジェクト: apedro-silva/Work
        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);
        }
コード例 #15
0
ファイル: Audit.cs プロジェクト: apedro-silva/Work
        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();
            }
        }
コード例 #16
0
ファイル: OperationalForm.cs プロジェクト: apedro-silva/Work
        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);
        }
コード例 #17
0
        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);
        }
コード例 #18
0
ファイル: User.cs プロジェクト: apedro-silva/Work
        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);
        }
コード例 #19
0
ファイル: Audit.cs プロジェクト: apedro-silva/Work
        public static IQueryable <Service> GetServices(SmizeeContext db)
        {
            IQueryable <Service> query = db.Services;

            return(query);
        }