Beispiel #1
0
        public ActionResult ApproveRecord(pfm_Scheme_Fund_ManagerRepo pfm_schemefundmanagerrepo)
        {
            pfm_schemefundmanagerrepo.Auth_Id   = "teksol.admin";
            pfm_schemefundmanagerrepo.Auth_Date = DateTime.Now;

            var log = new LoggerConfiguration().WriteTo.Seq("http://localhost:5341").CreateLogger();

            try
            {
                if (string.IsNullOrEmpty(pfm_schemefundmanagerrepo.Scheme_Fund_Manager_Id))
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Please select a record to approve.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                schemefundmanagerrepo.ApproveRecord(pfm_schemefundmanagerrepo);
                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Success",
                    Message = "Approval Successfully.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });

                Store store = X.GetCmp <Store>("ApproveSchemeFundManagerStore");
                store.Reload();
                var reset = X.GetCmp <FormPanel>("ApproveSchemeFundManagerPan");
                reset.Reset();

                return(this.Direct());
            }
            catch (Exception ex)
            {
                log.Write(level: Serilog.Events.LogEventLevel.Information, messageTemplate: ex.Message + " " + DateTime.Now);
                return(this.Direct());
            }
            finally
            {
            }
        }
Beispiel #2
0
        public ActionResult SaveRecord(pfm_Scheme_Fund_ManagerRepo pfm_scheme_fund_managerrepo)
        {
            var log = new LoggerConfiguration().WriteTo.Seq("http://localhost:5341").CreateLogger();

            try
            {
                pfm_scheme_fund_managerrepo.Maker_Id    = GlobalValue.User_ID;
                pfm_scheme_fund_managerrepo.Make_Date   = GlobalValue.Scheme_Today_Date;
                pfm_scheme_fund_managerrepo.Update_Id   = GlobalValue.User_ID;
                pfm_scheme_fund_managerrepo.Update_Date = GlobalValue.Scheme_Today_Date;
                if (ModelState.IsValid)
                {
                    if (!string.IsNullOrEmpty(pfm_scheme_fund_managerrepo.Scheme_Fund_Manager_Status))
                    {
                        pfm_scheme_fund_managerrepo.Scheme_Fund_Manager_Status = pfm_scheme_fund_managerrepo.Scheme_Fund_Manager_Status.ToUpper();
                    }

                    this.schemefundmanagerrepo.SaveRecord(pfm_scheme_fund_managerrepo);

                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Success",
                        Message = "Saved Successfully.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });

                    Store store = X.GetCmp <Store>("SchemeFundManagerStore");
                    store.Reload();
                    var reset = X.GetCmp <FormPanel>("SchemeFundManagerPan");
                    reset.Reset();

                    return(this.Direct());
                }

                string messages = string.Join(Environment.NewLine, ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).FirstOrDefault());
                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 (Exception ex)
            {
                string ora_code = ex.Message.Substring(0, 9);
                if (ora_code == "ORA-20000")
                {
                    ora_code = "Record already exist. Process aborted..";
                }
                else if (ora_code == "ORA-20100")
                {
                    ora_code = "Not all records are supplied. Process aborted..";
                }
                else
                {
                    ora_code = ex.ToString();
                }
                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Error",
                    Message = ora_code,
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                log.Write(level: Serilog.Events.LogEventLevel.Information, messageTemplate: ex.Message + " " + DateTime.Now);
                return(this.Direct());
            }
            finally
            {
            }
        }