private void SaveData() { if (gvLocationProduct.DataSource != null) { Cursor.Current = Cursors.WaitCursor; DataTable data = (DataTable)gvLocationProduct.DataSource; var id = 0; var locationCode = string.Empty; foreach (DataRow item in data.Rows) { id = Convert.ToInt32(item["Id"]); locationCode = item["LocationCode"].ToString(); DataTable locationProduct = new DataTable(); using (SqlCeConnection con = new SqlCeConnection(SqlHelper.SqlCeConnectionString)) { con.Open(); using (SqlCeCommand com = new SqlCeCommand(SqlHelper.GetSql(52), con)) { com.Parameters.AddWithValue("@Id", id); using (SqlCeDataAdapter adap = new SqlCeDataAdapter(com)) { adap.Fill(locationProduct); } } } List <ProductLocation> productLocations = new List <ProductLocation>(); foreach (DataRow row in locationProduct.Rows) { productLocations.Add(new ProductLocation { //LocationCode = locationCode, LocationType = Utils.GetLocationTypeByLocationCode(locationCode), ProductBarcode = row["ProductCode"].ToString(), //WarehouseCode = GlobalContext.WarehouseCode, PutQuantity = Utils.DecimalParse(row["PutQty"].ToString()), PutQuantitySpecified = true, PutLevel = Utils.DecimalParse(row["PutLevel"].ToString()), PutLevelSpecified = true, DisplayOrder = Utils.Int32Parse(row["DisplayOrder"].ToString()), DisplayOrderSpecified = true, RequestPrintLabel = Convert.IsDBNull(row["RequestPrintLabel"]) ? false : Convert.ToBoolean(row["RequestPrintLabel"]), RequestPrintLabelSpecified = true, MaxStock = Utils.DecimalParse(row["MaxStock"].ToString()), MaxStockSpecified = true, UserID = GlobalContext.UserCode, Remark = row["PrintLabelType"].ToString() }); } var result = string.Empty; result = ServiceHelper.MobileServices.ProductLocationAdd(GlobalContext.BranchCode, locationCode, GlobalContext.WarehouseCode, productLocations.ToArray()); if (!"ERROR".Equals(result)) { Delete(id); //using (SqlCeConnection con = new SqlCeConnection(SqlHelper.SqlCeConnectionString)) //{ // con.Open(); // using (SqlCeCommand com = new SqlCeCommand(SqlHelper.GetSql(51), con)) // { // com.Parameters.AddWithValue("@Id", id); // com.ExecuteNonQuery(); // } //} } else { Cursor.Current = Cursors.Default; GlobalMessageBox.ShowError("บันทึกข้อมูลไม่สำเร็จ กรุณาติดต่อผู้ดูแล"); BindGrid(); return; } } Cursor.Current = Cursors.Default; GlobalMessageBox.ShowInfomation("บันทึกข้อมูลไปยัง SAP สำเร็จ"); BindGrid(); } }
private void btnLogin_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtUserName.Text)) { GlobalMessageBox.ShowInfomation("กรุณาระบุชื่อเข้าใช้งาน"); return; } if (string.IsNullOrEmpty(txtPassword.Text)) { GlobalMessageBox.ShowInfomation("กรุณาระบุรหัสผ่านเข้าใช้งาน"); return; } if ("0000".Equals(ddlBranch.SelectedValue)) { GlobalMessageBox.ShowInfomation("กรุณาเลือกสาขา"); return; } if ("0000".Equals(ddlWarehouse.SelectedValue)) { GlobalMessageBox.ShowInfomation("กรุณาเลือกคลังสินค้า"); return; } if (ddlUseInPlaces.SelectedIndex == 0) { GlobalMessageBox.ShowInfomation("กรุณาสถานที่ใช้งาน"); return; } try { Cursor.Current = Cursors.WaitCursor; //var user = ServiceHelper.MobileServices.UserCheckLogin(GlobalContext.BranchCode, txtUserName.Text.Trim(), txtPassword.Text.Trim()); var user = UserManager.CheckLogin(txtUserName.Text.Trim(), txtPassword.Text.Trim()); if (user != null) { GlobalContext.UserCode = user.Code; GlobalContext.UserName = user.Name; GlobalContext.IsShowPrice = user.IsShowPrice; GlobalContext.IsShowSaleProfit = user.IsShowSaleProfit; GlobalContext.BranchCode = ddlBranch.SelectedValue.ToString(); GlobalContext.BranchName = ddlBranch.Text; GlobalContext.WarehouseCode = ddlWarehouse.SelectedValue.ToString(); GlobalContext.WarehouseName = ddlWarehouse.Text; if (ddlUseInPlaces.SelectedIndex == 1) { GlobalContext.UseInPlaces = UseInPlaces.STORE; GlobalContext.IsShowPrice = true; } if (ddlUseInPlaces.SelectedIndex == 2) { GlobalContext.UseInPlaces = UseInPlaces.WAREHOUSE; GlobalContext.IsShowPrice = false; } this.Hide(); new MainForm().Show(); } else { GlobalMessageBox.ShowError("ไม่มีพนักงานชื่อนี้ในระบบ หรือ ระบุข้อมูลไม่ถูกต้อง!"); } } catch (Exception ex) { GlobalMessageBox.ShowError(ex.Message); } finally { Cursor.Current = Cursors.Default; } }
private void btnSave_Click(object sender, EventArgs e) { if (_labelPrice.Count <= 0) { GlobalMessageBox.ShowInfomation("ระบุสินค้าก่อนทำการบันทึก"); return; } if (string.IsNullOrEmpty(cmbPrintType.Text)) { GlobalMessageBox.ShowInfomation("กรุณาเลือกประเภทป้าย"); return; } Cursor.Current = Cursors.WaitCursor; //var list = new List<LabelPrintProductDetail>(); //foreach (var item in _labelPrice) //{ // var labelPrice = new LabelPrintProductDetail(); // labelPrice.Productcode = product.ProductCode; // labelPrice.Productname = product.ProductName; // labelPrice.Barcode = product.Barcode; // labelPrice.Unitcode = product.UnitCode; // labelPrice.Unitname = product.UnitName; // labelPrice.OthUnitcode = labelPrice.Unitcode; // labelPrice.OthUnitname = labelPrice.Unitname; // labelPrice.PrintLabelTypeCode = cmbPrintType.Text; // var productPrice = MobileServiceHelper.MobileService.ProductPriceGetCurrentPrice(LabelPriceSession.Current.BranchCode, labelPrice.Productcode, labelPrice.Unitcode); // if (productPrice != null) // { // labelPrice.Sellprice = productPrice.Saleprice; // labelPrice.Pricedate = productPrice.Begindate; // labelPrice.OthUnitprice = labelPrice.Sellprice; // } // labelPrice.DisplayOrder = LabelPriceSession.Current.LabelPrintProductDetails.Count + 1; // LabelPriceSession.Current.LabelPrintProductDetails.Add(labelPrice); // list.Add(new LabelPrintProductDetail() { LocationCode = item.LocationCode }); //} try { var _labelPriceL = new List <LabelPrintProductDetail>(); foreach (var item in _labelPrice) { var labelPrice = new LabelPrintProductDetail(); labelPrice.Productcode = item.Productcode; labelPrice.Productname = item.Productname; labelPrice.Barcode = item.Barcode; labelPrice.Unitcode = item.Unitcode; labelPrice.Unitname = item.Unitname; labelPrice.OthUnitcode = labelPrice.Unitcode; labelPrice.OthUnitname = labelPrice.Unitname; labelPrice.PrintLabelTypeCode = cmbPrintType.SelectedValue.ToString(); var productPrice = ServiceHelper.MobileServices.ProductPriceGetCurrentPrice(GlobalContext.BranchCode, labelPrice.Productcode, labelPrice.Unitcode); if (productPrice != null) { labelPrice.Sellprice = productPrice.Saleprice; labelPrice.Pricedate = productPrice.Begindate; var productOtherPrice = ServiceHelper.MobileServices.ProductPriceGetCurrentPrice(GlobalContext.BranchCode, labelPrice.Productcode, labelPrice.OthUnitcode); if (productOtherPrice != null) { labelPrice.OthUnitprice = productOtherPrice.Saleprice; } } labelPrice.Sellprice = item.Sellprice; labelPrice.OthUnitprice = labelPrice.Sellprice; labelPrice.Locationcode = ""; labelPrice.Locationname = item.ProductPosition; labelPrice.Producttype = item.ProductLoggr; //labelPrice.s labelPrice.DisplayOrder = _labelPrice.Count + 1; labelPrice.DisplayOrderSpecified = true; _labelPriceL.Add(labelPrice); } var docno = ServiceHelper.MobileServices.LabelPrintProductAddWithDetail(GlobalContext.BranchCode , GlobalContext.UserCode , string.Format("Request from PDA by {0}", GlobalContext.UserCode) , cmbPrintType.SelectedValue.ToString() , _labelPriceL.ToArray()); _labelPrice.Clear(); grdLocations.DataSource = null; Cursor.Current = Cursors.Default; GlobalMessageBox.ShowInfomation(string.Format("บันทึกข้อมูล เสร็จเรียบร้อยแล้ว\nเลขที่เอกสารที่ได้คือ\n{0}", docno)); tbBarcode.Text = null; tbBarcode.Focus(); } catch (Exception ex) { GlobalMessageBox.ShowError(ex); } }
private void BindGrid() { if (string.IsNullOrEmpty(txtProductCode.Text.Trim())) { GlobalMessageBox.ShowInfomation("กรุณาระบุบาร์โค้ดสินค้า ก่อนทำการค้นหา"); // GlobalMessageBox.ShowInfomation("กรุณาระบุรหัสสินค้า ก่อนทำการค้นหา"); txtProductCode.Focus(); return; } try { Cursor.Current = Cursors.WaitCursor; if (bsProductLocation.DataSource == null) { bsProductLocation.DataSource = new List <ProductLocation>(); } ProductLocation product = null; var barcode = txtProductCode.Text.Trim(); if (OfflineMode) { product = new ProductLocation(); product.ProductCode = string.Empty; product.ProductBarcode = barcode; product.SalePrice = 0; } else { product = ServiceHelper.MobileServices.ProductLocationGetByProductCodeOrBarcode(barcode, GlobalContext.WarehouseCode, GlobalContext.BranchCode); } if (product != null) { product.ShopPrice = 0; Cursor.Current = Cursors.Default; //กรณีที่ใช้ในคลังหรือตรวจตำแหน่ง Top ไม่ต้องให้แสดงราคา และหน้าจอสำหรับป้อนราคา if (GlobalContext.UseInPlaces == UseInPlaces.WAREHOUSE || Utils.CheckLocationIsTopLevel(txtLocationCode.Text)) { dgvProducts.Columns["columnSalePrice"].Width = 0; dgvProducts.Columns["columnSalePrice"].AutoSizeColumnMode = AutoSizeColumnMode.None; dgvProducts.Columns["columnShopPrice"].Width = 0; dgvProducts.Columns["columnShopPrice"].AutoSizeColumnMode = AutoSizeColumnMode.None; } else { var oForm = new EnterPriceForm(); oForm.ProductCode = product.ProductCode; if (oForm.ShowDialog() == DialogResult.OK) { product.ShopPrice = oForm.Price; if (!OfflineMode) { product.ProductUnitCode = oForm.UnitCode; product.ProductUnitName = oForm.UnitName; var productPrice = ServiceHelper.MobileServices.ProductPriceGetCurrentPrice(GlobalContext.BranchCode, product.ProductCode, product.ProductUnitCode); product.SalePrice = productPrice.Saleprice; } } else { return; } } product.DisplayOrder = ((List <ProductLocation>)bsProductLocation.DataSource).Count + 1; ((List <ProductLocation>)bsProductLocation.DataSource).Add(product); bsProductLocation.ResetBindings(false); this.btnSave.Enabled = true; } this.txtProductCode.Text = null; } catch (Exception ex) { Cursor.Current = Cursors.Default; GlobalMessageBox.ShowError(ex.Message); } finally { Cursor.Current = Cursors.Default; } }
private void SaveData() { if (gvLocationProduct.DataSource != null) { try { Cursor.Current = Cursors.WaitCursor; //LocationCheckProductManager.TransferToServer(); DataTable productMixedTable = new DataTable(); List <ProductLocation> productLocations = new List <ProductLocation>(); using (SqlCeConnection con = new SqlCeConnection(SqlHelper.SqlCeConnectionString)) { con.Open(); using (SqlCeCommand com = new SqlCeCommand()) { com.Connection = con; foreach (Resco.Controls.SmartGrid.Row item in gvLocationProduct.Rows) { var locationCode = ((System.Data.DataRowView)(item.Data)).Row.ItemArray[0].ToString(); using (SqlCeDataAdapter adab = new SqlCeDataAdapter(com)) { com.CommandText = SqlHelper.GetSql(33); com.Parameters.Clear(); com.Parameters.AddWithValue("@LocationCode", locationCode); com.Parameters.AddWithValue("@CreatedBy", GlobalContext.UserCode); adab.Fill(productMixedTable); var isWarehouse = GlobalContext.UseInPlaces == UseInPlaces.WAREHOUSE ? true : false; foreach (DataRow row in productMixedTable.Rows) { var productLocation = ServiceHelper.MobileServices.ProductLocationGetByBarcode(row["Barcode"].ToString(), locationCode, GlobalContext.WarehouseCode, GlobalContext.BranchCode, isWarehouse); productLocation.OfficerID = row["OfficerId"].ToString(); productLocations.Add(productLocation); } // transfer to server. ServiceHelper.MobileServices.ProductLocationMixAdd(GlobalContext.BranchCode, GlobalContext.WarehouseCode, GlobalContext.UserCode, productLocations.ToArray()); //delete com.CommandText = SqlHelper.GetSql(30); com.ExecuteNonQuery(); productMixedTable.Clear(); productLocations.Clear(); } } } } Cursor.Current = Cursors.Default; GlobalMessageBox.ShowInfomation("บันทึกข้อมูลไปยัง SAP สำเร็จ"); this.Close(); } catch (Exception ex) { Cursor.Current = Cursors.Default; GlobalMessageBox.ShowError("บันทึกข้อมูลไม่สำเร็จ กรุณาลองใหม่อีกครั้ง " + ex.Message); BindGrid(); } } }
private void BindGrid() { //lblMessage.Visible = false; string messageAlert = string.Empty; try { Cursor.Current = Cursors.WaitCursor; List <HandHeldCounterHold> prouductBarcode = null; if (bindingSource.DataSource == null) { bindingSource.DataSource = new List <HandHeldCounterHold>(); } prouductBarcode = (List <HandHeldCounterHold>)bindingSource.DataSource; var productCodeOrBarcode = txtScan.Text.Trim(); //MessageBox.Show("MobileServices.GetProductCode"); var productCode = ServiceHelper.MobileServices.GetProductCode(GlobalContext.BranchCode, productCodeOrBarcode); //MessageBox.Show(productCode); if (prouductBarcode.FindAll(p => p.Productcode == productCode).Count > 0) { GlobalMessageBox.ShowInfomation("มีสินค้าอยู่ในรายการตรวจสอบนี้แล้ว"); //clear barcode textbox this.txtScan.Text = string.Empty; this.txtScan.Focus(); return; } //MessageBox.Show("call HandHeldCounterHoldGetByProductCode"); var products = ServiceHelper.MobileServices.HandHeldCounterHoldGetByProductCode(productCode , GlobalContext.UserCode , GlobalContext.UserCode//ddlEmployee.SelectedValue as string , GlobalContext.WarehouseCode , GlobalContext.BranchCode , out messageAlert); //MessageBox.Show(products.Length.ToString ()); //test. //ServiceHelper.MobileServices.HandHeldCounterHoldGetByProductCode2(productCode // , GlobalContext.UserCode // , ddlEmployee.SelectedValue as string // , GlobalContext.WarehouseCode // , GlobalContext.BranchCode); if (products != null) { foreach (var item in products) { prouductBarcode.Add(item); } bindingSource.DataSource = prouductBarcode; bindingSource.ResetBindings(false); } else { if (string.IsNullOrEmpty(messageAlert)) { GlobalMessageBox.ShowInfomation("ไม่พบรหัสสินค้า/บาร์โค้ดที่ระบุ"); } else { GlobalMessageBox.ShowInfomation(messageAlert); } } //clear barcode textbox this.txtScan.Text = string.Empty; this.txtScan.Focus(); } catch (Exception ex) { Cursor.Current = Cursors.Default; GlobalMessageBox.ShowError(ex); } finally { Cursor.Current = Cursors.Default; } }
private bool ValidatePassword() { if (ValueIsMajor) { var officer = ddlMajorCounter1.SelectedValue as string; if (string.IsNullOrEmpty(officer)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ ผู้นับ 1"); return(false); } officer = ddlMajorCounter2.SelectedValue as string; if (string.IsNullOrEmpty(officer)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ ผู้นับ 2"); return(false); } } else { string officer = string.Empty; string password = string.Empty; officer = ddlOfficer1.SelectedValue as string; password = txtPassword1.Text.Trim(); if (string.IsNullOrEmpty(officer)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ พนักงานคลัง 1"); return(false); } else { if (string.IsNullOrEmpty(password)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ รหัสผ่าน พนักงานคลัง 1"); return(false); } else { if (!CheckUserPassword(officer, password)) { GlobalMessageBox.ShowInfomation("รหัสผ่าน พนักงานคลัง 1 ไม่ถูกต้อง"); return(false); } } } officer = ddlOfficer2.SelectedValue as string; password = txtPassword2.Text.Trim(); if (string.IsNullOrEmpty(officer)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ พนักงานคลัง 2"); return(false); } else { if (string.IsNullOrEmpty(password)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ รหัสผ่าน พนักงานคลัง 2"); return(false); } else { if (!CheckUserPassword(officer, password)) { GlobalMessageBox.ShowInfomation("รหัสผ่าน พนักงานคลัง 2 ไม่ถูกต้อง"); return(false); } } } officer = ddlOfficer3.SelectedValue as string; password = txtPassword3.Text.Trim(); if (string.IsNullOrEmpty(officer)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ พนักงานตรวจสอบภายใน"); return(false); } else { if (string.IsNullOrEmpty(password)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ รหัสผ่าน พนักงานตรวจสอบภายใน"); return(false); } else { if (!CheckUserPassword(officer, password)) { GlobalMessageBox.ShowInfomation("รหัสผ่าน พนักงานตรวจสอบภายใน ไม่ถูกต้อง"); return(false); } } } officer = ddlOfficer4.SelectedValue as string; password = txtPassword4.Text.Trim(); if (string.IsNullOrEmpty(officer)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ หัวหน้าโซน"); return(false); } else { if (string.IsNullOrEmpty(password)) { GlobalMessageBox.ShowInfomation("กรุณาระบุ รหัสผ่าน หัวหน้าโซน"); return(false); } else { if (!CheckUserPassword(officer, password)) { GlobalMessageBox.ShowInfomation("รหัสผ่าน หัวหน้าโซน ไม่ถูกต้อง"); return(false); } } } } return(true); }
private void tbOrderNoFinish_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { Cursor.Current = Cursors.WaitCursor; var barcode = tbOrderNoFinish.Text.Trim(); if (string.IsNullOrEmpty(barcode)) { barcode = CeReader.Barcode.Scan(); } //if (!RF1DHelper.Scan(out barcode)) // barcode = tbOrderNoFinish.Text.Trim(); if (string.IsNullOrEmpty(barcode)) { GlobalMessageBox.ShowWarnning("กรุณาระบุเลขที่เอกสาร"); return; } else { if (barcode.Length > 10) { barcode = barcode.Substring(0, 10); } tbOrderNoFinish.Text = barcode; var order = ServiceHelper.MobileServices.OrderedSetGetByOrderNo(barcode); if (order != null) { if (order.FinishOn == null) { ServiceHelper.MobileServices.OrderedSetUpdate(barcode); tbOrderNoFinish.Text = barcode; GlobalMessageBox.ShowInfomation(string.Format("ปิดใบจัดเลขที่\n{0}\nเรียบร้อยแล้ว", barcode)); //tbOrderNoFinish.Text = string.Empty; //tbOrderNoFinish.Focus(); } else { new OrderedInfoForm(order).ShowDialog(); } this.Close(); } else { GlobalMessageBox.ShowWarnning("ไม่พบเลขที่เอกสารนี้ ในระบบ"); } } } catch (Exception ex) { GlobalMessageBox.ShowError(ex); } finally { Cursor.Current = Cursors.Default; } } }
private void btnInsert_Click(object sender, EventArgs e) { //var rowIndex = dgLocation.CurrentCell.RowNumber; var locations = (List <ProductLocation>)bsLocation.DataSource; //var displayOrder = locations.Find(p => p.ProductCode == this.GetCurrentProductCode()).DisplayOrder; var displayOrder = _currentRowIndex; var oForm = new LocationProductForm(this.OfflineMode); if (oForm.ShowDialog() == DialogResult.OK) { if (bsLocation.DataSource == null) { bsLocation.DataSource = new List <ProductLocation>(); } var location = oForm.ProductLocation; if (location == null) { return; } var productLocation = locations.Find(p => p.ProductBarcode == location.ProductBarcode); if (productLocation != null) { if (GlobalMessageBox.ShowQuestion("มีสินค้านี้อยู่ในตำแหน่งแล้ว\nคุณต้องการแก้ไขสินค้านี้ ใช่หรือไม่ ?") == DialogResult.Yes) { productLocation.ProductBarcode = oForm.ProductLocation.ProductBarcode; productLocation.ProductCode = oForm.ProductLocation.ProductCode; productLocation.PutLevel = oForm.ProductLocation.PutLevel; productLocation.ProductName = oForm.ProductLocation.ProductName; productLocation.PutQuantity = oForm.ProductLocation.PutQuantity; productLocation.ProductUnitCode = oForm.ProductLocation.ProductUnitCode; productLocation.ProductUnitName = oForm.ProductLocation.ProductUnitName; productLocation.RequestPrintLabel = oForm.ProductLocation.RequestPrintLabel; productLocation.RequestPrintLabelSpecified = true; productLocation.MaxStock = oForm.ProductLocation.MaxStock; productLocation.MaxStockSpecified = true; bsLocation.ResetBindings(false); return; } else { return; } } if (displayOrder == 0) { locations.Insert(0, location); } else { locations.Insert(displayOrder, location); } //locations.Insert(displayOrder - 1, location); bsLocation.ResetBindings(false); this.Reindex(); _currentRowIndex = displayOrder; GridSelected(); } }
private void AddOffLineMode() { var productLocations = (List <ProductLocation>)bsLocation.DataSource; if (productLocations.Exists(p => p.RequestPrintLabel) && cmbLabelType.SelectedIndex == 0) { GlobalMessageBox.ShowInfomation("กรุณาเลือกประเภทป้าย\nก่อนบันทึกข้อมูล"); return; } try { Cursor.Current = Cursors.WaitCursor; this.PrepareSave(); productLocations = (List <ProductLocation>)bsLocation.DataSource; using (SqlCeConnection con = new SqlCeConnection(SqlHelper.SqlCeConnectionString)) { con.Open(); using (SqlCeCommand cmd = new SqlCeCommand()) { cmd.Connection = con; IDbTransaction trans = con.BeginTransaction(IsolationLevel.Serializable); try { var locationCode = txtLocationCodeScan.Text.Trim(); cmd.CommandType = CommandType.Text; cmd.CommandText = SqlHelper.GetSql(48); cmd.Parameters.AddWithValue("@LocationCode", locationCode); cmd.Parameters.AddWithValue("@UserCode", GlobalContext.UserCode); cmd.ExecuteScalar(); cmd.Parameters.Clear(); //get the last insert id cmd.CommandText = "SELECT @@IDENTITY"; int id = Convert.ToInt32(cmd.ExecuteScalar()); cmd.CommandText = SqlHelper.GetSql(49); var displayOrder = 1; foreach (var item in productLocations) { //com.Parameters.AddWithValue("@LocationCode", locationCode); cmd.Parameters.AddWithValue("@LocationId", id); cmd.Parameters.AddWithValue("@ProductCode", item.ProductCode); cmd.Parameters.AddWithValue("@PutLevel", item.PutLevel); cmd.Parameters.AddWithValue("@PutQty", item.PutQuantity); cmd.Parameters.AddWithValue("@DisplayOrder", displayOrder); //com.Parameters.AddWithValue("@UserCode", GlobalContext.UserCode); cmd.Parameters.AddWithValue("@RequestPrintLabel", item.RequestPrintLabel); cmd.Parameters.AddWithValue("@MaxStock", item.MaxStock); if (item.Remark.Contains("เลือก")) { item.Remark = string.Empty; } cmd.Parameters.AddWithValue("@PrintLabelType", item.Remark); cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); displayOrder++; } trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw ex; } } } //GlobalMessageBox.ShowInfomation("บันทึกข้อมูลผูกตำแหน่งเรียบร้อย\n[Offline Mode] "); // call btnClear button btnClear_Click(null, null); } catch (Exception ex) { MessageBox.Show(ex.Message, "พบข้อผิดพลาด"); } finally { Cursor.Current = Cursors.Default; } }