Пример #1
0
        public static FinancialExportForm GetFormById(int financialExportFormId)
        {
            FinancialExportForm entity = null;

            using (SmizeeContext Context = new SmizeeContext())
            {
                entity = Context.FinancialExportForms.FirstOrDefault(f => f.FinancialExportFormID == financialExportFormId);

                // force context to get Form
                string code             = entity.Form.Periodicity.Code;
                int    functionalAreaID = entity.Form.FormType.FunctionalAreaID;
            }
            return(entity);
        }
Пример #2
0
        public static bool CheckFormsByFormDate(int formId, int productionUnitId, DateTime formDate)
        {
            bool result = false;

            FinancialExportForm entity = null;

            using (SmizeeContext Context = new SmizeeContext())
            {
                entity = Context.FinancialExportForms.FirstOrDefault(fef => (fef.FormID == formId) & (fef.ProductionUnitID == productionUnitId) & (fef.FormDate == formDate));
                if (entity != null)
                {
                    result = true;
                }
            }
            return(result);
        }
Пример #3
0
        public static int CreateForm(int formId, int productionUnitId, int periodNumber, DateTime formDate)
        {
            int fid;
            FinancialExportForm entity = new FinancialExportForm();

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

                db.FinancialExportForms.Add(entity);
                db.SaveChanges();
                fid = entity.FinancialExportFormID;
            }
            return(fid);
        }