public List<Inventory_Adjustment_Voucher_Detail> getAdjustedVoc()
 {
     Inventory_Adjustment_Voucher_Detail invenAdjVocDetail=new Inventory_Adjustment_Voucher_Detail();
     Inv_Adjustment_Voucher_DetailEnt invenVocDetailEnt=new Inv_Adjustment_Voucher_DetailEnt();
     invenAdjVocDetail.Status = false;
     List<Inventory_Adjustment_Voucher_Detail> adjList = invenVocDetailEnt.getInvAVD(invenAdjVocDetail);
     return adjList;
 }
 public void updateInvAdjStatus(string vocID, string itemCode)
 {
     Inv_Adjustment_Voucher_DetailEnt invAdVoDE = new Inv_Adjustment_Voucher_DetailEnt();
     Inventory_Adjustment_Voucher_Detail inAdjDe = new Inventory_Adjustment_Voucher_Detail();
     inAdjDe.Voucher_ID = vocID;
     inAdjDe.Item_Code = itemCode;
     inAdjDe.Status = true;
     invAdVoDE.updateInvAVD(inAdjDe);
 }
        //public List<Inventory_Adjustment_Voucher_Detail> getAllInvAVD()
        //{
        //    var q = from i in ContextDB.Inventory_Adjustment_Voucher_Detail
        //            select i;
        //    return q.ToList<Inventory_Adjustment_Voucher_Detail>();
        //}
        public List<Inventory_Adjustment_Voucher_Detail> getInvAVD(Inventory_Adjustment_Voucher_Detail invAVD)
        {
            var q = from i in ContextDB.Inventory_Adjustment_Voucher_Detail
                    where (i.Voucher_ID == invAVD.Voucher_ID || invAVD.Voucher_ID == null)
                    && (i.Item_Code == invAVD.Voucher_ID || invAVD.Voucher_ID == null)
                    && (i.Qty_Adjust == invAVD.Qty_Adjust || invAVD.Qty_Adjust == null)
                    && (i.Reason == invAVD.Reason || invAVD.Reason == null)
                    && (i.Status == invAVD.Status || invAVD.Status == null)
                    select i;

            return q.ToList<Inventory_Adjustment_Voucher_Detail>();
        }
        public bool deleteInvAVD(Inventory_Adjustment_Voucher_Detail invAVD)
        {
            try
            {
                ContextDB.Inventory_Adjustment_Voucher_Detail.DeleteObject(invAVD);
                ContextDB.SaveChanges();

                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
        public bool updateInvAVD(Inventory_Adjustment_Voucher_Detail invAVD)
        {
            try
            {
                Inventory_Adjustment_Voucher_Detail updInvAV = getInvAVDByID(invAVD.Voucher_ID, invAVD.Item_Code);
                updInvAV.Item_Code = invAVD.Item_Code == null ? updInvAV.Item_Code : invAVD.Item_Code;
                updInvAV.Qty_Adjust = invAVD.Qty_Adjust == null ? updInvAV.Qty_Adjust : invAVD.Qty_Adjust;
                updInvAV.Reason = invAVD.Reason == null ? updInvAV.Reason : invAVD.Reason;
                updInvAV.Status = invAVD.Status == null ? updInvAV.Status : invAVD.Status;
                ContextDB.SaveChanges();

                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
 public void createInvAdjVocDetail(Inventory_Adjustment_Voucher_Detail invAVD)
 {
     ContextDB.Inventory_Adjustment_Voucher_Detail.AddObject(invAVD);
     ContextDB.SaveChanges();
 }
 public void saveAdjustedQty(String voucherID, String itemCode, int qty, String reason)
 {
     Inventory_Adjustment_Voucher_Detail invAdj = new Inventory_Adjustment_Voucher_Detail();
     Inv_Adjustment_Voucher_DetailEnt invEnt = new Inv_Adjustment_Voucher_DetailEnt();
     invAdj.Voucher_ID = voucherID;
     invAdj.Item_Code = itemCode;
     invAdj.Qty_Adjust = qty;
     invAdj.Reason = reason;
     invAdj.Status = false;
     invEnt.createInvAdjVocDetail(invAdj);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Inventory_Adjustment_Voucher_Detail EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToInventory_Adjustment_Voucher_Detail(Inventory_Adjustment_Voucher_Detail inventory_Adjustment_Voucher_Detail)
 {
     base.AddObject("Inventory_Adjustment_Voucher_Detail", inventory_Adjustment_Voucher_Detail);
 }
 /// <summary>
 /// Create a new Inventory_Adjustment_Voucher_Detail object.
 /// </summary>
 /// <param name="voucher_ID">Initial value of the Voucher_ID property.</param>
 /// <param name="item_Code">Initial value of the Item_Code property.</param>
 public static Inventory_Adjustment_Voucher_Detail CreateInventory_Adjustment_Voucher_Detail(global::System.String voucher_ID, global::System.String item_Code)
 {
     Inventory_Adjustment_Voucher_Detail inventory_Adjustment_Voucher_Detail = new Inventory_Adjustment_Voucher_Detail();
     inventory_Adjustment_Voucher_Detail.Voucher_ID = voucher_ID;
     inventory_Adjustment_Voucher_Detail.Item_Code = item_Code;
     return inventory_Adjustment_Voucher_Detail;
 }