protected void ddlCustomer_id_SelectedIndexChanged(object sender, EventArgs e) { if (!ddlCustomer_id.SelectedValue.Equals("")) { m_customer cus = new m_customer().SelectByID(Convert.ToInt32(ddlCustomer_id.SelectedValue)); if (cus != null) { hCompanyId.Value = cus.ID + ""; txtCompanyName.Text = cus.company_name; //txtDepartment.Text = cus.department; //txtTelNumber.Text = cus.tel_number; //txtEmail.Text = cus.email_address; //txtAddress.InnerText = cus.address; //List<m_customer_contract_person> contractPersonList = new m_customer_contract_person().FindAllByCompanyID(cus.ID); //if (contractPersonList != null && contractPersonList.Count > 0) //{ // ddlContract_person_id.Items.Clear(); // ddlContract_person_id.Items.Add(new ListItem(Constants.PLEASE_SELECT, "")); // ddlContract_person_id.DataSource = contractPersonList; // ddlContract_person_id.DataBind(); // ddlContract_person_id.Enabled = true; //} //else //{ // //TODO //} // m_customer_contract_person contact = new m_customer_contract_person(); List <m_customer_contract_person> listContractPerson = contact.SelectAllByCusID(cus.ID); if (listContractPerson != null && listContractPerson.Count > 0) { ddlContract_person_id.DataSource = listContractPerson; ddlContract_person_id.DataBind(); contact = listContractPerson[0]; txtDepartment.Text = contact.department; txtEmail.Text = contact.email; } // m_customer_address cusAddress = new m_customer_address(); List <m_customer_address> litAddress = cusAddress.SelectAllByCusID(cus.ID); if (litAddress != null && litAddress.Count > 0) { ddlAddress.DataSource = litAddress; ddlAddress.DataBind(); cusAddress = litAddress[0]; txtTelNumber.Text = cusAddress.telephone; txtFax.Text = cusAddress.fax; } } else { //TODO } } }
protected void gvSample_RowUpdating(object sender, System.Web.UI.WebControls.GridViewUpdateEventArgs e) { this.CONTRACT_PKID = int.Parse(gvSample.DataKeys[e.RowIndex].Values[0].ToString()); TextBox _txtName = (TextBox)gvSample.Rows[e.RowIndex].FindControl("txtName"); TextBox _txtPhone = (TextBox)gvSample.Rows[e.RowIndex].FindControl("txtPhone_number"); TextBox _txtEmail = (TextBox)gvSample.Rows[e.RowIndex].FindControl("txtEmail"); TextBox _txtDepartment = (TextBox)gvSample.Rows[e.RowIndex].FindControl("txtDepartment"); m_customer_contract_person contract = List.Find(x => x.ID == this.CONTRACT_PKID); if (contract != null) { contract.company_id = objCustomer.ID; contract.name = _txtName.Text; contract.phone_number = _txtPhone.Text; contract.email = _txtEmail.Text; contract.department = _txtDepartment.Text; } gvSample.EditIndex = -1; gvSample.DataSource = ListShow; gvSample.DataBind(); btnAdd.Enabled = true; }
protected void gvJob_SelectedIndexChanged(object sender, EventArgs e) { int key = Convert.ToInt32(gvJob.SelectedDataKey.Value); job_sample jobSample = new job_sample().SelectByID(key); job_info jobInfo = new job_info().SelectByID(this.JobID); if (jobInfo != null) { m_customer cus = new m_customer().SelectByID(jobInfo.customer_id); m_customer_contract_person cus_con_per = new m_customer_contract_person().SelectByID(jobInfo.contract_person_id); lbJobNo.Text = jobSample.job_number; // String.Format("{0}{1}", jobSample.job_running.prefix, Convert.ToInt32(jobInfo.job_number).ToString("00000")); lbClient.Text = cus.company_name; // jobInfo.m_customer.company_name; lbContract.Text = cus_con_per.name; // jobInfo.m_customer_contract_person.name; List <job_sample> samples = job_sample.FindAllBySampleID(key);//.FindAllByJobID(jobInfo.ID); if (samples != null && samples.Count > 0) { lbSample.Text = samples[0].description.Length > 30 ? samples[0].description.Substring(0, 30) + " ..." : samples[0].description; int spec_id = 0; foreach (job_sample s in samples) { m_specification spec = new m_specification().SelectByID(s.specification_id); lbSpec.Text = spec.name.Length > 15 ? spec.name.Substring(0, 15) + "...":spec.name; if (spec_id != s.specification_id) { spec_id = s.specification_id; } m_type_of_test tot = new m_type_of_test().SelectByID(s.type_of_test_id); type_of_test = tot.name + ","; //String.Format("<i class=\"icon-check\"></i> {0} ", tot.name); } lbTot.Text = type_of_test.Substring(0, type_of_test.Length - 1); if (jobInfo.sample_diposition != null) { if (jobInfo.sample_diposition.Equals("Y")) { sample_diposition = "Discard";// "<i class=\"icon-check\"></i>Discard<i class=\"icon-check-empty\"></i>Return"; } else { sample_diposition = "Return";// "<i class=\"icon-check-empty\"></i>Discard <i class=\"icon-check\"></i>Return"; } lbSd.Text = sample_diposition; } lbSa.Text = samples[0].surface_area; } } else { //btnCancel_Click(null, null); } Console.WriteLine(); }
protected void ddlContract_person_id_SelectedIndexChanged(object sender, EventArgs e) { m_customer_contract_person contact = new m_customer_contract_person().FindByID(Convert.ToInt32(ddlContract_person_id.SelectedValue)); if (contact != null) { txtDepartment.Text = contact.department; txtEmail.Text = contact.email; } }
protected void gvSample_RowDeleting(object sender, GridViewDeleteEventArgs e) { this.CONTRACT_PKID = int.Parse(gvSample.DataKeys[e.RowIndex].Values[0].ToString()); m_customer_contract_person js = List.Find(x => x.ID == this.CONTRACT_PKID); if (js != null) { js.RowState = CommandNameEnum.Delete; gvSample.DataSource = ListShow; gvSample.DataBind(); } btnAdd.Enabled = true; }
private void fillinScreen() { m_customer cus = new m_customer().SelectByID(this.PKID); PKID = cus.ID; //cus.customer_code =string.Empty; txtCompanyName.Text = cus.company_name; //txtAddress.InnerText = cus.address; //cus.sub_district =string.Empty; //cus.mobile_number =string.Empty; //txtEmail.Text = cus.email_address; //cus.branch =string.Empty; //cus.district =string.Empty; //cus.ext =string.Empty; //txtDepartment.Text = cus.department; //cus.province=string.Empty; //cus.code =string.Empty; //txtTelNumber.Text = cus.tel_number; //cus.update_by = userLogin.ID; //cus.update_date = DateTime.Now; //cus.status = "A"; List <m_customer_contract_person> contractPersonList = new m_customer_contract_person().FindAllByCompanyID(cus.ID); if (contractPersonList != null && contractPersonList.Count > 0) { foreach (m_customer_contract_person tmp in contractPersonList) { tmp.RowState = CommandNameEnum.Edit; } this.List = contractPersonList; gvSample.DataSource = ListShow; gvSample.DataBind(); } List <m_customer_address> addressList = new m_customer_address().FindAllByCompanyID(cus.ID); if (addressList != null && addressList.Count > 0) { foreach (m_customer_address tmp in addressList) { tmp.RowState = CommandNameEnum.Edit; } this.ListCustomerAddress = addressList; gvCustomerAddress.DataSource = ListCustomerAddressShow; gvCustomerAddress.DataBind(); } }
protected void lbAdd_Click(object sender, EventArgs e) { m_customer_contract_person tmp = new m_customer_contract_person(); tmp.ID = CustomUtils.GetRandomNumberID(); tmp.company_id = this.PKID; tmp.name = string.Empty; tmp.phone_number = string.Empty; tmp.email = string.Empty; tmp.status = "A"; tmp.RowState = CommandNameEnum.Add; List.Add(tmp); gvSample.DataSource = ListShow; gvSample.PageIndex = 0; gvSample.DataBind(); }
private void fillinScreen() { type_of_test = ""; job_sample jobSample = new job_sample().SelectByID(this.SampleID); job_info jobInfo = new job_info().SelectByID(this.JobID); if (jobInfo != null) { m_customer cus = new m_customer().SelectByID(jobInfo.customer_id); m_customer_contract_person cus_con_per = new m_customer_contract_person().SelectByID(jobInfo.contract_person_id); lbClient.Text = cus.company_name; // jobInfo.m_customer.company_name; lbContract.Text = cus_con_per.name; // jobInfo.m_customer_contract_person.name; List <job_sample> samples = job_sample.FindAllByJobID(jobInfo.ID); if (samples != null && samples.Count > 0) { lbSample.Text = samples[0].description.Length > 30 ? samples[0].description.Substring(0, 30) + " ..." : samples[0].description; int spec_id = 0; int index = 0; foreach (job_sample s in samples) { if (index == 0) { lbJobNo.Text = s.job_number.Split('-')[0] + "-" + s.job_number.Split('-')[1] + "-" + s.job_number.Split('-')[2] + ",";// String.Format("{0}{1}", jobSample.job_running.prefix, Convert.ToInt32(jobInfo.job_number).ToString("00000")); } else { lbJobNo.Text += s.job_number.Split('-')[2] + ","; } m_specification spec = new m_specification().SelectByID(s.specification_id); lbSpec.Text = spec.name.Length > 15 ? spec.name.Substring(0, 15) + "..." : spec.name; if (spec_id != s.specification_id) { spec_id = s.specification_id; } m_type_of_test tot = new m_type_of_test().SelectByID(s.type_of_test_id); type_of_test += tot.name + ","; //String.Format("<i class=\"icon-check\"></i> {0} ", tot.name); index++; } lbTot.Text = type_of_test.Substring(0, type_of_test.Length - 1); if (jobInfo.sample_diposition != null) { if (jobInfo.sample_diposition.Equals("Y")) { sample_diposition = "Discard";// "<i class=\"icon-check\"></i>Discard<i class=\"icon-check-empty\"></i>Return"; } else { sample_diposition = "Return";// "<i class=\"icon-check-empty\"></i>Discard <i class=\"icon-check\"></i>Return"; } lbSd.Text = sample_diposition; } lbSa.Text = samples[0].surface_area; } lbJobNo.Text = lbJobNo.Text.Substring(0, lbJobNo.Text.Length - 1); /// ReportParameterCollection reportParameters = new ReportParameterCollection(); reportParameters.Add(new ReportParameter("pJobNo", lbJobNo.Text)); reportParameters.Add(new ReportParameter("pClient", lbClient.Text)); reportParameters.Add(new ReportParameter("pContract", lbContract.Text)); reportParameters.Add(new ReportParameter("pSample", lbSample.Text)); reportParameters.Add(new ReportParameter("pSpec", lbSpec.Text)); reportParameters.Add(new ReportParameter("pTest", lbTot.Text)); reportParameters.Add(new ReportParameter("pSampleD", lbSd.Text)); // Variables Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; // Setup the report viewer object and get the array of bytes ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.LocalReport.ReportPath = Server.MapPath("~/ReportObject/rptStricker.rdlc"); viewer.LocalReport.SetParameters(reportParameters); } else { //btnCancel_Click(null, null); } }
private void fillinScreen() { job_info job = new job_info().SelectByID(this.JobID); hJobID.Value = job.ID.ToString(); ddlCustomer_id.SelectedValue = job.customer_id.ToString(); txtDate_of_receive.Text = job.date_of_receive.Value.ToString("MM/dd/yyyy"); m_customer_contract_person contact = new m_customer_contract_person(); List <m_customer_contract_person> listContractPerson = contact.SelectAllByCusID(job.customer_id); if (listContractPerson != null && listContractPerson.Count > 0) { ddlContract_person_id.DataSource = listContractPerson; ddlContract_person_id.DataBind(); ddlContract_person_id.SelectedValue = job.contract_person_id.ToString(); m_customer_contract_person contactPerson = new m_customer_contract_person().SelectByID(job.contract_person_id); if (contactPerson != null) { txtDepartment.Text = contactPerson.department; txtEmail.Text = contactPerson.email; } } // m_customer_address cusAddress = new m_customer_address(); List <m_customer_address> litAddress = cusAddress.SelectAllByCusID(job.customer_id); if (litAddress != null && litAddress.Count > 0) { ddlAddress.DataSource = litAddress; ddlAddress.DataBind(); if (job.customer_address_id != null && job.customer_address_id > 0) { m_customer_address addr = new m_customer_address().SelectByID(job.customer_address_id.Value); if (addr != null) { ddlAddress.SelectedValue = job.customer_address_id.ToString(); txtTelNumber.Text = addr.telephone; txtFax.Text = addr.fax; } } else { ddlAddress.SelectedIndex = 0; } } m_customer customer = new m_customer().SelectByID(job.customer_id); if (customer != null) { hCompanyId.Value = customer.ID + ""; txtCompanyName.Text = customer.company_name; } else { //TODO } ddlJobNumber.SelectedValue = job.job_prefix.ToString(); txtJob_number.Text = Convert.ToInt32(job.job_number).ToString("00000"); ddlSecification_id.SelectedIndex = -1; txtDateOfRequest.Text = Convert.ToDateTime(job.date_of_request).ToString("dd/MM/yyyy"); txtCustomer_ref_no.Text = job.customer_ref_no; txtCompany_name_to_state_in_report.InnerText = job.company_name_to_state_in_report; txtDate_of_receive.Text = Convert.ToDateTime(job.date_of_receive).ToString("dd/MM/yyyy"); //txtS_pore_ref_no.Text = job.s_pore_ref_no; txtSpecRefRevNo.Text = job.spec_ref_rev_no; txtCustomer_ref_no.Text = job.customer_ref_no; rdSample_enoughNo.Checked = job.status_sample_enough.Equals("Y") ? true : false; rdPersonel_and_workloadYes.Checked = job.status_sample_full.Equals("Y") ? true : false; rdPersonel_and_workloadYes.Checked = job.status_personel_and_workload.Equals("Y") ? true : false; rdTest_toolYes.Checked = job.status_test_tool.Equals("Y") ? true : false; rdTest_methodYes.Checked = job.status_test_method.Equals("Y") ? true : false; rdSample_dipositionYes.Checked = job.sample_diposition.Equals("Y") ? true : false; this.listSample = job_sample.FindAllByJobID(job.ID); this.listSample = (this.CommandName == CommandNameEnum.Edit) ? this.listSample.Where(x => x.ID.Equals(this.SampleID)).ToList() : this.listSample; foreach (job_sample tmp in this.listSample) { tmp.RowState = CommandNameEnum.Edit; } ddlStatus.SelectedValue = listSample[0].job_status.ToString(); ddlStatus.Enabled = (this.CommandName == CommandNameEnum.Edit); gvSample.DataSource = listSample; gvSample.DataBind(); }