コード例 #1
0
        public ActionResult ApproveRecord(GLFeeRepo GLFee)
        {
            try
            {
                if (GLFee.TID < 1)
                {
                    X.Mask.Hide();
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry! No Transaction has been selected for approval.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                //GET GL BALANCES
                GLFee.Get_Balance(GLFee);

                if ((GLFee.GL_Balance * -1) < GLFee.Paid_Amount)
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry! Account Balance not sufficient for transaction",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                GlobalValue.Get_Scheme_Today_Date((GLFee.Scheme_Fund_Id.Substring(0, 2)));

                ///approve pending fee payment
                GLFee.Approve_GLFee(GLFee);

                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Success",
                    Message = "Fee Payment Successfully Approved.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                var pvr = new Ext.Net.MVC.PartialViewResult
                {
                    ViewName    = "GLFeeApprovePartial",
                    ContainerId = "MainArea",
                    RenderMode  = RenderMode.AddTo,
                };
                this.GetCmp <TabPanel>("MainArea").SetLastTabAsActive();
                return(pvr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public ActionResult SaveRecord(GLFeeRepo GLFee)
        {
            try
            {
                if (string.IsNullOrEmpty(GLFee.Scheme_Fund_Id))
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Please select Scheme Account.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }


                if (string.IsNullOrEmpty(GLFee.Fee_Id))
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Please select Fee Type.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                if (GLFee.Apply_Bal < GLFee.Paid_Amount || GLFee.Paid_Amount <= 0)
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Please Amount can not be more than 'Amount Payable' or less than 0.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                if (string.IsNullOrEmpty(GLFee.Trans_Type))
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Please 'Transaction Type' is required",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                if (!GLFee.Trans_Date.HasValue)
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Please 'Transaction Date' is required",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                if (string.IsNullOrEmpty(GLFee.Narration))
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Please 'Narration' is required",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                if (GLFee.Paid_Amount <= 0)
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Please enter a valid Amount",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                GLFee.Get_Balance(GLFee);
                //GET GL BALANCES
                if ((GLFee.GL_Balance * -1) < GLFee.Paid_Amount)
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry Bank Account Balance not sufficient for transaction",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                if (!string.IsNullOrEmpty(GLFee.Scheme_Fund_Id.Substring(0, 2)))
                {
                    GlobalValue.Get_Scheme_Today_Date((GLFee.Scheme_Fund_Id.Substring(0, 2)));
                    if (GLFee.Trans_Date != GlobalValue.Scheme_Today_Date)
                    {
                        X.Msg.Show(new MessageBoxConfig
                        {
                            Title   = "Error",
                            Message = "Sorry! Transaction date must be equal to scheme working date of " + GlobalValue.Scheme_Today_Date.Date.ToString(),
                            Buttons = MessageBox.Button.OK,
                            Icon    = MessageBox.Icon.INFO,
                            Width   = 350
                        });

                        return(this.Direct());
                    }
                }
                else
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Scheme cannot be verified.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                }

                //if (ModelState.IsValid)
                //{

                GLFee.SaveRecord(GLFee);

                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Success",
                    Message = "Fee Successfully Submitted.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                var pvr = new Ext.Net.MVC.PartialViewResult
                {
                    ViewName    = "GLFeeCreatePartial",
                    ContainerId = "MainArea",
                    RenderMode  = RenderMode.AddTo,
                };
                this.GetCmp <TabPanel>("MainArea").SetLastTabAsActive();
                return(pvr);
            }
            //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 (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());
            }
        }