private void MnuNewGRN_Click(object sender, EventArgs e) { try { if (dgGRNLine.DataSource == null) { MessageBox.Show("Please scan the item first!"); } else { Cursor.Current = Cursors.WaitCursor; try { qhStockTakeWS.StockTakeWS_Service qhserv = new QHMobile.qhStockTakeWS.StockTakeWS_Service(); qhserv.Url = WebServiceInstants.GetURL(ServiceType.StockTakeWS); qhserv.Credentials = nc; CurrencyManager cm = (CurrencyManager)this.BindingContext[dgGRNLine.DataSource]; DataView dv = (DataView)cm.List; //qhStockTakeWS.StockTakeWS[] stock_list = new qhStockTakeWS.StockTakeWS[stmod.Count]; qhStockTakeWS.StockTakeWS[] stock_list = new qhStockTakeWS.StockTakeWS[dv.Count]; //qhStockTakeWS.StockTakeWS[] stock_all = qhserv.ReadMultiple(null, null, 0); //linecount = stock_all.Count(); QH_Functions.QH_Functions qhfun = new QHMobile.QH_Functions.QH_Functions(); qhfun.Url = WebServiceInstants.GetURL(ServiceType.QH_Functions); qhfun.Credentials = nc; for (int i = 0; i < dv.Count; i++) { qhStockTakeWS.StockTakeWS updatestock = new QHMobile.qhStockTakeWS.StockTakeWS(); updatestock.Stock_take_Code = "1"; updatestock.Item_No = stmod[i].ItemNo; //updatestock.Item_No = dgGRNLine[i, 0].ToString(); // updatestock.Line_NoSpecified = true; //linecount = qhfun.GetStockTakeLastLineNo(); // linecount = ++linecount; //updatestock.Line_No = linecount; updatestock.BinCode = stmod[i].binNo; //updatestock.BinCode = dgGRNLine[i, 1].ToString(); updatestock.Stock_take_QuantitySpecified = true; updatestock.Stock_take_Quantity = stmod[i].qty; //updatestock.Stock_take_Quantity = Convert.ToInt32(dgGRNLine[i, 2].ToString()); updatestock.Stock_take_DateSpecified = true; updatestock.Stock_take_Date = stmod[i].postDate; //updatestock.Stock_take_Date = Convert.ToDateTime(dgGRNLine[i, 3].ToString()); updatestock.Staff_Dimension_Code = staffdim; //updatestock.Staff_Dimension_Code = dgGRNLine[i, 4].ToString(); updatestock.Entry_DateSpecified = true; updatestock.Entry_Date = stmod[i].entryDate; //updatestock.Entry_Date = Convert.ToDateTime(dgGRNLine[i, 5].ToString()); updatestock.Registered_DateSpecified = true; updatestock.Registered_Date = stmod[i].entryDate; //updatestock.Registered_Date = Convert.ToDateTime(dgGRNLine[i, 5].ToString()); updatestock.Message = "Items not in Phys. Invty Jnl"; if (string.IsNullOrEmpty(txtLocation.Text.ToString())) { updatestock.Location_Code = "QH1"; } else { updatestock.Location_Code = txtLocation.Text.ToString(); } updatestock.Category = stmod[i].category; //updatestock.Category = dgGRNLine[i, 6].ToString(); updatestock.Skip_Auto_NumberSpecified = false; updatestock.Skip_Auto_Number = false; qhserv.Create(ref updatestock); //stock_list[i] = updatestock; } //qhserv.CreateMultiple(ref stock_list); CompactSQL comsql = new CompactSQL(); comsql.deleteRecord("StockTakeEntry"); Cursor.Current = Cursors.Default; MessageBox.Show("Submitted!"); this.Close(); StockTake st = new StockTake(uname, staffdim, ulevel); st.Show(); } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show("Error" + ex); } } }catch (Exception ex) { MessageBox.Show("Error" + ex); } }
private void MnuNewGRN_Click(object sender, EventArgs e) { try { if (dgGRNLine.DataSource == null) { MessageBox.Show("Please scan the item first!"); } else { Cursor.Current = Cursors.WaitCursor; try { qhStockTakeWS.StockTakeWS_Service qhserv = new QHMobile.qhStockTakeWS.StockTakeWS_Service(); qhserv.Url = WebServiceInstants.GetURL(ServiceType.StockTakeWS); qhserv.Credentials = nc; CurrencyManager cm = (CurrencyManager)this.BindingContext[dgGRNLine.DataSource]; DataView dv = (DataView)cm.List; qhStockTakeWS.StockTakeWS[] stock_list = new qhStockTakeWS.StockTakeWS[dv.Count]; QH_Functions.QH_Functions qhfun = new QHMobile.QH_Functions.QH_Functions(); qhfun.Url = WebServiceInstants.GetURL(ServiceType.QH_Functions); qhfun.Credentials = nc; for (int i = 0; i < dv.Count; i++) { qhStockTakeWS.StockTakeWS updatestock = new QHMobile.qhStockTakeWS.StockTakeWS(); updatestock.Stock_take_Code = "1"; updatestock.Item_No = stmod[i].ItemNo; updatestock.BinCode = stmod[i].binNo; updatestock.Stock_take_QuantitySpecified = true; updatestock.Stock_take_Quantity = stmod[i].qty; updatestock.Stock_take_DateSpecified = true; updatestock.Stock_take_Date = stmod[i].postDate; updatestock.Staff_Dimension_Code = staffdim; updatestock.Entry_DateSpecified = true; updatestock.Entry_Date = stmod[i].entryDate; updatestock.Registered_DateSpecified = true; updatestock.Registered_Date = stmod[i].entryDate; updatestock.Message = "Items not in Phys. Invty Jnl"; updatestock.Location_Code = stmod[i].loc; updatestock.Category = stmod[i].category; updatestock.Skip_Auto_NumberSpecified = false; updatestock.Skip_Auto_Number = false; qhserv.Create(ref updatestock); //deleteRecordLine CompactSQL comsql = new CompactSQL(); comsql.deleteRecordLine("StockTakeEntry", stmod[i].lineno); } //qhserv.CreateMultiple(ref stock_list); //CompactSQL comsql = new CompactSQL(); //comsql.deleteRecord("StockTakeEntry"); Cursor.Current = Cursors.Default; MessageBox.Show("Submitted!"); this.Close(); StockTake st = new StockTake(uname, staffdim, ulevel); st.Show(); } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show("Error" + ex); this.Close(); StockTake st = new StockTake(uname, staffdim, ulevel); st.Show(); } } }catch (Exception ex) { MessageBox.Show("Error" + ex); } }