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 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 gvResult_RowDeleting(object sender, GridViewDeleteEventArgs e) { this.PKID = int.Parse(e.Keys[0].ToString().Split(Constants.CHAR_COMMA)[0]); m_type_of_test cus = new m_type_of_test().SelectByID(this.PKID); if (cus != null) { cus.Delete(); //Commit GeneralManager.Commit(); bindingData(); } }
private void fillinScreen() { m_type_of_test type_of_test = new m_type_of_test().SelectByID(this.PKID); ddlSpecification.SelectedValue = type_of_test.specification_id.ToString(); txtPrefix.Text = type_of_test.prefix; txtName.Text = type_of_test.name; if (type_of_test.ref_template_id != null) { ddlPathUrl.SelectedValue = type_of_test.ref_template_id.Value.ToString(); } //ddlTypeOfTest.Items.Clear(); //ddlTypeOfTest.DataSource = type_of_test.SelectParent(type_of_test.specification_id); //ddlTypeOfTest.DataBind(); //ddlTypeOfTest.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); //ddlTypeOfTest.SelectedValue = type_of_test.parent.ToString(); txtDataGroup.Text = type_of_test.data_group; }
protected void ddlSecification_id_SelectedIndexChanged(object sender, EventArgs e) { if (!ddlSecification_id.SelectedValue.Equals("")) { //if (ddlSecification_id.SelectedItem.Text.ToUpper().Contains("OTHER")) //{ // txtSpecification_other.Visible = true; // lbOther.Visible = true; //} //else //{ //List<m_type_of_test> disPlayTT = new List<m_type_of_test>(); List <m_type_of_test> lists = new m_type_of_test().SelectBySpecificationId(int.Parse(ddlSecification_id.SelectedValue));//.SelectParent(int.Parse(ddlSecification_id.SelectedValue)); //List<m_type_of_test> parents = lists.FindAll(x => x.parent == -1); foreach (m_type_of_test val in lists) { val.customName = String.Format("{0}-[{1}]{2}", val.data_group, val.prefix, val.name); //disPlayTT.Add(parent); //List<m_type_of_test> childs = new m_type_of_test().SelectChild(parent.ID); //if (childs != null) //{ // if (childs.Count > 0) // { // foreach (m_type_of_test child in childs) // { // child.customName = parent.name + "-" + child.name + "(" + child.prefix + ")"; // disPlayTT.Add(child); // } // } //} } lstTypeOfTest.Attributes.Add("multiple", ""); lstTypeOfTest.DataSource = lists; lstTypeOfTest.DataBind(); //} //txtSpecification_other.Text = string.Empty; //txtSpecification_other.Visible = false; //lbOther.Visible = false; } }
private void initialPage() { lbCommandName.Text = CommandNameEnum.Edit.ToString(); m_role role = new m_role(); ddlRole.Items.Clear(); ddlRole.DataSource = role.SelectAll(); ddlRole.DataBind(); ddlRole.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); m_title title = new m_title(); ddlTitle.Items.Clear(); ddlTitle.DataSource = title.SelectAll(); ddlTitle.DataBind(); ddlTitle.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); m_type_of_test type_of_test = new m_type_of_test(); lstTypeOfTest.Items.Clear(); lstTypeOfTest.DataSource = type_of_test.SelectDistinct(); lstTypeOfTest.DataBind(); lstTypeOfTest.Items.Insert(0, new ListItem(Constants.PLEASE_SELECT, "")); fillinScreen(); ddlRole.Enabled = false; txtUser.Enabled = false; txtPassword.Enabled = true; txtEmail.Enabled = true; ddlTitle.Enabled = true; txtFirstName.Enabled = true; txtLastName.Enabled = true; btnSave.Enabled = true; btnCancel.Enabled = true; }
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); } }
protected void btnAddSampleInfo_Click(object sender, EventArgs e) { foreach (ListItem item in lstTypeOfTest.Items) { if (item.Selected) { m_type_of_test tmp = new m_type_of_test().SelectByID(int.Parse(item.Value)); if (tmp != null) { job_sample jobSample = new job_sample(); jobSample.ID = CustomUtils.GetRandomNumberID(); jobSample.template_id = -1; jobSample.job_id = Convert.ToInt32(hJobID.Value); jobSample.type_of_test_id = tmp.ID; jobSample.specification_id = String.IsNullOrEmpty(ddlSecification_id.SelectedValue) ? 0 : int.Parse(ddlSecification_id.SelectedValue); jobSample.job_number = ddlJobNumber.SelectedItem.Text + "-" + txtJob_number.Text + "-" + tmp.prefix; jobSample.description = txtDescriptoin.Text; jobSample.model = txtModel.Text; jobSample.surface_area = txtSurfaceArea.Text; jobSample.remarks = txtRemark.Text; jobSample.no_of_report = 1;// Convert.ToInt16(ddlNoOfReport.SelectedValue); jobSample.uncertainty = (rdUncertaintyYes.Checked) ? "Y" : "N"; jobSample.RowState = CommandNameEnum.Add; jobSample.job_status = Convert.ToInt32(StatusEnum.LOGIN_CONVERT_TEMPLATE); jobSample.job_role = userLogin.role_id; jobSample.status_completion_scheduled = Convert.ToInt32(ddlCompletionScheduled.SelectedValue); //jobSample.due_date = Convert.ToDateTime(objJobInfo.date_of_receive.Value); jobSample.update_date = Convert.ToDateTime(objJobInfo.date_of_receive.Value); jobSample.update_by = userLogin.id; jobSample.is_hold = "0";//0=Unhold jobSample.part_no = txtPartNo.Text; jobSample.part_name = txtPartName.Text; jobSample.lot_no = txtLotNo.Text; jobSample.other_ref_no = txtOtherRefNo.Text; #region "Special Flow" /* * ELP: Login(convert template , select spec) > Chemist testing > Sr. chemist checking > Admin(Word) > Lab Manager > Admin (Upload file PDF) * ELS: Login(convert template(Ad hoc template)) >Chemist testing(Upload file) > Sr. chemist checking * ELN: Login(convert template(Ad hoc template)) > Chemist testing(Upload file) > Sr. chemist checking > Admin(Word) > Lab Manager Admin (Upload file PDF) * FA: Login > Chemist testing(Upload file) > Admin(Word) > Lab Manager > Admin (Upload file PDF) * GRP: Login > Admin(Upload file PDF) * ELWA : Login > Chemist testing(Upload file) > Sr. chemist checking > Admin(Word) > Lab Manager > Admin (Upload file PDF) * */ if (!String.IsNullOrEmpty(ddlJobNumber.SelectedValue)) { switch (ddlJobNumber.SelectedItem.Text.ToUpper()) { case "ELS": jobSample.template_id = 1; jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING); break; case "ELN": if (tmp.ref_template_id != null) { jobSample.template_id = tmp.ref_template_id.Value; } else { jobSample.template_id = 2; } jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING); break; case "FA": jobSample.template_id = 3; jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING); break; case "GRP": jobSample.template_id = 4; jobSample.job_status = Convert.ToInt32(StatusEnum.ADMIN_CONVERT_PDF); break; case "ELWA": jobSample.template_id = 5; jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING); break; default: //ELP break; } } #endregion m_completion_scheduled cs = new m_completion_scheduled().SelectByID(Convert.ToInt32(jobSample.status_completion_scheduled)); if (cs != null) { if (objJobInfo != null) { if (Constants.OTHER_REF_NOS.Contains(jobSample.other_ref_no)) { jobSample.due_date_lab = new DateTime(1, 1, 1); jobSample.due_date_customer = Convert.ToDateTime(objJobInfo.date_of_receive.Value).AddDays(Convert.ToInt32(cs.customer_due_date)); } else { jobSample.due_date = Convert.ToDateTime(objJobInfo.date_of_receive.Value).AddDays(Convert.ToInt32(cs.value)); jobSample.due_date_customer = Convert.ToDateTime(objJobInfo.date_of_receive.Value).AddDays(Convert.ToInt32(cs.customer_due_date)); jobSample.due_date_lab = Convert.ToDateTime(objJobInfo.date_of_receive.Value).AddDays(Convert.ToInt32(cs.lab_due_date)); } } } else { //logger.Debug("m_completion_scheduled is Empty!"); } jobSample.sample_prefix = ddlJobNumber.SelectedItem.Text; listSample.Add(jobSample); } else { // not find type of test } } } gvSample.DataSource = listSampleShow; gvSample.PageIndex = 0; gvSample.DataBind(); //Clear old value //txtDescriptoin.Text = string.Empty; //txtModel.Text = string.Empty; //txtSurfaceArea.Text = string.Empty; //txtRemark.Text = string.Empty; //rdUncertaintyNo.Checked = true; //ddlSecification_id.SelectedIndex = -1; //ddlCompletionScheduled.SelectedIndex = -1; lstTypeOfTest.ClearSelection(); }