/// <summary>
 /// Deprecated Method for adding a new object to the StockAdjustments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToStockAdjustments(StockAdjustment stockAdjustment)
 {
     base.AddObject("StockAdjustments", stockAdjustment);
 }
        public Constants.ACTION_STATUS SelectStockAdjustmentVoucher(string stockAdjustmentId)
        {
            Constants.ACTION_STATUS selectStatus = Constants.ACTION_STATUS.UNKNOWN;

            stockAdjustment = stockAdjustmentList.Find(delegate(StockAdjustment sAdjustment) { return sAdjustment.Id.Equals(stockAdjustmentId); });

            if (stockAdjustment != null)
            {
                selectStatus = Constants.ACTION_STATUS.SUCCESS;
            }
            else
            {
                selectStatus = Constants.ACTION_STATUS.FAIL;
            }

            return selectStatus;
        }
 /// <summary>
 /// Create a new StockAdjustment object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 public static StockAdjustment CreateStockAdjustment(global::System.String id, global::System.DateTime createdDate, global::System.Int32 status)
 {
     StockAdjustment stockAdjustment = new StockAdjustment();
     stockAdjustment.Id = id;
     stockAdjustment.CreatedDate = createdDate;
     stockAdjustment.Status = status;
     return stockAdjustment;
 }
 public string[] IssueAdjustment()
 {
     stockAdjustment = new StockAdjustment();
     stockAdjustment.Id = discrepancyBroker.GetStockAdjustmentId(currentEmployee);
     stockAdjustment.Discrepancy = discrepancy;
     stockAdjustment.CreatedDate = DateTime.Now;
     stockAdjustment.CreatedBy = Util.GetEmployee(employeeBroker);
     stockAdjustment.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.SHOW);
     string[] array = new string[3];
     array[0] = stockAdjustment.Id;
     array[1] = stockAdjustment.CreatedBy.Name;
     array[2] = discrepancy.CreatedBy.Name;
     return array;
 }
 public Constants.DB_STATUS Delete(StockAdjustment stockAdjustment)
 {
     throw new NotImplementedException();
 }
        public Constants.DB_STATUS Insert(StockAdjustment newStockAdjustment)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                inventory.AddToStockAdjustments(newStockAdjustment);
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;

            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return status;
        }
        public StockAdjustment GetStockAdjustment(StockAdjustment stockAdjustment)
        {
            stockAdjustmentObj = inventory.StockAdjustments.Where(staObj => staObj.Id == stockAdjustment.Id).First();
            if (!stockAdjustmentObj.Equals(null))
            {
                Discrepancy dis = inventory.Discrepancies.Where(disObj => disObj.Id == stockAdjustmentObj.Discrepancy.Id).First();

                stockAdjustmentObj.Discrepancy = dis;
            }
            return stockAdjustmentObj;

        }