public ActionResult Get_RemittnaceInBatchLogPending(Remit_Contribution_Upload_LogRepo remLog) { var log = new LoggerConfiguration().WriteTo.Seq("http://localhost:5341").CreateLogger(); try { return(this.Store(remLog.GetEmployeeCon_BatchList_ByStatus(remLog.Con_Log_Id))); } catch (Exception ex) { log.Write(level: Serilog.Events.LogEventLevel.Information, messageTemplate: ex.Message + " " + DateTime.Now); return(this.Direct()); } }
public ActionResult ApprovedRetmit_Record(Remit_Contribution_Upload_LogRepo conLogRepo) { try { if (!string.IsNullOrEmpty(conLogRepo.Con_Log_Id)) { //check if pending list exist for employer var app = new AppSettings(); con = app.GetConnection(); GlobalValue.Get_Scheme_Today_Date(conLogRepo.Scheme_Id); if (this.RemitConRepo.ApprovedRecord(conLogRepo)) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Remittance batch upload approved succesfully.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); ClearControls(); } return(this.Direct()); } else { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Select a batch to approve.", // " Insufficient data. Operation Aborted", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } //return this.Direct(); } catch (Exception ex) { X.Mask.Hide(); throw ex; } }
// filter con list for scheme public ActionResult GetGLAB(string Scheme_Id) { var misdepartmentrepo = new Remit_Contribution_Upload_LogRepo(); var mydata = misdepartmentrepo.GetGLASFList(Scheme_Id); List <object> data = new List <object>(); foreach (var ddd in mydata) { string id = Convert.ToString(ddd.For_Month) + Convert.ToString(ddd.For_Year); string name = Convert.ToString(ddd.monthname) + ", " + Convert.ToString(ddd.For_Year); data.Add(new { conlist_GLB_gId = id, conName = name }); } return(this.Store(data)); }
public ActionResult DeleteRetmit_Record(Remit_Contribution_Upload_LogRepo conLogRepo) { try { if (!string.IsNullOrEmpty(conLogRepo.Con_Log_Id)) { //check if pending list exist for employer var app = new AppSettings(); con = app.GetConnection(); if (conLogRepo.isValidDelete(conLogRepo.Con_Log_Id) == true) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Sorry! There is a pending purchase for this schedule. Process aborted.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } GlobalValue.Get_Scheme_Today_Date((conLogRepo.Scheme_Id)); if (this.RemitConRepo.DeleteRecord(conLogRepo)) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Remittance batch upload deleted succesfully.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); ClearControls(); } return(this.Direct()); } else { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Select a batch to delete.", // " Insufficient data. Operation Aborted", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } //return this.Direct(); } 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.Mask.Hide(); 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()); } }
public void SendIt3(string from, string pass, string subj, string msg, string to, string smtp, int port, Remit_Contribution_Upload_LogRepo employeeRepo, string attach) { try { MailMessage mail = new MailMessage(); System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient(); System.Net.Mail.MailAddress fromaddress = new System.Net.Mail.MailAddress(from, company_name); System.Net.Mail.Attachment attachment; attachment = new System.Net.Mail.Attachment(attach); mail.Attachments.Add(attachment); mail.From = fromaddress; mail.To.Add(to); mail.Subject = subj; mail.Body = msg; mail.IsBodyHtml = true; SmtpServer.Port = port; SmtpServer.Host = smtp; SmtpServer.EnableSsl = true; SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network; SmtpServer.Credentials = new System.Net.NetworkCredential(from, pass); SmtpServer.Send(mail); } catch (Exception ex) { throw ex; } }
public ActionResult PayAdvice_Record(Remit_Contribution_Upload_LogRepo employeeRepo) { try { if (String.IsNullOrEmpty(employeeRepo.Employer_Id)) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Please Select Contribution", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } string DD = System.DateTime.Now.ToString("dd-MMM-yyyy"); string queryString = "select * from VW_REMIT_CON_PURSHACE where con_log_id = '" + employeeRepo.Con_Log_Id + "' "; string queryinternet = "select * from setup_company"; using (OracleConnection connection = new OracleConnection(GlobalValue.ConString)) { OracleCommand command = new OracleCommand(queryString, connection); connection.Open(); OracleDataReader reader; reader = command.ExecuteReader(); // Always call Read before accessing data. while (reader.Read()) { employeeRepo.Scheme_Name = (string)reader["Scheme_Name"]; employeeRepo.Employer_Name = (string)reader["Employer_Name"]; employeeRepo.Con_Log_Id = (string)reader["Con_Log_Id"]; employeeRepo.For_MonthN = ((decimal)reader["For_Month"]).ToString(); employeeRepo.For_YearN = ((decimal)reader["For_Year"]).ToString(); employeeRepo.Contact_Person = (string)reader["Contact_Person"]; employeeRepo.Contact_Email = (string)reader["Contact_Email"]; if (String.IsNullOrEmpty(employeeRepo.Contact_Email)) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Sorry! No Email Address. Process aborted", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } if (Regex.IsMatch(((string)reader["Contact_Email"]), MatchEmailPattern) == false) { //log this } else { ////load report table //var con = new AppSettings(); //var param = new DynamicParameters(); //param.Add("P_ESF_ID", employeeRepo.ESF_Id, DbType.String, ParameterDirection.Input); //param.Add("P_MAKER_ID", GlobalValue.User_ID, DbType.String, ParameterDirection.Input); //con.GetConnection().Execute("REPORT_EMPLOYEE_STATEMENT", param, commandType: CommandType.StoredProcedure); employeeRepo.Contact_Email = (string)reader["Contact_Email"]; string DocumentName = "NA"; string pa = Server.MapPath("~/Penfad_Reports/employer_Payment_Advice.dll"); System.Reflection.Assembly assembly_1 = System.Reflection.Assembly.LoadFrom(pa); StiReport My_Report = StiReport.GetReportFromAssembly(assembly_1); //////asign constring My_Report.Dictionary.DataStore.Clear(); My_Report.Dictionary.Databases.Add(new StiOracleDatabase("con", GlobalValue.ConString)); My_Report[":P_CON_LOG"] = employeeRepo.Con_Log_Id; string path = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); if (!(System.IO.Directory.Exists(path + @"\" + "PAYMENT_ADVICE" + @"\" + employeeRepo.Scheme_Name + @"\" + employeeRepo.Employer_Name))) { System.IO.Directory.CreateDirectory(path + @"\" + "PAYMENT_ADVICE" + @"\" + employeeRepo.Scheme_Name + @"\" + employeeRepo.Employer_Name); } if (!(System.IO.File.Exists(path + @"\" + "PAYMENT_ADVICE" + @"\" + employeeRepo.Scheme_Name + @"\" + employeeRepo.Employer_Name + @"\" + employeeRepo.For_MonthN + "_" + employeeRepo.For_YearN + ".pdf"))) { System.IO.File.Delete(path + @"\" + "PAYMENT_ADVICE" + @"\" + employeeRepo.Scheme_Name + @"\" + employeeRepo.Employer_Name + @"\" + employeeRepo.For_MonthN + "_" + employeeRepo.For_YearN + ".pdf"); } DocumentName = (path + @"\" + "PAYMENT_ADVICE" + @"\" + employeeRepo.Scheme_Name + @"\" + employeeRepo.Employer_Name + @"\" + employeeRepo.For_MonthN + "_" + employeeRepo.For_YearN + ".pdf"); My_Report.Render(); My_Report.ExportDocument(StiExportFormat.Pdf, DocumentName); #region send email OracleCommand commandinternet = new OracleCommand(queryinternet, connection); //connection.Open(); OracleDataReader readerinternet; readerinternet = commandinternet.ExecuteReader(); // Always call Read before accessing data. while (readerinternet.Read()) { internetRepo.smtp = (string)readerinternet["smtp"]; internetRepo.email_from = (string)readerinternet["email_from"]; internetRepo.email_password = (string)readerinternet["email_password"]; internetRepo.port = Convert.ToInt16(readerinternet["port"]); internetRepo.company_name = (string)readerinternet["company_name"]; } var msg = $@"Dear {employeeRepo.Contact_Person}, Kindly find attached, Payment Advice for {employeeRepo.Scheme_Name}. Thank you. {internetRepo.company_name}"; string from = internetRepo.email_from, pass = internetRepo.email_password, subj = "Payment Advice", to = employeeRepo.Contact_Email; string smtp = internetRepo.smtp; int port = internetRepo.port; string attach = DocumentName; internetRepo.SendIt3(from, pass, subj, msg, to, smtp, port, employeeRepo, attach); #endregion } } // Always call Close when done reading. reader.Close(); X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Sent", Message = "Emails Successfully Sent", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); } return(this.Direct()); } catch (Exception ex) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Email traffic issue. Process aborted", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } }
public ActionResult download_PayAdvice_Record(Remit_Contribution_Upload_LogRepo conLogRepo) { try { if (String.IsNullOrEmpty(conLogRepo.Con_Log_Id)) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Please Select Contribution Schedule", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } string queryString = "select * from VW_REMIT_CON_PURSHACE where con_log_id = '" + conLogRepo.Con_Log_Id + "' "; using (OracleConnection connection = new OracleConnection(GlobalValue.ConString)) { OracleCommand command = new OracleCommand(queryString, connection); connection.Open(); OracleDataReader reader; reader = command.ExecuteReader(); // Always call Read before accessing data. while (reader.Read()) { conLogRepo.Scheme_Name = (string)reader["Scheme_Name"]; conLogRepo.Employer_Name = (string)reader["Employer_Name"]; conLogRepo.Con_Log_Id = (string)reader["Con_Log_Id"]; conLogRepo.For_MonthN = ((decimal)reader["For_Month"]).ToString(); conLogRepo.For_YearN = ((decimal)reader["For_Year"]).ToString(); string DocumentName = "NA"; string pa = Server.MapPath("~/Penfad_Reports/employer_Payment_Advice.dll"); System.Reflection.Assembly assembly_1 = System.Reflection.Assembly.LoadFrom(pa); StiReport My_Report = StiReport.GetReportFromAssembly(assembly_1); //////asign constring My_Report.Dictionary.DataStore.Clear(); My_Report.Dictionary.Databases.Add(new StiOracleDatabase("con", GlobalValue.ConString)); My_Report[":P_CON_LOG"] = conLogRepo.Con_Log_Id; string path = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); if (!(System.IO.Directory.Exists(path + @"\" + "PAYMENT_ADVICE" + @"\" + conLogRepo.Scheme_Name + @"\" + conLogRepo.Employer_Name))) { System.IO.Directory.CreateDirectory(path + @"\" + "PAYMENT_ADVICE" + @"\" + conLogRepo.Scheme_Name + @"\" + conLogRepo.Employer_Name); } if (!(System.IO.File.Exists(path + @"\" + "PAYMENT_ADVICE" + @"\" + conLogRepo.Scheme_Name + @"\" + conLogRepo.Employer_Name + @"\" + conLogRepo.For_MonthN + "_" + conLogRepo.For_YearN + ".pdf"))) { System.IO.File.Delete(path + @"\" + "PAYMENT_ADVICE" + @"\" + conLogRepo.Scheme_Name + @"\" + conLogRepo.Employer_Name + @"\" + conLogRepo.For_MonthN + "_" + conLogRepo.For_YearN + ".pdf"); } DocumentName = (path + @"\" + "PAYMENT_ADVICE" + @"\" + conLogRepo.Scheme_Name + @"\" + conLogRepo.Employer_Name + @"\" + conLogRepo.For_MonthN + "_" + conLogRepo.For_YearN + ".pdf"); My_Report.Render(); My_Report.ExportDocument(StiExportFormat.Pdf, DocumentName); ////return StiMvcViewer.GetReportSnapshotResult(My_Report); } // Always call Close when done reading. reader.Close(); X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Successful", Message = "Payment Advice Successfully Downloaded", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); } return(this.Direct()); } catch (Exception EX) { X.Mask.Hide(); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Could not download Payment Advice", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } }