Exemplo n.º 1
0
        public ActionResult ApproveRecord(pfm_SchemeRepo pfm_schemerepo)
        {
            pfm_schemerepo.Auth_Id   = GlobalValue.User_ID;
            pfm_schemerepo.Auth_Date = DateTime.Now;

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

            try
            {
                if (string.IsNullOrEmpty(pfm_schemerepo.Scheme_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());
                }

                schemerepo.ApproveRecord(pfm_schemerepo);
                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>("ApproveSchemeStore");
                store.Reload();
                var reset = X.GetCmp <FormPanel>("ApproveSchemePan");
                reset.Reset();

                return(this.Direct());
            }
            catch (Exception ex)
            {
                log.Write(level: Serilog.Events.LogEventLevel.Information, messageTemplate: ex.Message + " " + DateTime.Now);
                return(this.Direct());
            }
            finally
            {
            }
        }
Exemplo n.º 2
0
        public ActionResult ReassignSaveRecord(pfm_SchemeRepo pfm_schemerepo)
        {
            var log = new LoggerConfiguration().WriteTo.Seq("http://localhost:5341").CreateLogger();

            try
            {
                GlobalValue.Get_Scheme_Today_Date(pfm_schemerepo.Scheme_Id);

                pfm_schemerepo.Maker_Id    = GlobalValue.User_ID;
                pfm_schemerepo.Make_Date   = GlobalValue.Scheme_Today_Date;
                pfm_schemerepo.Maker_Id    = GlobalValue.User_ID;
                pfm_schemerepo.Update_Date = GlobalValue.Scheme_Today_Date;
                if (ModelState.IsValid)
                {
                    if (string.IsNullOrEmpty(pfm_schemerepo.Scheme_Id))
                    {
                        X.Msg.Show(new MessageBoxConfig
                        {
                            Title   = "Error",
                            Message = "Please select a record to re-assign a different custodian.",
                            Buttons = MessageBox.Button.OK,
                            Icon    = MessageBox.Icon.ERROR,
                            Width   = 350
                        });
                        return(this.Direct());
                    }

                    this.schemerepo.ReassignSaveRecord(pfm_schemerepo);

                    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>("ReassignSchemeStore");
                    store.Reload();
                    var reset = X.GetCmp <FormPanel>("ReassignSchemePan");
                    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 = "Record is uniquely defined in the system. 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
            {
            }
        }
Exemplo n.º 3
0
        public ActionResult AddSaveRecord(pfm_SchemeRepo pfm_schemerepo)
        {
            var log = new LoggerConfiguration().WriteTo.Seq("http://localhost:5341").CreateLogger();

            try
            {
                pfm_schemerepo.Maker_Id    = GlobalValue.User_ID;
                pfm_schemerepo.Make_Date   = GlobalValue.Default_Date_Value;
                pfm_schemerepo.Maker_Id    = GlobalValue.User_ID;
                pfm_schemerepo.Update_Date = GlobalValue.Default_Date_Value;


                if (ModelState.IsValid)
                {
                    if (!string.IsNullOrEmpty(pfm_schemerepo.Scheme_Name))
                    {
                        pfm_schemerepo.Scheme_Name = pfm_schemerepo.Scheme_Name.ToUpper();
                    }
                    if (!string.IsNullOrEmpty(pfm_schemerepo.NPRA_Number))
                    {
                        pfm_schemerepo.NPRA_Number = pfm_schemerepo.NPRA_Number.ToUpper();
                    }
                    if (!string.IsNullOrEmpty(pfm_schemerepo.Scheme_Status))
                    {
                        pfm_schemerepo.Scheme_Status = pfm_schemerepo.Scheme_Status.ToUpper();
                    }

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


                        var reset = X.GetCmp <FormPanel>("AddSchemePan");
                        reset.Reset();

                        return(this.Direct());
                    }
                    else
                    {
                        X.Msg.Show(new MessageBoxConfig
                        {
                            Title   = "Error",
                            Message = "Scheme not created. Please check and try again.",
                            Buttons = MessageBox.Button.OK,
                            Icon    = MessageBox.Icon.INFO,
                            Width   = 350
                        });
                        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
            {
            }
        }