public ActionResult EditCash([FromBody] Cash[] cashes)
        {
            if (_context.Cash.Where(d => d.Defenition == cashes[0].Defenition && d.Number == cashes[0].Number).Count() > 0)
            {
                return(Json("Bu məlumatlara uyğun kassa mövcuddur"));
            }
            if (cashes[0].Number == "" || cashes[0].Defenition == "")
            {
                var cash = _context.Cash.Find(cashes[0].Id);
                return(PartialView(cash));
            }
            string result = "Sistem xətası";

            try
            {
                Cash cash = new Cash();
                cash.Id         = cashes[0].Id;
                cash.Number     = cashes[0].Number;
                cash.Defenition = cashes[0].Defenition;

                _context.Update(cash);
                _context.SaveChanges();
                result = "Əməliyyat uğurla tamamlandı!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return(Json(result));
        }
        public ActionResult EditUser([FromBody] Users[] users)
        {
            string result = "Sistem xətası";

            try
            {
                Users user = new Users();
                user.Id       = users[0].Id;
                user.Username = users[0].Username;
                if (_context.Users.Where(n => n.Id == users[0].Id && n.Password == users[0].Password).Count() > 0)
                {
                    user.Password = users[0].Password;
                }
                else
                {
                    user.Password = Encrypt(users[0].Password.ToString());
                }
                user.IsAdmin = users[0].IsAdmin;

                _context.Update(user);
                _context.SaveChanges();
                result = "Əməliyyat yğurla tamamlandı";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
            return(Json(result));
        }
Exemple #3
0
        public ActionResult EditCostType([FromBody] CostType[] costTypes)
        {
            if (_context.CostType.Where(c => c.Defenition == costTypes[0].Defenition).Count() > 0)
            {
                return(Json("Bu məxaric növü mövcuddur"));
            }
            string result = "Sistem xətası";

            try
            {
                CostType costType = new CostType();
                costType.Id         = costTypes[0].Id;
                costType.Defenition = costTypes[0].Defenition;

                _context.Update(costType);
                _context.SaveChanges();
                result = "Əməliyyat uğurla tamamlandı!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }


            return(Json(result));
        }
        public ActionResult EditObject([FromBody] Objects[] objects)
        {
            if (_context.Objects.Where(
                    o => o.BuildingId == objects[0].BuildingId &&
                    o.Floor == objects[0].Floor &&
                    o.Porch == objects[0].Porch &&
                    o.Number == objects[0].Number &&
                    o.ObjectTypeId == objects[0].ObjectTypeId).Count() > 0)
            {
                return(Json("Bu obyek artıq mövcuddur"));
            }
            string result = "";

            try
            {
                Objects obj = new Objects();
                obj.Porch        = objects[0].Porch;
                obj.Floor        = objects[0].Floor;
                obj.Number       = objects[0].Number;
                obj.Squares      = objects[0].Squares;
                obj.BuildingId   = objects[0].BuildingId;
                obj.ObjectTypeId = objects[0].ObjectTypeId;

                _context.Update(obj);
                _context.SaveChanges();
                result = "Əməliyyat uğurla tamamlandı!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }


            return(Json(result));
        }
        public ActionResult EditObjectType([FromBody] ObjectType[] objectTypes)
        {
            if (_context.ObjectType.Where(o => o.Defenition == objectTypes[0].Defenition).Count() > 0)
            {
                return(Json("Bu obyekt növü mövcuddur"));
            }
            string result = "Sistem xətası";

            try
            {
                ObjectType objectType = new ObjectType();
                objectType.Id         = objectTypes[0].Id;
                objectType.Defenition = objectTypes[0].Defenition;

                _context.Update(objectType);
                _context.SaveChanges();
                result = "Əməliyyat uğurla tamamlandı!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }


            return(Json(result));
        }
        public ActionResult EditCustomerType([FromBody] CustomerType[] customerTypes)
        {
            if (_context.CustomerType.Where(d => d.Defenition == customerTypes[0].Defenition).Count() > 0)
            {
                return(Json("Bu müştəri tipi mövcuddur"));
            }
            string result = "Sistem xətası";

            try
            {
                CustomerType customerType = new CustomerType();
                customerType.Id         = customerTypes[0].Id;
                customerType.Defenition = customerTypes[0].Defenition;

                _context.Update(customerType);
                _context.SaveChanges();
                result = "Əməliyyat uğurla tamamlandı!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }


            return(Json(result));
        }
        public ActionResult EditBuilding([FromBody] Building[] buildings)
        {
            string result = "Sistem xətası";

            if (_context.Building.Where(n => n.Number == buildings[0].Number && n.Address == buildings[0].Address).Count() > 0)
            {
                return(Json("Bu məlumatlara uyğun bina mövcuddur"));
            }
            try
            {
                Building building = new Building();
                building.Id      = buildings[0].Id;
                building.Number  = buildings[0].Number;
                building.Address = buildings[0].Address;

                _context.Update(building);
                _context.SaveChanges();
                result = "Əməliyyat uğurla tamamlandı!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return(Json(result));
        }
        public ActionResult EditIncomeType([FromBody] IncomeType[] incomeTypes)
        {
            if (_context.IncomeType.Where(i => i.Defenition == incomeTypes[0].Defenition).Count() > 0)
            {
                return(Json("Bu mədaxil növü mövcuddur"));
            }
            string result = "Sistem xətası";

            try
            {
                IncomeType incomeType = new IncomeType();
                incomeType.Id         = incomeTypes[0].Id;
                incomeType.Defenition = incomeTypes[0].Defenition;

                _context.Update(incomeType);
                _context.SaveChanges();
                result = "Əməliyyat uğurla tamamlandı!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }


            return(Json(result));
        }
Exemple #9
0
        public ActionResult EditCustomer([FromBody] Customers[] customers)
        {
            if (_context.Customers.Where(
                    c => c.Name == customers[0].Name &&
                    c.Surname == customers[0].Surname &&
                    c.DocNumber == customers[0].DocNumber &&
                    c.Phone == customers[0].Phone).Count() > 0)
            {
                return(Json("Bu müştəri artıq mövcuddur"));
            }
            string result = "Sistem xətası";

            try
            {
                Customers customer = new Customers();
                customer.Id             = customers[0].Id;
                customer.Name           = customers[0].Name;
                customer.Surname        = customers[0].Surname;
                customer.Phone          = customers[0].Phone;
                customer.Email          = customers[0].Email;
                customer.DocNumber      = customers[0].DocNumber;
                customer.CustomerTypeId = customers[0].CustomerTypeId;

                _context.Update(customer);
                _context.SaveChanges();
                result = "Əməliyyat uğurla tamamlandı!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return(Json(result));
        }
Exemple #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Defenition")] SignType signType)
        {
            if (id != signType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(signType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SignTypeExists(signType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(signType));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ContractDetailId,PaymentDate,Reason,CreateDate")] PaymentDuration paymentDuration)
        {
            if (id != paymentDuration.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paymentDuration);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentDurationExists(paymentDuration.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractDetailId"] = new SelectList(_context.ContractDetail, "Id", "Id", paymentDuration.ContractDetailId);
            return(View(paymentDuration));
        }
Exemple #12
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Amount,CreatedDate,PaymentDate,Explanation,Explanation2,Explanation3,ContractId,Customer,Cash,CostTypDefenition,IncomeTypeDefenition,TransactionTypDefenition,SupportTypDefenition,Number,CustDocno,SignTypeId,SignTypeDefenition,CashId,TransactionTypeId,CustomersId,CostTypeId,SupportTypeId,ObjectsId,PaymentsId,IncomeTypeId")] PaymentTransactions paymentTransactions)
        {
            if (id != paymentTransactions.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paymentTransactions);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentTransactionsExists(paymentTransactions.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(paymentTransactions));
        }
Exemple #13
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,ContractDetailId,SupportTypeId,ObjectsId,Amount,SpDefenition,ObjNumber,CustomersId,MonthDept")] PaymentsList paymentsList)
        {
            if (id != paymentsList.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paymentsList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentsListExists(paymentsList.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(paymentsList));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ContractId,SupportTypeId,ServicePrice,ObjectsId")] ContractDetail contractDetail)
        {
            if (id != contractDetail.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contractDetail);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContractDetailExists(contractDetail.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractId"]    = new SelectList(_context.Contract, "Id", "Id", contractDetail.ContractId);
            ViewData["ObjectsId"]     = new SelectList(_context.Set <Objects>(), "Id", "Floor", contractDetail.ObjectsId);
            ViewData["SupportTypeId"] = new SelectList(_context.Set <SupportType>(), "Id", "Defenition", contractDetail.SupportTypeId);
            return(View(contractDetail));
        }
Exemple #15
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Defenition,Number")] Permission permission)
        {
            if (id != permission.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(permission);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PermissionExists(permission.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(permission));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Explanation")] Salary salary)
        {
            if (id != salary.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(salary);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SalaryExists(salary.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(salary));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,Amount,CashId,Number,Defenition")] CashBalance cashBalance)
        {
            if (id != cashBalance.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cashBalance);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CashBalanceExists(cashBalance.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cashBalance));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,PermissionId,Acces")] UserPermissions userPermissions)
        {
            if (id != userPermissions.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userPermissions);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserPermissionsExists(userPermissions.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PermissionId"] = new SelectList(_context.Permission, "Id", "Id", userPermissions.PermissionId);
            ViewData["UserId"]       = new SelectList(_context.Set <Users>(), "Id", "Password", userPermissions.UserId);
            return(View(userPermissions));
        }
Exemple #19
0
        public ActionResult EditContract([FromBody] Contract[] contracts)
        {
            string result = "Error";

            try
            {
                Contract contract = new Contract();
                contract.Id          = contracts[0].Id;
                contract.CustomersId = contracts[0].CustomersId;
                contract.Notes       = contracts[0].Notes;
                contract.PaymentDate = contracts[0].PaymentDate;
                _context.Update(contract);
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                result = ex.Message;
            }
            return(Json(result));
        }
        public ActionResult EditSupportType([FromBody] SupportType[] supportTypes)
        {
            string result = "Sistem xətası";

            try
            {
                SupportType supportType = new SupportType();
                supportType.Id         = supportTypes[0].Id;
                supportType.Defenition = supportTypes[0].Defenition;
                _context.Update(supportType);
                _context.SaveChanges();
                result = "Əməliyyat uğurla tamamlandı!";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }


            return(Json(result));
        }
        public ActionResult EditPayment([FromBody] Payments[] payments)
        {
            string result = "Sistem xətası";

            try
            {
                Payments payment = new Payments();
                payment.Id          = payments[0].Id;
                payment.Amount      = payments[0].Amount;
                payment.Explanation = payments[0].Explanation;
                //payment.Explanation2 = payments[0].Explanation2;
                //payment.Explanation3 = payments[0].Explanation3;
                //payment.TransactionTypeId = payments[0].TransactionTypeId;
                //payment.SignTypeId = payments[0].SignTypeId;
                //payment.CashId = payments[0].CashId;
                //if (payments[0].CostTypeId != null)
                //{
                //    payment.CostTypeId = payments[0].CostTypeId;
                //}
                //if (payments[0].ContractDetailId != null)
                //{
                //    payment.ContractDetailId = payments[0].ContractDetailId;
                //}
                //if (payments[0].IncomeTypeId != null)
                //{
                //    payment.IncomeTypeId = payments[0].IncomeTypeId;
                //}

                _context.Update(payment);
                _context.SaveChanges();

                result = "Əməliyyat uğurla tamamlandı";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return(Json(result));
        }
        public ActionResult EditDuration([FromBody] PaymentDuration[] paymentDurations)
        {
            string result = "Sistem xətası";

            try
            {
                PaymentDuration paymentDuration = new PaymentDuration();
                paymentDuration.Id          = paymentDurations[0].Id;
                paymentDuration.PaymentDate = paymentDurations[0].PaymentDate;
                paymentDuration.Reason      = paymentDurations[0].Reason;

                _context.Update(paymentDuration);
                _context.SaveChanges();

                result = "Əməliyyat uğurla tamamlandı";
                return(Json(result));
            }
            catch (Exception ex)
            {
                result = ex.Message;
                return(Json(result));
            }
        }