public async Task <IActionResult> PutElectricityConnection(int id, ElectricityConnection electricityConnection)
        {
            if (id != electricityConnection.ElectricityConnectionId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutOnlineSaleReturn(int id, OnlineSaleReturn onlineSaleReturn)
        {
            if (id != onlineSaleReturn.OnlineSaleReturnId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutPointRedeemed(int id, PointRedeemed pointRedeemed)
        {
            if (id != pointRedeemed.PointRedeemedId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 4
0
        public async Task <IActionResult> PutEmployee(int id, Employee employee)
        {
            if (id != employee.EmployeeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 5
0
        public async Task <IActionResult> PutPaymentDetail(string id, PaymentDetail paymentDetail)
        {
            if (id != paymentDetail.InvoiceNo)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 6
0
        public async Task <IActionResult> PutStoreHoliday(int id, StoreHoliday storeHoliday)
        {
            if (id != storeHoliday.StoreHolidayId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 7
0
        public async Task <IActionResult> PutAppInfo(int id, AppInfo appInfo)
        {
            if (id != appInfo.AppInfoId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 8
0
        public async Task <IActionResult> PutDueRecoverd(int id, DueRecoverd dueRecoverd)
        {
            if (id != dueRecoverd.DueRecoverdId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutRegularInvoice(string id, RegularInvoice regularInvoice)
        {
            if (id != regularInvoice.InvoiceNo)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 10
0
        public async Task <IActionResult> PutProductItem(int id, ProductItem productItem)
        {
            if (id != productItem.ProductItemId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 11
0
        public async Task <IActionResult> PutLedgerMaster(int id, LedgerMaster ledgerMaster)
        {
            if (id != ledgerMaster.LedgerMasterId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 12
0
        public async Task <IActionResult> PutSaleTaxType(int id, SaleTaxType saleTaxType)
        {
            if (id != saleTaxType.SaleTaxTypeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 13
0
        public async Task <IActionResult> PutPaySlip(int id, PaySlip paySlip)
        {
            if (id != paySlip.PaySlipId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 14
0
        public async Task <IActionResult> PutReceipt(int id, Receipt receipt)
        {
            if (id != receipt.ReceiptId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        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());
        }
        public async Task <IActionResult> PutTranscationMode(int id, TranscationMode transcationMode)
        {
            if (id != transcationMode.TranscationModeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 17
0
        public async Task <IActionResult> PutCashDetail(int id, CashDetail cashDetail)
        {
            if (id != cashDetail.CashDetailId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 18
0
        public async Task <IActionResult> PutCouponPayment(int id, CouponPayment couponPayment)
        {
            if (id != couponPayment.CouponPaymentId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 19
0
        public async Task <IActionResult> PutBankWithdrawal(int id, BankWithdrawal bankWithdrawal)
        {
            if (id != bankWithdrawal.BankWithdrawalId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 20
0
        //StoreBased Action
        public void CashInBankCorrectionForMonth(eStoreDbContext db, DateTime forDate, int StoreId)
        {
            IEnumerable <CashInBank> cashs = db.CashInBanks.Where(c => c.CIBDate.Month == forDate.Month && c.CIBDate.Year == forDate.Year && c.StoreId == StoreId).OrderBy(c => c.CIBDate);

            decimal cBal = 0;

            if (cashs != null && cashs.Any())
            {
                cBal = GetClosingBalance(db, cashs.First().CIBDate, StoreId);
                if (cBal == 0)
                {
                    cBal = cashs.First().OpenningBalance;
                }

                foreach (var cash in cashs)
                {
                    cash.OpenningBalance = cBal;

                    cash.ClosingBalance = cash.OpenningBalance + cash.CashIn - cash.CashOut;
                    cBal = cash.ClosingBalance;

                    db.Entry(cash).State = EntityState.Modified;
                }
                try
                {
                    db.SaveChanges();
                }
                catch (Exception)
                {
                    // Log.Info("CashInBank Correction failed");
                }
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Tailoring Manager
        /// </summary>
        /// <param name="db"></param>
        /// <param name="delivery"></param>
        /// <param name="isEdit"></param>
        /// <param name="isDelete"></param>
        public void OnUpdateData(eStoreDbContext db, TalioringDelivery delivery, bool isEdit, bool isDelete = false)
        {
            TalioringBooking booking = db.TalioringBookings.Find(delivery.TalioringBookingId);

            //Updating Booking for Delivery Status.
            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;
                }
            }
        }
Esempio n. 22
0
        //StoreBased Action
        public void ProcessBankClosingBalance(eStoreDbContext db, DateTime date, int StoreId, bool saveit = false)
        {
            CashInBank today;

            today = db.CashInBanks.Where(c => c.CIBDate.Date == date.Date && c.StoreId == StoreId).FirstOrDefault();
            if (today != null)
            {
                if (today.ClosingBalance != today.OpenningBalance + today.CashIn - today.CashOut)
                {
                    today.ClosingBalance  = today.OpenningBalance + today.CashIn - today.CashOut;
                    db.Entry(today).State = EntityState.Modified;
                    if (saveit)
                    {
                        db.SaveChanges();
                    }
                }
            }
        }
Esempio n. 23
0
        //Update CashOutHand/Bank
        public static void UpDateCashOutHand(eStoreDbContext db, DateTime dateTime, decimal Amount, bool saveit = false)
        {
            //throw new NotImplementedException();
            CashInHand cashIn = db.CashInHands.Where(d => d.CIHDate == dateTime).FirstOrDefault();

            if (cashIn != null)
            {
                cashIn.CashOut        += Amount;
                db.Entry(cashIn).State = EntityState.Modified;
                if (saveit)
                {
                    db.SaveChanges();
                }
            }
            else
            {
                CreateCashInHand(db, dateTime, 0, Amount, saveit);
            }
        }
Esempio n. 24
0
 public void Update(T entity)
 {
     _db.Attach(entity);
     _context.Entry(entity).State = EntityState.Modified;
 }