//3..Save to Database public void addRequisitionList(List <ReqBO> rlst, LoginBO loginBo) { //create purchase object Requisition robj = new Requisition(); robj.DepartmentID = loginBo.DepID; robj.EmployeeID = loginBo.EmpID; robj.Status = "Pending"; robj.OrderDate = DateTime.Now; robj.Reason = ""; //For requistion items list List <Requisition_Item> rst = new List <Requisition_Item>(); foreach (ReqBO r in rlst) //from parameter pass { Requisition_Item ri = new Requisition_Item(); ri.ItemID = r.ItemID; ri.Status = "New"; ri.RequestedQty = r.RequestedQty; ri.ReceivedQty = 0; ri.UnfulfilledQty = r.RequestedQty; ri.RetrievedQty = 0; ri.ToRetrieveQty = 0; rst.Add(ri); } da.addRequisitionList(robj, rst); }
public static void AddNewRequisition(List <RequestedItem> item, DateTime date, string status, int empID, string DeptCode) { using (TransactionScope ts = new TransactionScope()) { StationeryEntities context = new StationeryEntities(); Requisition r = new Requisition(); List <Requisition_Item> list = new List <Requisition_Item>(); //to pass from previous form r.RequestDate = date; r.Status = status; r.RequestedBy = empID; r.DeptCode = DeptCode; context.Requisitions.Add(r); context.SaveChanges(); foreach (RequestedItem i in item) { int qty = i.Quantity; string code = i.Code; Requisition_Item ri = new Requisition_Item(); ri.RequisitionID = r.RequisitionID; ri.ItemCode = code; ri.RequestedQty = qty; list.Add(ri); } context.Requisition_Item.AddRange(list); context.SaveChanges(); ts.Complete(); } }
//ADD REQUISITION ITEM public static void addItemToRequisition(string code, int qty, int id) { Requisition_Item ri = new Requisition_Item(); ri.RequisitionID = id; ri.ItemCode = code; ri.RequestedQty = qty; EFBroker_Requisition.AddItemToRequisition(ri); }
public static void AddItemToRequisition(Requisition_Item item) { using (StationeryEntities context = new StationeryEntities()) { context.Requisition_Item.Add(item); context.SaveChanges(); } return; }
public Disbursement_Item CreateDisbursementItemList(int disbursementID, Requisition_Item r) { Disbursement_Item disbursement_Item = new Disbursement_Item(); disbursement_Item.DisbursementID = disbursementID; disbursement_Item.ItemCode = r.ItemCode; disbursement_Item.TotalRequestedQty = r.RequestedQty; disbursement_Item.ActualQty = 0;///////////////////////////////////////////////////////in order to do += ActualQty return(disbursement_Item); }
public static void removeRequisitionItem(int id, string code) { using (TransactionScope ts = new TransactionScope()) { StationeryEntities context = new StationeryEntities(); Requisition_Item ri = context.Requisition_Item.Where(r => r.RequisitionID.Equals(id)).Where(r => r.ItemCode.Equals(code)).FirstOrDefault(); context.Requisition_Item.Remove(ri); context.SaveChanges(); ts.Complete(); } }
public static void EditRequisitionItemQty(int id, string code, int qty) { using (TransactionScope ts = new TransactionScope()) { StationeryEntities context = new StationeryEntities(); Requisition_Item ri = context.Requisition_Item.Where(i => i.RequisitionID == id).Where(i => i.ItemCode.Equals(code)).FirstOrDefault(); ri.RequestedQty += qty; context.SaveChanges(); ts.Complete(); } }
public static void UpdateRequisitionItem(int id, string code, int qty) { using (TransactionScope ts = new TransactionScope()) { StationeryEntities context = new StationeryEntities(); Requisition_Item ri = context.Requisition_Item.Where(r => r.RequisitionID == id && r.ItemCode.Equals(code)).FirstOrDefault(); ri.RequestedQty = qty; context.Entry(ri).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); ts.Complete(); } }
protected void BtnDelete_Click(object sender, EventArgs e) { //LoadData(); GridViewRow row = ((System.Web.UI.WebControls.Button)sender).Parent.Parent as GridViewRow; string itemDes = gvItemList.DataKeys[row.RowIndex].Value.ToString(); Requisition_Item rItem = RequisitionControl.findByReqIDItemCode(id, itemDes); string iCode = rItem.ItemCode; int rId = rItem.RequisitionID; RequisitionControl.removeRequisitionItem(rId, iCode); showAllItems(); }
protected void ReqRow_Updating(object sender, GridViewUpdateEventArgs e) { vsQty.Enabled = true; System.Web.UI.WebControls.TextBox qtyText = (System.Web.UI.WebControls.TextBox)gvItemList.Rows[e.RowIndex].FindControl("txtQuantity"); int newQty = Convert.ToInt32(qtyText.Text); System.Web.UI.WebControls.Label codeLabel = (System.Web.UI.WebControls.Label)gvItemList.Rows[e.RowIndex].FindControl("lblCode"); string itemDesc = codeLabel.Text; Requisition_Item item = RequisitionControl.findByReqIDItemCode(id, itemDesc); string iCode = item.ItemCode; int rId = item.RequisitionID; RequisitionControl.updateRequisitionItem(rId, iCode, newQty); gvItemList.EditIndex = -1; showAllItems(); }