public bool addDiscrepancyDetail(iDiscrepancyDetail idisd)
    {
        ReportDescrepancyController rd   = new ReportDescrepancyController();
        DiscrepancyDetail           disd = new DiscrepancyDetail();

        disd = changeiDisdtoDisdEntity(idisd);

        return(rd.insertDiscrepancyDetail(disd));
    }
    public bool addDiscrepancy(iDiscrepancy ides)
    {
        ReportDescrepancyController rd = new ReportDescrepancyController();
        Discrepancy des = new Discrepancy();

        des = changeiDestoDesEntity(ides);

        return(rd.insertDiscrepancy(des));
    }
    public iStock[] StockByID(string id)
    {
        List <iStock> list             = new List <iStock>();
        ReportDescrepancyController rd = new ReportDescrepancyController();
        Stock stk = new Stock();

        stk = rd.getStockByID(id);
        iStock istk = new iStock();

        istk = ChangeStockEntitytoiStock(stk);
        list.Add(istk);
        return(list.ToArray <iStock>());
    }
    public iStock[] StockList()

    {
        ReportDescrepancyController rd = new ReportDescrepancyController();
        List <Stock> list = new List <Stock>();

        list = rd.getAllStock();
        List <iStock> ilist = new List <iStock>();

        for (int i = 0; i < list.Count; i++) // Loop through List with for
        {
            iStock ist = new iStock();
            ist = ChangeStockEntitytoiStock(list[i]);
            ilist.Add(ist);
        }
        return(ilist.ToArray <iStock>());
    }
    public DiscrepancyDetail changeiDisdtoDisdEntity(iDiscrepancyDetail idisd)
    {
        DiscrepancyDetail           disd = new DiscrepancyDetail();
        ReportDescrepancyController rd   = new ReportDescrepancyController();

        disd.DiscrepancyID = rd.getDiscrepancyID();
        disd.ItemCode      = idisd.ItemCode;
        if (idisd.Quantity < 0)
        {
            disd.Quantity = -1 * idisd.Quantity;
        }
        else
        {
            disd.Quantity = idisd.Quantity;
        }
        disd.Amount      = float.Parse(idisd.Amount);
        disd.IsAdded     = bool.Parse(idisd.IsAdded);
        disd.Reason      = idisd.Reason;
        disd.DeletedFlag = false;
        return(disd);
    }