Exemple #1
0
        public Task <bool> DeleteAsync(BILL_DETAILSVM entity)
        {
            return(Task.Run <bool>(() =>
            {
                BILL_DETAILS bd = new BILL_DETAILS
                {
                    AddedBy = entity.AddedBy,
                    AddedOn = entity.AddedOn,
                    BILL_DETAILS_REMARKS = entity.BILL_DETAILS_REMARKS,
                    BILL_ID = entity.BILL_ID,
                    BILL_INVENTORY_VALUE = entity.BILL_INVENTORY_VALUE,
                    Disable = entity.Disable,
                    DISC_RATE = entity.DISC_RATE,
                    DISC_VALUE = entity.DISC_VALUE,
                    EMP_ID = entity.EMP_ID,
                    EXPIRED_DATE = entity.EXPIRED_DATE,
                    EXTRA_RATE = entity.EXTRA_RATE,
                    EXTRA_VALUE = entity.EXTRA_VALUE,
                    GIFT = entity.GIFT,
                    GRID_ROW_NUMBER = entity.GRID_ROW_NUMBER,
                    ITEM_ID = entity.ITEM_ID,
                    PRODUCTION_DATE = entity.PRODUCTION_DATE,
                    QTY = entity.QTY,
                    SERVICE_ID = entity.SERVICE_ID,
                    UNIT_ID = entity.UNIT_ID,
                    UNIT_PRICE = entity.UNIT_PRICE,
                    CaliberID = entity.CaliberID,
                    UpdatedBy = entity.UpdatedBy,
                    UpdatedOn = entity.UpdatedOn,
                    ItemWeight = entity.ItemWeight,
                    ManufacturingWages = entity.ManufacturingWages,
                    itemGmWages = entity.itemGmWages,
                    CostCenterID = entity.CostCenterID,

                    VATRate = entity.VATRate,
                    SubjectToVAT = entity.SubjectToVAT,
                    VatValue = entity.VatValue,

                    WagesDiscRate = entity.WagesDiscRate,
                    WagesDiscValue = entity.WagesDiscValue,

                    ActualItemWeight = entity.ActualItemWeight,
                    TaxTotal = entity.TaxTotal,
                    IsExemptOfTax = entity.IsExemptOfTax,

                    ClearnessRate = entity.ClearnessRate
                };
                object[] keys = new object[2] {
                    entity.BILL_ID, entity.GRID_ROW_NUMBER
                };
                billDetailsMRepo.DeleteComposite(bd, keys);
                return true;
            }));
        }
Exemple #2
0
        public bool InsertBillDetails(List <BILL_DETAILSVM> BillDetails)
        {
            long Bill_ID = Convert.ToInt32(BillDetails[0].BILL_ID);

            if (Bill_ID < 1)
            {
                Bill_ID = billMasterMRepo.GetAll().OrderByDescending(m => m.BILL_ID).FirstOrDefault().BILL_ID;
            }

            //Delete All
            {
                List <BILL_DETAILS> ShouldBeDeleted = billDetailsMRepo.Filter(x => x.BILL_ID == Bill_ID).ToList <BILL_DETAILS>();

                foreach (BILL_DETAILS item in ShouldBeDeleted)
                {
                    object[] keys = new object[2] {
                        Bill_ID, item.GRID_ROW_NUMBER
                    };
                    billDetailsMRepo.DeleteComposite(item, keys);
                    //new { Bill_ID = item.BILL_ID, GRID_ROW_NUMBER = item.GRID_ROW_NUMBER }
                }
            }

            //Insert All Again
            foreach (BILL_DETAILSVM item in BillDetails)
            {
                if (item.ITEM_ID > 0)
                {
                    BILL_DETAILS Bill_DetailObj = new BILL_DETAILS();
                    Bill_DetailObj.AddedBy = item.AddedBy;
                    Bill_DetailObj.AddedOn = item.AddedOn;
                    Bill_DetailObj.BILL_DETAILS_REMARKS = item.BILL_DETAILS_REMARKS;
                    Bill_DetailObj.BILL_ID = Bill_ID;
                    Bill_DetailObj.BILL_INVENTORY_VALUE = item.BILL_INVENTORY_VALUE;
                    Bill_DetailObj.Disable    = item.Disable;
                    Bill_DetailObj.DISC_RATE  = item.DISC_RATE;
                    Bill_DetailObj.DISC_VALUE = item.DISC_VALUE;

                    Bill_DetailObj.EXPIRED_DATE       = item.EXPIRED_DATE;
                    Bill_DetailObj.EXTRA_RATE         = item.EXTRA_VALUE;
                    Bill_DetailObj.EXTRA_VALUE        = item.EXTRA_VALUE;
                    Bill_DetailObj.GIFT               = item.GIFT;
                    Bill_DetailObj.GRID_ROW_NUMBER    = item.GRID_ROW_NUMBER;
                    Bill_DetailObj.ITEM_ID            = item.ITEM_ID;
                    Bill_DetailObj.PRODUCTION_DATE    = item.PRODUCTION_DATE;
                    Bill_DetailObj.QTY                = item.QTY;
                    Bill_DetailObj.SERVICE_ID         = item.SERVICE_ID;
                    Bill_DetailObj.UNIT_ID            = Convert.ToInt16(GetUnitIDByItemID(item.ITEM_ID));
                    Bill_DetailObj.UNIT_PRICE         = item.UNIT_PRICE;
                    Bill_DetailObj.CaliberID          = item.CaliberID;
                    Bill_DetailObj.UpdatedBy          = item.UpdatedBy;
                    Bill_DetailObj.UpdatedOn          = item.UpdatedOn;
                    Bill_DetailObj.EMP_ID             = item.EMP_ID;
                    Bill_DetailObj.ItemWeight         = item.ItemWeight;
                    Bill_DetailObj.ManufacturingWages = item.ManufacturingWages;
                    Bill_DetailObj.itemGmWages        = item.itemGmWages;
                    Bill_DetailObj.CostCenterID       = item.CostCenterID;

                    Bill_DetailObj.VATRate      = item.VATRate;
                    Bill_DetailObj.SubjectToVAT = item.SubjectToVAT;
                    Bill_DetailObj.VatValue     = item.VatValue;

                    Bill_DetailObj.WagesDiscRate  = item.WagesDiscRate;
                    Bill_DetailObj.WagesDiscValue = item.WagesDiscValue;

                    Bill_DetailObj.ActualItemWeight = item.ActualItemWeight;
                    Bill_DetailObj.TaxTotal         = item.TaxTotal;
                    Bill_DetailObj.IsExemptOfTax    = item.IsExemptOfTax;

                    Bill_DetailObj.ClearnessRate = item.ClearnessRate;

                    billDetailsMRepo.Add(Bill_DetailObj);
                }
            }

            return(true);
        }