Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetTransactionOptions(Options, true, false, false, false, false, false, false);
                SetPageDescription(Resources.MainMenu.IM_03_02);
                currentOption = Options.SelectedValue;

                string pu      = Request.QueryString["PU"];
                string fefid   = Request.QueryString["FID"];
                string stateid = Request.QueryString["ST"];
                if (fefid != null)
                {
                    CompanyFormID.Value        = fefid;
                    currentOption              = "UPD";
                    OptionsPanel.Visible       = false;
                    SearchPanel.Visible        = false;
                    DetailPanel.Visible        = true;
                    ConfirmButtonPanel.Visible = true;

                    FinancialForm entity = CxFinancialForm.GetFormById(int.Parse(fefid));
                    FormMessageLiteral.Text = GetPeriodMessage(Resources.Resource.lForm2Message, entity.PeriodNumber, entity.Form.Periodicity.Code, entity.FormDate);

                    if (stateid == "3")
                    {
                        DetailPanel.Enabled        = false;
                        ApprovePanel.Visible       = true;
                        ConfirmButtonPanel.Visible = false;
                        FormMessageLiteral.Text    = "";
                    }

                    ProductionUnitLiteral.Text = pu;
                    FillDateLiteral.Text       = DateTime.Now.ToShortDateString();
                    ShowCurrentForm(int.Parse(fefid));
                }
            }
            else
            {
                currentOption = Options.SelectedValue;
                User user      = WebSecurity.GetUserInfo(Page.User.Identity.Name);
                int? companyId = user.CompanyID;

                if (companyId != null && companyId != 0)
                {
                    ddlCompany.SelectedValue = companyId.ToString();
                    ddlCompany.Enabled       = false;
                }
            }
        }
Example #2
0
        private static void ProcessLateFinancialForm(Form currentForm)
        {
            int? alarmRangeUser      = 0;
            int? alarmRangeManager   = 0;
            int? alarmRangeExecutive = 0;
            bool userAlert           = false;
            bool managerAlert        = false;
            bool executiveAlert      = false;

            IQueryable <FinancialForm> forms = CxFinancialForm.GetFormsNotApproved(currentForm.FormID);
            var result = forms.ToList();

            // for each form not apporved (formState!=4)
            foreach (FinancialForm f1 in result)
            {
                alarmRangeUser      = f1.Form.AlarmRangeUser;
                alarmRangeManager   = f1.Form.AlarmRangeManager;
                alarmRangeExecutive = f1.Form.AlarmRangeExecutive;
                int lateDays = GetFormLateDays(f1.FormDate, f1.Form.Periodicity.Code);

                if (lateDays >= alarmRangeUser && f1.UserAlertDate == null)
                {
                    Goodies.SendEmail(Properties.Settings.Default.LateNotificationMessage, f1.ProductionUnitID, f1.Form.FormType.FunctionalAreaID, f1.Form.Description, f1.PeriodNumber, f1.Form.Periodicity.Code, f1.FormDate);
                    userAlert = true;
                }
                if (lateDays >= alarmRangeManager && f1.ManagerAlertDate == null)
                {
                    Goodies.SendManagerEmail(Properties.Settings.Default.LateNotificationMessage, f1.ProductionUnitID, f1.Form.FormType.FunctionalAreaID, f1.Form.Description, f1.PeriodNumber, f1.Form.Periodicity.Code, f1.FormDate);
                    managerAlert = true;
                }
                if (lateDays >= alarmRangeExecutive && f1.ExecutiveAlertDate == null)
                {
                    Goodies.SendExecutiveEmail(Properties.Settings.Default.LateNotificationMessage, f1.ProductionUnitID, f1.Form.FormType.FunctionalAreaID, f1.Form.Description, f1.PeriodNumber, f1.Form.Periodicity.Code, f1.FormDate);
                    executiveAlert = true;
                }
                CxFinancialForm.UpdateAlertDate(f1.FinancialFormID, userAlert, managerAlert, executiveAlert);
            }
        }
Example #3
0
        private void BindZEEUserForms(User user)
        {
            SmizeeContext db               = new Models.SmizeeContext();
            string        userName         = Page.User.Identity.Name;
            Guid?         userId           = user.UserId;
            int?          functionalAreaId = user.FunctionalAreaID;

            CleanMessage(MessagePanel, ErrorPanel);

            var ffInQueueX = from f in CxFinancialSDZEEForm.GetUserFormsInQueue(db, userName, functionalAreaId) select f;
            var ffInQueue  = from f in ffInQueueX
                             select new
            {
                //FormId = f.FormID,
                CompanyFormID   = f.FinancialSDZEEFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = "ZEE",
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };


            var olfInQueueX = from f in CxOperationalLicensesForm.GetUserFormsInQueue(db, userName, functionalAreaId) select f;
            var olfInQueue  = from f in olfInQueueX
                              select new
            {
                //FormId = f.FormID,
                CompanyFormID   = f.OperationalLicensesFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = "ZEE",
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };

            var ofInQueueX = from f in CxOperationalForm.GetUserFormsInQueue(db, userName, functionalAreaId) select f;
            var ofInQueue  = from f in ofInQueueX
                             select new
            {
                //FormId = f.FormID,
                CompanyFormID   = f.OperationalFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = "ZEE",
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };

            var hrfInQueueX = from f in CxHumanResourceSDZEEForm.GetUserFormsInQueue(db, userName, functionalAreaId) select f;
            var hrfInQueue  = from f in hrfInQueueX
                              select new
            {
                //FormId = f.FormID,
                CompanyFormID   = f.HumanResourceSDZEEFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = "ZEE",
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };


            var f0X = from f in CxFinancialExportForm.GetFormsForApproval(db, userName, 0, null, functionalAreaId)
                      select new
            {
                CompanyFormID   = f.FinancialExportFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = f.ProductionUnit.Description,
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };

            var f1X = from f in CxFinancialForm.GetFormsForApproval(db, userName, 0, null, functionalAreaId)
                      select new
            {
                CompanyFormID   = f.FinancialFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = f.ProductionUnit.Description,
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };

            var f3X = from f in CxHumanResourceForm.GetFormsForApproval(db, userName, 0, null, functionalAreaId)
                      select new
            {
                CompanyFormID   = f.HumanResourceFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = f.ProductionUnit.Description,
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };

            var f4X = from f in CxHumanResourceQualificationForm.GetFormsForApproval(db, userName, 0, null, functionalAreaId)
                      select new
            {
                CompanyFormID   = f.HumanResourceQualificationFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = f.ProductionUnit.Description,
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };

            var fInQueue = ffInQueue.Union(ofInQueue);

            fInQueue = fInQueue.Union(olfInQueue);
            fInQueue = fInQueue.Union(hrfInQueue);
            fInQueue = fInQueue.Union(f0X);
            fInQueue = fInQueue.Union(f1X);
            fInQueue = fInQueue.Union(f3X);
            fInQueue = fInQueue.Union(f4X);

            int formStateId  = int.Parse(ddlFormState.SelectedValue);
            var listEntities = fInQueue.Where(f => formStateId == 0 | f.FormStateId == formStateId).ToList();

            gvFormsInQueue.DataSource = listEntities;
            gvFormsInQueue.DataBind();

            if (listEntities.Count == 0)
            {
                ShowInfo(MessagePanel, Resources.Resource.mNoRecordsFound);
                ListPanel.Visible = false;
            }
            else
            {
                ListPanel.Visible = true;
            }
        }
Example #4
0
        private void BindUserForms(Guid?userId, int?companyId, int?functionalAreaId)
        {
            SmizeeContext db       = new Models.SmizeeContext();
            string        userName = Page.User.Identity.Name;

            if (functionalAreaId == 0)
            {
                functionalAreaId = null;
            }

            CleanMessage(MessagePanel, ErrorPanel);

            var upu = from f in CxUserProductionUnit.GetProductionUnitsByUserId(db, userId) select f;

            var fefInQueueX = from f in CxFinancialExportForm.GetUserFormsInQueue(db, userName, companyId, null, functionalAreaId) select f;
            var fefInQueue  = from f in fefInQueueX
                              join y1 in upu on f.ProductionUnitID equals y1.ProductionUnitID
                              select new
            {
                FormId          = f.FormID,
                CompanyFormID   = f.FinancialExportFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = f.ProductionUnit.Description,
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };


            var ffInQueueX = from f in CxFinancialForm.GetUserFormsInQueue(db, userName, companyId, null, functionalAreaId) select f;
            var ffInQueue  = from f in ffInQueueX
                             join y1 in upu on f.ProductionUnitID equals y1.ProductionUnitID
                             select new
            {
                FormId          = f.FormID,
                CompanyFormID   = f.FinancialFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = f.ProductionUnit.Description,
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };

            var hrfInQueueX = from f in CxHumanResourceForm.GetUserFormsInQueue(db, userName, companyId, null, functionalAreaId) select f;
            var hrfInQueue  = from f in hrfInQueueX
                              join y1 in upu on f.ProductionUnitID equals y1.ProductionUnitID
                              select new
            {
                FormId          = f.FormID,
                CompanyFormID   = f.HumanResourceFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = f.ProductionUnit.Description,
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };

            var x           = from f in CxHumanResourceQualificationForm.GetUserFormsInQueue(db, userName, companyId, null, functionalAreaId) select f;
            var hrqfInQueue = from f in x join y1 in upu on f.ProductionUnitID equals y1.ProductionUnitID
                              select new
            {
                FormId          = f.FormID,
                CompanyFormID   = f.HumanResourceQualificationFormID,
                FormDescription = f.Form.Description,
                Periodicity     = f.Form.Periodicity.Description,
                ProductionUnit  = f.ProductionUnit.Description,
                FormPage        = f.Form.FormType.FormPage,
                FormStateId     = f.StateID,
                FormState       = f.State.Description,
                FormDate        = f.FormDate,
                PeriodicityCode = f.Form.Periodicity.Code,
                PeriodNumber    = f.PeriodNumber
            };

            var fInQueue = fefInQueue.Union(ffInQueue);

            fInQueue = fInQueue.Union(hrfInQueue);
            fInQueue = fInQueue.Union(hrqfInQueue);

            int formStateId = int.Parse(ddlFormState.SelectedValue);

            var listEntities = fInQueue.Where(f => formStateId == 0 | f.FormStateId == formStateId).ToList();

            gvFormsInQueue.DataSource = listEntities;
            gvFormsInQueue.DataBind();

            if (listEntities.Count == 0)
            {
                ShowInfo(MessagePanel, Resources.Resource.mNoRecordsFound);
                ListPanel.Visible = false;
            }
            else
            {
                ListPanel.Visible = true;
            }
        }