public static ReportHeader getReportHeder(job_sample _sample) { ReportHeader rpt = new ReportHeader(); job_info _job = new job_info(); _job = _job.SelectByID(_sample.job_id); if (_job != null) { m_customer _cus = new m_customer(); _cus = _cus.SelectByID(_job.customer_id); m_customer_address addr = new m_customer_address(); addr = addr.SelectByID(_job.customer_address_id.Value); if (_cus != null) { rpt.addr1 = _cus.company_name; rpt.addr2 = addr.address; } rpt.cusRefNo = _job.customer_ref_no;// (_sample.sample_po== null) ? String.Empty : _sample.sample_po.ToString(); rpt.cur_date = DateTime.Now; rpt.dateOfDampleRecieve = Convert.ToDateTime(_job.date_of_receive); rpt.dateOfAnalyze = Convert.ToDateTime(_sample.date_chemist_alalyze); rpt.dateOfTestComplete = Convert.ToDateTime(_sample.date_chemist_complete); //ATT / ELP / 16 / XXXX(เลขจ็อบ) - XX(Test) int phisicalYear = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2)); if (DateTime.Now.Month < 4) { phisicalYear = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2)) - 1; } String AmRetest = String.Empty; switch (_sample.amend_or_retest) { case "AM": AmRetest = (_sample.amend_count > 0) ? "AM" + _sample.amend_count + "/" : String.Empty; break; case "R": AmRetest = (_sample.retest_count > 0) ? "R" + _sample.retest_count + "/" : String.Empty; break; } String[] tmp = _sample.job_number.Split('-'); rpt.alsRefNo = String.Format("{0}ATT/{1}/{2}/{3}-{4}", AmRetest, tmp[0], phisicalYear, tmp[1], tmp[2]);// _sample.job_number.ToString(); rpt.description = (String.IsNullOrEmpty(_sample.description) ? String.Empty : "Description:" + _sample.description + "\n") + (String.IsNullOrEmpty(_sample.model) ? String.Empty : "Model:" + _sample.model + "\n") + (String.IsNullOrEmpty(_sample.surface_area) ? String.Empty : "Surface Area:" + _sample.surface_area + "\n") + (!String.IsNullOrEmpty(_sample.remarks) ? "Remark: " + _sample.remarks + "\n" : ""); rpt.model = _sample.model; rpt.surface_areas = _sample.surface_area; rpt.remark = _sample.remarks; } return(rpt); }
public void initialInfo(job_info _job, job_sample _sample) { /*INFO*/ if (_job != null && _sample != null) { m_customer cus = new m_customer(); cus = cus.SelectByID(_job.customer_id); lbPoNo.Text = (_sample.sample_po == null) ? String.Empty : _sample.sample_po.ToString(); lbDate.Text = DateTime.Now.ToString("MM/dd/yyyy"); lbCompany.Text = String.Format("{0}<br />{1}", cus.company_name, cus.address); lbDateSampleReceived.Text = Convert.ToDateTime(_job.date_of_receive).ToString("MM/dd/yyyy"); String[] tmp = _sample.job_number.Split('-'); lbRefNo.Text = String.Format("{4}ATT/{0}/{1}/{2}-{3}", tmp[0], _job.date_of_receive.Value.ToString("yy"), tmp[1], tmp[2], (_sample.amend_count > 0 ? (_sample.amend_count == 1 ? "AM/" : "AM/" + _sample.amend_count) : "")); ////String.Format("AM/ATT/ELP/17/XXXX-XX") //lbDownloadName.Text = _sample.job_number.ToString(); lbDateTestCompleted.Text = Convert.ToDateTime(_sample.due_date).ToString("MM/dd/yyyy"); lbSampleDescription.Text = String.Format("Description:{0}<br />Model:{1}<br />Surface Area:{2}<br />Remark:{3}<br />", _sample.description, _sample.model, _sample.surface_area, _sample.remarks); m_specification mSpec = new m_specification(); mSpec = mSpec.SelectByID(_sample.specification_id); m_type_of_test typeOfTest = new m_type_of_test(); typeOfTest = typeOfTest.SelectByID(_sample.type_of_test_id); txtSpec.Text = String.Format("Specification [{0}]-->Type Of Test [{1}]", (mSpec == null) ? String.Empty : mSpec.name, typeOfTest.name); } }
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 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(); }
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 gvResult_RowDeleting(object sender, GridViewDeleteEventArgs e) { this.PKID = int.Parse(e.Keys[0].ToString().Split(Constants.CHAR_COMMA)[0]); m_customer cus = new m_customer().SelectByID(this.PKID); if (cus != null) { try { cus.Delete(); //Commit GeneralManager.Commit(); bindingData(); } catch (Exception ex) { Console.WriteLine(); MessageBox.Show(this.Page, Resources.MSG_BE_USED); } } }
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(); }
private void initialPage() { this.listSample = new List <job_sample>(); m_customer customer = new m_customer(); ddlCustomer_id.Items.Clear(); ddlCustomer_id.DataSource = customer.SelectAll(); ddlCustomer_id.DataBind(); ddlCustomer_id.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); ddlContract_person_id.Items.Clear(); ddlContract_person_id.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); m_specification specification = new m_specification(); ddlSecification_id.Items.Clear(); ddlSecification_id.DataSource = specification.SelectAll(); ddlSecification_id.DataBind(); ddlSecification_id.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); ddlJobNumber.Items.Clear(); ddlJobNumber.DataSource = new job_running().SelectAll(); ddlJobNumber.DataBind(); ddlJobNumber.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); m_completion_scheduled m_completion_scheduled = new m_completion_scheduled(); ddlCompletionScheduled.DataSource = m_completion_scheduled.SelectAll(); ddlCompletionScheduled.DataBind(); ddlAddress.Items.Clear(); ddlAddress.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); ddlStatus.Items.Clear(); ddlStatus.DataSource = new m_status().SelectByMainStatus(); ddlStatus.DataBind(); ddlStatus.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); switch (CommandName) { case CommandNameEnum.Add: txtDateOfRequest.Text = DateTime.Now.ToString("dd/MM/yyyy"); txtDate_of_receive.Text = DateTime.Now.ToString("dd/MM/yyyy"); ddlCustomer_id.Enabled = true; ddlContract_person_id.Enabled = true; ddlSecification_id.Enabled = true; txtDateOfRequest.Enabled = true; txtCustomer_ref_no.Enabled = true; txtCompany_name_to_state_in_report.Attributes.Remove("readonly"); //txtCompany_name_to_state_in_report.Attributes["readonly"] = "readonly"; txtJob_number.Enabled = true; txtDate_of_receive.Enabled = true; //txtS_pore_ref_no.Enabled = true; txtSpecRefRevNo.Enabled = true; txtCustomer_ref_no.Enabled = true; rdSample_enoughNo.Enabled = true; rdPersonel_and_workloadYes.Enabled = true; rdPersonel_and_workloadYes.Enabled = true; rdTest_toolYes.Enabled = true; rdTest_methodYes.Enabled = true; //rdCompletion_scheduledNormal_Normal.Enabled = true; //rdCompletion_scheduledNormal_Urgent.Enabled = true; //rdCompletion_scheduledNormal_Express.Enabled = true; rdSample_dipositionYes.Enabled = true; //txtSpecification_other.Enabled = true; //lbOther.Visible = false; btnAddSampleInfo.Enabled = true; btnSave.Enabled = true; btnCancel.Enabled = true; break; case CommandNameEnum.Edit: fillinScreen(); btnAddSampleInfo.Enabled = true; btnSave.Enabled = true; btnCancel.Enabled = true; break; case CommandNameEnum.View: fillinScreen(); ddlCustomer_id.Attributes["readonly"] = "readonly"; ddlContract_person_id.Attributes["readonly"] = "readonly"; ddlSecification_id.Attributes["readonly"] = "readonly"; txtDateOfRequest.Attributes["readonly"] = "readonly"; txtCustomer_ref_no.Attributes["readonly"] = "readonly"; txtCompany_name_to_state_in_report.Attributes["readonly"] = "readonly"; txtJob_number.Attributes["readonly"] = "readonly"; txtDate_of_receive.Attributes["readonly"] = "readonly"; //txtS_pore_ref_no.Attributes["readonly"] = "readonly"; txtSpecRefRevNo.Attributes["readonly"] = "readonly"; txtCustomer_ref_no.Attributes["readonly"] = "readonly"; rdSample_enoughNo.Attributes["readonly"] = "readonly"; rdPersonel_and_workloadYes.Attributes["readonly"] = "readonly"; rdPersonel_and_workloadYes.Attributes["readonly"] = "readonly"; rdTest_toolYes.Attributes["readonly"] = "readonly"; rdTest_methodYes.Attributes["readonly"] = "readonly"; //rdCompletion_scheduledNormal_Normal.Attributes["readonly"] = "readonly"; //rdCompletion_scheduledNormal_Urgent.Attributes["readonly"] = "readonly"; //rdCompletion_scheduledNormal_Express.Attributes["readonly"] = "readonly"; rdSample_dipositionYes.Attributes["readonly"] = "readonly"; //txtSpecification_other.Enabled = false; //lbOther.Visible = false; btnAddSampleInfo.Enabled = false; btnSave.Enabled = false; btnCancel.Enabled = true; break; } //txtSpecification_other.Visible = false; }