public List<Requisition_Detail> getStatusDetail(string frmNo)
 {
     RequisitionDetailEnt reqDetailEnt = new RequisitionDetailEnt();
     Requisition_Detail reqDetail = new Requisition_Detail();
     reqDetail.Req_Form_No = frmNo;
     return reqDetailEnt.getReqDetail(reqDetail);
 }
        public List<Requisition_Detail> getReqDetail(Requisition_Detail reqDet)
        {
            var q = from rd in ContextDB.Requisition_Detail
                    where rd.Req_Form_No == reqDet.Req_Form_No
                    select rd;

            return q.ToList<Requisition_Detail>();
        }
        public void bundleSelectedRequisition(List<Requisition> lstReqNo, string reqFrmNo, string empID, string deptID, List<Requisition> lstRej)
        {
            var q = from lr in lstReqNo
                    join rd in ContextDB.Requisition_Detail on lr.Req_Form_No equals rd.Req_Form_No
                    join s in ContextDB.Stationary_Catalogue on rd.Item_Code equals s.Item_Code
                    group rd by new { rd.Item_Code, s.Description } into g
                    select new Requisition_Detail
                    {
                        //Req_Form_No = g.Key.Req_Form_No,
                        Item_Code = g.Key.Item_Code,
                        Description = g.Key.Description,
                        Qty = g.Sum(rd => rd.Qty)
                    };

            RequisitionEnt reqE = new RequisitionEnt();
            Requisition req = new Requisition();
            req.Req_Form_No = reqFrmNo;
            req.Emp_ID = empID;
            req.Approval_Status = 3;
            req.Approval_Date = DateTime.Now;
            req.Approval_By = null;
            req.Req_Status = false;
            req.Notification = false;
            req.Prior = false;

            reqE.createRequisition(req);

            foreach (var val in q)
            {
                Requisition_Detail rd = new Requisition_Detail();
                rd.Req_Form_No = reqFrmNo;
                rd.Item_Code = val.Item_Code;
                rd.Description = val.Description;
                rd.Qty = val.Qty;

                RequisitionDetailEnt rdE = new RequisitionDetailEnt();
                rdE.createReqDetail(rd);

            }

            foreach (var val in lstReqNo)
            {
                Requisition reqt = (Requisition)val;
                reqt.Approval_Status = 2;

                updateRequisition(reqt);

            }
            foreach (var val in lstRej)
            {
                Requisition reqt = (Requisition)val;
                reqt.Approval_Status = 0;

                updateRequisition(reqt);

            }
        }
        public bool deleteReqDetail(Requisition_Detail reqDet)
        {
            try
            {
                ContextDB.Requisition_Detail.DeleteObject(reqDet);
                ContextDB.SaveChanges();

                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
        public bool updateReqDetail(Requisition_Detail reqDet)
        {
            try
            {
                Requisition_Detail rd = new Requisition_Detail();

                rd.Item_Code = reqDet.Item_Code;
                rd.Description = reqDet.Description;
                rd.Qty = reqDet.Qty;

                ContextDB.SaveChanges();

                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
 public int insertDisbursementDetail(Requisition_Detail rdm)
 {
     int i = eb.insertDisbursementDetail(rdm); return i;
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Requisition req = new Requisition();

               req.Req_Form_No = empCtrl.generateID(ur.Dept_ID);
               req.Request_Date = DateTime.Now;
               req.Emp_ID = ur.Emp_ID;
               req.Approval_Status = 1;
               req.Approval_By =null;
               req.Approval_Date = null;
               req.Req_Status = null;
               req.Notification = false;
               req.Prior = false;
               empCtrl.submitRequisition(req);
               foreach (GridViewRow row in itemDetailsGrid.Rows)
               {
               Requisition_Detail rd = new Requisition_Detail();
               rd.Req_Form_No = req.Req_Form_No;
               rd.Item_Code = row.Cells[1].Text;
               rd.Description = row.Cells[2].Text;
               rd.Qty = Convert.ToInt32((row.Cells[3]).Text);
               empCtrl.submitRequisitionDetails(rd);
               }

               this.itemDetailsGrid.DataSource = null;
               User u = new User();
               u.Emp_ID = ur.Emp_ID;
               empCtrl.sendEmailToDeptHead(u);
               data = new List<fields>();
               lblStatus.Text = "The Requisition was submitted successfully";
               ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Record saved successfully.');window.location='Emp-Welcom.aspx';", true);
        }
 public void submitRequisitionDetails(Requisition_Detail rd)
 {
     RequisitionDetailEnt rdEntity = new RequisitionDetailEnt();
     rdEntity.createReqDetail(rd);
 }
 public void createReqDetail(Requisition_Detail reqDet)
 {
     ContextDB.Requisition_Detail.AddObject(reqDet);
     ContextDB.SaveChanges();
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Requisition_Detail EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRequisition_Detail(Requisition_Detail requisition_Detail)
 {
     base.AddObject("Requisition_Detail", requisition_Detail);
 }
 /// <summary>
 /// Create a new Requisition_Detail object.
 /// </summary>
 /// <param name="req_Form_No">Initial value of the Req_Form_No property.</param>
 /// <param name="item_Code">Initial value of the Item_Code property.</param>
 public static Requisition_Detail CreateRequisition_Detail(global::System.String req_Form_No, global::System.String item_Code)
 {
     Requisition_Detail requisition_Detail = new Requisition_Detail();
     requisition_Detail.Req_Form_No = req_Form_No;
     requisition_Detail.Item_Code = item_Code;
     return requisition_Detail;
 }
        //insert/create new row to disbursement detail when click 'Submit at retrieval UI
        public int insertDisbursementDetail(Requisition_Detail rdm)
        {
            var disbursement_Detail = new Disbursement_Detail
            {
                Item_Code = rdm.Item_Code,
                Qty_Required = rdm.Qty,
            };
            entity.Disbursement_Detail.AddObject(disbursement_Detail);

            int i = entity.SaveChanges();
            return i;
        }