예제 #1
0
        public ActionResult SaveRecord(crm_EmployerSchemeRepo ESRepo)
        {
            try
            {
                if (ESRepo.isESUnique(ESRepo.Employer_Id + ESRepo.Scheme_Id) == true)
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Duplicate",
                        Message = "Employer Scheme already exist.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    return(this.Direct());
                }
                if (ModelState.IsValid)
                {
                    this.ESRepo.SaveRecord(ESRepo);

                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Success",
                        Message = "Employer Scheme Successfully Added.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    ClearControls();
                    Store store = X.GetCmp <Store>("esStore");
                    store.Reload();

                    return(this.Direct());
                }
                else
                {
                    string messages = string.Join(Environment.NewLine, ModelState.Values
                                                  .SelectMany(x => x.Errors)
                                                  .Select(x => x.ErrorMessage));

                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = messages, // " Insufficient data. Operation Aborted",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }
            }
            catch (System.Exception)
            {
                throw;
            }
        }
예제 #2
0
        public ActionResult ApproveRecord(crm_EmployerSchemeRepo ESRepo)
        {
            try
            {
                if (ESRepo.ES_Id == string.Empty)
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry! No 'Employer Scheme' has been selected for approval.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                ESRepo.ApproveESRecord(ESRepo);
                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Success",
                    Message = "Employer Scheme Successfully Approved.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                ClearControls_Approve();
                Store store = X.GetCmp <Store>("ApproveesStore");
                store.Reload();

                return(this.Direct());
            }
            catch (System.Exception EX)
            {
                throw EX;
            }
        }