public bool SaveSaleDetailItems(SaleDetail model, int checkupdate)
        {
            using (RMSDBEntities db = new RMSDBEntities())
            {
                if (checkupdate == 0)

                {
                    db.SaleDetails.Add(model);
                    db.SaveChanges();
                    return(true);
                }
                else
                {
                    SaleDetail RowinDb = db.SaleDetails.Where(d => d.TicketNo == model.TicketNo && d.ItemId == model.ItemId).SingleOrDefault();



                    RowinDb.ItemId         = model.ItemId;
                    RowinDb.itemName       = model.itemName;
                    RowinDb.Price          = model.Price;
                    RowinDb.Discount       = model.Discount;
                    RowinDb.Quantity       = model.Quantity;
                    RowinDb.Total          = model.Total;
                    RowinDb.TicketNo       = model.TicketNo;
                    RowinDb.RecordID       = model.RecordID;
                    RowinDb.Aed_Vat        = model.Aed_Vat;
                    RowinDb.Aed_Vat_Amount = model.Aed_Vat_Amount;
                    RowinDb.Date           = model.Date;

                    db.SaveChanges();
                    return(true);
                }
            }
        }
        public bool Delete_SaleItemFromSaleDetail(int id)
        {
            using (RMSDBEntities db = new RMSDBEntities())
            {
                if (id != 0)
                {
                    SaleDetail RowinDb = db.SaleDetails.Where(d => d.RecordID == id).SingleOrDefault();

                    {
                        db.SaleDetails.Remove(RowinDb);
                        db.SaveChanges();
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
            }
        }