void updateValueCD1() { for (int i = 0; i < grvData.RowCount; i++) { string productCode = Lib.ToString(grvData.GetRowCellValue(i, "F1")); if (string.IsNullOrEmpty(productCode)) { continue; } string v10 = Lib.ToString(grvData.GetRowCellValue(i, "F6")); string v20 = Lib.ToString(grvData.GetRowCellValue(i, "F7")); string v30 = Lib.ToString(grvData.GetRowCellValue(i, "F8")); string v40 = Lib.ToString(grvData.GetRowCellValue(i, "F9")); string v50 = Lib.ToString(grvData.GetRowCellValue(i, "F10")); string v60 = Lib.ToString(grvData.GetRowCellValue(i, "F11")); string v70 = Lib.ToString(grvData.GetRowCellValue(i, "F12")); string v80 = Lib.ToString(grvData.GetRowCellValue(i, "F13")); string v90 = Lib.ToString(grvData.GetRowCellValue(i, "F14")); string v100 = Lib.ToString(grvData.GetRowCellValue(i, "F15")); string v110 = Lib.ToString(grvData.GetRowCellValue(i, "F16")); string v120 = Lib.ToString(grvData.GetRowCellValue(i, "F17")); TextUtils.ExcuteProcedure("spImportCD1", new string[] { "@ProductCode", "@Value10", "@Value20", "@Value30", "@Value40", "@Value50", "@Value60", "@Value70", "@Value80", "@Value90", "@Value100", "@Value110", "@Value120" }, new object[] { productCode, v10, v20, v30, v40, v50, v60, v70, v80, v90, v100, v110, v120 }); } MessageBox.Show("Nhập khẩu thành công dữ liệu công đoạn 1"); }
private void btnDelete_Click(object sender, EventArgs e) { try { frmSkipOrder frmSkipOrder = new frmSkipOrder(); if (frmSkipOrder.ShowDialog() == DialogResult.OK) { frmChooseRisk frm = new frmChooseRisk(); if (frm.ShowDialog() == DialogResult.OK) { TextUtils.ExcuteProcedure("spDeleteStock", new string[] { "@Order", "@Stock" }, new object[] { Order, NameKho }); //Lưu vào bảng biết được người bỏ qua công đoạn SkipOrderModel skipOrderModel = new SkipOrderModel(); skipOrderModel.WorkerName = Worker; skipOrderModel.LineName = Line; skipOrderModel.OrderCode = Order; skipOrderModel.StockCode = NameKho; skipOrderModel.StockCDCode = NameKhoCD; skipOrderModel.CreatDate = DateTime.Now; skipOrderModel.Reason = frm.RiskDescription; SkipOrderBO.Instance.Insert(skipOrderModel); MessageBox.Show("Bỏ qua thành công", "Thông báo", MessageBoxButtons.OK); this.Dispose(); } } } catch { } }
private void btnSave_Click(object sender, EventArgs e) { if (cboUserGroup.SelectedIndex < 0) { return; } int userGroupID = TextUtils.ToInt(cboUserGroup.SelectedValue); int catID = TextUtils.ToInt(treeData.FocusedNode.GetValue(colIDTree)); if (catID == 0) { return; } grvData.FocusedRowHandle = -1; List <int> lstPerID = new List <int>(); for (int i = 0; i < grvData.RowCount; i++) { bool isRole = TextUtils.ToBoolean(grvData.GetRowCellValue(i, colIsHasRole)); if (isRole) { lstPerID.Add(TextUtils.ToInt(grvData.GetRowCellValue(i, colID))); } } TextUtils.ExcuteProcedure("spAddPermissionToGroupRole", new string[] { "@UserGroupID", "@FormAndFunctionGroupID", "@ListPermissionID" }, new object[] { userGroupID, catID, lstPerID.Count > 0 ? string.Join(";", lstPerID) : "" }); MessageBox.Show("Phân quyền thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); }
bool SaveData() { if (ValidateForm()) { try { if (_type == cGlobalVariables.Add) { areaModel.AreaCode = txbAreaCode.Text.Trim(); areaModel.ManagerID = TextUtils.ToInt(cbManager.EditValue); areaModel.ManagerCode = cbManager.Text.Trim(); areaModel.AreaName = txbAreaName.Text.Trim(); AreaBO.Instance.Insert(areaModel); return(true); } if (_type == cGlobalVariables.Edit) { areaModel.AreaCode = txbAreaCode.Text.Trim(); areaModel.ManagerID = TextUtils.ToInt(cbManager.EditValue); areaModel.ManagerCode = cbManager.Text.Trim(); areaModel.AreaName = txbAreaName.Text.Trim(); TextUtils.ExcuteProcedure("spHypUpdateArea", new string[] { "@id", "@areaCode", "@managerID", "@managerCode", "@areaName" }, new object[] { areaModel.ID, areaModel.AreaCode, areaModel.ManagerID, areaModel.ManagerCode, areaModel.AreaName }); return(true); } } catch (Exception ex) { return(false); } } return(false); }
bool SaveData() { if (ValidateForm()) { try { knifeProcessedList.KnifeCode = cKnifeList.Text.Trim(); knifeProcessedList.KnifeID = TextUtils.ToInt(cKnifeList.EditValue); knifeProcessedList.WorkerID = TextUtils.ToInt(cWorker.EditValue); knifeProcessedList.ProductCode = txbProductCode.Text.Trim(); knifeProcessedList.MachineID = TextUtils.ToInt(cMachine.EditValue); knifeProcessedList.MachineCode = cMachine.Text.Trim(); knifeProcessedList.Quantity = TextUtils.ToInt(txbQuantity.Value); TextUtils.ExcuteProcedure("spKnifeAddProcess", new string[] { "@knifeID", "@knifeCode", "@workerID", "@productCode", "@machineID", "@machineCode", "@quantity" }, new object[] { knifeProcessedList.KnifeID, knifeProcessedList.KnifeCode, knifeProcessedList.WorkerID, knifeProcessedList.ProductCode, knifeProcessedList.MachineID, knifeProcessedList.MachineCode, knifeProcessedList.Quantity }); return(true); } catch (Exception ex) { MessageBox.Show("Có lỗi trong quá trình xử lý!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } } return(false); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { txtRate.Text = ""; int rowCount = grvData.RowCount; for (int i = 0; i < rowCount; i++) { try { if (i < 1) { continue; } progressBar1.Invoke((Action)(() => { progressBar1.Value = i; })); txtRate.Invoke((Action)(() => { txtRate.Text = string.Format("{0}/{1}", i, rowCount - 1); })); string ShipTo = Lib.ToString(grvData.GetRowCellValue(i, "F1")); // Đích DateTime DeliveryDate; DateTime AssemblyDate; //Kiểm tra nếu đích trống thì next if (string.IsNullOrEmpty(ShipTo)) { continue; } DeliveryDate = Lib.ToDate3(grvData.GetRowCellValue(i, "F2")); // Ngày xuất hàng if (Lib.ToDate3(grvData.GetRowCellValue(i, "F2")) == new DateTime(1950, 1, 1)) { DeliveryDate = Lib.ToDate3(grvData.GetRowCellValue(i, "DATEF2")); } AssemblyDate = Lib.ToDate3(grvData.GetRowCellValue(i, "F3")); //Ngày lắp ráp if (Lib.ToDate3(grvData.GetRowCellValue(i, "F3")) == new DateTime(1950, 1, 1)) { AssemblyDate = Lib.ToDate3(grvData.GetRowCellValue(i, "DATEF3")); } TextUtils.ExcuteProcedure("spUpdateAssemblyDate", new string[] { "@ShipTo", "@DeliveryDate", "@AssemblyDate" }, new object[] { ShipTo, DeliveryDate, AssemblyDate }); } catch (Exception ex) { MessageBox.Show("Lỗi lưu dữ liệu tại dòng " + i + Environment.NewLine + ex.ToString()); } } }
private void btnSave_Click(object sender, EventArgs e) { try { ProductGroup.ProductGroupCode = txtCode.Text.Trim(); ProductGroup.ProductGroupName = txtName.Text.Trim(); if (ProductGroup.ID <= 0) { ProductGroup.ID = (int)ProductGroupBO.Instance.Insert(ProductGroup); } else { ProductGroupBO.Instance.Update(ProductGroup); } CurentNode = ProductGroup.ID; for (int i = 0; i < arrStep.Count; i++) { WorkingStepModel step = (WorkingStepModel)arrStep[i]; int type = 0; if (step.ID <= 0) { step.ProductGroupID = ProductGroup.ID; step.ID = (int)WorkingStepBO.Instance.Insert(step); type = 1; //Thêm step vào các sản phẩm thuộc nhóm này } else { WorkingStepBO.Instance.Update(step); type = 2; //Cập nhật vào các sản phẩm thuộc nhóm này } TextUtils.ExcuteProcedure("spUpdateProductStep_ByWorkingStep" , new string[] { "@WorkingStepID", "@Type" } , new object[] { step.ID, type }); } DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
bool SaveData() { if (ValidateForm()) { try { if (_type == cGlobalVariables.Add) { knifeDetailListModel.KnifeCode = txbKnifeCode.Text.Trim(); knifeDetailListModel.WorkerID = TextUtils.ToInt(cWorker.EditValue); knifeDetailListModel.KnifeName = txbKnifeName.Text.Trim(); knifeDetailListModel.ImportedDate = DateTime.Now; knifeDetailListModel.ATC = TextUtils.ToInt(txbATC.Value); knifeDetailListModel.STD = TextUtils.ToInt(txbSTD.Value); knifeDetailListModel.Description = txbDescription.Text; knifeDetailListModel.Status = true; KnifeDetailListBO.Instance.Insert(knifeDetailListModel); return(true); } if (_type == cGlobalVariables.Edit) { knifeDetailListModel.KnifeCode = txbKnifeCode.Text.Trim(); knifeDetailListModel.WorkerID = TextUtils.ToInt(cWorker.EditValue); knifeDetailListModel.KnifeName = txbKnifeName.Text.Trim(); knifeDetailListModel.ImportedDate = DateTime.Now; knifeDetailListModel.ATC = TextUtils.ToInt(txbATC.Value); knifeDetailListModel.STD = TextUtils.ToInt(txbSTD.Value); knifeDetailListModel.Description = txbDescription.Text; TextUtils.ExcuteProcedure("spKnifeDetailUpdate", new string[] { "@id", "@knifeCode", "@knifeName", "@description", "@std", "@atc", "@workerID" }, new object[] { knifeDetailListModel.ID, knifeDetailListModel.KnifeCode, knifeDetailListModel.KnifeName, knifeDetailListModel.Description, knifeDetailListModel.STD, knifeDetailListModel.ATC, knifeDetailListModel.WorkerID }); return(true); } } catch (Exception ex) { return(false); } } return(false); }
bool SaveData() { if (ValidateForm()) { try { if (_type == cGlobalVariables.Add) { departmentModel.DepartmentCode = txbDepartmentCode.Text.Trim(); departmentModel.ManagerID = TextUtils.ToInt(cbManager.EditValue); departmentModel.AreaID = TextUtils.ToInt(cArea.EditValue); departmentModel.ManagerCode = cbManager.Text.Trim(); departmentModel.AreaCode = cArea.Text.Trim(); departmentModel.DepartmentName = txbDepartmentName.Text.Trim(); departmentModel.Description = txbDescription.Text; DepartmentBO.Instance.Insert(departmentModel); return(true); } if (_type == cGlobalVariables.Edit) { departmentModel.DepartmentCode = txbDepartmentCode.Text.Trim(); departmentModel.ManagerID = TextUtils.ToInt(cbManager.EditValue); departmentModel.AreaID = TextUtils.ToInt(cArea.EditValue); departmentModel.ManagerCode = cbManager.Text.Trim(); departmentModel.AreaCode = cArea.Text.Trim(); departmentModel.DepartmentName = txbDepartmentName.Text.Trim(); departmentModel.Description = txbDescription.Text; TextUtils.ExcuteProcedure("spHypUpdateDepartment", new string[] { "@id", "@departmentCode", "@areaID", "@areaCode", "@managerID", "@managerCode", "@departmentName", "@description" }, new object[] { departmentModel.ID, departmentModel.DepartmentCode, departmentModel.AreaID, departmentModel.AreaCode, departmentModel.ManagerID, departmentModel.ManagerCode, departmentModel.DepartmentName, departmentModel.Description }); return(true); } } catch (Exception ex) { return(false); } } return(false); }
bool SaveData() { if (ValidateForm()) { try { if (_type == cGlobalVariables.Add) { stageModel.StageCode = txbStageCode.Text.Trim(); stageModel.ManagerID = TextUtils.ToInt(cbManager.EditValue); stageModel.DepartmentID = TextUtils.ToInt(cDepartment.EditValue); stageModel.ManagerCode = cbManager.Text.Trim(); stageModel.DepartmentCode = cDepartment.Text.Trim(); stageModel.StageName = txbStageName.Text.Trim(); stageModel.Description = txbDescription.Text; StageBO.Instance.Insert(stageModel); return(true); } if (_type == cGlobalVariables.Edit) { stageModel.StageCode = txbStageCode.Text.Trim(); stageModel.ManagerID = TextUtils.ToInt(cbManager.EditValue); stageModel.DepartmentID = TextUtils.ToInt(cDepartment.EditValue); stageModel.ManagerCode = cbManager.Text.Trim(); stageModel.DepartmentCode = cDepartment.Text.Trim(); stageModel.StageName = txbStageName.Text.Trim(); stageModel.Description = txbDescription.Text; TextUtils.ExcuteProcedure("spHypUpdateStage", new string[] { "@id", "@stageCode", "@departmentID", "@departmentCode", "@managerID", "@managerCode", "@stageName", "@description" }, new object[] { stageModel.ID, stageModel.StageCode, stageModel.DepartmentID, stageModel.DepartmentCode, stageModel.ManagerID, stageModel.ManagerCode, stageModel.StageName, stageModel.Description }); return(true); } } catch (Exception ex) { return(false); } } return(false); }
private void btnChooseUser_Click(object sender, EventArgs e) { frmChooseEmployee frm = new frmChooseEmployee(); if (frm.ShowDialog() == DialogResult.OK) { List <int> lstEmployeeID = frm.LstID; if (lstEmployeeID.Count == 0) { return; } int masterID = TextUtils.ToInt(grvData.GetFocusedRowCellValue("ID")); if (masterID == 0) { return; } string lstID = string.Join(";", lstEmployeeID); TextUtils.ExcuteProcedure("spAddUserToGroupRole", new string[] { "@ListUserID", "@UserGroupID" }, new object[] { lstID, masterID }); loadDetail(); } }
bool SaveData() { if (ValidateForm()) { try { knifeDisposed.KnifeCode = cKnifeList.Text.Trim(); knifeDisposed.KnifeID = TextUtils.ToInt(cKnifeList.EditValue); knifeDisposed.WorkerID = TextUtils.ToInt(cWorker.EditValue); TextUtils.ExcuteProcedure("spKnifeAddToDisposeQueue", new string[] { "@knifeCode", "@knifeID", "@workerID" }, new object[] { knifeDisposed.KnifeCode, knifeDisposed.KnifeID, knifeDisposed.WorkerID }); return(true); } catch (Exception ex) { MessageBox.Show("Có lỗi trong quá trình xử lý!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } } return(false); }
private void btnDelete_Click(object sender, EventArgs e) { if (grvData.FocusedRowHandle < 0) { return; } int strID = TextUtils.ToInt(grvData.GetFocusedRowCellValue("ID")); string strName = TextUtils.ToString(grvData.GetFocusedRowCellValue("SortOrder")); if (WorkingBO.Instance.CheckExist("WorkingStepID", strID)) { MessageBox.Show("Công đoạn này đang được sử dụng bên Mục kiểm tra nên không thể xóa được!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (MessageBox.Show(String.Format("Bạn có chắc muốn xóa công đoạn [{0}] không?", strName), TextUtils.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { if (strID > 0) { TextUtils.ExcuteProcedure("spUpdateProductStep_ByWorkingStep" , new string[] { "@WorkingStepID", "@Type" } , new object[] { strID, 3 }); } grvData.DeleteSelectedRows(); } catch { MessageBox.Show("Có lỗi xảy ra khi thực hiện thao tác, xin vui lòng thử lại sau."); } } }
private void button2_Click(object sender, EventArgs e) { TextUtils.ExcuteProcedure("spDongBoMaterialQLSX", null, null); MessageBox.Show("OK"); }