private int InsertStockInItem() { grvProductStockInShop.EndEdit(); ArrayList arr = new ArrayList(); ArrayList SiArr = new ArrayList(); bool ret = true; bool rr = true; double cnt = 0; cnt = grvProductStockInShop.Rows.Count; StockInData sd = new StockInData(); sd.GRANDTOT = Convert.ToDouble(txtTotal.Text.Trim()); sd.LOID = Convert.ToDouble((txtSiLoid.Text.Trim()==""?"0":txtSiLoid.Text.Trim())); SiArr.Add(sd); if (_FLAG == "ADD") { for (int i = 0; i < cnt; i++) { DataGridViewTextBoxCell QTY = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["RECEIVE_QTY"]; DataGridViewTextBoxCell STOCKIN = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["SILOID"]; DataGridViewTextBoxCell PRODUCT = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["PDLOID"]; DataGridViewTextBoxCell REFLOID = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["RQILOID"]; DataGridViewTextBoxCell PRICE = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["PRICE"]; DataGridViewTextBoxCell ULOID = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["ULOID"]; StockInItemData dr = new StockInItemData(); dr.QTY = Convert.ToDouble(QTY.Value.ToString()); dr.STOCKIN = Convert.ToDouble(STOCKIN.Value.ToString()); dr.PRODUCT = Convert.ToDouble(PRODUCT.Value.ToString()); dr.REFLOID = Convert.ToDouble(REFLOID.Value.ToString()); dr.PRICE = Convert.ToDouble(PRICE.Value.ToString()); dr.UNIT = Convert.ToDouble(ULOID.Value.ToString()); arr.Add(dr); } ProductStockInShopFlow csFlow = new ProductStockInShopFlow(); ret = csFlow.InsertStockInitem(Appz.CurrentUserData.UserID, arr); if (ret == true) { rr = csFlow.UpdateStockIn_GrandTot(Appz.CurrentUserData.UserID, SiArr); return 1; } else { Appz.OpenWarningDialog(csFlow.ErrorMessage); return 0; } } else { if (txtSiiStatus.Text.Trim() == "AP") { Appz.OpenWarningDialog("ÃÒ¡ÒùÕé¶Ù¡Â×¹ÂѹáÅéÇ"); return 0; } else { for (int i = 0; i < cnt; i++) { DataGridViewTextBoxCell SIILOID = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["SIILOID"]; DataGridViewTextBoxCell RECEIVE_QTY = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["RECEIVE_QTY"]; StockInItemData dr = new StockInItemData(); dr.LOID = Convert.ToDouble(SIILOID.Value.ToString()); dr.QTY = Convert.ToDouble(RECEIVE_QTY.Value.ToString()); arr.Add(dr); } ProductStockInShopFlow csFlow = new ProductStockInShopFlow(); ret = csFlow.UpdateTemptable(Appz.CurrentUserData.UserID, arr); if (ret == true) { rr = csFlow.UpdateStockIn_GrandTot(Appz.CurrentUserData.UserID, SiArr); return 2; } else { Appz.OpenWarningDialog(csFlow.ErrorMessage); return 0; } } } }
private int InsertStockInItem() { grvProductStockInShop.EndEdit(); ArrayList arr = new ArrayList(); bool ret = true; double cnt = 0; cnt = grvProductStockInShop.Rows.Count; if (_FLAG == "ADD") { for (int i = 0; i < cnt; i++) { DataGridViewTextBoxCell QTY = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["RECEIVE_QTY"]; DataGridViewTextBoxCell STOCKIN = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["SILOID"]; DataGridViewTextBoxCell PRODUCT = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["PDLOID"]; DataGridViewTextBoxCell REFLOID = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["RQILOID"]; StockInItemData dr = new StockInItemData(); dr.QTY = Convert.ToDouble(QTY.Value.ToString()); dr.STOCKIN = Convert.ToDouble(STOCKIN.Value.ToString()); dr.PRODUCT = Convert.ToDouble(PRODUCT.Value.ToString()); dr.REFLOID = Convert.ToDouble(REFLOID.Value.ToString()); arr.Add(dr); } ProductStockInShopFlow csFlow = new ProductStockInShopFlow(); ret = csFlow.InsertStockInitem(Appz.CurrentUserData.UserID, arr); if (ret == true) { //Appz.OpenInformationDialog("ºÑ¹·Ö¡ÃÒ¡ÒÃàÃÕºÃéÍÂ"); return 1; } else { Appz.OpenWarningDialog(csFlow.ErrorMessage); return 0; } } else { if (txtSiiStatus.Text.Trim() == "AP") { Appz.OpenWarningDialog("ÃÒ¡ÒùÕé¶Ù¡Â×¹ÂѹáÅéÇ"); return 0; } else { for (int i = 0; i < cnt; i++) { DataGridViewTextBoxCell SIILOID = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["SIILOID"]; DataGridViewTextBoxCell RECEIVE_QTY = (DataGridViewTextBoxCell)grvProductStockInShop.Rows[i].Cells["RECEIVE_QTY"]; StockInItemData dr = new StockInItemData(); dr.LOID = Convert.ToDouble(SIILOID.Value.ToString()); dr.QTY = Convert.ToDouble(RECEIVE_QTY.Value.ToString()); arr.Add(dr); } ProductStockInShopFlow csFlow = new ProductStockInShopFlow(); ret = csFlow.UpdateTemptable(Appz.CurrentUserData.UserID, arr); if (ret == true) return 2; else Appz.OpenWarningDialog(csFlow.ErrorMessage); return 0; } } }