protected void btnModify_Click(object sender, EventArgs e)//event handler to update tracking and cost info for this ship req on the page { SqlConnection updateShipReq = new SqlConnection(connectionSTR); ShippingRequestDataContext db = new ShippingRequestDataContext(updateShipReq); string thisShipReq = Request.QueryString["field1"]; var UpdateFinder = db.Processed_Requests.Where(s => s.Original_ShipID.Equals(thisShipReq)).Select(s => s).ToList(); foreach (var found in UpdateFinder) { found.Payroll_Status = ddlStatusUpdate.SelectedItem.Text; System.Diagnostics.Debug.WriteLine("Update finder found " + found.Original_ShipID + " and changed the status to " + ddlStatusUpdate.SelectedItem.Text); db.SubmitChanges(); } db.Dispose(); }
protected void btnModify_Click(object sender, EventArgs e)//event handler to update tracking and cost info for this ship req on the page { SqlConnection updateShipReq = new SqlConnection(connectionSTR); ShippingRequestDataContext db = new ShippingRequestDataContext(updateShipReq); string thisShipReq = Request.QueryString["field1"]; var UpdateFinder = db.Processed_Requests.Where(s => s.Original_ShipID.Equals(thisShipReq)).Select(s => s).ToList(); foreach (var found in UpdateFinder) { found.Payroll_Status = ddlStatusUpdate.SelectedItem.Text; System.Diagnostics.Debug.WriteLine("UpdateFinder found " + found.Original_ShipID + " and changed the status to " + ddlStatusUpdate.SelectedItem.Text); db.SubmitChanges(); } db.Dispose(); string EmailDestination = GetEmpEmailbyEmpID(Label_Emp_ID.Text); System.Diagnostics.Debug.WriteLine("EmailDestination value is: " + EmailDestination); MailAddress from = new MailAddress("*****@*****.**"); //May want to get current user email or hardcode something from payroll if only payroll employees are added to the perm group MailAddress to = new MailAddress(EmailDestination); //This will remain MailMessage message = new MailMessage(from, to); //instantiated new email msg message.Subject = "Payroll Deduction Acknowledgement"; //will want to check with payroll on what they would like for their subject message.IsBodyHtml = true; //email will contain html message.Body = @"<html> <body style='wodth:100%'> <h4>Payroll Deduction </h4> <p>Hello " + Label_User.Text.Substring(5) + ",<br/>" + "<p> This email is to inform you payroll has acknowledged your personal ship request: #" + Label_ShipID.Text + ", and within 4 weeks you should expect to see a payroll deduction in the amount of $" + Label_Cost.Text + " to settle a debt to Omni Air Intl. If you have questions regarding this charge please contact payroll by responding to this email</p>" + "</body>" + "</html>"; SmtpClient client = new SmtpClient(); client.Host = "smtprelay.oai.aero"; client.Port = 25; System.Diagnostics.Debug.WriteLine("Sending an email message to " + to + " by using SMTP " + client.Host); try { client.Send(message); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Exception caught in CreateTestMessage " + ex.ToString()); } }
protected void btnModify_Click(object sender, EventArgs e)//event handler to update tracking and cost info for this ship req on the page { Label_Tracking.Text = Input_TrackingNum.Text; Label_Cost.Text = Input_Cost.Text; System.Diagnostics.Debug.WriteLine("Tracking value is: " + Input_TrackingNum.Text + " and Cost value is " + Input_Cost.Text); SqlConnection updateShipReq = new SqlConnection(connectionSTR); ShippingRequestDataContext db = new ShippingRequestDataContext(updateShipReq); int?thisShipReq = Convert.ToInt32(Request.QueryString["field1"]); var UpdateFinder = db.Shipping_Requests.Where(s => s.ID.Equals(thisShipReq)).Select(s => s).ToList(); foreach (var found in UpdateFinder) { found.Tracking_Num = Input_TrackingNum.Text; //var foo = decimal.Parse(string1);//Bryan's decimal to str conversion snippet var DecimalCost = decimal.Parse(Input_Cost.Text); found.Original_Cost = DecimalCost; db.SubmitChanges(); } db.Dispose(); }