public ActionResult SaveRecord(Invest_Equity_CISRepo Equity_CISRepo) { try { if (Equity_CISRepo.isOrderUnique(Equity_CISRepo.Invest_No) == true) { X.Msg.Show(new MessageBoxConfig { Title = "Duplicate", Message = "Order already exist.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } //get current product quantity from Equity Balance table Table Equity_CISRepo.Get_Product_Current_Quantity(Equity_CISRepo); if ((Equity_CISRepo.Order_Quantity) > Equity_CISRepo.Current_Quantity) { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Sorry! Current Quantity is not enough for this transaction.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } if (!string.IsNullOrEmpty(Equity_CISRepo.Scheme_Id)) { GlobalValue.Get_Scheme_Today_Date(Equity_CISRepo.Scheme_Id); if (Equity_CISRepo.Order_Date != GlobalValue.Scheme_Today_Date) { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Sorry! 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) { this.Equity_CISRepo.sellSaveRecord(Equity_CISRepo); X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Order Successfully Processed.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); //ClearControls(); // Store store = X.GetCmp<Store>("ecis_SellSFStore"); // store.Reload(); // return this.Direct(); var pvr = new Ext.Net.MVC.PartialViewResult { ViewName = "Equity_CIS_SellPartial", 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) { throw ex; } }
public ActionResult SaveRecord(Invest_Equity_CISRepo Equity_CISRepo) { try { if (Equity_CISRepo.isOrderUnique(Equity_CISRepo.Invest_No) == true) { X.Msg.Show(new MessageBoxConfig { Title = "Duplicate", Message = "Order already exist.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } //check if issuer exist Equity_CISRepo.ck_issuer(Equity_CISRepo); if ((Equity_CISRepo.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 (string.IsNullOrEmpty(Equity_CISRepo.Issuer_Id)) { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Please Select Issuer.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } //get GL balance from GL_Account Table Equity_CISRepo.Get_GL_Balance(Equity_CISRepo); if ((Equity_CISRepo.GL_Balance * -1) < Equity_CISRepo.Total_Cost) { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Sorry! Cash balance is not enough for this transaction", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } if (!string.IsNullOrEmpty(Equity_CISRepo.Scheme_Id)) { GlobalValue.Get_Scheme_Today_Date(Equity_CISRepo.Scheme_Id); if (Equity_CISRepo.Order_Date != GlobalValue.Scheme_Today_Date) { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Sorry! Order 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) { this.Equity_CISRepo.SaveRecord(Equity_CISRepo); X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Order Successfully Processed.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); var pvr = new Ext.Net.MVC.PartialViewResult { ViewName = "Equity_CISPartial", 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()); } }