public void AddNewItemwithNegativeQty(DataRow d) { string wh = Utils.SalesStoreCode; const string storetype = "S"; var ds = new DsInventory().STOCKMASTER; var ta = new DsInventoryTableAdapters.STOCKMASTERTableAdapter { Connection = { ConnectionString = _constr } }; //ta.FillByItemNo(ds, d["ITEMNO"].ToString(), "S", Utils.Company); ta.FillByItemNoAll(ds, d["ITEMNO"].ToString(), Utils.Company); if (ds.Rows.Count > 0) { foreach (DsInventory.STOCKMASTERRow dr in ds.Rows) { if (dr.SPRICE == decimal.Parse(d["SPRICE"].ToString())) { ta.UpdateSaleQtyByStockid(-int.Parse(d["DQNTY"].ToString()), dr.STOCKID); return; } } } ta.Insert(d["ITEMNO"].ToString(), d["BARCODE"].ToString(), 0, decimal.Parse(d["SPRICE"].ToString()), decimal.Parse(d["CPRICE"].ToString()), null, storetype, null, null, null, false, wh, Utils.Company, -int.Parse(d["DQNTY"].ToString()),null); }