public async Task <ActionResult <TalioringBooking> > PostTalioringBooking(TalioringBooking talioringBooking)
        {
            _context.TalioringBookings.Add(talioringBooking);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTalioringBooking", new { id = talioringBooking.TalioringBookingId }, talioringBooking));
        }
        public void OnUpdateData(AprajitaRetailsContext db, TalioringDelivery delivery, bool isEdit, bool isDelete = false)
        {
            TalioringBooking booking = db.TalioringBookings.Find(delivery.TalioringBookingId);

            if (isEdit)
            {
                if (booking != null)
                {
                    var oldId = db.TailoringDeliveries.Where(c => c.TalioringDeliveryId == delivery.TalioringDeliveryId).Select(c => new { c.TalioringBookingId }).FirstOrDefault();
                    if (oldId.TalioringBookingId != delivery.TalioringBookingId)
                    {
                        TalioringBooking old = db.TalioringBookings.Find(oldId.TalioringBookingId);
                        old.IsDelivered         = false;
                        booking.IsDelivered     = true;
                        db.Entry(booking).State = EntityState.Modified;
                        db.Entry(old).State     = EntityState.Modified;
                    }
                }
            }
            else
            {
                if (booking != null)
                {
                    if (isDelete)
                    {
                        booking.IsDelivered = false;
                    }
                    else
                    {
                        booking.IsDelivered = true;
                    }
                    db.Entry(booking).State = EntityState.Modified;
                }
            }
        }
        public async Task <IActionResult> PutTalioringBooking(int id, TalioringBooking talioringBooking)
        {
            if (id != talioringBooking.TalioringBookingId)
            {
                return(BadRequest());
            }

            _context.Entry(talioringBooking).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TalioringBookingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #4
0
        public async Task <IActionResult> Edit(int id, [Bind("TalioringBookingId,BookingDate,CustName,DeliveryDate,TryDate,BookingSlipNo,TotalAmount,TotalQty,ShirtQty,ShirtPrice,PantQty,PantPrice,CoatQty,CoatPrice,KurtaQty,KurtaPrice,BundiQty,BundiPrice,Others,OthersPrice,IsDelivered,StoreId,UserId,EntryStatus,IsReadOnly")] TalioringBooking talioringBooking)
        {
            if (id != talioringBooking.TalioringBookingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(talioringBooking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TalioringBookingExists(talioringBooking.TalioringBookingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreName", talioringBooking.StoreId);
            return(View(talioringBooking));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TalioringBooking talioringBooking = db.Bookings.Find(id);

            db.Bookings.Remove(talioringBooking);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #6
0
        // GET: TalioringBookings/Create
        public ActionResult Create()
        {
            TalioringBooking booking = new TalioringBooking();

            booking.BookingDate  = DateTime.Today;
            booking.TryDate      = DateTime.Today.AddDays(3);
            booking.DeliveryDate = DateTime.Today.AddDays(6);
            return(PartialView(booking));
        }
Exemple #7
0
        private async System.Threading.Tasks.Task <SortedList <int, string> > AddBookingAsync()
        {
            // TalioringBookingId BookingDate CustName DeliveryDate    TryDate BookingSlipNo   TotalAmount TotalQty    ShirtQty ShirtPrice
            // PantQty PantPrice   CoatQty CoatPrice   KurtaQty KurtaPrice  BundiQty BundiPrice  Others OthersPrice IsDelivered StoreId
            // UserName

            var ws = xS.GetWS("Bookings");
            var nonEmptyDataRows = ws.RowsUsed();
            int Row = 6;//Title;
            SortedList <int, string> list = new SortedList <int, string>();

            foreach (var dR in nonEmptyDataRows)
            {
                if (dR.RowNumber() > Row)
                {
                    list.Add(dR.Cell(1).GetValue <int>(), dR.Cell(6).Value.ToString());
                    TalioringBooking book = new TalioringBooking
                    {
                        IsReadOnly    = true,
                        EntryStatus   = 0,
                        BookingDate   = dR.Cell(2).GetDateTime(),
                        CustName      = dR.Cell(3).GetValue <string>(),
                        DeliveryDate  = dR.Cell(4).GetDateTime(),
                        TryDate       = dR.Cell(5).GetDateTime(),
                        BookingSlipNo = dR.Cell(6).Value.ToString(),
                        TotalAmount   = dR.Cell(7).GetValue <decimal>(),
                        TotalQty      = dR.Cell(8).GetValue <int>(),
                        ShirtQty      = dR.Cell(9).GetValue <int>(),
                        ShirtPrice    = dR.Cell(10).GetValue <decimal>(),

                        PantQty   = dR.Cell(11).GetValue <int>(),
                        PantPrice = dR.Cell(12).GetValue <decimal>(),

                        CoatQty   = dR.Cell(13).GetValue <int>(),
                        CoatPrice = dR.Cell(14).GetValue <decimal>(),

                        KurtaQty   = dR.Cell(15).GetValue <int>(),
                        KurtaPrice = dR.Cell(16).GetValue <decimal>(),

                        BundiQty   = dR.Cell(17).GetValue <int>(),
                        BundiPrice = dR.Cell(18).GetValue <decimal>(),

                        Others      = dR.Cell(19).GetValue <int>(),
                        OthersPrice = dR.Cell(20).GetValue <decimal>(),
                        IsDelivered = dR.Cell(21).GetBoolean(),
                        StoreId     = 1,//dR.Cell(22).GetValue<int>(),
                        UserId      = dR.Cell(23).GetValue <string>()
                    };
                    await db.TalioringBookings.AddAsync(book);
                }
            }

            await db.SaveChangesAsync();

            return(list);
        }
 public ActionResult Edit([Bind(Include = "TalioringBookingId,BookingDate,CustName,DeliveryDate,TryDate,BookingSlipNo,TotalAmount,TotalQty,ShirtQty,ShirtPrice,PantQty,PantPrice,CoatQty,CoatPrice,KurtaQty,KurtaPrice,BundiQty,BundiPrice,Others,OthersPrice")] TalioringBooking talioringBooking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(talioringBooking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(PartialView(talioringBooking));
 }
        // GET: TalioringBookings/Create
        public ActionResult Create()
        {
            TalioringBooking booking = new TalioringBooking
            {
                BookingDate  = DateTime.Today,
                TryDate      = DateTime.Today.AddDays(3),
                DeliveryDate = DateTime.Today.AddDays(6)
            };

            return(PartialView(booking));
        }
Exemple #10
0
        public async Task <IActionResult> Create([Bind("TalioringBookingId,BookingDate,CustName,DeliveryDate,TryDate,BookingSlipNo,TotalAmount,TotalQty,ShirtQty,ShirtPrice,PantQty,PantPrice,CoatQty,CoatPrice,KurtaQty,KurtaPrice,BundiQty,BundiPrice,Others,OthersPrice,IsDelivered")] TalioringBooking talioringBooking)
        {
            if (ModelState.IsValid)
            {
                _context.Add(talioringBooking);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView(talioringBooking));
        }
Exemple #11
0
        public ActionResult Create([Bind(Include = "TalioringBookingId,BookingDate,CustName,DeliveryDate,TryDate,BookingSlipNo,TotalAmount,TotalQty,ShirtQty,ShirtPrice,PantQty,PantPrice,CoatQty,CoatPrice,KurtaQty,KurtaPrice,BundiQty,BundiPrice,Others,OthersPrice")] TalioringBooking talioringBooking)
        {
            if (ModelState.IsValid)
            {
                db.Bookings.Add(talioringBooking);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(talioringBooking));
        }
Exemple #12
0
        public async Task <IActionResult> Create([Bind("TalioringBookingId,BookingDate,CustName,DeliveryDate,TryDate,BookingSlipNo,TotalAmount,TotalQty,ShirtQty,ShirtPrice,PantQty,PantPrice,CoatQty,CoatPrice,KurtaQty,KurtaPrice,BundiQty,BundiPrice,Others,OthersPrice,IsDelivered,StoreId,UserId,EntryStatus,IsReadOnly")] TalioringBooking talioringBooking)
        {
            if (ModelState.IsValid)
            {
                _context.Add(talioringBooking);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.StoreID     = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Tailoring/TalioringBookings");
            ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreName", talioringBooking.StoreId);
            return(View(talioringBooking));
        }
        // GET: TalioringBookings/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TalioringBooking talioringBooking = db.Bookings.Find(id);

            if (talioringBooking == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(talioringBooking));
        }
        private void ProcessData(int id, bool isDelete = false)
        {
            TalioringBooking booking = db.Bookings.Find(id);

            if (booking != null && isDelete == false)
            {
                booking.IsDelivered     = true;
                db.Entry(booking).State = EntityState.Modified;
            }
            else if (booking != null && isDelete)
            {
                booking.IsDelivered     = false;
                db.Entry(booking).State = EntityState.Modified;
            }
        }
Exemple #15
0
        [Authorize(Roles = "Admin,PowerUser")]     public async Task <IActionResult> Edit(int id, [Bind("TalioringBookingId,BookingDate,CustName,DeliveryDate,TryDate,BookingSlipNo,TotalAmount,TotalQty,ShirtQty,ShirtPrice,PantQty,PantPrice,CoatQty,CoatPrice,KurtaQty,KurtaPrice,BundiQty,BundiPrice,Others,OthersPrice,IsDelivered")] TalioringBooking talioringBooking)
        {
            if (id != talioringBooking.TalioringBookingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(talioringBooking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TalioringBookingExists(talioringBooking.TalioringBookingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(PartialView(talioringBooking));
        }