Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        private void bindingData()
        {
            job_info jobInfo = new job_info();

            jobInfo.sample_id = this.SampleID;
            searchResult      = jobInfo.SearchData();
            gvJob.DataSource  = searchResult;
            gvJob.DataBind();
        }
Пример #4
0
        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();
        }
Пример #5
0
        protected void gvJob_SelectedIndexChanged(object sender, EventArgs e)
        {
            int key = Convert.ToInt32(gvJob.SelectedDataKey.Value);

            job_info jobInfo = new job_info().SelectByID(this.JobID);

            if (jobInfo != null)
            {
                lbJobNo.Text    = String.Format("{0}{1}", jobInfo.job_running.prefix, Convert.ToInt32(jobInfo.job_number).ToString("00000"));
                lbClient.Text   = jobInfo.m_customer.company_name;
                lbContract.Text = jobInfo.m_customer_contract_person.name;


                List <job_sample> samples = job_sample.FindAllByJobID(jobInfo.ID);
                if (samples != null && samples.Count > 0)
                {
                    int spec_id = 0;
                    foreach (job_sample s in samples)
                    {
                        //if (s.ID == 18)
                        //{
                        //    lbSample.Text += s.description + "<br/>";


                        //    lbSpec.Text = s.m_specification.name;
                        //    if (spec_id != s.specification_id)
                        //    {
                        //        spec_id = s.specification_id;
                        //    }
                        //    type_of_test += String.Format("<i class=\"icon-check\"></i> {0} ", s.m_type_of_test.name);
                        //}
                    }

                    if (jobInfo.sample_diposition != null)
                    {
                        if (jobInfo.sample_diposition.Equals("Y"))
                        {
                            sample_diposition = "<i class=\"icon-check\"></i>Discard<i class=\"icon-check-empty\"></i>Return";
                        }
                        else
                        {
                            sample_diposition = "<i class=\"icon-check-empty\"></i>Discard <i class=\"icon-check\"></i>Return";
                        }
                    }
                }
            }
            else
            {
                btnCancel_Click(null, null);
            }

            Console.WriteLine();
        }
Пример #6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            job_info editofficer = entities.job_info.Find(id);

            editofficer.job_name        = TextBox1.Text;
            editofficer.sector_id       = int.Parse(SRlist.SelectedValue);
            editofficer.direction_id    = int.Parse(dirlist.SelectedValue);
            editofficer.branch_id       = int.Parse(BRlist.SelectedValue);
            editofficer.section_id      = int.Parse(Slist.SelectedValue);
            editofficer.top_assossiated = int.Parse(asslist.SelectedValue);
            entities.SaveChanges();
            Response.Redirect("jobInfo.aspx");
        }
Пример #7
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            job_info newofficer = new job_info();

            newofficer.job_name        = textbox1.Text;
            newofficer.sector_id       = int.Parse(DropDownList1.SelectedValue);
            newofficer.direction_id    = int.Parse(DropDownList2.SelectedValue);
            newofficer.branch_id       = int.Parse(DropDownList3.SelectedValue);
            newofficer.section_id      = int.Parse(DropDownList4.SelectedValue);
            newofficer.top_assossiated = int.Parse(DropDownList5.SelectedValue);
            entities.job_info.Add(newofficer);
            entities.SaveChanges();
            Response.Redirect("jobInfo.aspx");
        }
Пример #8
0
        private void fillinScreen()
        {
            job_info jobInfo = new job_info().SelectByID(this.JobID);

            if (jobInfo != null)
            {
                lbJobNo.Text    = String.Format("{0}{1}", jobInfo.job_running.prefix, Convert.ToInt32(jobInfo.job_number).ToString("00000"));
                lbClient.Text   = jobInfo.m_customer.company_name;
                lbContract.Text = jobInfo.m_customer_contract_person.name;


                //    List<job_sample> samples = job_sample.FindAllByJobID(jobInfo.ID);
                //    if (samples != null && samples.Count > 0)
                //    {
                //        int spec_id = 0;
                //        foreach (job_sample s in samples)
                //        {
                //            lbSample.Text += s.description + "<br/>";


                //            lbSpec.Text = s.m_specification.name;
                //            if (spec_id != s.specification_id)
                //            {
                //                spec_id = s.specification_id;
                //            }
                //            type_of_test += String.Format("<i class=\"icon-check\"></i> {0} ", s.m_type_of_test.name);
                //        }

                //        if (jobInfo.sample_diposition != null)
                //        {
                //            if (jobInfo.sample_diposition.Equals("Y"))
                //            {
                //                sample_diposition = "<i class=\"icon-check\"></i>Discard<i class=\"icon-check-empty\"></i>Return";
                //            }
                //            else
                //            {
                //                sample_diposition = "<i class=\"icon-check-empty\"></i>Discard <i class=\"icon-check\"></i>Return";
                //            }
                //        }
                //    }
            }
            else
            {
                btnCancel_Click(null, null);
            }
        }
Пример #9
0
        private void LoadTemplate()
        {
            string controlPath = LastLoadedTemplate;

            if (!string.IsNullOrEmpty(controlPath))
            {
                plhCoverPage.Controls.Clear();
                UserControl uc = (UserControl)LoadControl(controlPath);
                plhCoverPage.Controls.Add(uc);
                //Job Sample Info
                job_info job = new job_info().SelectByID(this.jobSample.job_id);
                plhSampleInfo.Controls.Clear();
                UserControl uc1 = (UserControl)LoadControl(Constants.LINK_SAMPLE_INFO);
                plhSampleInfo.Controls.Add(uc1);
                ((ALS.ALSI.Web.UserControls.SampleInfo)(uc1)).initialInfo(job, jobSample);
            }
        }
Пример #10
0
        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);
            }
        }
Пример #11
0
        private void bindingData()
        {
            job_info jobInfo = new job_info();

            jobInfo.sample_id = this.SampleID;
            searchResult      = jobInfo.SearchData();
            gvJob.DataSource  = searchResult;
            gvJob.DataBind();

            //Show file.
            try
            {
                job_info jInfo = new job_info();
                jInfo = jInfo.SelectByID(this.jobSample.job_id);
                ///


                String rootPath    = Configurations.PATH_SOURCE.Replace("{0}\\{1}\\{2}\\{3}\\{4}", "");
                String correctPath = String.Empty;

                for (int y = DateTime.Now.Year; y > DateTime.Now.Year - 2; y--)
                {
                    for (int m = 1; m <= 12; m++)
                    {
                        for (int dd = 1; dd <= DateTime.DaysInMonth(y, m); dd++)
                        {
                            String checkPath = String.Format("{0}{1}\\{2}\\{3}\\{4}", rootPath, y, m.ToString("00"), dd.ToString("00"), this.jobSample.job_number);
                            if (Directory.Exists(checkPath))
                            {
                                correctPath = String.Format(Configurations.PATH_SOURCE, y, m.ToString("00"), dd.ToString("00"), this.jobSample.job_number, String.Empty);
                                break;
                            }
                        }
                    }
                }

                List <FileList> listOfFile = new List <FileList>();
                //String year = jInfo.create_date.Value.Year.ToString();
                //String month = jInfo.create_date.Value.Month.ToString("00");
                //String day = jInfo.create_date.Value.Day.ToString("00");
                //String job = this.jobSample.job_number;

                DirectoryInfo d             = new DirectoryInfo(correctPath); //Assuming Test is your Folder
                FileInfo[]    Files         = d.GetFiles("*.*");              //Getting Text files
                string        str           = "";
                int           index         = 1;
                List <String> keepExtension = new List <String>();
                keepExtension.Add(".xls");
                keepExtension.Add(".jpg");
                keepExtension.Add(".xlt");
                keepExtension.Add(".csv");

                foreach (FileInfo file in Files)
                {
                    FileList fl = new FileList();
                    fl.order = index;
                    fl.name  = Path.GetFileName(file.FullName);
                    fl.url   = String.Concat(Configurations.HOST, "/uploads/", file.FullName.Replace(rootPath, "").Replace("\\", "/"));
                    //str = str + ", " + file.Name;
                    index++;
                    if (keepExtension.Contains(Path.GetExtension(file.FullName)))
                    {
                        listOfFile.Add(fl);
                    }
                }

                gvFileList.DataSource = listOfFile;
                gvFileList.DataBind();
                lbShowListText.Text = "";
            }
            catch (Exception ex)
            {
                lbShowListText.Text = "-";
            }
        }
Пример #12
0
        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();
        }