private void GetRequestDetails() { var a = (from data in dbContext.tblRequests join incharge in dbContext.tblIncharges on data.Incharge_ID equals incharge.Incharge_ID into UP from incharge in UP.DefaultIfEmpty() where data.JR_Code.Trim() == jrcode.Trim() select new { Request_Date = data.Request_Date, EmpID = data.EmpID, InchargeCode = incharge.Incharge_ID, Incharge = incharge.Incharge, Customer = data.Customer, PartName = data.Partname, PartCode = data.Partcode, JigType = data.JigType, Quantity = data.Quantity, QtyProdPerHr = data.QtyProdPerHr, Monthly_Req = data.Monthly_Req, Machine_Capacity = data.Machine_Capacity, NextForecast = data.NextForeCast, Problem_Desc = data.Problem_Desc } ).ToList(); foreach (DataRow row in ConvertToDataTable(a).Rows) { userempid = row[1].ToString().Trim(); incharge = row[2].ToString().Trim(); } GetRequestorDetails(userempid); }
private void LoadData() { try { string code = _boxCode; var a = from data in dbContext.tbl_BoxMaster join boxSeries in dbContext.tbl_BoxSeries on data.BoxCode equals boxSeries.BoxCode into UP from boxSeries in UP.DefaultIfEmpty() where data.BoxCode == code orderby boxSeries.SeriesNo select new { BoxCode = data.BoxCode, SeriesNo = boxSeries.SeriesNo, IsDisposed = boxSeries.IsDisposed, IsUsed = boxSeries.IsUsed, IsIssuedToProduction = boxSeries.IsIssuedToProduction, IsIssuedToWareHouse = boxSeries.IsIssuedToWareHouse, IsDelivered = boxSeries.IsDelivered, IsReturned = boxSeries.IsReturned, BoxSeriesCode = boxSeries.BoxCode + "-" + boxSeries.SeriesNo }; gridInventory.ItemsSource = a.ToList(); GetCount(); } catch { } }
private void GetRequestDetails() { string remarksRejected = string.Empty; var a = (from data in dbContext.tblRequests join incharge in dbContext.tblIncharges on data.Incharge_ID equals incharge.Incharge_ID join assess in dbContext.tblAssessments on data.AssessmentCode equals assess.AssessmentCode into UP from assess in UP.DefaultIfEmpty() where data.JR_Code.Trim() == jrcode.Trim() select new { Request_Date = data.Request_Date, EmpID = data.EmpID, InchargeCode = incharge.Incharge_ID, Incharge = incharge.Incharge, Customer = data.Customer, PartName = data.Partname, PartCode = data.Partcode, JigType = data.JigType, Quantity = data.Quantity, QtyProdPerHr = data.QtyProdPerHr, Monthly_Req = data.Monthly_Req, Machine_Capacity = data.Machine_Capacity, NextForecast = data.NextForeCast, Problem_Desc = data.Problem_Desc, AssessmentCode = data.AssessmentCode, AssessmentDesc = assess.Assessment, AssessmentRemarks = data.AssessmentRemarks, IsRejected = data.IsRejected, IsCancelled = data.IsCancelled, Checker = data.Checker, AssessBy = data.AssessedBy, Noter = data.Noter, Manager = data.Manager, AcceptBy = data.FinalAcceptanceBy, PreparerRemarks = data.Req_Remarks, CheckerRemarks = data.CheckerRemarks, AssesstorRemarks = data.AssessedRemarks, NoterRemarks = data.NoterRemarks, ApproverRemarks = data.ManagerRemarks, ReceiverRemarks = data.AcceptRemarks, RejectRemarks = data.RejectRemarks, DateChecked = data.DateChecked, DateAssessed = data.DateAssessed, DateNoted = data.DateNoted, DateApprove = data.DateApproved, DateReceived = data.DateAccepted, IsExistingJig = data.IsExistingJig } ).ToList(); foreach (DataRow row in ConvertToDataTable(a).Rows) { tbdateRequest.Text = Convert.ToDateTime(row[0]).ToString("dd") + "-" + Convert.ToDateTime(row[0]).ToString("MMM") + "-" + Convert.ToDateTime(row[0]).ToString("yyyy"); userempid = row[1].ToString().Trim(); incharge = row[2].ToString().Trim(); tbItemName.Text = row[5].ToString(); tbItemQuantity.Text = row[8].ToString(); tbCustomer.Text = row[4].ToString(); tbPartName.Text = row[5].ToString(); tbPartCode.Text = row[6].ToString(); tbTypeOfJig.Text = row[7].ToString(); tbQuantity_Jigs.Text = row[8].ToString(); qtyhrtxt.Text = row[9].ToString(); mreqtxt.Text = row[10].ToString(); mcaptxt.Text = row[11].ToString(); tbNextForecast.Text = row[12].ToString(); tbjustification.Text = row[13].ToString().Replace(" ", " ").Replace("<br/>", "\r\n"); tbAssessment.Text = row[15].ToString().Trim(); //if (row[14].ToString().Trim() == "CP") //{ // tbAssessmentRemarks.Text = row[16].ToString().Trim(); // colAssessRemarks.Visible = true; //} //else //{ // tbAssessmentRemarks.Text = "N/A"; // colAssessRemarks.Visible = false; //} if (string.IsNullOrEmpty(row[16].ToString().Trim())) { tbAssessmentRemarks.Text = "N/A"; } else { tbAssessmentRemarks.Text = row[16].ToString().Trim(); } if (row.IsNull(36)) { tbIsExistingJig.Text = "N/A"; } else { if (Convert.ToBoolean(row[36]) == true) { tbIsExistingJig.Text = "Yes"; } else { tbIsExistingJig.Text = "No"; } } if (Convert.ToBoolean(row[17]) == true && Convert.ToBoolean(row[18]) == false) { rowRejected.Visible = true; rowCancelled.Visible = false; remarksRejected = "This request has been rejected. <br /> See below details:"; remarksRejected += "<br />" + "<br />" + "\"" + row[30].ToString().Replace(" ", " ").Replace("<br />", "\r\n") + "\""; lblRemarks.Text = remarksRejected; } else if (Convert.ToBoolean(row[17]) == false && Convert.ToBoolean(row[18]) == true) { rowRejected.Visible = false; rowCancelled.Visible = true; } else { rowRejected.Visible = false; rowCancelled.Visible = false; } //Preparer.InnerText = tbReqName.Text.Trim(); Checker.InnerText = row[19].ToString().Trim(); Assesstor.InnerText = row[20].ToString().Trim(); Noter.InnerText = row[21].ToString().Trim(); Approver.InnerText = row[22].ToString().Trim(); Receiver.InnerText = row[23].ToString().Trim(); lblPreparerRemarks.InnerText = row[24].ToString().Trim(); lblCheckerRemarks.InnerText = row[25].ToString().Trim(); lblAssesstorRemarks.InnerText = row[26].ToString().Trim(); lblNoterRemarks.InnerText = row[27].ToString().Trim(); lblApproverRemarks.InnerText = row[28].ToString().Trim(); lblReceiverRemarks.InnerText = row[29].ToString().Trim(); lblDateSigned_Preparer.InnerText = string.IsNullOrEmpty(row[0].ToString()) ? string.Empty : Convert.ToDateTime(row[0]).ToString("yyyy-MMM-dd"); lblDateSigned_Checker.InnerText = string.IsNullOrEmpty(row[31].ToString()) ? string.Empty : Convert.ToDateTime(row[31]).ToString("yyyy-MMM-dd"); lblDateSigned_Assesstor.InnerText = string.IsNullOrEmpty(row[32].ToString()) ? string.Empty : Convert.ToDateTime(row[32]).ToString("yyyy-MMM-dd"); lblDateSigned_Noter.InnerText = string.IsNullOrEmpty(row[33].ToString()) ? string.Empty : Convert.ToDateTime(row[33]).ToString("yyyy-MMM-dd"); lblDateSigned_Approver.InnerText = string.IsNullOrEmpty(row[34].ToString()) ? string.Empty : Convert.ToDateTime(row[34]).ToString("yyyy-MMM-dd"); lblDateSigned_Receiver.InnerText = string.IsNullOrEmpty(row[35].ToString()) ? string.Empty : Convert.ToDateTime(row[35]).ToString("yyyy-MMM-dd"); } SQLDSGetAttachment.ConnectionString = ClsConfig.JobRequestConnectionString; if (incharge == "01" || incharge == "02" || incharge == "03") { rdoInCharge.SelectedValue = "07"; } else if (incharge == "04" || incharge == "05" || incharge == "06") { rdoInCharge.SelectedValue = "08"; } else { rdoInCharge.SelectedValue = incharge; } GetRequestorDetails(userempid); GetTypeOfRequest(Request.QueryString["RCode"].ToString().Trim()); if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") { rowJigs.Visible = true; rowFacilities.Visible = false; } else { rowJigs.Visible = false; rowFacilities.Visible = true; } }
private void GetRequestDetails() { string remarksHold = string.Empty; var a = (from data in dbContext.tblRequests join incharge in dbContext.tblIncharges on data.Incharge_ID equals incharge.Incharge_ID into UP join assess in dbContext.tblAssessments on data.AssessmentCode equals assess.AssessmentCode from incharge in UP.DefaultIfEmpty() where data.JR_Code.Trim() == jrcode.Trim() select new { Request_Date = data.Request_Date, EmpID = data.EmpID, InchargeCode = incharge.Incharge_ID, Incharge = incharge.Incharge, Customer = data.Customer, PartName = data.Partname, PartCode = data.Partcode, JigType = data.JigType, Quantity = data.Quantity, QtyProdPerHr = data.QtyProdPerHr, Monthly_Req = data.Monthly_Req, Machine_Capacity = data.Machine_Capacity, NextForecast = data.NextForeCast, Problem_Desc = data.Problem_Desc, AssessmentCode = data.AssessmentCode, AssessmentDesc = assess.Assessment, AssessmentRemarks = data.AssessmentRemarks, HoldRemarks = data.HoldRemarks, IsHold = data.IsHold, HoldBy = data.HoldBy, IsExistingJig = data.IsExistingJig } ).ToList(); foreach (DataRow row in ConvertToDataTable(a).Rows) { tbdateRequest.Text = Convert.ToDateTime(row[0]).ToString("dd") + "-" + Convert.ToDateTime(row[0]).ToString("MMM") + "-" + Convert.ToDateTime(row[0]).ToString("yyyy"); userempid = row[1].ToString().Trim(); incharge = row[2].ToString().Trim(); tbItemName.Text = row[5].ToString(); tbItemQuantity.Text = row[8].ToString(); tbCustomer.Text = row[4].ToString(); tbPartName.Text = row[5].ToString(); tbPartCode.Text = row[6].ToString(); tbTypeOfJig.Text = row[7].ToString(); tbQuantity_Jigs.Text = row[8].ToString(); qtyhrtxt.Text = row[9].ToString(); mreqtxt.Text = row[10].ToString(); mcaptxt.Text = row[11].ToString(); tbNextForecast.Text = row[12].ToString(); tbjustification.Text = row[13].ToString().Replace(" ", " ").Replace("<br/>", "\r\n"); tbAssessment.Text = row[15].ToString().Trim(); //if (row[14].ToString().Trim() == "CP") //{ // tbAssessmentRemarks.Text = row[16].ToString().Trim(); // colAssessRemarks.Visible = true; //} //else //{ // tbAssessmentRemarks.Text = "N/A"; // colAssessRemarks.Visible = false; //} if (string.IsNullOrEmpty(row[16].ToString().Trim())) { tbAssessmentRemarks.Text = "N/A"; } else { tbAssessmentRemarks.Text = row[16].ToString().Trim(); } if (row.IsNull(20)) { tbIsExistingJig.Text = "N/A"; } else { if (Convert.ToBoolean(row[20]) == true) { tbIsExistingJig.Text = "Yes"; } else { tbIsExistingJig.Text = "No"; } } if (Convert.ToBoolean(row[18]) == true) { rowHold.Visible = true; remarksHold = "This request is set as hold. See below details:"; remarksHold += "<br />" + "<br />" + row[17].ToString().Replace(" ", " ").Replace("<br/>", "\r\n"); lblHoldRemarks.Text = remarksHold; } else { rowHold.Visible = false; } } SQLDSGetAttachment.ConnectionString = ClsConfig.JobRequestConnectionString; if (incharge == "01" || incharge == "02" || incharge == "03") { rdoInCharge.SelectedValue = "07"; } else if (incharge == "04" || incharge == "05" || incharge == "06") { rdoInCharge.SelectedValue = "08"; } else { rdoInCharge.SelectedValue = incharge; } GetRequestorDetails(userempid); GetTypeOfRequest(Session["RCode"].ToString().Trim()); if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") { rowJigs.Visible = true; rowFacilities.Visible = false; } else { rowJigs.Visible = false; rowFacilities.Visible = true; } }
protected void Approve(object sender, EventArgs e) { string link = string.Empty, body = string.Empty, jono = string.Empty; var app = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).FirstOrDefault(); if (app != null) { app.JRF_No = GenerateJONumber().Trim(); app.Is_Approved = true; app.Manager = approverfullname_fnamefirst.ToString(); app.ManagerRemarks = "SIGNED"; app.DateApproved = DateTime.Now.Date; app.IsHold = false; app.CreationDateTime = DateTime.Now; dbContext.Entry(app).State = EntityState.Modified; dbContext.SaveChanges(); } link = Environment.NewLine + "http://" + HttpContext.Current.Request.Url.Authority + "/AdminHomeDirect.aspx"; var asstr = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsAssesstor == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); foreach (DataRow dr in ConvertToDataTable(asstr).Rows) { body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; body += "<br /><br />" + "Please be informed that you have a new job order request ready for project acceptance."; body += "<br /><br />" + "You may click the link below to redirect to main page. "; body += "<br /><br />" + link + "?EmpID=" + dr["EmpID"].ToString().Trim(); body += "<br /><br />" + "Thank You."; body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; var rx = new Regex(@"(?<=\w)\w"); var newString2 = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); using (MailMessage mm = new MailMessage()) { string sub = "Online Job Order Request: New Job Order Request Ready For Project Acceptance"; mm.Subject = sub.ToUpper(); mm.Body = body; var newString = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderName"].ToString()); mm.To.Add(dr["EmailAdd"].ToString().Trim()); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); smtp.EnableSsl = true; mm.IsBodyHtml = true; NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); } } //var noter = (from data in dbContext.tblUsers // join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID // into UP // from inchargePerson in UP.DefaultIfEmpty() // where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsNoter == true // select new // { // EmpID = data.EmpID, // EmailAdd = data.EmailAdd, // InchargeCode = inchargePerson.Incharge_ID, // IsAssesstor = inchargePerson.IsAssesstor, // IsNoter = inchargePerson.IsNoter // } // ).ToList(); //foreach (DataRow dr in ConvertToDataTable(noter).Rows) //{ // body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; // body += "<br /><br />" + "Please be informed that you have a new job order request."; // body += "<br /><br />" + "You may click the link below to redirect to main page. "; // body += "<br /><br />" + link; // body += "<br /><br />" + "Thank You."; // body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; // var rx = new Regex(@"(?<=\w)\w"); // var newString2 = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); // using (MailMessage mm = new MailMessage()) // { // string sub = "Online Job Order Request: New Job Order Request"; // mm.Subject = sub.ToUpper(); // mm.Body = body; // var newString = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); // mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), // ConfigurationManager.AppSettings["MailSenderName"].ToString()); // mm.To.Add(dr["EmailAdd"].ToString().Trim()); // SmtpClient smtp = new SmtpClient(); // smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); // smtp.EnableSsl = true; // mm.IsBodyHtml = true; // NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), // ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); // smtp.Credentials = NetworkCred; // smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); // ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, // X509Chain chain, SslPolicyErrors sslPolicyErrors) // { return true; }; // smtp.Send(mm); // } //} SendToRequestor(); divSuccess.Visible = true; divApplication.Visible = false; }
protected void Approve(object sender, EventArgs e) { string link = string.Empty, body = string.Empty; link = Environment.NewLine + "http://" + HttpContext.Current.Request.Url.Authority + "/" + ConfigurationManager.AppSettings["ApproverPage"]; var asstr = (from data in dbContext.tblUsers join approvers in dbContext.tblApprovers on data.EmpID equals approvers.EmpID into UP from approvers in UP.DefaultIfEmpty() where approvers.OrderValue == 1 select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd } ).ToList(); var asstr2 = (from data in dbContext.tblUsers join approvers in dbContext.tblApprovers on data.EmpID equals approvers.EmpID into UP from approvers in UP.DefaultIfEmpty() where approvers.OrderValue == 1 select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd } ).ToList(); string appempid = string.Empty; foreach (DataRow dr in ConvertToDataTable(asstr2).Rows) { appempid = dr["EmpID"].ToString().Trim(); } var dbuser = dbHRISContext.SKPI_GetAllEmployeesByEmpID(appempid.Trim()).ToList(); if (ConvertToDataTable(dbuser).Rows.Count > 0) { foreach (DataRow row in ConvertToDataTable(dbuser).Rows) { nextApprover = row["FullName_FnameFirst"].ToString().Trim(); } } var app = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).FirstOrDefault(); if (app != null) { app.Is_Noted = true; app.Noter = approverfullname_fnamefirst.ToString(); app.NoterRemarks = "SIGNED"; app.DateNoted = DateTime.Now.Date; app.IsHold = false; app.Manager = nextApprover.Trim(); app.IsSentToApprover_First = true; app.CreationDateTime = DateTime.Now; dbContext.Entry(app).State = EntityState.Modified; dbContext.SaveChanges(); } foreach (DataRow dr in ConvertToDataTable(asstr).Rows) { Boolean ress; ress = SaveEmailLogs(link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + Session["RCode"].ToString().Trim(), "Approver", dr["EmailAdd"].ToString().Trim(), Session["FullName_LnameFirst"].ToString().Trim() , dr["EmpID"].ToString().Trim(), Session["RCode"].ToString().Trim()); body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; body += "<br /><br />" + "I Have Prepared A Job Order Request For Your Checking And Approval."; body += "<br /><br />" + "You may click the link below to redirect to main page. "; body += "<br /><br />" + link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + Session["RCode"].ToString().Trim(); body += "<br /><br />" + "Thank You."; body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; var rx = new Regex(@"(?<=\w)\w"); var newString2 = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); using (MailMessage mm = new MailMessage()) { string sub = "Online Job Order Request: Requesting For Approval"; mm.Subject = sub.ToUpper(); mm.Body = body; var newString = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderName"].ToString()); mm.To.Add(dr["EmailAdd"].ToString().Trim()); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); smtp.EnableSsl = true; mm.IsBodyHtml = true; NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); } } SendToRequestor(); divSuccess.Visible = true; divApplication.Visible = false; }
protected void Approve(object sender, EventArgs e) { string link = string.Empty, body = string.Empty; var count = dbContext.tblAttachments.Where(x => x.jr_code == jrcode && x.typeofattachment.Trim() == "Admin" && x.IsCheckerReviewed == false && x.IsApproverReviewed == false).Count(); if (count > 0) { Show("Some attachments are not yet reviewed. Must download and review the attachments first."); } else { var app = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).FirstOrDefault(); if (app != null) { app.IsHold = false; app.AttachementStatus = "NOTED"; app.CreationDateTime = DateTime.Now; dbContext.Entry(app).State = EntityState.Modified; dbContext.SaveChanges(); } var accept = dbContext.tblAttachments.Where(x => x.jr_code == jrcode && x.typeofattachment.Trim() == "Admin").FirstOrDefault(); if (accept != null) { accept.CheckedBy = approverfullname_fnamefirst; accept.IsChecked = true; accept.datecreated = DateTime.Now; dbContext.Entry(accept).State = EntityState.Modified; dbContext.SaveChanges(); } link = Environment.NewLine + "http://" + HttpContext.Current.Request.Url.Authority + "/" + ConfigurationManager.AppSettings["AttachmentApproverPage"]; var asstr = (from data in dbContext.tblUsers join approvers in dbContext.tblApprovers on data.EmpID equals approvers.EmpID into UP from approvers in UP.DefaultIfEmpty() where approvers.OrderValue == 1 select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd } ).ToList(); foreach (DataRow dr in ConvertToDataTable(asstr).Rows) { body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; body += "<br /><br />" + "I Have Prepared A Job Order Request Attachment/s For Your Checking And Approval."; body += "<br /><br />" + "You may click the link below to redirect to main page. "; body += "<br /><br />" + link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + Session["RCode"].ToString().Trim(); body += "<br /><br />" + "Thank You."; body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; var rx = new Regex(@"(?<=\w)\w"); var newString2 = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); using (MailMessage mm = new MailMessage()) { string sub = "Online Job Order Request: Requesting For Approval"; mm.Subject = sub.ToUpper(); mm.Body = body; var newString = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderName"].ToString()); mm.To.Add(dr["EmailAdd"].ToString().Trim()); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); smtp.EnableSsl = true; mm.IsBodyHtml = true; NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); } } //SendToRequestor(); divSuccess.Visible = true; divApplication.Visible = false; } }
protected void btnaccept_Click(object sender, EventArgs e) { string link = string.Empty, body = string.Empty, jono = string.Empty; if (RadCheckBox1.Checked == true) { var app = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).FirstOrDefault(); if (app != null) { app.IsHold = false; app.Is_AttachmentApproved = true; app.AttachementStatus = "APPROVED"; app.CreationDateTime = DateTime.Now; dbContext.Entry(app).State = EntityState.Modified; dbContext.SaveChanges(); } divDetails.Visible = false; divRecords.Visible = true; jrcode = string.Empty; Session["RCode"] = null; gridRecords.Rebind(); Show("JO has been successfully accepted"); } else { if (gridAttachment2.MasterTableView.Items.Count > 0) { var verify = dbContext.tblAttachments.Where(x => x.jr_code == jrcode && x.typeofattachment.Trim() == "Admin" && x.IsPrepared == true && x.IsChecked == true && x.IsApproved == false).Count(); if (verify >= 1) { link = Environment.NewLine + "http://" + "192.168.1.42:5033"///HttpContext.Current.Request.Url.Authority + "/" + ConfigurationManager.AppSettings["AttachmentApproverPage"]; var asstr = (from data in dbContext.tblUsers join approvers in dbContext.tblApprovers on data.EmpID equals approvers.EmpID into UP from approvers in UP.DefaultIfEmpty() where approvers.OrderValue == 1 select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd } ).ToList(); foreach (DataRow dr in ConvertToDataTable(asstr).Rows) { body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; body += "<br /><br />" + "I Have Prepared A Job Order Request Attachment/s For Your Checking and Approval."; body += "<br /><br />" + "You may click the link below to redirect to main page. "; body += "<br /><br />" + link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + Session["RCode"].ToString().Trim(); body += "<br /><br />" + "Thank You."; body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; var rx = new Regex(@"(?<=\w)\w"); var newString2 = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); using (MailMessage mm = new MailMessage()) { string sub = "Online Job Order Request: Requesting For Attachment Approval"; mm.Subject = sub.ToUpper(); mm.Body = body; var newString = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderName"].ToString()); mm.To.Add(dr["EmailAdd"].ToString().Trim()); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); smtp.EnableSsl = true; mm.IsBodyHtml = true; NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); } } } else { //string link = string.Empty, body = string.Empty; var app = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).FirstOrDefault(); if (app != null) { app.IsHold = false; app.AttachementStatus = "PREPARED"; app.CreationDateTime = DateTime.Now; dbContext.Entry(app).State = EntityState.Modified; dbContext.SaveChanges(); } var accept = dbContext.tblAttachments.Where(x => x.jr_code == jrcode && x.typeofattachment.Trim() == "Admin").FirstOrDefault(); if (accept != null) { accept.PreparedBy = Session["FullName_FnameFirst"].ToString(); accept.IsPrepared = true; accept.datecreated = DateTime.Now; dbContext.Entry(accept).State = EntityState.Modified; dbContext.SaveChanges(); } link = Environment.NewLine + "http://" + "192.168.1.42:5033"///HttpContext.Current.Request.Url.Authority + "/" + ConfigurationManager.AppSettings["AttachmentNoterPage"]; var asstr = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == incharge && inchargePerson.IsNoter == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); foreach (DataRow dr in ConvertToDataTable(asstr).Rows) { body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; body += "<br /><br />" + "I Have Prepared A Job Order Request Attachment/s For Your Checking and Approval."; body += "<br /><br />" + "You may click the link below to redirect to main page. "; body += "<br /><br />" + link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + Session["RCode"].ToString().Trim(); body += "<br /><br />" + "Thank You."; body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; var rx = new Regex(@"(?<=\w)\w"); var newString2 = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); using (MailMessage mm = new MailMessage()) { string sub = "Online Job Order Request: Requesting For Attachment Approval"; mm.Subject = sub.ToUpper(); mm.Body = body; var newString = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderName"].ToString()); mm.To.Add(dr["EmailAdd"].ToString().Trim()); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); smtp.EnableSsl = true; mm.IsBodyHtml = true; NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); } } } divDetails.Visible = false; divRecords.Visible = true; jrcode = string.Empty; Session["RCode"] = null; gridRecords.Rebind(); Show("Successfully Send To The Next Approver"); } else { Show("Must Upload Attachment First"); } } }
protected void Page_Init(object sender, EventArgs e) { string id = Request.QueryString["EmpID"].ToString().Trim(); var getchecker = (from data in dbContext.tblUsers join incharge in dbContext.tblInchargePersons on data.EmpID equals incharge.EmpID into UP from incharge in UP.DefaultIfEmpty() where data.EmpID.Trim() == id select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, UserRole = data.UserRole, InchargeCode = incharge.Incharge_ID } ).ToList(); if (ConvertToDataTable(getchecker).Rows.Count == 0) { var dbuser = dbHRISContext.SKPI_GetAllEmployeesByEmpID(id).ToList(); if (ConvertToDataTable(dbuser).Rows.Count > 0) { foreach (DataRow row in ConvertToDataTable(dbuser).Rows) { Session["Position"] = row["Pos_Desc"].ToString(); } Session["EmpID"] = Request.QueryString["EmpID"].ToString().Trim(); Response.Redirect("RegisterEmployee.aspx"); } else { ShowMessage("Invalid Employee ID"); } } else { foreach (DataRow row in ConvertToDataTable(getchecker).Rows) { Session["EmpID"] = row[0].ToString(); Session["UserEmail"] = row[1].ToString(); Session["UserRole"] = row[2].ToString(); Session["InchargeID"] = row[3].ToString(); } var dbuser = dbHRISContext.SKPI_GetAllEmployeesByEmpID(id).ToList(); foreach (DataRow row in ConvertToDataTable(dbuser).Rows) { Session["Position"] = row["Pos_Desc"].ToString(); Session["DeptCode"] = row["Dept_Code"].ToString(); Session["DeptName"] = row["Dept_Desc"].ToString(); Session["SectCode"] = row["Sect_Code"].ToString(); Session["SectName"] = row["Sect_Desc"].ToString(); Session["FName"] = row["FirstName"].ToString(); Session["FullName_LnameFirst"] = row["FullName_LnameFirst"].ToString(); Session["FullName_FnameFirst"] = row["FullName_FnameFirst"].ToString(); } } }
private void Save() { if (tbQty.Value <= 0) { MessageBox.Show("Enter Quantity"); tbQty.Value = 0; tbQty.Focus(); } else if (!recDate.SelectedDate.HasValue) { MessageBox.Show("Purchased date is required"); recDate.Focus(); } else { int?maxCount = dbContext.tbl_BoxSeries.Where(p => p.BoxCode == _boxCode).Select(p => p.SeriesNo).DefaultIfEmpty(0).Max(); int count = maxCount.GetValueOrDefault() + 1; if (maxCount.GetValueOrDefault() == 0) { for (int i = count; i <= tbQty.Value; i++) { //MessageBox.Show(i.ToString()); tbl_BoxSeries _tb2 = new tbl_BoxSeries() { BoxCode = _boxCode, SeriesNo = i, IsDisposed = false, IsUsed = false, IsDelivered = false, IsReturned = false, IsIssuedToProduction = false, IsIssuedToWareHouse = false, EncodedBy = _name, DateEncoded = DateTime.Now }; dbContext.tbl_BoxSeries.Add(_tb2); tbl_PurchasedHistory tbldata = new tbl_PurchasedHistory() { ItemCode = _boxCode + "-" + i.ToString(), DatePurchased = recDate.SelectedDate.Value }; dbContext.tbl_PurchasedHistory.Add(tbldata); } dbContext.SaveChanges(); } else { for (int i = maxCount.GetValueOrDefault() + 1; i <= maxCount.GetValueOrDefault() + tbQty.Value; i++) { tbl_BoxSeries _tb2 = new tbl_BoxSeries() { BoxCode = _boxCode, SeriesNo = i, IsDisposed = false, IsUsed = false, IsDelivered = false, IsReturned = false, IsIssuedToProduction = false, IsIssuedToWareHouse = false, EncodedBy = _name, DateEncoded = DateTime.Now }; dbContext.tbl_BoxSeries.Add(_tb2); tbl_PurchasedHistory tbldata = new tbl_PurchasedHistory() { ItemCode = _boxCode + "-" + i.ToString(), DatePurchased = recDate.SelectedDate.Value }; dbContext.tbl_PurchasedHistory.Add(tbldata); } dbContext.SaveChanges(); } var a = from data in dbContext.tbl_BoxMaster join boxSeries in dbContext.tbl_BoxSeries on data.BoxCode equals boxSeries.BoxCode into UP from boxSeries in UP.DefaultIfEmpty() where data.BoxCode == _boxCode orderby boxSeries.SeriesNo select new { BoxCode = data.BoxCode, SeriesNo = boxSeries.SeriesNo, IsDisposed = boxSeries.IsDisposed, IsUsed = boxSeries.IsUsed, IsIssuedToProduction = boxSeries.IsIssuedToProduction, IsIssuedToWareHouse = boxSeries.IsIssuedToWareHouse, IsDelivered = boxSeries.IsDelivered, IsReturned = boxSeries.IsReturned, BoxSeriesCode = boxSeries.BoxCode + "-" + boxSeries.SeriesNo }; string empname = string.Empty; var empdata = dbHRIS.SKPI_GetAllEmployeesByEmpID(_empID).ToList(); foreach (DataRow dr in ConvertToDataTable(empdata).Rows) { empname = dr["FullName_LnameFirst"].ToString(); } tbl_TransactionMaster transact = new tbl_TransactionMaster() { TransactBy = empname, TransactionDetails = "Encoded New Box Series Quantity", CreationDateTime = DateTime.Now }; dbContext.tbl_TransactionMaster.Add(transact); dbContext.SaveChanges(); MessageBox.Show("Quantity successfully added"); tbQty.Value = 0; tbQty.Focus(); LoadData(); } }
private void GetRequestDetails() { string remarksHold = string.Empty; var a = (from data in dbContext.tblRequests join incharge in dbContext.tblIncharges on data.Incharge_ID equals incharge.Incharge_ID //into UP join assess in dbContext.tblAssessments on data.AssessmentCode equals assess.AssessmentCode into UP from assess in UP.DefaultIfEmpty() where data.JR_Code.Trim() == jrcode.Trim() select new { Request_Date = data.Request_Date, EmpID = data.EmpID, InchargeCode = incharge.Incharge_ID, Incharge = incharge.Incharge, Customer = data.Customer, PartName = data.Partname, PartCode = data.Partcode, JigType = data.JigType, Quantity = data.Quantity, QtyProdPerHr = data.QtyProdPerHr, Monthly_Req = data.Monthly_Req, Machine_Capacity = data.Machine_Capacity, NextForecast = data.NextForeCast, Problem_Desc = data.Problem_Desc, AssessmentCode = data.AssessmentCode, AssessmentDesc = assess.Assessment, AssessmentRemarks = data.AssessmentRemarks, HoldRemarks = data.HoldRemarks, IsHold = data.IsHold, HoldBy = data.HoldBy, Checker = data.Checker, AssessBy = data.AssessedBy, Noter = data.Noter, Manager = data.Manager, AcceptBy = data.FinalAcceptanceBy, IsCancelled = data.IsCancelled, IsRejected = data.IsRejected, PreparerRemarks = data.Req_Remarks, CheckerRemarks = data.CheckerRemarks, AssesstorRemarks = data.AssessedRemarks, NoterRemarks = data.NoterRemarks, ApproverRemarks = data.ManagerRemarks, ReceiverRemarks = data.AcceptRemarks, Is_Noted = data.Is_Noted } ).ToList(); foreach (DataRow row in ConvertToDataTable(a).Rows) { tbdateRequest.Text = Convert.ToDateTime(row[0]).ToString("dd") + "-" + Convert.ToDateTime(row[0]).ToString("MMM") + "-" + Convert.ToDateTime(row[0]).ToString("yyyy"); userempid = row[1].ToString().Trim(); incharge = row[2].ToString().Trim(); tbItemName.Text = row[5].ToString(); tbItemQuantity.Text = row[8].ToString(); tbCustomer.Text = row[4].ToString(); tbPartName.Text = row[5].ToString(); tbPartCode.Text = row[6].ToString(); tbTypeOfJig.Text = row[7].ToString(); tbQuantity_Jigs.Text = row[8].ToString(); qtyhrtxt.Text = row[9].ToString(); mreqtxt.Text = row[10].ToString(); mcaptxt.Text = row[11].ToString(); tbNextForecast.Text = row[12].ToString(); tbjustification.Text = row[13].ToString().Replace(" ", " ").Replace("<br/>", "\r\n"); tbAssessment.Text = row[15].ToString().Trim(); if (row[14].ToString().Trim() == "CP") { tbAssessmentRemarks.Text = row[16].ToString().Trim(); colAssessRemarks.Visible = true; } else { tbAssessmentRemarks.Text = "N/A"; colAssessRemarks.Visible = false; } if (Convert.ToBoolean(row[18]) == true) { rowHold.Visible = true; remarksHold = "This request is set as hold. See below details:"; remarksHold += "<br />" + "<br />" + row[17].ToString().Replace(" ", " ").Replace("<br />", "\r\n"); lblHoldRemarks.Text = remarksHold; } else { rowHold.Visible = false; } Checker.InnerText = row[20].ToString().Trim(); Assesstor.InnerText = row[21].ToString().Trim(); Noter.InnerText = row[22].ToString().Trim(); Approver.InnerText = row[23].ToString().Trim(); Receiver.InnerText = row[24].ToString().Trim(); lblPreparerRemarks.InnerText = row[27].ToString().Trim(); lblCheckerRemarks.InnerText = row[28].ToString().Trim(); lblAssesstorRemarks.InnerText = row[29].ToString().Trim(); lblNoterRemarks.InnerText = row[30].ToString().Trim(); lblApproverRemarks.InnerText = row[31].ToString().Trim(); lblReceiverRemarks.InnerText = row[32].ToString().Trim(); isChecked = Convert.ToBoolean(row[33]); } SQLDSGetAttachment.ConnectionString = ClsConfig.JobRequestConnectionString; if (incharge == "01" || incharge == "02" || incharge == "03") { rdoInCharge.SelectedValue = "07"; } else if (incharge == "04" || incharge == "05" || incharge == "06") { rdoInCharge.SelectedValue = "08"; } else { rdoInCharge.SelectedValue = incharge; } GetRequestorDetails(userempid); GetTypeOfRequest(Session["RCode"].ToString().Trim()); if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") { rowJigs.Visible = true; rowFacilities.Visible = false; } else { rowJigs.Visible = false; rowFacilities.Visible = true; } if (isChecked == false) { divNoterShowProcessing.Visible = true; } else { divNoterShowProcessing.Visible = false; } }
private void Save(string appr) { if ((rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") && (ddlCheckJig.SelectedIndex == -1 || ddlCheckJig.SelectedIndex == 0)) { Show("Select if jig is exists."); } else { string link = string.Empty, body = string.Empty; link = Environment.NewLine + "http://" + HttpContext.Current.Request.Url.Authority + "/" + ConfigurationManager.AppSettings["NoterPage"]; //var app = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).FirstOrDefault(); //if (app != null) //{ // app.Is_Assessed = true; // app.AssessedBy = Session["FullName_LnameFirst"].ToString(); // app.AssessedRemarks = "SIGNED"; // app.DateAssessed = DateTime.Now.Date; // app.Noter = appr;//nextApprover.Trim(); // app.IsHold = false; // app.AssessmentCode = ddlAssessment.SelectedValue.ToString().Trim(); // if (ddlAssessment.SelectedValue.ToString().Trim() == "CP") // { // app.AssessmentRemarks = tbAssessmentRemarks.Text.Trim(); // app.IsCancelled = true; // } // else // { // app.AssessmentRemarks = "N/A"; // app.IsCancelled = false; // } // dbContext.Entry(app).State = EntityState.Modified; // //dbContext.SaveChanges(); //} SqlCommand cmd = new SqlCommand("update tblRequest set " + "Is_Assessed=@Is_Assessed, " + "AssessedBy=@AssessedBy, " + "AssessedRemarks =@AssessedRemarks," + "DateAssessed=@Date, " + "Noter=@Noter, " + "IsHold=@IsHold," + "IsExistingJig=convert(bit, @IsExistingJig)," + "AssessmentRemarks=@AssessmentRemarks, " + "IsCancelled=@IsCancelled ," + "AssessmentCode = @AssessmentCode " + "where JR_Code=@JR_Code"); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@AssessedBy", Session["FullName_LnameFirst"].ToString().Trim()); cmd.Parameters.AddWithValue("@Noter", appr); if (ddlAssessment.SelectedValue.ToString().Trim() == "CP") { cmd.Parameters.AddWithValue("@AssessedRemarks", "REJECTED"); cmd.Parameters.AddWithValue("@IsCancelled", true); } else { cmd.Parameters.AddWithValue("@AssessedRemarks", "SIGNED"); cmd.Parameters.AddWithValue("@IsCancelled", false); } if (tbAssessmentRemarks.Text.Length == 0) { cmd.Parameters.AddWithValue("@AssessmentRemarks", "N/A"); } else { cmd.Parameters.AddWithValue("@AssessmentRemarks", tbAssessmentRemarks.Text.Trim()); } if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") { cmd.Parameters.AddWithValue("@IsExistingJig", string.IsNullOrEmpty(ddlCheckJig.SelectedValue.ToString().Trim()) ? DBNull.Value.ToString() : ddlCheckJig.SelectedValue.ToString().Trim()); } else { cmd.Parameters.AddWithValue("@IsExistingJig", DBNull.Value); } cmd.Parameters.AddWithValue("@JR_Code", jrcode); cmd.Parameters.AddWithValue("@Date", DateTime.Now.Date); cmd.Parameters.AddWithValue("@IsHold", false); cmd.Parameters.AddWithValue("@Is_Assessed", true); cmd.Parameters.AddWithValue("@AssessmentCode", ddlAssessment.SelectedValue.ToString().Trim()); SqlHelper.ExecuteNonQuery(ClsConfig.JobRequestConnectionString, cmd); if (ddlAssessment.SelectedValue.ToString().Trim() != "CP") { var asstr = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsNoter == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); foreach (DataRow dr in ConvertToDataTable(asstr).Rows) { Boolean ress; ress = SaveEmailLogs(link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + Session["RCode"].ToString().Trim(), "Noter", dr["EmailAdd"].ToString().Trim(), Session["FullName_LnameFirst"].ToString().Trim() , dr["EmpID"].ToString().Trim(), Session["RCode"].ToString().Trim()); body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; body += "<br /><br />" + "I Have Prepared A Job Order Request For Your Checking and Approval."; body += "<br /><br />" + "You may click the link below to redirect to main page. "; body += "<br /><br />" + link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + Session["RCode"].ToString().Trim(); body += "<br /><br />" + "Thank You."; body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; var rx = new Regex(@"(?<=\w)\w"); var newString2 = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); using (MailMessage mm = new MailMessage()) { string sub = "Online Job Order Request: Requesting For Approval"; mm.Subject = sub.ToUpper(); mm.Body = body; var newString = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderName"].ToString()); mm.To.Add(dr["EmailAdd"].ToString().Trim()); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); smtp.EnableSsl = true; mm.IsBodyHtml = true; NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); } //} dbContext.SaveChanges(); } if (tbAssessmentRemarks.Text.Length == 0) { SendToRequestor(); } else { SendRemarksToRequestor(); } } } }
protected void Approve(object sender, EventArgs e) { string link = string.Empty, body = string.Empty; link = Environment.NewLine + "http://" + HttpContext.Current.Request.Url.Authority + "/" + ConfigurationManager.AppSettings["NoterPage"]; var asstr = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsNoter == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); var asstr2 = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsNoter == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); string appempid = string.Empty; foreach (DataRow dr in ConvertToDataTable(asstr2).Rows) { appempid = dr["EmpID"].ToString().Trim(); } var dbuser = dbHRISContext.SKPI_GetAllEmployeesByEmpID(appempid.Trim()).ToList(); if (ConvertToDataTable(dbuser).Rows.Count > 0) { foreach (DataRow row in ConvertToDataTable(dbuser).Rows) { nextApprover = row["FullName_FnameFirst"].ToString().Trim(); } } Save(nextApprover); Show("Record Successfully Assessed"); gridRecords.Rebind(); divDetails.Visible = false; divRecords.Visible = true; jrcode = string.Empty; Session["RCode"] = null; //} }
private void GetRequestDetails() { var a = (from data in dbContext.tblRequests join incharge in dbContext.tblIncharges on data.Incharge_ID equals incharge.Incharge_ID into UP from incharge in UP.DefaultIfEmpty() where data.JR_Code.Trim() == jrcode.Trim() select new { Request_Date = data.Request_Date, EmpID = data.EmpID, InchargeCode = incharge.Incharge_ID, Incharge = incharge.Incharge, Customer = data.Customer, PartName = data.Partname, PartCode = data.Partcode, JigType = data.JigType, Quantity = data.Quantity, QtyProdPerHr = data.QtyProdPerHr, Monthly_Req = data.Monthly_Req, Machine_Capacity = data.Machine_Capacity, NextForecast = data.NextForeCast, Problem_Desc = data.Problem_Desc, Checker = data.Checker, AssessBy = data.AssessedBy, Noter = data.Noter, Manager = data.Manager, AcceptBy = data.FinalAcceptanceBy, IsCancelled = data.IsCancelled, IsRejected = data.IsRejected, PreparerRemarks = data.Req_Remarks, CheckerRemarks = data.CheckerRemarks, AssesstorRemarks = data.AssessedRemarks, NoterRemarks = data.NoterRemarks, ApproverRemarks = data.ManagerRemarks, ReceiverRemarks = data.AcceptRemarks, DateChecked = data.DateChecked, DateAssessed = data.DateAssessed, DateNoted = data.DateNoted, DateApprove = data.DateApproved, DateReceived = data.DateAccepted } ).ToList(); foreach (DataRow row in ConvertToDataTable(a).Rows) { tbdateRequest.Text = Convert.ToDateTime(row[0]).ToString("dd") + "-" + Convert.ToDateTime(row[0]).ToString("MMM") + "-" + Convert.ToDateTime(row[0]).ToString("yyyy"); userempid = row[1].ToString().Trim(); incharge = row[2].ToString().Trim(); tbItemName.Text = row[5].ToString(); tbItemQuantity.Text = row[8].ToString(); tbCustomer.Text = row[4].ToString(); tbPartName.Text = row[5].ToString(); tbPartCode.Text = row[6].ToString(); tbTypeOfJig.Text = row[7].ToString(); tbQuantity_Jigs.Text = row[8].ToString(); qtyhrtxt.Text = row[9].ToString(); mreqtxt.Text = row[10].ToString(); mcaptxt.Text = row[11].ToString(); tbNextForecast.Text = row[12].ToString(); tbjustification.Text = row[13].ToString().Replace(" ", " ").Replace("<br/>", "\r\n"); Checker.InnerText = row[14].ToString().Trim(); Assesstor.InnerText = row[15].ToString().Trim(); Noter.InnerText = row[16].ToString().Trim(); Approver.InnerText = row[17].ToString().Trim(); Receiver.InnerText = row[18].ToString().Trim(); lblPreparerRemarks.InnerText = row[21].ToString().Trim(); lblCheckerRemarks.InnerText = row[22].ToString().Trim(); lblAssesstorRemarks.InnerText = row[23].ToString().Trim(); lblNoterRemarks.InnerText = row[24].ToString().Trim(); lblApproverRemarks.InnerText = row[25].ToString().Trim(); lblReceiverRemarks.InnerText = row[26].ToString().Trim(); lblDateSigned_Preparer.InnerText = Convert.ToDateTime(row[0]).ToString("yyyy-MMM-dd"); lblDateSigned_Checker.InnerText = Convert.ToDateTime(row[27]).ToString("yyyy-MMM-dd"); lblDateSigned_Assesstor.InnerText = string.IsNullOrEmpty(row[28].ToString()) ? string.Empty : Convert.ToDateTime(row[28]).ToString("yyyy-MMM-dd"); lblDateSigned_Noter.InnerText = string.IsNullOrEmpty(row[29].ToString()) ? string.Empty : Convert.ToDateTime(row[29]).ToString("yyyy-MMM-dd"); lblDateSigned_Approver.InnerText = string.IsNullOrEmpty(row[30].ToString()) ? string.Empty : Convert.ToDateTime(row[30]).ToString("yyyy-MMM-dd"); lblDateSigned_Receiver.InnerText = string.IsNullOrEmpty(row[31].ToString()) ? string.Empty : Convert.ToDateTime(row[31]).ToString("yyyy-MMM-dd"); } SQLDSGetAttachment.ConnectionString = ClsConfig.JobRequestConnectionString; if (incharge == "01" || incharge == "02" || incharge == "03") { rdoInCharge.SelectedValue = "07"; } else if (incharge == "04" || incharge == "05" || incharge == "06") { rdoInCharge.SelectedValue = "08"; } else { rdoInCharge.SelectedValue = incharge; } //rdoInCharge.SelectedValue = incharge; GetRequestorDetails(userempid); GetTypeOfRequest(Session["RCode"].ToString().Trim()); if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") { rowJigs.Visible = true; rowFacilities.Visible = false; } else { rowJigs.Visible = false; rowFacilities.Visible = true; } if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") { rowJigs.Visible = true; rowFacilities.Visible = false; ddlCheckJig.Enabled = true; } else { rowJigs.Visible = false; rowFacilities.Visible = true; ddlCheckJig.Enabled = false; } }
protected void ChangeIncharge(object sender, EventArgs e) { string link = string.Empty, body = string.Empty; dbContext = new JobRequestDBEntities(); var a = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).FirstOrDefault(); if (a != null) { tblRequest tbldata = a as tblRequest; tbldata.Incharge_ID = incharge; dbContext.Entry(tbldata).State = EntityState.Modified; dbContext.SaveChanges(); } link = Environment.NewLine + "http://" + HttpContext.Current.Request.Url.Authority + "/DirectAssessment.aspx"; var asstr = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsAssesstor == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); foreach (DataRow dr in ConvertToDataTable(asstr).Rows) { Boolean ress; ress = SaveEmailLogs(link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + jrcode , "Assesstor", dr["EmailAdd"].ToString().Trim(), approverfullname_fnamefirst.ToString().Trim() , dr["EmpID"].ToString().Trim(), Session["RCode"].ToString().Trim()); body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; body += "<br /><br />" + "I Have Prepared A Job Order Request For Your Assessment."; body += "<br /><br />" + "You may click the link below to redirect to main page. "; body += "<br /><br />" + link + "?EmpID=" + dr["EmpID"].ToString().Trim() + "&RCode=" + jrcode; body += "<br /><br />" + "Thank You."; body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; var rx = new Regex(@"(?<=\w)\w"); var newString2 = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); using (MailMessage mm = new MailMessage()) { string sub = "Online Job Order Request: Requesting For Approval"; mm.Subject = sub.ToUpper(); mm.Body = body; var newString = rx.Replace(Session["FullName_FnameFirst"].ToString(), new MatchEvaluator(m => m.Value.ToLowerInvariant())); mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderName"].ToString()); mm.To.Add(dr["EmailAdd"].ToString().Trim()); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); smtp.EnableSsl = true; mm.IsBodyHtml = true; NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); } } dbContext.SaveChanges(); SendToRequestor_Transferred(); Show("Record Successfully Transferred"); divRecords.Visible = true; gridRecords.Rebind(); }
private void SendRemarksToAssesstor() { string body = string.Empty; body = "Dear Sir/Ma'am," + "<br /><br />" + "Good Day!"; body += "<br /><br />" + "Requestor has a concern on the finsihed job order."; body += "<br /><br />" + "Job Order No: " + tbJobOrderNo.Text.Trim(); body += "<br /><br />" + "Concern: " + tbEmpRemarks.Text.Trim(); body += "<br /><br />" + "Thank You."; body += "<br /><br />" + "Note: This is a system generated email. Please do not reply. Thank you"; var asstr = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsAssesstor == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); foreach (DataRow dr in ConvertToDataTable(asstr).Rows) { using (MailMessage mm = new MailMessage()) { string sub = "Online Job Order Request: Accepted By Requestor"; mm.Subject = sub.ToUpper(); mm.Body = body; mm.From = new MailAddress(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderName"].ToString()); mm.To.Add(dr["EmailAdd"].ToString().Trim()); SmtpClient smtp = new SmtpClient(); smtp.Host = ConfigurationManager.AppSettings["MailServer"].ToString(); smtp.EnableSsl = true; mm.IsBodyHtml = true; NetworkCredential NetworkCred = new NetworkCredential(ConfigurationManager.AppSettings["MailSenderEmailAddress"].ToString(), ConfigurationManager.AppSettings["MailSenderEmailPassword"].ToString()); smtp.Credentials = NetworkCred; smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); } } }
protected void Approve(object sender, EventArgs e) { string link = string.Empty, body = string.Empty; link = Environment.NewLine + "http://" + HttpContext.Current.Request.Url.Authority + "/" + ConfigurationManager.AppSettings["NoterPage"]; var asstr = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsNoter == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); var asstr2 = (from data in dbContext.tblUsers join inchargePerson in dbContext.tblInchargePersons on data.EmpID equals inchargePerson.EmpID into UP from inchargePerson in UP.DefaultIfEmpty() where inchargePerson.Incharge_ID == rdoInCharge.SelectedValue && inchargePerson.IsNoter == true select new { EmpID = data.EmpID, EmailAdd = data.EmailAdd, InchargeCode = inchargePerson.Incharge_ID, IsAssesstor = inchargePerson.IsAssesstor, IsNoter = inchargePerson.IsNoter } ).ToList(); string appempid = string.Empty; foreach (DataRow dr in ConvertToDataTable(asstr2).Rows) { appempid = dr["EmpID"].ToString().Trim(); } var dbuser = dbHRISContext.SKPI_GetAllEmployeesByEmpID(appempid.Trim()).ToList(); if (ConvertToDataTable(dbuser).Rows.Count > 0) { foreach (DataRow row in ConvertToDataTable(dbuser).Rows) { nextApprover = row["FullName_FnameFirst"].ToString().Trim(); } } Save(nextApprover); //var app = dbContext.tblRequests.Where(x => x.JR_Code == jrcode).FirstOrDefault(); //if (app != null) //{ //app.Is_Assessed = true; //app.AssessedBy = Session["FullName_LnameFirst"].ToString(); //app.AssessedRemarks = "SIGNED"; //app.DateAssessed = DateTime.Now.Date; //app.Noter = nextApprover.Trim(); //app.IsHold = false; //app.AssessmentCode = ddlAssessment.SelectedValue.ToString().Trim(); //if (ddlAssessment.SelectedValue.ToString().Trim() == "CP") //{ // app.AssessmentRemarks = tbAssessmentRemarks.Text.Trim(); // app.IsCancelled = true; //} //else //{ // app.AssessmentRemarks = "N/A"; // app.IsCancelled = false; //} //dbContext.Entry(app).State = EntityState.Modified; // dbContext.SaveChanges(); //} //jrcode = string.Empty; //Session["RCode"] = null; divSuccess.Visible = true; divApplication.Visible = false; }
private void GetRequestDetails() { var a = (from data in dbContext.tblRequests join incharge in dbContext.tblIncharges on data.Incharge_ID equals incharge.Incharge_ID into UP from incharge in UP.DefaultIfEmpty() where data.JR_Code.Trim() == jrcode.Trim() select new { Request_Date = data.Request_Date, EmpID = data.EmpID, InchargeCode = incharge.Incharge_ID, Incharge = incharge.Incharge, Customer = data.Customer, PartName = data.Partname, PartCode = data.Partcode, JigType = data.JigType, Quantity = data.Quantity, QtyProdPerHr = data.QtyProdPerHr, Monthly_Req = data.Monthly_Req, Machine_Capacity = data.Machine_Capacity, NextForecast = data.NextForeCast, Problem_Desc = data.Problem_Desc } ).ToList(); foreach (DataRow row in ConvertToDataTable(a).Rows) { tbdateRequest.Text = Convert.ToDateTime(row[0]).ToString("dd") + "-" + Convert.ToDateTime(row[0]).ToString("MMM") + "-" + Convert.ToDateTime(row[0]).ToString("yyyy"); userempid = row[1].ToString().Trim(); incharge = row[2].ToString().Trim(); tbItemName.Text = row[5].ToString(); tbItemQuantity.Text = row[8].ToString(); tbCustomer.Text = row[4].ToString(); tbPartName.Text = row[5].ToString(); tbPartCode.Text = row[6].ToString(); tbTypeOfJig.Text = row[7].ToString(); tbQuantity_Jigs.Text = row[8].ToString(); qtyhrtxt.Text = row[9].ToString(); mreqtxt.Text = row[10].ToString(); mcaptxt.Text = row[11].ToString(); tbNextForecast.Text = row[12].ToString(); tbjustification.Text = row[13].ToString().Replace(" ", " ").Replace("<br/>", "\r\n"); } SQLDSGetAttachment.ConnectionString = ClsConfig.JobRequestConnectionString; if (incharge == "01" || incharge == "02" || incharge == "03") { rdoInCharge.SelectedValue = "07"; } else if (incharge == "04" || incharge == "05" || incharge == "06") { rdoInCharge.SelectedValue = "08"; } else { rdoInCharge.SelectedValue = incharge; } GetRequestorDetails(userempid); GetTypeOfRequest(Session["RCode"].ToString().Trim()); if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") { rowJigs.Visible = true; rowFacilities.Visible = false; } else { rowJigs.Visible = false; rowFacilities.Visible = true; } }
private void GetRequestDetails() { var a = (from data in dbContext.tblRequests join incharge in dbContext.tblIncharges on data.Incharge_ID equals incharge.Incharge_ID join assess in dbContext.tblAssessments on data.AssessmentCode equals assess.AssessmentCode into UP from assess in UP.DefaultIfEmpty() where data.JR_Code.Trim() == jrcode.Trim() select new { Request_Date = data.Request_Date, EmpID = data.EmpID, InchargeCode = incharge.Incharge_ID, Incharge = incharge.Incharge, Customer = data.Customer, PartName = data.Partname, PartCode = data.Partcode, JigType = data.JigType, Quantity = data.Quantity, QtyProdPerHr = data.QtyProdPerHr, Monthly_Req = data.Monthly_Req, Machine_Capacity = data.Machine_Capacity, NextForecast = data.NextForeCast, Problem_Desc = data.Problem_Desc, AssessmentCode = data.AssessmentCode, AssessmentDesc = assess.Assessment, AssessmentRemarks = data.AssessmentRemarks, JRNo = data.JRF_No, Completion_Date = data.Completion_Date, CompletionRemarks = data.CompletionRemarks, Checker = data.Checker, AssessBy = data.AssessedBy, Noter = data.Noter, Manager = data.Manager, AcceptBy = data.FinalAcceptanceBy, PreparerRemarks = data.Req_Remarks, CheckerRemarks = data.CheckerRemarks, AssesstorRemarks = data.AssessedRemarks, NoterRemarks = data.NoterRemarks, ApproverRemarks = data.ManagerRemarks, ReceiverRemarks = data.AcceptRemarks } ).ToList(); foreach (DataRow row in ConvertToDataTable(a).Rows) { tbdateRequest.Text = Convert.ToDateTime(row[0]).ToString("dd") + "-" + Convert.ToDateTime(row[0]).ToString("MMM") + "-" + Convert.ToDateTime(row[0]).ToString("yyyy"); userempid = row[1].ToString().Trim(); incharge = row[2].ToString().Trim(); tbItemName.Text = row[5].ToString(); tbItemQuantity.Text = row[8].ToString(); tbCustomer.Text = row[4].ToString(); tbPartCode.Text = row[6].ToString(); tbTypeOfJig.Text = row[7].ToString(); tbQuantity_Jigs.Text = row[8].ToString(); qtyhrtxt.Text = row[9].ToString(); mreqtxt.Text = row[10].ToString(); mcaptxt.Text = row[11].ToString(); tbNextForecast.Text = row[12].ToString(); tbjustification.Text = row[13].ToString().Replace(" ", " ").Replace("<br/>", "\r\n"); tbAssessment.Text = row[15].ToString().Trim(); if (row[14].ToString().Trim() == "CP") { tbAssessmentRemarks.Text = row[16].ToString().Trim(); colAssessRemarks.Visible = true; } else { tbAssessmentRemarks.Text = "N/A"; colAssessRemarks.Visible = false; } tbJobOrderNo.Text = row[17].ToString(); Checker.InnerText = row[20].ToString().Trim(); Assesstor.InnerText = row[21].ToString().Trim(); Noter.InnerText = row[22].ToString().Trim(); Approver.InnerText = row[23].ToString().Trim(); Receiver.InnerText = row[24].ToString().Trim(); lblPreparerRemarks.InnerText = row[25].ToString().Trim(); lblCheckerRemarks.InnerText = row[26].ToString().Trim(); lblAssesstorRemarks.InnerText = row[27].ToString().Trim(); lblNoterRemarks.InnerText = row[28].ToString().Trim(); lblApproverRemarks.InnerText = row[29].ToString().Trim(); lblReceiverRemarks.InnerText = row[30].ToString().Trim(); } SQLDSGetAttachment.ConnectionString = ClsConfig.JobRequestConnectionString; rdoInCharge.SelectedValue = incharge; GetRequestorDetails(userempid); GetTypeOfRequest(Session["RCode"].ToString().Trim()); if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05") { rowJigs.Visible = true; rowFacilities.Visible = false; } else { rowJigs.Visible = false; rowFacilities.Visible = true; } }
private void GetRequestDetails() { btnChangeNoter.Attributes["href"] = "javascript:void(0);"; btnChangeNoter.Attributes["onclick"] = String.Format("return ShowChangeApproverForm('{0}','{1}');" , jrcode.ToString().Trim(), "Checker"); string remarksHold = string.Empty; var a = (from data in dbContext.tblRequests join incharge in dbContext.tblIncharges on data.Incharge_ID equals incharge.Incharge_ID into UP from incharge in UP.DefaultIfEmpty() where data.JR_Code.Trim() == jrcode.Trim() select new { Request_Date = data.Request_Date, EmpID = data.EmpID, InchargeCode = incharge.Incharge_ID, Incharge = incharge.Incharge, Customer = data.Customer, PartName = data.Partname, PartCode = data.Partcode, JigType = data.JigType, Quantity = data.Quantity, QtyProdPerHr = data.QtyProdPerHr, Monthly_Req = data.Monthly_Req, Machine_Capacity = data.Machine_Capacity, NextForecast = data.NextForeCast, Problem_Desc = data.Problem_Desc, HoldRemarks = data.HoldRemarks, IsHold = data.IsHold, HoldBy = data.HoldBy, Checker = data.Checker, AssessBy = data.AssessedBy, Noter = data.Noter, Manager = data.Manager, AcceptBy = data.FinalAcceptanceBy, PreparerRemarks = data.Req_Remarks, CheckerRemarks = data.CheckerRemarks, AssesstorRemarks = data.AssessedRemarks, NoterRemarks = data.NoterRemarks, ApproverRemarks = data.ManagerRemarks, ReceiverRemarks = data.AcceptRemarks, Is_Checked = data.Is_Checked, DateChecked = data.DateChecked, DateAssessed = data.DateAssessed, DateNoted = data.DateNoted, DateApprove = data.DateApproved, DateReceived = data.DateAccepted } ).ToList(); foreach (DataRow row in ConvertToDataTable(a).Rows) { tbdateRequest.Text = Convert.ToDateTime(row[0]).ToString("dd") + "-" + Convert.ToDateTime(row[0]).ToString("MMM") + "-" + Convert.ToDateTime(row[0]).ToString("yyyy"); userempid = row[1].ToString().Trim(); incharge = row[2].ToString().Trim(); tbItemName.Text = row[5].ToString(); tbItemQuantity.Text = row[8].ToString(); tbCustomer.Text = row[4].ToString(); tbPartName.Text = row[5].ToString(); tbPartCode.Text = row[6].ToString(); tbTypeOfJig.Text = row[7].ToString(); tbQuantity_Jigs.Text = row[8].ToString(); qtyhrtxt.Text = row[9].ToString(); mreqtxt.Text = row[10].ToString(); mcaptxt.Text = row[11].ToString(); tbNextForecast.Text = row[12].ToString(); tbjustification.Text = row[13].ToString().Replace(" ", " ").Replace("<br/>", "\r\n"); if (Convert.ToBoolean(row[15]) == true) { rowHold.Visible = true; remarksHold = "This request is set as hold. See below details:"; remarksHold += Environment.NewLine + Environment.NewLine + row[14].ToString().Replace(" ", " ").Replace("<br />", "\r\n"); lblHoldRemarks.Text = remarksHold; } else { rowHold.Visible = false; } Checker.InnerText = row[17].ToString().Trim(); Assesstor.InnerText = row[18].ToString().Trim(); Noter.InnerText = row[19].ToString().Trim(); Approver.InnerText = row[20].ToString().Trim(); Receiver.InnerText = row[21].ToString().Trim(); lblPreparerRemarks.InnerText = row[22].ToString().Trim(); lblCheckerRemarks.InnerText = row[23].ToString().Trim(); lblAssesstorRemarks.InnerText = row[24].ToString().Trim(); lblNoterRemarks.InnerText = row[25].ToString().Trim(); lblApproverRemarks.InnerText = row[26].ToString().Trim(); lblReceiverRemarks.InnerText = row[27].ToString().Trim(); isChecked = Convert.ToBoolean(row[28]); lblDateSigned_Preparer.InnerText = string.IsNullOrEmpty(row[0].ToString()) ? string.Empty : Convert.ToDateTime(row[0]).ToString("yyyy-MMM-dd"); lblDateSigned_Checker.InnerText = string.IsNullOrEmpty(row[29].ToString()) ? string.Empty : Convert.ToDateTime(row[29]).ToString("yyyy-MMM-dd"); lblDateSigned_Assesstor.InnerText = string.IsNullOrEmpty(row[30].ToString()) ? string.Empty : Convert.ToDateTime(row[30]).ToString("yyyy-MMM-dd"); lblDateSigned_Noter.InnerText = string.IsNullOrEmpty(row[31].ToString()) ? string.Empty : Convert.ToDateTime(row[31]).ToString("yyyy-MMM-dd"); lblDateSigned_Approver.InnerText = string.IsNullOrEmpty(row[32].ToString()) ? string.Empty : Convert.ToDateTime(row[32]).ToString("yyyy-MMM-dd"); lblDateSigned_Receiver.InnerText = string.IsNullOrEmpty(row[33].ToString()) ? string.Empty : Convert.ToDateTime(row[33]).ToString("yyyy-MMM-dd"); } SQLDSGetAttachment.ConnectionString = ClsConfig.JobRequestConnectionString; if (incharge == "01" || incharge == "02" || incharge == "03") { rdoInCharge.SelectedValue = "07"; } else if (incharge == "04" || incharge == "05" || incharge == "06") { rdoInCharge.SelectedValue = "08"; } else { rdoInCharge.SelectedValue = incharge; } GetRequestorDetails(userempid); GetTypeOfRequest(Session["RCode"].ToString().Trim()); if (rdoInCharge.SelectedValue == "04" || rdoInCharge.SelectedValue == "05" || rdoInCharge.SelectedValue == "08") { rowJigs.Visible = true; rowFacilities.Visible = false; } else { rowJigs.Visible = false; rowFacilities.Visible = true; } if (isChecked == false) { divNoterShowProcessing.Visible = true; } else { divNoterShowProcessing.Visible = false; } }