public ActionResult gclasscode(Invest_ProductRepo ProductRepo) { ProductRepo.getclasscode(ProductRepo); if (ProductRepo.Class_Id == "04" || ProductRepo.Class_Id == "05") { this.GetCmp <NumberField>("ProductP_UnitPrice").SetHidden(false); this.GetCmp <ComboBox>("ProductP_Listed").SetHidden(false); } else { this.GetCmp <NumberField>("ProductP_UnitPrice").SetValue("0"); this.GetCmp <ComboBox>("ProductP_Listed").SetValue("NO"); this.GetCmp <NumberField>("ProductP_UnitPrice").SetHidden(true); this.GetCmp <ComboBox>("ProductP_Listed").SetHidden(true); } if (ProductRepo.Class_Id == "03") { this.GetCmp <ComboBox>("txt_Bond_Type").SetHidden(false); this.GetCmp <ComboBox>("txt_FIX_float").SetHidden(false); } else { this.GetCmp <ComboBox>("txt_Bond_Type").SetHidden(true); this.GetCmp <ComboBox>("txt_Bond_Type").SetValue("NA"); this.GetCmp <ComboBox>("txt_FIX_float").SetHidden(true); this.GetCmp <ComboBox>("txt_FIX_float").SetValue("NA"); } return(this.Direct()); }
public ActionResult SaveRecord(Invest_ProductRepo ProductRepo) { try { if (ModelState.IsValid) { if (Microsoft.VisualBasic.Information.IsNumeric(ProductRepo.Equity_CIS_Unit_Price)) { ProductRepo.Equity_CIS_Unit_Price = Convert.ToDecimal(ProductRepo.Equity_CIS_Unit_Price); if (ProductRepo.Equity_CIS_Unit_Price < 0 && ProductRepo.Class_Id == "04") { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Invalid Unit Price for " + ProductRepo.Product_Name, Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); var xxx = X.GetCmp <ComboBox>("txtClass_Id"); xxx.Enable(); return(this.Direct()); } } else { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Invalid Unit Price for " + ProductRepo.Product_Name, Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } if (ProductRepo.Bond_Class == "NA" && ProductRepo.Class_Id == "03") { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Bond Type can not be 'NA'", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } if (ProductRepo.Fix_Floating == "NA" && ProductRepo.Class_Id == "03") { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Fix/Floating can not be 'NA'", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } this.ProductRepo.SaveRecord(ProductRepo); X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Product Successfully Saved.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); ClearControls(); Store store = X.GetCmp <Store>("productStore"); store.Reload(); return(this.Direct()); } 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 = "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 }); return(this.Direct()); } finally { } }
public ActionResult UploadUP(Invest_ProductRepo PRepo, pfm_Scheme_FundRepo SFRepo) { try { if (!PRepo.E_Unit_Date.HasValue) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Date is required.Process aborted.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } //Check if file Exist file_upload1 if (this.GetCmp <FileUploadField>("file_upload_UP_EC").HasFile) { HttpPostedFile file_posted = this.GetCmp <FileUploadField>("file_upload_UP_EC").PostedFile; string extension = Path.GetExtension(file_posted.FileName); if (extension != ".xlsx" && extension != ".xls") { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "selected file must be an excel file.Process aborted.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } ImageWork.Upload_Any_File_Not_Image(file_posted); if (ECUpload(ImageWork.Current_Path_For_Other_Files, PRepo)) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Unit Prices successfully uploaded.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); this.ClearControls(); //var pvr = new Ext.Net.MVC.PartialViewResult //{ // ViewName = "LoadUnitPricePartial", // ContainerId = "MainArea", // RenderMode = RenderMode.AddTo, //}; //this.GetCmp<TabPanel>("MainArea").SetLastTabAsActive(); //return pvr; } } else { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Please select a file to upload.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } return(this.Direct()); } catch (Exception ex) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Sorry! File upload failed. Contact System Administrator", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } }
public bool ECUpload(string filePath, Invest_ProductRepo PRepo) { try { if (System.IO.File.Exists(filePath) == false) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "File does not exist.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(false); } //'get file extension string file_ext = Path.GetExtension(filePath); string consString_excel = ""; switch (file_ext) { case ".xls": consString_excel = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=Excel 8.0;HDR=Yes;IMEX=2"; break; case ".xlsx": consString_excel = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePath + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\""; break; } OleDbConnection con_ex = new OleDbConnection(); OleDbCommand cmd = new OleDbCommand(); string query1 = "Select COUNT(*) AS NOS From [sheet1$]"; string query2 = "Select * From [sheet1$]"; int totalsum = 1; con_ex.ConnectionString = consString_excel; con_ex.Open(); cmd.Connection = con_ex; cmd.CommandText = query1; totalsum = Convert.ToInt32(cmd.ExecuteScalar()); //(); con_ex.Close(); if (con_ex.State == ConnectionState.Closed) { con_ex.Open(); } if (con_ex.State == ConnectionState.Open) { cmd.Connection = con_ex; cmd.CommandText = query2; OleDbDataReader srda = cmd.ExecuteReader(); int a_value = 0; if (srda.HasRows) { string errormsg = ""; Stopwatch sw = new Stopwatch(); // Start The StopWatch ...From 000 sw.Start(); var app = new AppSettings(); //IDbConnection con; TransactionOptions tsOp = new TransactionOptions(); tsOp.IsolationLevel = System.Transactions.IsolationLevel.Snapshot; TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, tsOp); tsOp.Timeout = TimeSpan.FromMinutes(20); using (OracleConnection conn = new OracleConnection(app.conString())) // { conn.Open(); try { while (srda.Read()) { a_value += 1; // Invest_ProductRepo PRepo = new Invest_ProductRepo(); if (srda["Share Code"] != DBNull.Value) { PRepo.Product_Name = srda["Share Code"].ToString(); OracleCommand cmd_emp_id = new OracleCommand(); cmd_emp_id.CommandText = "SEL_INVEST_PRODUCTNAMEEXIST"; cmd_emp_id.CommandType = CommandType.StoredProcedure; cmd_emp_id.Connection = (OracleConnection)conn; //Input param cmd_emp_id.Parameters.Add("p_ProductId", OracleDbType.Varchar2, ParameterDirection.Input).Value = PRepo.Product_Name; //Output param OracleParameter count = new OracleParameter("p_result", OracleDbType.Decimal, 100, ParameterDirection.Output); cmd_emp_id.Parameters.Add(count); cmd_emp_id.ExecuteNonQuery(); string mtotal = (count.Value).ToString(); int total = Convert.ToInt32(mtotal); if (total <= 0) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Wrong Share Code .Process aborted " + PRepo.Product_Name, Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(false); } } else { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Share Code is required", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(false); } if (srda["Closing Price VWAP (GHS)"] == DBNull.Value || Microsoft.VisualBasic.Information.IsNumeric(srda["Closing Price VWAP (GHS)"]) == false) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Invalid 'Closing Price VWAP (GHS)'.Process aborted " + PRepo.Product_Name, Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(false); } else { PRepo.Equity_CIS_Unit_Price = Convert.ToDecimal(srda["Closing Price VWAP (GHS)"]); } //Update Invest_Product table DynamicParameters param_B = new DynamicParameters(); param_B.Add(name: "P_ProductName", value: PRepo.Product_Name, dbType: DbType.String, direction: ParameterDirection.Input); param_B.Add(name: "P_UNIT_PRICE", value: PRepo.Equity_CIS_Unit_Price, dbType: DbType.Decimal, direction: ParameterDirection.Input); param_B.Add(name: "P_Unit_Date", value: PRepo.E_Unit_Date, dbType: DbType.Date, direction: ParameterDirection.Input); param_B.Add(name: "P_MAKER_ID", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input); conn.Execute("UPD_EC_UNITPRICE", param_B, commandType: CommandType.StoredProcedure); } ///while ts.Complete(); // this.GetCmp<Window>("loading_EmpBatch").Hide(); //var pvr = new Ext.Net.MVC.PartialViewResult //{ // ViewName = "LoadUnitPricePartial", // ContainerId = "MainArea", // RenderMode = RenderMode.AddTo, //}; //this.GetCmp<TabPanel>("MainArea").SetLastTabAsActive(); //return true; } catch (TransactionException transexeption) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = transexeption.ToString(), Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); // errormsg = transexeption.ToString(); return(false); //throw; //var pvr = new Ext.Net.MVC.PartialViewResult //{ // ViewName = "LoadUnitPricePartial", // ContainerId = "MainArea", // RenderMode = RenderMode.AddTo, //}; //this.GetCmp<TabPanel>("MainArea").SetLastTabAsActive(); //return true; } catch (Exception ex) { X.Mask.Hide(); 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(false); //var pvr = new Ext.Net.MVC.PartialViewResult //{ // ViewName = "LoadUnitPricePartial", // ContainerId = "MainArea", // RenderMode = RenderMode.AddTo, //}; //this.GetCmp<TabPanel>("MainArea").SetLastTabAsActive(); //return true; } finally { ts.Dispose(); ////a_value = a_value; //if (conn.State == ConnectionState.Open) //{ // conn.Close(); //} //if (con_ex.State == ConnectionState.Open) //{ // con_ex.Close(); //} } } //end for transscope } } return(true); } catch (Exception ex) { X.Mask.Hide(); 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(false); } }