public CSGoodsReceive DeleteGoodsReceivede(string Rec_OID, string Rec_ProductID, string uID) { CSGoodsReceive oReceiveDetails = new CSGoodsReceive(); DataTable oDt = null; try { strSQL = "delete from t_GReceive where Rec_OID = '" + Rec_OID + "' and Rec_ProductID = '" + Rec_ProductID + "' "; oManager = new CConManager(); oDt = oManager.Read(strSQL); } catch (Exception ex) { CConManager oManager = new CConManager(); oManager.s_ErrorMessage = ex.Message; } return(oReceiveDetails); }
//public List<CGoodsReceiveDetails> AllGoodsReceive(string Rec_OID, string uID) //{ // List<CGoodsReceiveDetails> oGoodReceiveList = new List<CGoodsReceiveDetails>(); // DataTable oDt = null; // try // { // strSQL = @"select * from t_GRDet where GRDet_MStrOID= '" + GRMstr_ID + "'"; // oManager = new CConManager(); // oDt = oManager.Read(strSQL, uID); // if (oDt.Rows.Count > 0) // { // foreach (DataRow dr in oDt.Rows) // { // CGoodsReceiveDetails oGoodsReceiveDetails = new CGoodsReceiveDetails(); // oGoodsReceiveDetails.GRDet_OID = dr["GRDet_OID"].ToString(); // oGoodsReceiveDetails.GRDet_Branch = dr["GRDet_Branch"].ToString(); // oGoodsReceiveDetails.GRDet_MStrOID = dr["GRDet_MStrOID"].ToString(); // oGoodsReceiveDetails.GRDet_ItemOID = dr["GRDet_ItemOID"].ToString(); // oGoodsReceiveDetails.GRDet_QTY = float.Parse(dr["GRDet_QTY"].ToString()); // oGoodsReceiveDetails.GRDet_UOM = dr["GRDet_UOM"].ToString(); // oGoodsReceiveDetails.GRDet_BranchOID =dr["GRDet_BranchOID"].ToString(); // oGoodsReceiveDetails.GRDet_LocOID = dr["GRDet_LocOID"].ToString(); // oGoodsReceiveDetails.GRDet_InvType = int.Parse(dr["GRDet_InvType"].ToString()); // oGoodsReceiveDetails.GRDet_Currency = dr["GRDet_Currency"].ToString(); // oGoodsReceiveDetails.GRDet_Price = float.Parse(dr["GRDet_Price"].ToString()); // oGoodsReceiveDetails.GRDet_Amount = float.Parse(dr["GRDet_Amount"].ToString()); // oGoodReceiveList.Add(oGoodsReceiveDetails); // oGoodsReceiveDetails = null; // } // } // else // { // strSQL = @"delete from t_GRMstr where GRMstr_OID = '" + GRMstr_ID + "'"; // oManager = new CConManager(); // oDt = oManager.Read(strSQL, uID); // } // } // catch (Exception ex) // { // CConManager oManager = new CConManager(); // oManager.s_ErrorMessage = ex.Message; // } // return oGoodReceiveList; //} #endregion #region Delete GoodsReceive Details public CSGoodsReceive UpdateGoodsReceivede(CSGoodsReceive ogoodreceive, string uID) { CSGoodsReceive oReceiveDetails = new CSGoodsReceive(); DataTable oDt = null; try { strSQL = "Update t_GReceive set Rec_ReceivedQty= " + ogoodreceive.Rec_ReceivedQty + "where Rec_OID = " + ogoodreceive.Rec_OID + " and Rec_ProductID = '" + ogoodreceive.Rec_ProductID + "' "; oManager = new CConManager(); oDt = oManager.Read(strSQL); } catch (Exception ex) { CConManager oManager = new CConManager(); oManager.s_ErrorMessage = ex.Message; } return(oReceiveDetails); }
private void dgvGoodsReceive_CellClick(object sender, DataGridViewCellEventArgs e) { CDeleteSalesPorduct oGoodsReceive = new CDeleteSalesPorduct(); if (dgvGoodsReceive.Rows.Count > 0) { if (e.RowIndex != -1) { if (e.ColumnIndex == 9) { string Rec_OID = dgvGoodsReceive.Rows[e.RowIndex].Cells["Rec_OID"].Value.ToString(); string Rec_ProductID = dgvGoodsReceive.Rows[e.RowIndex].Cells["Rec_ProductID"].Value.ToString(); CSGoodsReceive oGoodReceiveProduct = oGoodsReceive.DeleteGoodsReceivede(Rec_OID, Rec_ProductID, CurrentUser); dgvGoodsReceive.Rows.RemoveAt(e.RowIndex); } } } }
public List <CSGoodsReceive> allGoodsReceive(string uID) { List <CSGoodsReceive> oGoodsReceiveList = new List <CSGoodsReceive>(); DataTable oDt = null; try { strSQL = string.Format("SELECT dbo.t_GReceive.Rec_OID, dbo.t_GReceive.Rec_ReqID, dbo.t_GReceive.Rec_IssueID, dbo.t_GReceive.Rec_BranchID, dbo.t_GReceive.Rec_ProductID, dbo.t_GReceive.Rec_WantedQTY, dbo.t_GReceive.Rec_IssueQTY, dbo.t_GReceive.Rec_Remark, dbo.t_GReceive.Rec_ReceivedQty, dbo.t_Item.Item_ItemName FROM dbo.t_Item RIGHT OUTER JOIN dbo.t_GReceive ON dbo.t_Item.Item_OID = dbo.t_GReceive.Rec_ProductID"); oManager = new CConManager(); oDt = oManager.Read(strSQL); if (oDt != null) { foreach (DataRow dr in oDt.Rows) { CSGoodsReceive oGoodReceives = new CSGoodsReceive(); oGoodReceives.Item_Name = dr["Item_ItemName"].ToString(); oGoodReceives.Rec_OID = dr["Rec_OID"].ToString(); oGoodReceives.Rec_ReqID = dr["Rec_ReqID"].ToString(); oGoodReceives.Rec_IssueID = dr["Rec_IssueID"].ToString(); oGoodReceives.Rec_BranchID = dr["Rec_BranchID"].ToString(); oGoodReceives.Rec_ProductID = dr["Rec_ProductID"].ToString(); oGoodReceives.Rec_WantedQTY = Int32.Parse(dr["Rec_WantedQTY"].ToString()); oGoodReceives.Rec_IssueQTY = Int32.Parse(dr["Rec_IssueQTY"].ToString()); oGoodReceives.Rec_Remark = dr["Rec_Remark"].ToString(); oGoodReceives.Rec_ReceivedQty = Int32.Parse(dr["Rec_ReceivedQty"].ToString()); oGoodsReceiveList.Add(oGoodReceives); oGoodReceives = null; } } } catch (Exception ex) { CConManager oManager = new CConManager(); oManager.s_ErrorMessage = ex.Message; } return(oGoodsReceiveList); }