コード例 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.jobSample.other_ref_no = txtOtherRefNo.Text;
            if (Constants.OTHER_REF_NOS.Contains(this.jobSample.other_ref_no.Trim()))
            {
                this.jobSample.due_date_lab = new DateTime(1, 1, 1);
            }
            this.jobSample.Update();
            job_sample_logs tmp = new job_sample_logs
            {
                ID            = 0,
                job_sample_id = this.jobSample.ID,
                log_title     = String.Format("Change Other Ref no."),
                //job_remark = txtRemark.Text,
                is_active = "0",
                date      = DateTime.Now
            };

            tmp.Insert();

            //Commit
            GeneralManager.Commit();

            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
コード例 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtDuedate.Text))
            {
                jobSample.date_admin_sent_to_cus = null;
            }
            else
            {
                jobSample.date_admin_sent_to_cus = CustomUtils.converFromDDMMYYYY(txtDuedate.Text);
            }
            this.jobSample.Update();
            job_sample_logs tmp = new job_sample_logs
            {
                ID            = 0,
                job_sample_id = this.jobSample.ID,
                log_title     = String.Format("Change Report Date"),
                //job_remark = txtRemark.Text,
                is_active = "0",
                date      = DateTime.Now
            };

            tmp.Insert();

            //Commit
            GeneralManager.Commit();

            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
コード例 #3
0
ファイル: Main.Master.cs プロジェクト: pawit1357/ALS.ALSI.Web
        private void renderAlert()
        {
            RoleEnum roleEnum = (RoleEnum)Enum.Parse(typeof(RoleEnum), userLogin.role_id.ToString());

            job_sample_logs        jobSampleLogsBiz = new job_sample_logs();
            List <job_sample_logs> jobSampleLogs    = jobSampleLogsBiz.SelectNotification(userLogin);

            StringBuilder htmlNotification = new StringBuilder();

            htmlNotification.Append("<li class=\"dropdown dropdown-extended dropdown-notification\" id=\"header_notification_bar\">");
            htmlNotification.Append("<a href = \"javascript:;\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" data-hover=\"dropdown\" data-close-others=\"true\">");
            htmlNotification.Append("<i class=\"icon-bell\"></i>");
            htmlNotification.Append("<span class=\"badge badge-default\">" + jobSampleLogs.Count + " </span>");
            htmlNotification.Append("</a>");
            htmlNotification.Append("<ul class=\"dropdown-menu\">");
            htmlNotification.Append("<li class=\"external\">");
            htmlNotification.Append("<h3>");
            htmlNotification.Append("<span class=\"bold\">" + jobSampleLogs.Count + " pending</span> notifications</h3>");
            htmlNotification.Append("<a href = \"/alis/view/sampleLog/SearchSampleLog.aspx\" > view all</a>");
            htmlNotification.Append("</li>");
            htmlNotification.Append("<li>");
            htmlNotification.Append("<ul class=\"dropdown-menu-list scroller\" style=\"height: 250px;\" data-handle-color=\"#637283\">");
            #region "ALERT CONTENT"
            foreach (job_sample_logs log in jobSampleLogs)
            {
                htmlNotification.Append("<li>");
                htmlNotification.Append("<a href = \"javascript:;\" >");
                htmlNotification.Append("<span class=\"time\">" + log.date.Value.ToShortDateString() + "</span>");
                htmlNotification.Append("<span class=\"details\">");
                htmlNotification.Append("<span class=\"label label-sm label-icon label-success\">");
                htmlNotification.Append("<i class=\"fa fa-plus\"></i>");
                htmlNotification.Append("</span>" + log.job_number + "<br>" + log.log_title + "(" + log.job_remark + ")</span>");
                htmlNotification.Append("</a>");
                htmlNotification.Append("</li>");
            }


            #endregion
            htmlNotification.Append("</ul>");
            htmlNotification.Append("</li>");
            htmlNotification.Append("</ul>");
            htmlNotification.Append("</li>");

            litAlert.Text = htmlNotification.ToString();
        }
コード例 #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.jobSample.date_srchemist_complate = CustomUtils.converFromDDMMYYYY(txtDuedate.Text);
            this.jobSample.Update();
            job_sample_logs tmp = new job_sample_logs
            {
                ID            = 0,
                job_sample_id = this.jobSample.ID,
                log_title     = String.Format("Change Sr Complete date by {0}", userLogin.username),
                job_remark    = txtRemark.Text,
                is_active     = "0",
                date          = DateTime.Now
            };

            tmp.Insert();

            //Commit
            GeneralManager.Commit();

            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
コード例 #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.jobSample.singapore_ref_no     = txtSingaporeRefNo.Text;
            this.jobSample.date_chemist_alalyze = CustomUtils.converFromDDMMYYYY(txtDateAnalyzed.Text);
            this.jobSample.Update();
            job_sample_logs tmp = new job_sample_logs
            {
                ID            = 0,
                job_sample_id = this.jobSample.ID,
                log_title     = String.Format("Change Other Ref no."),
                //job_remark = txtRemark.Text,
                is_active = "0",
                date      = DateTime.Now
            };

            tmp.Insert();

            //Commit
            GeneralManager.Commit();

            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
コード例 #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.jobSample.due_date          = CustomUtils.converFromDDMMYYYY(txtDuedate.Text);
            this.jobSample.due_date_lab      = CustomUtils.converFromDDMMYYYY(txtDuedate.Text);
            this.jobSample.due_date_customer = this.jobSample.due_date_lab.Value.AddDays(1);
            this.jobSample.Update();
            job_sample_logs tmp = new job_sample_logs
            {
                ID            = 0,
                job_sample_id = this.jobSample.ID,
                log_title     = String.Format("Change Due Date"),
                job_remark    = txtRemark.Text,
                is_active     = "0",
                date          = DateTime.Now
            };

            tmp.Insert();

            //Commit
            GeneralManager.Commit();

            removeSession();
            MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath);
        }
コード例 #7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Boolean isValid = true;

            StatusEnum status = (StatusEnum)Enum.Parse(typeof(StatusEnum), this.jobSample.job_status.ToString(), true);

            switch (status)
            {
            case StatusEnum.CHEMIST_TESTING:

                if (FileUpload2.HasFile)
                {
                    ;                         // && (Path.GetExtension(FileUpload2.FileName).Equals(".xls") || Path.GetExtension(FileUpload2.FileName).Equals(".xlt")))
                }
                {
                    string yyyy = DateTime.Now.ToString("yyyy");
                    string MM   = DateTime.Now.ToString("MM");
                    string dd   = DateTime.Now.ToString("dd");

                    String source_file     = String.Format(Configurations.PATH_SOURCE, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(FileUpload2.FileName));
                    String source_file_url = String.Format(Configurations.PATH_URL, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(FileUpload2.FileName));


                    if (!Directory.Exists(Path.GetDirectoryName(source_file)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(source_file));
                    }
                    FileUpload2.SaveAs(source_file);
                    this.jobSample.ad_hoc_tempalte_path = source_file_url;
                }

                this.jobSample.job_status            = Convert.ToInt32(StatusEnum.SR_CHEMIST_CHECKING);
                this.jobSample.step2owner            = userLogin.id;
                this.jobSample.date_chemist_complete = DateTime.Now;

                break;

            case StatusEnum.SR_CHEMIST_CHECKING:
                StatusEnum srChemistApproveStatus = (StatusEnum)Enum.Parse(typeof(StatusEnum), ddlStatus.SelectedValue, true);
                switch (srChemistApproveStatus)
                {
                case StatusEnum.SR_CHEMIST_APPROVE:
                    this.jobSample.job_status = Convert.ToInt32(StatusEnum.ADMIN_CONVERT_WORD);
                    #region ":: STAMP COMPLETE DATE"


                    this.jobSample.date_srchemist_complate = DateTime.Now;
                    #endregion
                    break;

                case StatusEnum.SR_CHEMIST_DISAPPROVE:
                    this.jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING);
                    #region "LOG"
                    job_sample_logs jobSampleLog = new job_sample_logs
                    {
                        ID            = 0,
                        job_sample_id = this.jobSample.ID,
                        log_title     = String.Format("Sr.Chemist DisApprove"),
                        job_remark    = txtRemark.Text,
                        is_active     = "0",
                        date          = DateTime.Now
                    };
                    jobSampleLog.Insert();
                    #endregion
                    break;
                }
                this.jobSample.step4owner = userLogin.id;
                break;

            case StatusEnum.LABMANAGER_CHECKING:
                StatusEnum labApproveStatus = (StatusEnum)Enum.Parse(typeof(StatusEnum), ddlStatus.SelectedValue, true);
                switch (labApproveStatus)
                {
                case StatusEnum.LABMANAGER_APPROVE:
                    this.jobSample.job_status = Convert.ToInt32(StatusEnum.ADMIN_CONVERT_PDF);

                    this.jobSample.date_labman_complete = DateTime.Now;
                    break;

                case StatusEnum.LABMANAGER_DISAPPROVE:
                    this.jobSample.job_status = Convert.ToInt32(ddlAssignTo.SelectedValue);
                    #region "LOG"
                    job_sample_logs jobSampleLog = new job_sample_logs
                    {
                        ID            = 0,
                        job_sample_id = this.jobSample.ID,
                        log_title     = String.Format("Lab Manager DisApprove"),
                        job_remark    = txtRemark.Text,
                        is_active     = "0",
                        date          = DateTime.Now
                    };
                    jobSampleLog.Insert();
                    #endregion
                    break;
                }
                this.jobSample.step5owner = userLogin.id;
                break;

            case StatusEnum.ADMIN_CONVERT_WORD:
                if (FileUpload1.HasFile)    // && (Path.GetExtension(FileUpload1.FileName).Equals(".doc") || Path.GetExtension(FileUpload1.FileName).Equals(".docx")))
                {
                    string yyyy = DateTime.Now.ToString("yyyy");
                    string MM   = DateTime.Now.ToString("MM");
                    string dd   = DateTime.Now.ToString("dd");

                    String source_file     = String.Format(Configurations.PATH_SOURCE, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(FileUpload1.FileName));
                    String source_file_url = String.Format(Configurations.PATH_URL, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(FileUpload1.FileName));


                    if (!Directory.Exists(Path.GetDirectoryName(source_file)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(source_file));
                    }
                    FileUpload1.SaveAs(source_file);
                    this.jobSample.path_word  = source_file_url;
                    this.jobSample.job_status = Convert.ToInt32(StatusEnum.LABMANAGER_CHECKING);
                }
                else
                {
                    errors.Add("Invalid File. Please upload a File with extension .doc|.docx");
                }
                this.jobSample.step6owner = userLogin.id;
                break;

            case StatusEnum.ADMIN_CONVERT_PDF:
                if (FileUpload1.HasFile)    // && (Path.GetExtension(FileUpload1.FileName).Equals(".pdf")))
                {
                    string yyyy = DateTime.Now.ToString("yyyy");
                    string MM   = DateTime.Now.ToString("MM");
                    string dd   = DateTime.Now.ToString("dd");

                    String source_file     = String.Format(Configurations.PATH_SOURCE, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(FileUpload1.FileName));
                    String source_file_url = String.Format(Configurations.PATH_URL, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(FileUpload1.FileName));


                    if (!Directory.Exists(Path.GetDirectoryName(source_file)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(source_file));
                    }
                    FileUpload1.SaveAs(source_file);
                    this.jobSample.path_pdf   = source_file_url;
                    this.jobSample.job_status = Convert.ToInt32(StatusEnum.JOB_COMPLETE);
                    this.jobSample.step7owner = userLogin.id;

                    //lbMessage.Text = string.Empty;
                }
                else
                {
                    errors.Add("Invalid File. Please upload a File with extension .pdf");
                    //lbMessage.Attributes["class"] = "alert alert-error";
                    //isValid = false;
                }
                break;
            }

            if (errors.Count > 0)
            {
                litErrorMessage.Text = MessageBox.GenWarnning(errors);
                modalErrorList.Show();
            }
            else
            {
                litErrorMessage.Text = String.Empty;
                //########
                this.jobSample.Update();
                //Commit
                GeneralManager.Commit();

                removeSession();
                MessageBox.Show(this.Page, Resources.MSG_SAVE_SUCCESS, PreviousPath);
            }
        }
コード例 #8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Boolean isValid = true;

            StatusEnum status = (StatusEnum)Enum.Parse(typeof(StatusEnum), this.jobSample.job_status.ToString(), true);

            switch (status)
            {
            case StatusEnum.LOGIN_CONVERT_TEMPLATE:
                this.jobSample.step1owner = userLogin.id;

                break;

            case StatusEnum.LOGIN_SELECT_SPEC:
                this.jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING);
                this.jobSample.step2owner = userLogin.id;
                this.jobSample.is_no_spec = cbCheckBox.Checked ? "1" : "0";
                template_seagate_copperwire_coverpage.DeleteBySampleID(this.SampleID);
                foreach (template_seagate_copperwire_coverpage _cover in this.coverpages)
                {
                    _cover.specification_id = Convert.ToInt32(ddlSpecification.SelectedValue);
                    _cover.procedureNo      = txtProcedureNo.Text;
                    _cover.number_of_pieces_used_for_extraction = txtNumberOfPiecesUsedForExtraction.Text;
                }
                template_seagate_copperwire_coverpage.InsertList(this.coverpages);

                break;

            case StatusEnum.CHEMIST_TESTING:
                this.jobSample.job_status = Convert.ToInt32(StatusEnum.SR_CHEMIST_CHECKING);
                this.jobSample.step3owner = userLogin.id;
                this.jobSample.is_no_spec = cbCheckBox.Checked ? "1" : "0";

                #region ":: STAMP COMPLETE DATE"
                this.jobSample.date_chemist_alalyze  = CustomUtils.converFromDDMMYYYY(txtDateAnalyzed.Text);
                this.jobSample.date_chemist_complete = DateTime.Now;
                #endregion

                foreach (template_seagate_copperwire_coverpage _cover in this.coverpages)
                {
                    _cover.specification_id = Convert.ToInt32(ddlSpecification.SelectedValue);
                    _cover.procedureNo      = txtProcedureNo.Text;
                    _cover.number_of_pieces_used_for_extraction = txtNumberOfPiecesUsedForExtraction.Text;
                }

                template_seagate_copperwire_coverpage.UpdateList(this.coverpages);
                template_seagate_copperwire_img.DeleteBySampleID(this.SampleID);
                template_seagate_copperwire_img.InsertList(this.refImg);

                break;

            case StatusEnum.SR_CHEMIST_CHECKING:
                StatusEnum srChemistApproveStatus = (StatusEnum)Enum.Parse(typeof(StatusEnum), ddlStatus.SelectedValue, true);
                switch (srChemistApproveStatus)
                {
                case StatusEnum.SR_CHEMIST_APPROVE:
                    this.jobSample.job_status = Convert.ToInt32(StatusEnum.ADMIN_CONVERT_WORD);
                    #region ":: STAMP COMPLETE DATE"
                    this.jobSample.date_srchemist_complate = DateTime.Now;
                    //this.jobSample.date
                    #endregion
                    break;

                case StatusEnum.SR_CHEMIST_DISAPPROVE:
                    this.jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING);
                    #region "LOG"
                    job_sample_logs jobSampleLog = new job_sample_logs
                    {
                        ID            = 0,
                        job_sample_id = this.jobSample.ID,
                        log_title     = String.Format("Sr.Chemist DisApprove"),
                        job_remark    = txtRemark.Text,
                        is_active     = "0",
                        date          = DateTime.Now
                    };
                    jobSampleLog.Insert();
                    #endregion
                    break;
                }
                this.jobSample.step4owner = userLogin.id;
                break;

            case StatusEnum.LABMANAGER_CHECKING:
                StatusEnum labApproveStatus = (StatusEnum)Enum.Parse(typeof(StatusEnum), ddlStatus.SelectedValue, true);
                switch (labApproveStatus)
                {
                case StatusEnum.LABMANAGER_APPROVE:
                    this.jobSample.job_status           = Convert.ToInt32(StatusEnum.ADMIN_CONVERT_PDF);
                    this.jobSample.date_labman_complete = DateTime.Now;
                    break;

                case StatusEnum.LABMANAGER_DISAPPROVE:
                    this.jobSample.job_status = Convert.ToInt32(ddlAssignTo.SelectedValue);
                    #region "LOG"
                    job_sample_logs jobSampleLog = new job_sample_logs
                    {
                        ID            = 0,
                        job_sample_id = this.jobSample.ID,
                        log_title     = String.Format("Lab Manager DisApprove"),
                        job_remark    = txtRemark.Text,
                        is_active     = "0",
                        date          = DateTime.Now
                    };
                    jobSampleLog.Insert();
                    #endregion
                    break;
                }
                this.jobSample.step5owner = userLogin.id;
                break;

            case StatusEnum.ADMIN_CONVERT_WORD:
                if (btnUpload.HasFile && (Path.GetExtension(btnUpload.FileName).Equals(".doc") || Path.GetExtension(btnUpload.FileName).Equals(".docx")))
                {
                    string yyyy = DateTime.Now.ToString("yyyy");
                    string MM   = DateTime.Now.ToString("MM");
                    string dd   = DateTime.Now.ToString("dd");

                    String source_file     = String.Format(Configurations.PATH_SOURCE, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(btnUpload.FileName));
                    String source_file_url = String.Format(Configurations.PATH_URL, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(btnUpload.FileName));


                    if (!Directory.Exists(Path.GetDirectoryName(source_file)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(source_file));
                    }
                    btnUpload.SaveAs(source_file);
                    this.jobSample.path_word  = source_file_url;
                    this.jobSample.job_status = Convert.ToInt32(StatusEnum.LABMANAGER_CHECKING);
                    //lbMessage.Text = string.Empty;
                }
                else
                {
                    errors.Add("Invalid File. Please upload a File with extension .doc|.docx");
                    //lbMessage.Attributes["class"] = "alert alert-error";
                    //isValid = false;
                }
                this.jobSample.step6owner = userLogin.id;
                break;

            case StatusEnum.ADMIN_CONVERT_PDF:
                if (btnUpload.HasFile && (Path.GetExtension(btnUpload.FileName).Equals(".pdf")))
                {
                    string yyyy = DateTime.Now.ToString("yyyy");
                    string MM   = DateTime.Now.ToString("MM");
                    string dd   = DateTime.Now.ToString("dd");

                    String source_file     = String.Format(Configurations.PATH_SOURCE, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(btnUpload.FileName));
                    String source_file_url = String.Format(Configurations.PATH_URL, yyyy, MM, dd, this.jobSample.job_number, Path.GetFileName(btnUpload.FileName));


                    if (!Directory.Exists(Path.GetDirectoryName(source_file)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(source_file));
                    }
                    btnUpload.SaveAs(source_file);
                    this.jobSample.path_pdf   = source_file_url;
                    this.jobSample.job_status = Convert.ToInt32(StatusEnum.JOB_COMPLETE);
                    //lbMessage.Text = string.Empty;
                }
                else
                {
                    errors.Add("Invalid File. Please upload a File with extension .pdf");
                    //lbMessage.Attributes["class"] = "alert alert-error";
                    //isValid = false;
                }
                //this.jobSample.job_status = Convert.ToInt32(StatusEnum.JOB_COMPLETE);
                this.jobSample.step7owner = userLogin.id;
                break;
            }

            if (errors.Count > 0)
            {
                litErrorMessage.Text = MessageBox.GenWarnning(errors);
                modalErrorList.Show();
            }
            else
            {
                litErrorMessage.Text = String.Empty;
                //########

                this.jobSample.update_date = DateTime.Now;
                this.jobSample.update_by   = userLogin.id;
                this.jobSample.Update();
                //Commit
                GeneralManager.Commit();

                //removeSession();
                MessageBox.Show(this.Page, Resources.MSG_SAVE_SUCCESS, PreviousPath);
            }
        }
コード例 #9
0
        private void initialPage()
        {
            this.jobSample = new job_sample().SelectByID(this.SampleID);
            if (jobSample != null)
            {
                StatusEnum status = (StatusEnum)Enum.Parse(typeof(StatusEnum), jobSample.job_status.ToString(), true);

                switch (status)
                {
                case StatusEnum.LOGIN_CONVERT_TEMPLATE:
                case StatusEnum.LOGIN_SELECT_SPEC:
                    Step1Status         = " active";
                    Step2Status         = "";
                    Step3Status         = "";
                    Step4Status         = "";
                    Step5Status         = "";
                    Step6Status         = "";
                    lbWorkFlowStep.Text = "1";
                    break;

                case StatusEnum.CHEMIST_TESTING:
                    Step1Status         = " done";
                    Step2Status         = " active";
                    Step3Status         = "";;
                    Step4Status         = "";
                    Step5Status         = "";
                    Step6Status         = "";
                    lbWorkFlowStep.Text = "2";
                    break;

                case StatusEnum.SR_CHEMIST_CHECKING:
                case StatusEnum.SR_CHEMIST_APPROVE:
                case StatusEnum.SR_CHEMIST_DISAPPROVE:
                    Step1Status         = " done";
                    Step2Status         = " done";
                    Step3Status         = " active";
                    Step4Status         = "";
                    Step5Status         = "";
                    Step6Status         = "";
                    lbWorkFlowStep.Text = "3";
                    break;

                case StatusEnum.ADMIN_CONVERT_WORD:
                    Step1Status         = " done";
                    Step2Status         = " done";
                    Step3Status         = " done";
                    Step4Status         = " active";
                    Step5Status         = "";
                    Step6Status         = "";
                    lbWorkFlowStep.Text = "4";
                    break;

                case StatusEnum.LABMANAGER_CHECKING:
                case StatusEnum.LABMANAGER_APPROVE:
                case StatusEnum.LABMANAGER_DISAPPROVE:
                    Step1Status         = " done";
                    Step2Status         = " done";
                    Step3Status         = " done";
                    Step4Status         = " done";
                    Step5Status         = " active";
                    Step6Status         = "";
                    lbWorkFlowStep.Text = "5";
                    break;

                case StatusEnum.ADMIN_CONVERT_PDF:
                    Step1Status         = " done";
                    Step2Status         = " done";
                    Step3Status         = " done";
                    Step4Status         = " done";
                    Step5Status         = " done";
                    Step6Status         = " active";
                    lbWorkFlowStep.Text = "6";
                    break;
                }
                job_sample_logs logs = new job_sample_logs();

                //job_sample_logs sampleLog = logs.SelectDate(this.jobSample.ID, Convert.ToInt16(StatusEnum.LOGIN_SELECT_SPEC));
                //lbStep1UseDate.Text = (sampleLog != null) ? String.Format("({0})", DateTime.Now.Subtract(Convert.ToDateTime(sampleLog.date)).Days.ToString()) : String.Empty;
                //sampleLog = logs.SelectDate(this.jobSample.ID, Convert.ToInt16(StatusEnum.CHEMIST_TESTING));
                //lbStep2UseDate.Text = (sampleLog != null) ? String.Format("({0})", DateTime.Now.Subtract(Convert.ToDateTime(sampleLog.date)).Days.ToString()) : String.Empty;
                //sampleLog = logs.SelectDate(this.jobSample.ID, Convert.ToInt16(StatusEnum.SR_CHEMIST_CHECKING));
                //lbStep3UseDate.Text = (sampleLog != null) ? String.Format("({0})", DateTime.Now.Subtract(Convert.ToDateTime(sampleLog.date)).Days.ToString()) : String.Empty;
                //sampleLog = logs.SelectDate(this.jobSample.ID, Convert.ToInt16(StatusEnum.ADMIN_CONVERT_WORD));
                //lbStep4UseDate.Text = (sampleLog != null) ? String.Format("({0})", DateTime.Now.Subtract(Convert.ToDateTime(sampleLog.date)).Days.ToString()) : String.Empty;
                //sampleLog = logs.SelectDate(this.jobSample.ID, Convert.ToInt16(StatusEnum.LABMANAGER_CHECKING));
                //lbStep5UseDate.Text = (sampleLog != null) ? String.Format("({0})", DateTime.Now.Subtract(Convert.ToDateTime(sampleLog.date)).Days.ToString()) : String.Empty;
                //sampleLog = logs.SelectDate(this.jobSample.ID, Convert.ToInt16(StatusEnum.ADMIN_CONVERT_PDF));
                //lbStep6UseDate.Text = (sampleLog != null) ? String.Format("({0})", DateTime.Now.Subtract(Convert.ToDateTime(sampleLog.date)).Days.ToString()) : String.Empty;

                lbStep1UseDate.Text = (lbStep1UseDate.Text.Equals("(0)")) ? String.Empty : lbStep1UseDate.Text;
                lbStep2UseDate.Text = (lbStep2UseDate.Text.Equals("(0)")) ? String.Empty : lbStep2UseDate.Text;
                lbStep3UseDate.Text = (lbStep3UseDate.Text.Equals("(0)")) ? String.Empty : lbStep3UseDate.Text;
                lbStep4UseDate.Text = (lbStep4UseDate.Text.Equals("(0)")) ? String.Empty : lbStep4UseDate.Text;
                lbStep5UseDate.Text = (lbStep5UseDate.Text.Equals("(0)")) ? String.Empty : lbStep5UseDate.Text;
                lbStep6UseDate.Text = (lbStep6UseDate.Text.Equals("(0)")) ? String.Empty : lbStep6UseDate.Text;
            }
        }
コード例 #10
0
        private void bindingData()
        {
            using (var ctx = new ALSIEntities())
            {
                job_sample_logs jsl    = new job_sample_logs();
                var             result = from l in ctx.job_sample_logs
                                         join j in ctx.job_sample on l.job_sample_id equals j.ID
                                         orderby l.date descending
                                         select new
                {
                    l.ID,
                    j.step1owner,
                    j.step2owner,
                    j.step3owner,
                    j.step4owner,
                    j.step5owner,
                    j.step6owner,
                    j.step7owner,
                    l.log_title,
                    l.job_remark,
                    l.date,
                    j.job_status,
                    j.job_number
                };

                RoleEnum roleEnum = (RoleEnum)Enum.Parse(typeof(RoleEnum), userLogin.role_id.ToString());
                switch (roleEnum)
                {
                case RoleEnum.LOGIN:
                    result = result.Where(x => x.step1owner == userLogin.id || x.step2owner == userLogin.id);
                    result = result.Where(x => x.job_status == 11);    // Convert.ToInt16(StatusEnum.LOGIN_SELECT_SPEC));
                    break;

                case RoleEnum.CHEMIST:
                    result = result.Where(x => x.step3owner == userLogin.id);
                    result = result.Where(x => x.job_status == 12);    // Convert.ToInt16(StatusEnum.CHEMIST_TESTING));
                    break;

                case RoleEnum.SR_CHEMIST:
                    result = result.Where(x => x.step4owner == userLogin.id);
                    result = result.Where(x => x.job_status == 4);    // Convert.ToInt16(StatusEnum.SR_CHEMIST_CHECKING));
                    break;

                case RoleEnum.ADMIN:
                    result = result.Where(x => x.step6owner == userLogin.id || x.step7owner == userLogin.id);
                    //result = result.Where(x => x.job_status == Convert.ToInt16(StatusEnum.ADMIN_CONVERT_PDF)||x.job_status == Convert.ToInt16(StatusEnum.ADMIN_CONVERT_WORD));
                    break;

                case RoleEnum.LABMANAGER:
                    result = result.Where(x => x.step5owner == userLogin.id);
                    result = result.Where(x => x.job_status == 9);    // Convert.ToInt16(StatusEnum.LABMANAGER_CHECKING));
                    break;
                }

                DataTable dt = result.ToDataTable();
                foreach (DataRow dr in dt.Rows)
                {
                    int             id   = Convert.ToInt32(dr["ID"].ToString());
                    job_sample_logs _jsl = jsl.SelectByID(id);
                    if (_jsl != null)
                    {
                        _jsl.is_active = "1";
                        _jsl.Update();
                    }

                    Console.WriteLine();
                }
                searchResult        = result.ToList();
                gvResult.DataSource = searchResult;
                gvResult.DataBind();
                //Commit
                GeneralManager.Commit();

                //if (gvResult.Rows.Count > 0)
                //{
                //    lbTotalRecords.Text = String.Format(Constants.TOTAL_RECORDS, gvResult.Rows.Count);
                //}
                //else
                //{
                //    lbTotalRecords.Text = string.Empty;
                //}
            }
        }