protected void gvResult_RowCommand(object sender, GridViewCommandEventArgs e) { CommandNameEnum cmd = (CommandNameEnum)Enum.Parse(typeof(CommandNameEnum), e.CommandName, true); this.CommandName = cmd; switch (cmd) { case CommandNameEnum.Edit: case CommandNameEnum.View: this.PKID = int.Parse(e.CommandArgument.ToString().Split(Constants.CHAR_COMMA)[0]); Server.Transfer(Constants.LINK_TEMPLATE); break; case CommandNameEnum.Inactive: this.PKID = int.Parse(e.CommandArgument.ToString().Split(Constants.CHAR_COMMA)[0]); m_template template = new m_template().SelectByID(this.PKID); if (template != null) { template.status = "I"; template.Update(); GeneralManager.Commit(); bindingData(); } break; } }
protected void btnSave_Click(object sender, EventArgs e) { //Remove Delete switch (CommandName) { case CommandNameEnum.Add: objJobInfo.Insert(); break; case CommandNameEnum.Edit: foreach (job_sample s in this.listSample) { s.job_status = Convert.ToInt16(ddlStatus.SelectedValue); s.sample_prefix = ddlJobNumber.SelectedItem.Text; s.update_by = userLogin.id; s.update_date = DateTime.Now; } objJobInfo.Update(); break; } //Commit GeneralManager.Commit(); removeSession(); MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath); }
protected void btnSave_Click(object sender, EventArgs e) { switch (CommandName) { case CommandNameEnum.ChangeStatus: this.jobSample.job_status = String.IsNullOrEmpty(ddlStatus.SelectedValue) ? 0 : int.Parse(ddlStatus.SelectedValue); if (this.jobSample.job_status == 10) { //if change status to convert template this.jobSample.template_id = -1; this.jobSample.path_word = String.Empty; this.jobSample.path_pdf = String.Empty; } if (this.jobSample.job_status == 13) { //if change status to convert word this.jobSample.path_word = String.Empty; this.jobSample.path_pdf = String.Empty; } this.jobSample.Update(); break; } //Commit GeneralManager.Commit(); removeSession(); MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath); }
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); }
public void Insert() { _repository.Add(this); GeneralManager.Commit(); job_running.IncrementRunning(this.job_prefix); foreach (job_sample sample in this.jobSample) { sample.job_id = this.ID; switch (sample.RowState) { case CommandNameEnum.Add: sample.Insert(); break; case CommandNameEnum.Edit: sample.Update(); break; case CommandNameEnum.Delete: sample.Delete(); break; } } }
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); }
protected void btnSave_Click(object sender, EventArgs e) { switch (CommandName) { case CommandNameEnum.Add: obj.Insert(); break; case CommandNameEnum.Edit: obj.Update(); break; } this.PKID = (this.PKID == 0) ? obj.GetMax() : this.PKID; MenuBiz menuBiz = new MenuBiz(); menu_role menuRoleBiz = new menu_role(); List <menu_role> _menuRoles = menuRoleBiz.getRoleListByRoleId(PKID); List <menu> menus = menuBiz.GetAll().Where(x => x.PREVIOUS_MENU_ID != null).OrderBy(x => x.DISPLAY_ORDER).ToList(); foreach (menu _menu in menus) { menu_role menuRole = _menuRoles.Where(x => x.MENU_ID == _menu.MENU_ID).FirstOrDefault(); if (menuRole != null) { menuRole.IS_CREATE = isChecked(menuRole, CommandNameEnum.Add); menuRole.IS_EDIT = isChecked(menuRole, CommandNameEnum.Edit); menuRole.IS_DELETE = isChecked(menuRole, CommandNameEnum.Delete); menuRole.RowState = CommandNameEnum.Edit; } else { menu_role _menuRole = new menu_role(); _menuRole.ROLE_ID = this.PKID; _menuRole.MENU_ID = Convert.ToInt32(_menu.MENU_ID); _menuRole.IS_REQUIRED_ACTION = false; _menuRole.IS_CREATE = false; _menuRole.IS_DELETE = false; _menuRole.IS_EDIT = false; _menuRole.UPDATE_BY = "SYSTEM"; _menuRole.CREATE_DATE = DateTime.Now; _menuRole.UPDATE_DATE = DateTime.Now; _menuRole.RowState = CommandNameEnum.Add; _menuRoles.Add(_menuRole); menu_role tmp_menuRole = _menuRoles.Where(x => x.MENU_ID == _menu.MENU_ID).FirstOrDefault(); tmp_menuRole.IS_CREATE = isChecked(tmp_menuRole, CommandNameEnum.Add); tmp_menuRole.IS_DELETE = isChecked(tmp_menuRole, CommandNameEnum.Edit); tmp_menuRole.IS_EDIT = isChecked(tmp_menuRole, CommandNameEnum.Delete); tmp_menuRole.RowState = CommandNameEnum.Add; } } foreach (menu_role _menuRole in _menuRoles.Where(x => x.IS_CREATE == (bool)false && x.IS_EDIT == (bool)false && x.IS_DELETE == (bool)false)) { _menuRole.RowState = CommandNameEnum.Delete; } menuRoleBiz.InsertList(_menuRoles); GeneralManager.Commit(); removeSession(); MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath); }
protected void btnSubmit_Click(object sender, EventArgs e) { userLogin.password = CustomUtils.EncodeMD5(txtPassword.Text); userLogin.is_force_change_password = false; userLogin.Update(); //Commit GeneralManager.Commit(); Response.Redirect("Login.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { jobSample.sample_invoice = txtInvoice.Text; //jobSample.sample_po = txtPo.Text; jobSample.Update(); //Commit GeneralManager.Commit(); removeSession(); MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath); }
protected void btnSave_Click(object sender, EventArgs e) { switch (CommandName) { case CommandNameEnum.ConvertTemplate: if (FileUpload1.HasFile && (Path.GetExtension(FileUpload1.FileName).Equals(".xls") || Path.GetExtension(FileUpload1.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(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.ad_hoc_tempalte_path = source_file_url; } this.jobSample.template_id = String.IsNullOrEmpty(ddlTemplate.SelectedValue) ? 0 : int.Parse(ddlTemplate.SelectedValue); switch (int.Parse(ddlTemplate.SelectedValue)) { case 901: //PA TAMPLATE(BLANK) this.jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING); break; default: if (pUploadfile.Visible) { this.jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING); } else { this.jobSample.job_status = Convert.ToInt32(StatusEnum.LOGIN_SELECT_SPEC); } break; } this.jobSample.Update(); break; } //Commit GeneralManager.Commit(); removeSession(); MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath); }
//protected void lbAdd_Click(object sender, EventArgs e) //{ // this.CommandName = CommandNameEnum.Add; // Server.Transfer(Constants.LINK_LIBRARY); //} protected void gvResult_RowDeleting(object sender, GridViewDeleteEventArgs e) { this.PKID = int.Parse(e.Keys[0].ToString().Split(Constants.CHAR_COMMA)[0]); tb_m_dhs_library cus = new tb_m_dhs_library().SelectByID(this.PKID); if (cus != null) { cus.Delete(); //Commit GeneralManager.Commit(); bindingData(); } }
protected void gvResult_RowDeleting(object sender, GridViewDeleteEventArgs e) { this.PKID = int.Parse(e.Keys[0].ToString().Split(Constants.CHAR_COMMA)[0]); m_template template = new m_template().SelectByID(this.PKID); if (template != null) { template.Delete(); bindingData(); } //Commit GeneralManager.Commit(); }
protected void gvResult_RowDeleting(object sender, GridViewDeleteEventArgs e) { this.PKID = int.Parse(e.Keys[0].ToString().Split(Constants.CHAR_COMMA)[0]); users_login user = new users_login().SelectByID(this.PKID); if (user != null) { user.Delete(); //Commit GeneralManager.Commit(); bindingData(); } }
private void processUpload(String filePath) { using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { Boolean bUploadSuccess = false; #region "UPLOAD EXCEL" HSSFWorkbook wd = new HSSFWorkbook(fs); ISheet sheet = wd.GetSheetAt(0); //int id = 1; if (sheet != null) { tb_m_dhs_library library = new tb_m_dhs_library(); List <tb_m_dhs_library> lists = new List <tb_m_dhs_library>(); //Delete before new insert library.DeleteBySpecificationID(Convert.ToInt32(this.PKID)); for (int row = 1; row <= sheet.LastRowNum; row++) { if (sheet.GetRow(row) != null) //null is when the row only contains empty cells { tb_m_dhs_library lib = new tb_m_dhs_library(); lib.id = row; lib.specification_id = this.PKID; lib.cas = CustomUtils.GetCellValue(sheet.GetRow(row).GetCell(0)); lib.libraryID = CustomUtils.GetCellValue(sheet.GetRow(row).GetCell(2)); lib.classification = CustomUtils.GetCellValue(sheet.GetRow(row).GetCell(1)); lists.Add(lib); } } library.InsertList(lists); bUploadSuccess = true; btnSave.Enabled = false; //Commit GeneralManager.Commit(); } #endregion if (bUploadSuccess) { Message = "<div class=\"alert alert-uccess\"><button class=\"close\" data-dismiss=\"alert\"></button><span>Upload Success.</span></div>"; } else { Message = "<div class=\"alert alert-error\"><button class=\"close\" data-dismiss=\"alert\"></button><span>Upload Fail.</span></div>"; } } }
protected void btnSave_Click(object sender, EventArgs e) { switch (CommandName) { case CommandNameEnum.Add: obj.Insert(); break; case CommandNameEnum.Edit: obj.Update(); break; } //Commit GeneralManager.Commit(); removeSession(); Response.Redirect(PreviousPath); }
protected void btnSave_Click(object sender, EventArgs e) { switch (CommandName) { case CommandNameEnum.Add: objCustomer.Insert(); break; case CommandNameEnum.Edit: objCustomer.Update(); break; } //Commit GeneralManager.Commit(); removeSession(); MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath); }
protected void gvResult_RowDeleting(object sender, GridViewDeleteEventArgs e) { this.PKID = int.Parse(e.Keys[0].ToString().Split(Constants.CHAR_COMMA)[0]); m_role cus = new m_role().SelectByID(this.PKID); if (cus != null) { cus.Delete(); menu_role menuRoleBiz = new menu_role(); menuRoleBiz.DeleteByRoleID(PKID); //Commit GeneralManager.Commit(); bindingData(); } }
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); } } }
protected void gvResult_RowUpdating(object sender, GridViewUpdateEventArgs e) { int _id = Convert.ToInt32(gvResult.DataKeys[e.RowIndex].Values[0].ToString()); TextBox _txtRunningNumber = (TextBox)gvResult.Rows[e.RowIndex].FindControl("txtRunningNumber"); if (_txtRunningNumber != null) { job_running _tmp = this.jobrunnings.Find(x => x.ID == _id); if (_tmp != null) { _tmp.running_number = Convert.ToInt32(_txtRunningNumber.Text); } _tmp.Update(); //Commit GeneralManager.Commit(); } gvResult.EditIndex = -1; gvResult.DataSource = this.jobrunnings; bindingData(); }
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); }
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); }
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); }
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; //} } }
protected void btnSave_Click(object sender, EventArgs e) { string yyyy = DateTime.Now.ToString("yyyy"); string MM = DateTime.Now.ToString("MM"); string dd = DateTime.Now.ToString("dd"); RoleEnum userRole = (RoleEnum)Enum.Parse(typeof(RoleEnum), userLogin.role_id.ToString(), true); foreach (job_sample jobSample in this.dataList) { if (this.isPoGroupOperation) { jobSample.sample_po = txtPo.Text; } else if (this.isChangeDueDateGroup) { switch (userRole) { case RoleEnum.SR_CHEMIST: if (String.IsNullOrEmpty(txtDuedate.Text)) { jobSample.due_date_lab = null; } else { jobSample.due_date_lab = CustomUtils.converFromDDMMYYYY(txtDuedate.Text); } break; case RoleEnum.ADMIN: if (String.IsNullOrEmpty(txtDuedate.Text)) { jobSample.date_admin_sent_to_cus = null; } else { jobSample.date_admin_sent_to_cus = CustomUtils.converFromDDMMYYYY(txtDuedate.Text); } break; } } else if (this.isInvoiceGroupOperation) { jobSample.sample_invoice = txtInvoice.Text; } else { StatusEnum status = (StatusEnum)Enum.Parse(typeof(StatusEnum), jobSample.job_status.ToString(), true); switch (status) { case StatusEnum.LOGIN_CONVERT_TEMPLATE: if (FileUpload1.HasFile && (Path.GetExtension(FileUpload1.FileName).Equals(".xls") || Path.GetExtension(FileUpload1.FileName).Equals(".xlt"))) { String source_file = String.Format(Configurations.PATH_SOURCE, yyyy, MM, dd, jobSample.job_number, Path.GetFileName(FileUpload1.FileName)); String source_file_url = String.Format(Configurations.PATH_URL, yyyy, MM, dd, jobSample.job_number, Path.GetFileName(FileUpload1.FileName)); if (!Directory.Exists(Path.GetDirectoryName(source_file))) { Directory.CreateDirectory(Path.GetDirectoryName(source_file)); } FileUpload1.SaveAs(source_file); jobSample.ad_hoc_tempalte_path = source_file_url; } jobSample.template_id = String.IsNullOrEmpty(ddlTemplate.SelectedValue) ? 0 : int.Parse(ddlTemplate.SelectedValue); switch (int.Parse(ddlTemplate.SelectedValue)) { case 901: //PA TAMPLATE(BLANK) jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING); break; default: if (pUploadfile.Visible) { jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING); } else { jobSample.job_status = Convert.ToInt32(StatusEnum.LOGIN_SELECT_SPEC); } break; } break; case StatusEnum.CHEMIST_TESTING: jobSample.job_status = Convert.ToInt32(StatusEnum.SR_CHEMIST_CHECKING); jobSample.date_chemist_complete = DateTime.Now; //jobSample.date_chemist_alalyze = CustomUtils.converFromDDMMYYYY(txtDateAnalyzed.Text); if (rdWithReport.Checked) { String source_file = String.Format(Configurations.PATH_SOURCE, yyyy, MM, dd, jobSample.job_number, Path.GetFileName(FileUpload2.FileName)); String source_file_url = String.Format(Configurations.PATH_URL, yyyy, MM, dd, jobSample.job_number, Path.GetFileName(FileUpload2.FileName)); if (!Directory.Exists(Path.GetDirectoryName(source_file))) { Directory.CreateDirectory(Path.GetDirectoryName(source_file)); } FileUpload2.SaveAs(source_file); jobSample.path_word = source_file_url; } else { string rawFileTemplate = Server.MapPath("~/template/") + "no_report.doc"; String source_file = String.Format(Configurations.PATH_SOURCE, yyyy, MM, dd, jobSample.job_number, Path.GetFileName(rawFileTemplate)); String source_file_url = String.Concat(String.Empty, String.Format(Configurations.PATH_URL, yyyy, MM, dd, jobSample.job_number, Path.GetFileName(rawFileTemplate))); if (!Directory.Exists(Path.GetDirectoryName(source_file))) { Directory.CreateDirectory(Path.GetDirectoryName(source_file)); } if (!File.Exists(source_file)) { File.Copy(rawFileTemplate, source_file); } jobSample.path_word = source_file_url; } break; case StatusEnum.SR_CHEMIST_CHECKING: StatusEnum _srChemistSelectedStatus = (StatusEnum)Enum.Parse(typeof(StatusEnum), ddlStatus.SelectedValue, true); switch (_srChemistSelectedStatus) { case StatusEnum.SR_CHEMIST_APPROVE: jobSample.job_status = Convert.ToInt32(StatusEnum.ADMIN_CONVERT_WORD); #region ":: STAMP COMPLETE DATE" jobSample.date_srchemist_complate = DateTime.Now; #endregion break; case StatusEnum.SR_CHEMIST_DISAPPROVE: jobSample.job_status = Convert.ToInt32(StatusEnum.CHEMIST_TESTING); break; } break; case StatusEnum.LABMANAGER_CHECKING: StatusEnum _labmanSelectedStatus = (StatusEnum)Enum.Parse(typeof(StatusEnum), ddlStatus.SelectedValue, true); switch (_labmanSelectedStatus) { case StatusEnum.LABMANAGER_APPROVE: jobSample.job_status = Convert.ToInt32(StatusEnum.ADMIN_CONVERT_PDF); break; case StatusEnum.LABMANAGER_DISAPPROVE: jobSample.job_status = Convert.ToInt32(ddlAssignTo.SelectedValue); break; } break; case StatusEnum.ADMIN_CONVERT_WORD: jobSample.job_status = Convert.ToInt32(StatusEnum.LABMANAGER_CHECKING); break; case StatusEnum.ADMIN_CONVERT_PDF: jobSample.job_status = Convert.ToInt32(StatusEnum.JOB_COMPLETE); break; } jobSample.group_submit = Convert.ToSByte(1); } jobSample.Update(); } //Commit GeneralManager.Commit(); removeSession(); MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath); }
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); } }
protected void btnSave_Click(object sender, EventArgs e) { job_sample oldSample = new job_sample().SelectByID(this.SampleID); List <job_sample> jobSamples = new job_sample().findByIdAndStatus(oldSample.job_number, (this.CommandName == CommandNameEnum.Retest) ? StatusEnum.JOB_RETEST : StatusEnum.JOB_AMEND); job_sample newSample = new job_sample(); newSample.template_id = oldSample.template_id; newSample.job_id = oldSample.job_id; newSample.type_of_test_id = oldSample.type_of_test_id; newSample.specification_id = oldSample.specification_id; newSample.job_number = oldSample.job_number; newSample.description = oldSample.description; newSample.model = oldSample.model; newSample.surface_area = oldSample.surface_area; newSample.remarks = oldSample.remarks; newSample.no_of_report = oldSample.no_of_report; newSample.uncertainty = oldSample.uncertainty; newSample.job_role = userLogin.role_id; newSample.status_completion_scheduled = oldSample.status_completion_scheduled; newSample.due_date = oldSample.due_date; newSample.due_date_customer = oldSample.due_date_customer; newSample.due_date_lab = oldSample.due_date_lab; newSample.path_word = oldSample.path_word; newSample.path_pdf = oldSample.path_pdf; newSample.step1owner = oldSample.step1owner; newSample.step2owner = oldSample.step2owner; newSample.step3owner = oldSample.step3owner; newSample.step4owner = oldSample.step4owner; newSample.step5owner = oldSample.step5owner; newSample.step6owner = oldSample.step6owner; newSample.step7owner = oldSample.step7owner; newSample.due_date = oldSample.due_date; newSample.is_no_spec = oldSample.is_no_spec; newSample.is_hold = oldSample.is_hold; newSample.update_date = DateTime.Now; newSample.amend_count = 0; newSample.retest_count = 0; newSample.amend_or_retest = (this.CommandName == CommandNameEnum.Amend) ? "AM" : "R"; newSample.sample_prefix = oldSample.sample_prefix; switch (newSample.amend_or_retest) { case "AM": newSample.amend_count = newSample.findAmendOrRetestCount(newSample.job_number, newSample.amend_or_retest) + 1; break; case "R": newSample.retest_count = newSample.findAmendOrRetestCount(newSample.job_number, newSample.amend_or_retest) + 1; break; } newSample.job_status = Convert.ToInt16(ddlStatus.SelectedValue); newSample.path_pdf = String.Empty; newSample.path_word = String.Empty; newSample.Insert(); oldSample.Update(); //Commit GeneralManager.Commit(); m_template template = new m_template().SelectByID(oldSample.template_id); if (template != null) { switch (Path.GetFileNameWithoutExtension(template.path_url)) { case "Seagate_Copperwire": template_seagate_copperwire_coverpage.CloneData(oldSample.ID, newSample.ID); template_seagate_copperwire_img.CloneData(oldSample.ID, newSample.ID); break; case "Seagate_Corrosion": template_seagate_corrosion_coverpage.CloneData(oldSample.ID, newSample.ID); template_seagate_corrosion_img.CloneData(oldSample.ID, newSample.ID); break; case "Seagate_DHS": case "Seagate_DHS_V2": template_seagate_dhs_coverpage.CloneData(oldSample.ID, newSample.ID); tb_m_dhs_cas.CloneData(oldSample.ID, newSample.ID); break; case "Seagate_FTIR": case "Seagate_FTIR_Adhesive": case "Seagate_FTIR_Damper": case "Seagate_FTIR_Packing": template_seagate_ftir_coverpage.CloneData(oldSample.ID, newSample.ID); break; case "Seagate_GCMS": case "Seagate_GCMS_2": case "Seagate_GCMS_3": template_seagate_gcms_coverpage.CloneData(oldSample.ID, newSample.ID); template_seagate_gcms_coverpage_img.CloneData(oldSample.ID, newSample.ID); tb_m_gcms_cas.CloneData(oldSample.ID, newSample.ID); break; case "Seagate_HPA": case "Seagate_HPA_1": case "Seagate_HPA_Boyd": case "Seagate_HPA_Siam": template_seagate_hpa_coverpage.CloneData(oldSample.ID, newSample.ID); break; case "Seagate_IC": template_seagate_ic_coverpage.CloneData(oldSample.ID, newSample.ID); break; case "Seagate_LPC": template_seagate_lpc_coverpage.CloneData(oldSample.ID, newSample.ID); break; case "WD_Corrosion": template_wd_corrosion_coverpage.CloneData(oldSample.ID, newSample.ID); template_wd_corrosion_img.CloneData(oldSample.ID, newSample.ID); break; case "WD_DHS": template_wd_dhs_coverpage.CloneData(oldSample.ID, newSample.ID); tb_m_dhs_cas.CloneData(oldSample.ID, newSample.ID); break; case "WD_FTIR": case "WD_FTIR_IDM": template_wd_ftir_coverpage.CloneData(oldSample.ID, newSample.ID); break; case "WD_GCMS": case "WD_GCMS_CVR": template_wd_gcms_coverpage.CloneData(oldSample.ID, newSample.ID); tb_m_gcms_cas.CloneData(oldSample.ID, newSample.ID); break; case "WD_HPA_FOR_1": case "WD_HPA_FOR_1_V2": template_wd_hpa_for1_coverpage.CloneData(oldSample.ID, newSample.ID); break; case "WD_HPA_FOR_3": template_wd_hpa_for3_coverpage.CloneData(oldSample.ID, newSample.ID); break; case "WD_IC": template_wd_ic_coverpage.CloneData(oldSample.ID, newSample.ID); //template_wd_ir_coverpage template_wd_ir_coverpage = new template_wd_ir_coverpage(); break; case "WD_LPC": template_wd_lpc_coverpage.CloneData(oldSample.ID, newSample.ID); break; case "WD_MESA": case "WD_MESA_IDM": case "WD_MESA_InkRibon": template_wd_mesa_coverpage.CloneData(oldSample.ID, newSample.ID); template_wd_mesa_img.CloneData(oldSample.ID, newSample.ID); break; } } //Commit GeneralManager.Commit(); removeSession(); MessageBox.Show(this, Resources.MSG_SAVE_SUCCESS, PreviousPath); }
protected void gvJob_RowCommand(object sender, GridViewCommandEventArgs e) { CommandNameEnum cmd = (CommandNameEnum)Enum.Parse(typeof(CommandNameEnum), e.CommandName, true); m_completion_scheduled cs = new m_completion_scheduled().SelectByID(Convert.ToInt32(CompletionScheduledEnum.NORMAL)); this.CommandName = cmd; this.JobID = (cmd == CommandNameEnum.Page) ? 0 : int.Parse(e.CommandArgument.ToString().Split(Constants.CHAR_COMMA)[0]); this.SampleID = (cmd == CommandNameEnum.Page) ? 0 : int.Parse(e.CommandArgument.ToString().Split(Constants.CHAR_COMMA)[1]); switch (cmd) { case CommandNameEnum.Edit: //Server.Transfer(Constants.LINK_EDIT_SAMPLE); //break; case CommandNameEnum.View: Server.Transfer(Constants.LINK_JOB_REQUEST); break; case CommandNameEnum.ConvertTemplate: Server.Transfer(Constants.LINK_JOB_CONVERT_TEMPLATE); break; case CommandNameEnum.Workflow: Server.Transfer(Constants.LINK_JOB_WORK_FLOW); break; case CommandNameEnum.ChangeStatus: Server.Transfer(Constants.LINK_JOB_CHANGE_STATUS); break; case CommandNameEnum.ChangeDueDate: Server.Transfer(Constants.LINK_JOB_CHANGE_DUEDATE); break; case CommandNameEnum.ChangeSrCompleteDate: Server.Transfer(Constants.LINK_JOB_SR_COMPLETE_DATE); break; case CommandNameEnum.ChangePo: Server.Transfer(Constants.LINK_JOB_CHANGE_PO); break; case CommandNameEnum.ChangeInvoice: Server.Transfer(Constants.LINK_JOB_CHANGE_INVOICE); break; case CommandNameEnum.Print: if (userLogin.role_id == Convert.ToInt32(RoleEnum.ADMIN)) { Server.Transfer(Constants.LINK_ADMIN_PRINT); } else { Server.Transfer(Constants.LINK_JOB_PRINT_LABEL); } break; case CommandNameEnum.ChangeReportDate: Server.Transfer(Constants.LINK_REPORT_DATE); break; case CommandNameEnum.ChangeOtherRefNo: Server.Transfer(Constants.LINK_CHANGE_OTHER_REF_NO); break; case CommandNameEnum.ChangeSingaporeRefNo: Server.Transfer(Constants.LINK_CHANGE_SINGAPORE_REF_NO); break; case CommandNameEnum.Amend: case CommandNameEnum.Retest: Server.Transfer(Constants.LINK_RETEST); break; case CommandNameEnum.Hold: if (cs != null) { job_sample jobSample = new job_sample().SelectByID(this.SampleID); jobSample.update_date = DateTime.Now; jobSample.is_hold = "1"; jobSample.Update(); //Commit GeneralManager.Commit(); bindingData(); } break; case CommandNameEnum.UnHold: if (cs != null) { job_sample jobSample = new job_sample().SelectByID(this.SampleID); jobSample.update_date = DateTime.Now; jobSample.due_date = (jobSample.update_date == null) ? DateTime.Now.AddDays(cs.value.Value) : jobSample.update_date.Value.AddDays(cs.value.Value); jobSample.due_date_customer = (jobSample.update_date == null) ? DateTime.Now.AddDays(cs.lab_due_date.Value) : jobSample.update_date.Value.AddDays(cs.lab_due_date.Value); jobSample.due_date_lab = (jobSample.update_date == null) ? DateTime.Now.AddDays(cs.customer_due_date.Value) : jobSample.update_date.Value.AddDays(cs.customer_due_date.Value); jobSample.is_hold = "0"; jobSample.job_status = Convert.ToInt16(StatusEnum.CHEMIST_TESTING); jobSample.Update(); //Commit GeneralManager.Commit(); bindingData(); } break; case CommandNameEnum.ViewFile: Server.Transfer(Constants.LINK_VIEW_FILE); break; } }
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); } }