public Constants.ACTION_STATUS CreateAdjustment()
        {
            Constants.ACTION_STATUS status   = Constants.ACTION_STATUS.UNKNOWN;
            Constants.DB_STATUS     dbStatus = discrepancyBroker.Insert(stockAdjustment);
            if (dbStatus == Constants.DB_STATUS.SUCCESSFULL)
            {
                status = Constants.ACTION_STATUS.SUCCESS;
            }
            else
            {
                status = Constants.ACTION_STATUS.FAIL;
            }
            //   discrepancy.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.HIDDEN);
            List <DiscrepancyDetail> dd = GetList(discrepancy.DiscrepancyDetails.ToList());

            foreach (DiscrepancyDetail temp in dd)
            {
                StockCardDetail stockCardDetail = new StockCardDetail();
                stockCardDetail.Id          = itemBroker.GetStockCardDetailId();
                stockCardDetail.Item        = temp.Item;
                stockCardDetail.Description = "Stock Adjsutment " + stockAdjustment.Id;
                stockCardDetail.Qty         = temp.Qty;
                stockCardDetail.CreatedDate = DateTime.Now;
                stockCardDetail.CreatedBy   = Util.GetEmployee(employeeBroker);
                stockCardDetail.Status      = Converter.objToInt(Constants.VISIBILITY_STATUS.SHOW);
                stockCardDetail.Balance     = itemBroker.GetCurrentBalance(temp.Item) + Converter.objToInt(temp.Qty);
                itemBroker.Insert(stockCardDetail);
                temp.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.HIDDEN);
                //discrepancyBroker.Update(temp);
            }

            bool flag = false;

            foreach (DiscrepancyDetail temp in discrepancy.DiscrepancyDetails)
            {
                if (temp.Status == Converter.objToInt(Constants.VISIBILITY_STATUS.SHOW))
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                discrepancy.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.HIDDEN);
            }
            else
            {
                discrepancy.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.SHOW);
            }
            discrepancyBroker.Update(discrepancy);


            return(status);
        }
        /// <summary>
        ///     Create discrepancy
        ///     Created By:JinChengCheng
        ///     Created Date:26-01-2012
        ///     Modified By:
        ///     Modified Date:
        ///     Modification Reason:
        ///     Modified By:
        ///     Modified Date:
        ///     Modification Reason:
        /// </summary>
        /// <param name=""></param>
        /// <returns>The return type of this method is status.</returns>
        public Constants.ACTION_STATUS SelectCreate()
        {
            Constants.ACTION_STATUS status = Constants.ACTION_STATUS.UNKNOWN;

            int totalAdded = 0;

            foreach (DiscrepancyDetail discrepancyDetail in discrepancy.DiscrepancyDetails)
            {
                discrepancyDetail.Id = discrepancyBroker.GetDiscrepancyDetailId() + (totalAdded++);
            }


            if (discrepancyBroker.Insert(discrepancy) == Constants.DB_STATUS.SUCCESSFULL)
            {
                status = Constants.ACTION_STATUS.SUCCESS;
            }
            else
            {
                status = Constants.ACTION_STATUS.FAIL;
            }

            return(status);
        }