Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Net.Mail;
- using System.Net;
- using System.Data.SqlClient;
- using System.Configuration;
- using System.Data;
- using System.Security.Principal;
- using System.Web.Security;
- using System.DirectoryServices;
- using System.DirectoryServices.ActiveDirectory;
- namespace WorkOrderManagement
- {
- public partial class CreateWorkOrder : System.Web.UI.Page
- {
- bool successfull;
- protected void Page_Load(object sender, EventArgs e)
- {
- // captureuseremail();
- TextBox9.Visible = false;
- Label11.Visible = false;
- TextBox TextBoxStatus = (TextBox)(DetailsView1.FindControl("TextBox12"));
- TextBoxStatus.Text = "Open";
- TextBox13.Visible = false;
- Label12.Visible = false;
- TextBox14.Visible = false;
- TextBox15.Visible = false;
- //Label11.Text = "Hello";
- //TextBox lab = (TextBox)DetailsView1.FindControl("TextBox12");
- //lab.Visible = false;
- //TextBox10.Visible = true;
- //TextBox11.Visible = false;
- //TextBox12.Visible = false;
- //TextBox13.Visible = false;
- //TextBox14.Visible = false;
- //DropDownList list = (DropDownList)(DetailsView1.FindControl("DropDownList1"));
- //TextBox9.Text = list.SelectedValue;
- }
- protected void TextBox7_TextChanged(object sender, EventArgs e)
- {
- }
- protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
- {
- }
- protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
- {
- if (successfull == true && Page.IsValid && e.AffectedRows ==1)
- {
- //TextBox TextBoxWorkOrderNumber = (TextBox)(DetailsView1.FindControl("TextBox11"));
- TextBox TextBoxRequestor = (TextBox)(DetailsView1.FindControl("TextBox3"));
- TextBox TextBoxDate = (TextBox)(DetailsView1.FindControl("TextBox1"));
- //TextBoxDate.Text = DateTime.Now.ToShortDateString();
- TextBox TextBoxDepartment = (TextBox)(DetailsView1.FindControl("TextBox4"));
- TextBox TextBoxCompletionDate = (TextBox)(DetailsView1.FindControl("TextBox16"));
- TextBox TextBoxMachineDescription = (TextBox)(DetailsView1.FindControl("TextBox5"));
- TextBox TextBoxMachineLocation = (TextBox)(DetailsView1.FindControl("TextBox6"));
- TextBox TextBoxWorkRequired = (TextBox)(DetailsView1.FindControl("TextBox7"));
- // DropDownList status = (DropDownList)(DetailsView1.FindControl("DropDownList2"));
- TextBox TextBoxStatus = (TextBox)(DetailsView1.FindControl("TextBox12"));
- TextBoxStatus.Text = "Open";
- DropDownList list = (DropDownList)(DetailsView1.FindControl("DropDownList1"));
- TextBox9.Text = list.SelectedValue;
- DropDownList lists = (DropDownList)(DetailsView1.FindControl("DropDownList2"));
- TextBox14.Text = lists.SelectedValue;
- if (TextBoxRequestor.Text.Length <= 0)
- {
- TextBoxRequestor.Text = "Not Applicable";
- }
- if (TextBox14.Text.Length <= 0)
- {
- TextBoxDepartment.Text = "Not Provided";
- }
- if (TextBoxCompletionDate.Text.Length <= 0)
- {
- TextBoxCompletionDate.Text = "Not Provided";
- }
- if (TextBoxMachineDescription.Text.Length <= 0)
- {
- TextBoxMachineDescription.Text = "Not Provided";
- }
- if (TextBoxMachineLocation.Text.Length <= 0)
- {
- TextBoxMachineLocation.Text = "Not Provided";
- }
- if (TextBoxWorkRequired.Text.Length <= 0)
- {
- TextBoxWorkRequired.Text = "Not Provided";
- }
- if (TextBox9.Text == "Safety" && e.AffectedRows ==1)
- {
- {
- bool isLocal = HttpContext.Current.Request.IsLocal;
- if (isLocal == true)
- {
- string id = TextBox13.Text.ToString();
- System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();
- mm.From = new System.Net.Mail.MailAddress("abc@abc.com");//who send
- mm.To.Add(new System.Net.Mail.MailAddress("abc@abc.com"));
- //abc@abc.com
- mm.Subject = "WorkOrders Type Safety";
- mm.Body = "DO NOT REPLY TO THIS EMAIL" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/SafetyReport.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number For Report" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/Safety.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on this Work Order Number To Enter Data" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBox14.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- //mm.Body = "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/Safety.aspx?=WorkOrderNum=\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBoxDepartment.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- mm.IsBodyHtml = true;
- System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
- client.Host = ConfigurationManager.AppSettings["smtpServer"];
- client.Send(mm);
- captureuseremail();
- }
- else
- {
- string id = TextBox13.Text.ToString();
- System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();
- mm.From = new System.Net.Mail.MailAddress("abc@abc.com");//who send
- mm.To.Add(new System.Net.Mail.MailAddress("abc@abc.com"));
- //abc@rstover.com
- mm.Subject = "WorkOrders Type Safety";
- mm.Body = "DO NOT REPLY TO THIS EMAIL" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://ioksv004/WorkOrder/SafetyReport.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number For Report" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://ioksv004/WorkOrder/Safety.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number To Enter Data" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBox14.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- //mm.Body = "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/Safety.aspx?=WorkOrderNum=\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBoxDepartment.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- mm.IsBodyHtml = true;
- System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
- client.Host = ConfigurationManager.AppSettings["smtpServer"];
- client.Send(mm);
- captureuseremail();
- }
- }
- }
- if (TextBox9.Text == "Quality" && e.AffectedRows ==1)
- {
- bool isLocal = HttpContext.Current.Request.IsLocal;
- if (isLocal == true)
- {
- System.Net.Mail.MailMessage nn = new System.Net.Mail.MailMessage();
- nn.From = new System.Net.Mail.MailAddress("abc@abc.com");//who send
- nn.To.Add(new System.Net.Mail.MailAddress("abc@abc.com"));
- nn.Subject = "WorkOrders Type Quality";
- nn.Body = "DO NOT REPLY TO THIS EMAIL" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/QualityReport.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number For Report" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/Quality.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number To Enter Data" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBox14.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- //mm.Body = "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/Safety.aspx?=WorkOrderNum=\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBoxDepartment.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- nn.IsBodyHtml = true;
- System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
- client.Host = ConfigurationManager.AppSettings["smtpServer"];
- captureuseremail();
- }
- else
- {
- System.Net.Mail.MailMessage nn = new System.Net.Mail.MailMessage();
- nn.From = new System.Net.Mail.MailAddress("abc@abc.com");//who send
- nn.To.Add(new System.Net.Mail.MailAddress("abc@abc.com"));
- nn.Subject = "WorkOrders Type Quality";
- nn.Body = "DO NOT REPLY TO THIS EMAIL" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://ioksv004/WorkOrder/QualityReport.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number For Report" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://ioksv004/WorkOrder/Quality.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number To Enter Data" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBox14.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- //mm.Body = "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/Safety.aspx?=WorkOrderNum=\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBoxDepartment.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- nn.IsBodyHtml = true;
- System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
- client.Host = ConfigurationManager.AppSettings["smtpServer"];
- client.Send(nn);
- captureuseremail();
- }
- }
- if (TextBox9.Text == "General" && e.AffectedRows ==1)
- {
- bool isLocal = HttpContext.Current.Request.IsLocal;
- if (isLocal == true)
- {
- System.Net.Mail.MailMessage aa = new System.Net.Mail.MailMessage();
- aa.From = new System.Net.Mail.MailAddress("abc@abc.com");//who send
- aa.To.Add(new System.Net.Mail.MailAddress("abc@abc.com"));
- aa.Subject = "WorkOrders Type General";
- aa.Body = "DO NOT REPLY TO THIS EMAIL" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/GeneralReport.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number For Report" +"<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/General.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number To Enter Data" + "<br><br/>"+ "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBox14.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- //mm.Body = "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/Safety.aspx?=WorkOrderNum=\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBoxDepartment.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- aa.IsBodyHtml = true;
- System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
- client.Host = ConfigurationManager.AppSettings["smtpServer"];
- client.Send(aa);
- captureuseremail();
- }
- else
- {
- System.Net.Mail.MailMessage aa = new System.Net.Mail.MailMessage();
- aa.From = new System.Net.Mail.MailAddress("abc@abc.com");//who send
- aa.To.Add(new System.Net.Mail.MailAddress("abc@abc.com"));
- aa.Subject = "WorkOrders Type General";
- aa.Body = "DO NOT REPLY TO THIS EMAIL" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://ioksv004/WorkOrder/GeneralReport.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number For Report" + "<br><br/>" + "WorkOrderNumber" + ": " + "<a href=\"http://ioksv004/WorkOrder/General.aspx?WorkOrderNum=" + TextBox13.Text + "\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number To Enter Data" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBox14.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- //mm.Body = "WorkOrderNumber" + ": " + "<a href=\"http://localhost:49695/Safety.aspx?=WorkOrderNum=\">" + TextBox13.Text + "</a>" + "<-Click on the Work Order Number" + "<br><br/>" + "Requestor" + ": " + TextBoxRequestor.Text + "<br><br/>" + "Date" + ": " + TextBoxDate.Text + "<br><br/>" + "Department" + ": " + TextBoxDepartment.Text + "<br><br/>" + "Completion Date" + ": " + TextBoxCompletionDate.Text + "<br><br/>" + "Machine Description" + ": " + TextBoxMachineDescription.Text + "<br><br/>" + "Machine Location" + ": " + TextBoxMachineLocation.Text + "<br><br/>" + "Work Required" + ": " + TextBoxWorkRequired.Text + "<br><br/>" + "Status" + ": " + TextBoxStatus.Text;
- aa.IsBodyHtml = true;
- System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
- client.Host = ConfigurationManager.AppSettings["smtpServer"];
- client.Send(aa);
- captureuseremail();
- }
- }
- }
- else
- {
- Label17.Text = "Insert Was Not Successful, Please Contact the Developer";
- }
- }
- protected void captureuseremail()
- {
- TextBox email = new TextBox();
- email.Text = HttpContext.Current.Request.LogonUserIdentity.Name.ToString();
- string username = email.Text.Split('\\')[1];
- string domain = email.Text.Split('\\')[0];
- DirectoryEntry entry = new DirectoryEntry("LDAP://" + domain);
- DirectorySearcher adsearcher = new DirectorySearcher(entry);
- adsearcher.SearchScope = SearchScope.Subtree;
- adsearcher.Filter = "(&(objectClass=user)(samaccountname=" + username + "))";
- SearchResult userObject = adsearcher.FindOne();
- if (userObject != null)
- {
- string[] props = new string[] {"mail" };
- foreach (string prop in props)
- {
- TextBox15.Text = userObject.Properties[prop][0].ToString();
- }
- }
- string con = ConfigurationManager.ConnectionStrings["WorkOrderConnectionString3"].ToString();
- SqlConnection sqlcon = new SqlConnection(con);
- sqlcon.Open();
- using (SqlCommand cmd = new SqlCommand())
- {
- cmd.Connection = sqlcon;
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "UPDATE [WorkOrder].[dbo].[Master] SET [ReqEmailAddress] = @Email WHERE WorkOrderNum = @workordernum";
- cmd.Parameters.AddWithValue("@workordernum", TextBox13.Text);
- cmd.Parameters.AddWithValue("@Email", TextBox15.Text);
- cmd.ExecuteNonQuery();
- }
- }
- protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
- {
- DropDownList list = (DropDownList)(DetailsView1.FindControl("DropDownList1"));
- TextBox9.Text = list.SelectedValue;
- }
- protected void DropDownList1_TextChanged(object sender, EventArgs e)
- {
- DropDownList list = (DropDownList)(DetailsView1.FindControl("DropDownList1"));
- TextBox9.Text = list.SelectedValue;
- }
- protected void TextBox2_TextChanged(object sender, EventArgs e)
- {
- //cusCustom_ServerValidateit();
- }
- protected void Validate(object sender, EventArgs e)
- {
- }
- protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
- {
- if (Page.IsValid)
- {
- //TextBox TextBoxWorkOrderNumber = (TextBox)(DetailsView1.FindControl("TextBox11"));
- TextBox TextBoxRequestor = (TextBox)(DetailsView1.FindControl("TextBox3"));
- TextBox TextBoxDate = (TextBox)(DetailsView1.FindControl("TextBox1"));
- //TextBoxDate.Text = DateTime.Now.ToShortDateString();
- TextBox TextBoxDepartment = (TextBox)(DetailsView1.FindControl("TextBox4"));
- TextBox TextBoxCompletionDate = (TextBox)(DetailsView1.FindControl("TextBox16"));
- TextBox TextBoxMachineDescription = (TextBox)(DetailsView1.FindControl("TextBox5"));
- TextBox TextBoxMachineLocation = (TextBox)(DetailsView1.FindControl("TextBox6"));
- TextBox TextBoxWorkRequired = (TextBox)(DetailsView1.FindControl("TextBox7"));
- // DropDownList status = (DropDownList)(DetailsView1.FindControl("DropDownList2"));
- TextBox TextBoxStatus = (TextBox)(DetailsView1.FindControl("TextBox12"));
- TextBoxStatus.Text = "Open";
- DropDownList list = (DropDownList)(DetailsView1.FindControl("DropDownList1"));
- TextBox9.Text = list.SelectedValue;
- DropDownList lists = (DropDownList)(DetailsView1.FindControl("DropDownList2"));
- TextBox14.Text = lists.SelectedValue;
- if (TextBoxRequestor.Text.Length <= 0)
- {
- TextBoxRequestor.Text = "Not Applicable";
- }
- if (TextBox14.Text.Length <= 0)
- {
- TextBoxDepartment.Text = "Not Provided";
- }
- if (TextBoxCompletionDate.Text.Length <= 0)
- {
- TextBoxCompletionDate.Text = "Not Provided";
- }
- if (TextBoxMachineDescription.Text.Length <= 0)
- {
- TextBoxMachineDescription.Text = "Not Provided";
- }
- if (TextBoxMachineLocation.Text.Length <= 0)
- {
- TextBoxMachineLocation.Text = "Not Provided";
- }
- if (TextBoxWorkRequired.Text.Length <= 0)
- {
- TextBoxWorkRequired.Text = "Not Provided";
- }
- successfull = true;
- }
- else
- {
- e.Cancel = true;
- successfull = false;
- }
- }
- protected void RequestorSource_Inserted(object sender, SqlDataSourceStatusEventArgs e)
- {
- if (successfull == true)
- {
- try
- {
- int newid = (int)e.Command.Parameters["@NewId"].Value;
- TextBox13.Text = newid.ToString();
- }
- catch
- {
- successfull = false;
- }
- if (e.AffectedRows == 1 && successfull == true)
- {
- successfull = true;
- }
- else
- {
- successfull = false;
- }
- }
- else
- {
- successfull = false;
- }
- }
- protected void DetailsView1_ItemCreated(object sender, EventArgs e)
- {
- TextBox TextBoxDate = (TextBox)(DetailsView1.FindControl("TextBox1"));
- TextBoxDate.Text = DateTime.Now.ToString("MM/dd/yyyy");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement