Beispiel #1
0
        // approve sec bond
        public ActionResult ReverseRecordSec(BondRepo MM_TBill)
        {
            try
            {
                if (string.IsNullOrEmpty(MM_TBill.Invest_No))
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry! No Investment has been selected for reversal.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                //get GL balance from GL_Account Table
                MM_TBill.Get_GL_Balance(MM_TBill);

                //if ((TransFixRepo.GL_Balance * -1) < TransFixRepo.Amount_Invested)
                //{
                //    X.Msg.Show(new MessageBoxConfig
                //    {
                //        Title = "Error",
                //        Message = "Sorry! Insufficient Cash in Scheme-Fund Bank Account.",
                //        Buttons = MessageBox.Button.OK,
                //        Icon = MessageBox.Icon.INFO,
                //        Width = 350
                //    });

                //    return this.Direct();
                //}
                GlobalValue.Get_Scheme_Today_Date(MM_TBill.Scheme_Id);

                //if (!string.IsNullOrEmpty(MM_TBill.Scheme_Id))
                //{
                //    GlobalValue.Get_Scheme_Today_Date(MM_TBill.Scheme_Id);
                //    if (MM_TBill.Settlement_Date > GlobalValue.Scheme_Today_Date)
                //    {
                //        X.Msg.Show(new MessageBoxConfig
                //        {
                //            Title = "Error",
                //            Message = "Sorry! This transaction can not be reversed. Process aborted",
                //            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

                //    });
                //}

                MM_TBill.Reverse_MM_TBill(MM_TBill);

                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Success",
                    Message = "Investment Successfully Reversed.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                //ClearControls_Sec();
                //Store storesec = X.GetCmp<Store>("Reversedsecbondstore");
                //storesec.Reload();
                var pvr = new Ext.Net.MVC.PartialViewResult
                {
                    ViewName    = "ReverseSecBondPartial",
                    ContainerId = "MainArea",
                    RenderMode  = RenderMode.AddTo,
                };
                this.GetCmp <TabPanel>("MainArea").SetLastTabAsActive();
                return(pvr);
            }
            catch (Exception ex)
            {
                return(this.Direct());
            }
        }
        public ActionResult Sec_SaveRecord(BondRepo MM_TBill)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (MM_TBill.isOrderUnique(MM_TBill.Invest_No) == true)
                    {
                        X.Msg.Show(new MessageBoxConfig
                        {
                            Title   = "Duplicate",
                            Message = "Investment already exist.",
                            Buttons = MessageBox.Button.OK,
                            Icon    = MessageBox.Icon.INFO,
                            Width   = 350
                        });
                        return(this.Direct());
                    }

                    //check if issuer exist
                    MM_TBill.ck_issuer(MM_TBill);

                    if ((MM_TBill.CH_NUMBER <= 0))
                    {
                        X.Msg.Show(new MessageBoxConfig
                        {
                            Title   = "Error",
                            Message = "Sorry! Unregistered Issuer",
                            Buttons = MessageBox.Button.OK,
                            Icon    = MessageBox.Icon.INFO,
                            Width   = 350
                        });

                        return(this.Direct());
                    }

                    if ((MM_TBill.Cost) <= 0)
                    {
                        X.Msg.Show(new MessageBoxConfig
                        {
                            Title   = "Error",
                            Message = "Sorry! Invalid Cost",
                            Buttons = MessageBox.Button.OK,
                            Icon    = MessageBox.Icon.INFO,
                            Width   = 350
                        });

                        return(this.Direct());
                    }


                    //get GL balance from GL_Account Table
                    MM_TBill.Get_GL_Balance(MM_TBill);
                    MM_TBill.GL_Balance    = Math.Round(MM_TBill.GL_Balance, 2);
                    MM_TBill.Cost          = Math.Round(MM_TBill.Cost, 2);
                    MM_TBill.Brokerage_Fee = Math.Round(MM_TBill.Brokerage_Fee, 2);

                    if ((MM_TBill.GL_Balance * -1) < MM_TBill.Cost + MM_TBill.Brokerage_Fee)
                    {
                        X.Msg.Show(new MessageBoxConfig
                        {
                            Title   = "Error",
                            Message = "Sorry! Cash balance is not enough for this investment",
                            Buttons = MessageBox.Button.OK,
                            Icon    = MessageBox.Icon.INFO,
                            Width   = 350
                        });

                        return(this.Direct());
                    }

                    if (MM_TBill.Last_Coupon_Payment_Date < MM_TBill.Start_Date)
                    {
                        X.Msg.Show(new MessageBoxConfig
                        {
                            Title   = "Error",
                            Message = "Sorry! Last Coupon Payment Date can not be before Start Date",
                            Buttons = MessageBox.Button.OK,
                            Icon    = MessageBox.Icon.INFO,
                            Width   = 350
                        });

                        return(this.Direct());
                    }

                    if (MM_TBill.Amount_Invested != MM_TBill.Cost && MM_TBill.Current_Yield <= 0)
                    {
                        X.Msg.Show(new MessageBoxConfig
                        {
                            Title   = "Error",
                            Message = "Invalid Current Yield. Please enter a valid Yield.",
                            Buttons = MessageBox.Button.OK,
                            Icon    = MessageBox.Icon.INFO,
                            Width   = 350
                        });
                        return(this.Direct());
                    }

                    if (!string.IsNullOrEmpty(MM_TBill.Scheme_Id))
                    {
                        GlobalValue.Get_Scheme_Today_Date(MM_TBill.Scheme_Id);
                        if (MM_TBill.Settlement_Date != GlobalValue.Scheme_Today_Date)
                        {
                            X.Msg.Show(new MessageBoxConfig
                            {
                                Title   = "Error",
                                Message = "Sorry! Settlement 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
                        });
                    }

                    this.MM_TBill.Add_Submit_Trans_Sec(MM_TBill);

                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Success",
                        Message = "Investment Successfully Processed.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });
                    //ClearControls_Sec();
                    //Store store = X.GetCmp<Store>("SecBondSFStore");
                    //store.Reload();
                    //return this.Direct();
                    var pvr = new Ext.Net.MVC.PartialViewResult
                    {
                        ViewName    = "SecBondPartial",
                        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());
            }
        }
Beispiel #3
0
        // approve sec bond
        public ActionResult ApproveRecordSec(BondRepo TransFixRepo)
        {
            try
            {
                if (string.IsNullOrEmpty(TransFixRepo.Invest_No))
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry! No Investment has been selected for approval.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.ERROR,
                        Width   = 350
                    });
                    return(this.Direct());
                }

                //get GL balance from GL_Account Table
                TransFixRepo.Get_GL_Balance(TransFixRepo);
                if ((TransFixRepo.GL_Balance * -1) < TransFixRepo.Cost + TransFixRepo.Brokerage_Fee)
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Title   = "Error",
                        Message = "Sorry! Insufficient Cash in Scheme-Fund Bank Account.",
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Width   = 350
                    });

                    return(this.Direct());
                }


                TransFixRepo.Approve_MM_TBill(TransFixRepo);

                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Success",
                    Message = "Investment Successfully Approved.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Width   = 350
                });
                //ClearControls_Sec();
                //Store storesec = X.GetCmp<Store>("Approvesecbondstore");
                //storesec.Reload();
                var pvr = new Ext.Net.MVC.PartialViewResult
                {
                    ViewName    = "ApproveSecBondPartial",
                    ContainerId = "MainArea",
                    RenderMode  = RenderMode.AddTo,
                };
                this.GetCmp <TabPanel>("MainArea").SetLastTabAsActive();

                return(pvr);
            }
            catch (Exception ex)
            {
                return(this.Direct());
            }
        }