Example #1
0
        public static HumanResourceForm GetFormById(int operationalLicensesFormId)
        {
            HumanResourceForm entity = null;

            using (SmizeeContext Context = new SmizeeContext())
            {
                entity = Context.HumanResourceForms.FirstOrDefault(f => f.HumanResourceFormID == operationalLicensesFormId);
                // force context to get Form
                string code             = entity.Form.Periodicity.Code;
                int    functionalAreaID = entity.Form.FormType.FunctionalAreaID;
            }
            return(entity);
        }
Example #2
0
        public static bool CheckFormsByFormDate(int formId, int productionUnitId, DateTime formDate)
        {
            bool result = false;

            HumanResourceForm entity = null;

            using (SmizeeContext Context = new SmizeeContext())
            {
                entity = Context.HumanResourceForms.FirstOrDefault(fef => (fef.FormID == formId) & (fef.ProductionUnitID == productionUnitId) & (fef.FormDate == formDate));
                if (entity != null)
                {
                    result = true;
                }
            }
            return(result);
        }
Example #3
0
        public static int CreateForm(int formId, int productionUnitId, int periodNumber, DateTime formDate)
        {
            int HumanResourceFormId  = 0;
            HumanResourceForm entity = new HumanResourceForm();

            using (var db = new Models.SmizeeContext())
            {
                entity.FormID           = formId;
                entity.StateID          = 1;
                entity.ProductionUnitID = productionUnitId;
                entity.PeriodNumber     = periodNumber;
                entity.FormDate         = formDate;

                db.HumanResourceForms.Add(entity);
                db.SaveChanges();
                HumanResourceFormId = entity.HumanResourceFormID;
            }
            return(HumanResourceFormId);
        }