public static HumanResourceSDZEEForm GetFormById(int operationalLicensesFormId)
        {
            HumanResourceSDZEEForm entity = null;

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

            HumanResourceSDZEEForm entity = null;

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

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

                db.HumanResourceSDZEEForms.Add(entity);
                db.SaveChanges();
                HumanResourceFormId = entity.HumanResourceSDZEEFormID;
            }
            return(HumanResourceFormId);
        }