public string NewPurchaseReq(List <Core.Domain.Purchase_Requisition.PurchaseRequisitionDetail> PurchaseItem, Core.Domain.Purchase_Requisition.PurchaseRequisition PurchaseHeader)
        {
            db = new SqlConnection(ConfigurationManager.ConnectionStrings["cnConsumption"].ConnectionString);
            string sql;

            //First Add Header
            int ID = 0;


            string NewPrNO = "PR-" + DateTime.Now.ToLongTimeString();

            sql = " INSERT INTO TH_PurchaseRequisition(PRNo,PRDate,KitchenID,Remarks)VALUES ('" + NewPrNO + "',@PRDate,1,@Remarks) " +
                  "Select Cast(SCOPE_IDENTITY() AS int)";

            try
            {
                ID = db.Query <int>(sql, new
                {
                    PurchaseHeader.PRDate,
                    PurchaseHeader.Remarks
                }).SingleOrDefault();
            }
            catch (Exception e)
            {
                if (e.Message.IndexOf("") > 0)
                {
                    db.Close();
                    return("-1");
                }
            }
            foreach (PurchaseRequisitionDetail obj in PurchaseItem)
            {
                sql = " Insert into TD_PurchaseRequisition (PRID,ItemID,Qty,Unit,Specs) " +
                      " Values (" + ID + ",@ItemID,@Qty,@Unit,@Specs)";


                db.Execute(sql, new
                {
                    obj.ItemId,
                    obj.Qty,
                    obj.Unit,
                    obj.Specs
                });
            }

            return(NewPrNO);
        }
        public string EditPurchaseReq(List <Core.Domain.Purchase_Requisition.PurchaseRequisitionDetail> PurchaseItem, Core.Domain.Purchase_Requisition.PurchaseRequisition PurchaseHeader)
        {
            db = new SqlConnection(ConfigurationManager.ConnectionStrings["cnConsumption"].ConnectionString);
            string sql;


            foreach (PurchaseRequisitionDetail obj in PurchaseItem)
            {
                sql = " Insert into TD_PurchaseRequisition (PRID,ItemID,Qty) " +
                      " Values (@PRID,@ItemID,@Qty)";


                db.Execute(sql, new
                {
                    obj.PRID,
                    obj.ItemId,
                    obj.Qty
                });
            }

            return("");
        }