예제 #1
0
        public void AddProduct(Product product)
        {
            var productData     = _productfactory.CreateProductData(product);
            var productCategory = new List <Persistence.Data.WebShopModel.ProductCategory>();

            if (product.ListCategories.Count > 0)
            {
                foreach (var item in product.ListCategories)
                {
                    if (item.IdCategory > 0)
                    {
                        productCategory.Add(new Persistence.Data.WebShopModel.ProductCategory
                        {
                            Product    = productData,
                            IdCategory = item.IdCategory
                        });
                    }
                }
                _unitofwork.ProductCategoryRepository.AddRange(productCategory);
                _unitofwork.Complete();
            }
            else
            {
                _unitofwork.ProductRepository.Add(productData);
                _unitofwork.Complete();
            }
        }
예제 #2
0
        public ActionResult AddPatient(PatientFormViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                viewModel.Cities  = _unitofWork.Cities.GetCities();
                viewModel.Heading = "New Patient";

                return(View(viewModel));
            }
            var patient = new Patient()
            {
                Name      = viewModel.Name,
                Address   = viewModel.Address,
                BirthDate = viewModel.GetBirthDate(),
                CityId    = viewModel.City,
                DateTime  = DateTime.Now,
                Sex       = viewModel.Sex,
                DStatus   = true,
                Phone     = viewModel.Phone,
                Height    = viewModel.Height,
                Weight    = viewModel.Weight,
                Token     = DateTime.Now.ToString("ddMMyyyy") + new Random(1000).Next(1000).ToString()
            };

            _unitofWork.Patients.Add(patient);
            _unitofWork.Complete();
            return(RedirectToAction("Index"));
        }
        public ActionResult MakeAppointment(AppointmentFormViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                viewModel.DoctorsList = _unitofWork.Doctors.DoctorsToSelectList();
                return(View("AttendanceForm", viewModel));
            }

            var appoint = new Appointment()
            {
                DoctorId          = viewModel.Doctor,
                Doctor            = _unitofWork.Doctors.GetDoctor(viewModel.Doctor),
                Detail            = viewModel.Detail,
                PatientId         = viewModel.Patient,
                StartDateTime     = viewModel.GetStartDateTime(),
                AppointmentStatus = AppointmentStatus.Pending,
                DStatus           = true
            };

            if (_unitofWork.Appointments.ValidateAppointment(viewModel.GetStartDateTime(), viewModel.Doctor))
            {
                viewModel.DoctorsList = _unitofWork.Doctors.DoctorsToSelectList();
                ViewBag.ApptError     = "Appointment not available in the choosen Datetime";
                return(View(viewModel));
            }
            _unitofWork.Appointments.AddAppointment(appoint);
            _unitofWork.Complete();
            return(RedirectToActionPermanent("AllAppointments", "Appointments"));
        }
        public async Task AddDevice(Device device)
        {
            if (await _unitofWork.DeviceRepository.AnyAsync(e => e.DeviceId == device.DeviceId))
            {
                throw new UserFriendlyException("Device is already Assigned");
            }
            await _unitofWork.DeviceRepository.AddAsync(device);

            _unitofWork.Complete();
        }
 public ActionResult EditSpecialization(SpecializationViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var spec = _unitofWork.Specializations.GetSpecialization(viewModel.Id);
         spec.Name        = viewModel.Name;
         spec.Description = viewModel.Description;
         _unitofWork.Complete();
         return(RedirectToActionPermanent("Specializations"));
     }
     return(View("SpecForm", viewModel));
 }
예제 #6
0
        public async Task <Order> UpdateOrderPaymentFailed(string paymentIntentId)
        {
            var spec  = new OrderByPaymentIntentIdSpecification(paymentIntentId);
            var order = await _unitofWork.Repository <Order>().GetEntityWithSpec(spec);

            if (order == null)
            {
                return(null);
            }

            order.Status = OrderStatus.PaymentFailed;
            _unitofWork.Repository <Order>().Update(order);

            await _unitofWork.Complete();

            return(order);
        }
        public ActionResult Edit(DoctorFormViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Specializations = _unitOfWork.Specializations.GetSpecializations();
                return(View(model));
            }
            var docInDb = _unitOfWork.Doctors.GetDoctor(model.Id);

            docInDb.Id               = model.Id;
            docInDb.IsAvailable      = model.IsAvailable;
            docInDb.Name             = model.Name;
            docInDb.Phone            = model.Phone;
            docInDb.Address          = model.Address;
            docInDb.SpecializationId = model.Specialization;
            _unitOfWork.Complete();
            return(RedirectToAction("DoctorProfile"));
        }
예제 #8
0
 public override void LogMessage(Log log)
 {
     lock (lockObj)
     {
         _unitOfWork.Loggings.Add(log);
         _unitOfWork.Complete();
     }
     //_unitOfWork.Dispose();
 }
예제 #9
0
        public async Task <IActionResult> Createreceipe([FromBody] SaveRecipe saveRecipe)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest());
                }
                var receipe = mapper.Map <SaveRecipe, receipe>(saveRecipe);
                receipe.CreateDate = DateTime.Now;
                CookbookRepository.Createreceipe(receipe);
                await unitofWork.Complete();

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
예제 #10
0
        public ActionResult Create(ContactFormViewModel contactViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("ContactForm", contactViewModel));
            }

            var contact = new Contact
            {
                UserId      = User.Identity.GetUserId(),
                FirstName   = contactViewModel.FirstName,
                LastName    = contactViewModel.LastName,
                EmailId     = contactViewModel.EmailId,
                Status      = contactViewModel.Status,
                PhoneNumber = contactViewModel.PhoneNumber
            };

            _unitofWork.Contacts.Add(contact);
            _unitofWork.Complete();

            return(RedirectToAction("Index", "Home"));
        }
        public ICommandResult <StatusMessage> Handle(InviteUserCommand command)
        {
            StatusMessage message      = new StatusMessage();
            UserLogin     objuserLogin = new UserLogin();

            message.IsSuccessful = false;
            try
            {
                objuserLogin.UserName     = command.AppartmentNumber;
                objuserLogin.PasswordHash = command.PasswordHash;

                if (_unitofWork.Complete() > 0)
                {
                    var userLogin = _unitofWork.UserLogins.GetUserLoginByName(command.AppartmentNumber.Trim());

                    User objUser = new User();
                    objUser.AppartmentNumber = command.AppartmentNumber;
                    objUser.ContactNumber1   = command.ContactNumber1;
                    objUser.ContactNumber2   = command.ContactNumber2;
                    objUser.FirstName        = command.FirstName;
                    objUser.MiddleName       = command.MiddleName;
                    objUser.LastName         = command.LastName;
                    objUser.PrimaryEmail     = command.PrimaryEmail;
                    objUser.RoleID           = command.RoleID;
                    objUser.UserLoginID      = userLogin.UserLoginID;
                    _unitofWork.Complete();
                    message.IsSuccessful = true;
                    message.Message      = "User Invitation Success";
                }
            }
            catch (Exception ex)
            {
                message.IsSuccessful = false;
                message.Message      = "User Invitation Failed";
            }

            return(CommandResult.OK(message));
        }
예제 #12
0
        public IActionResult Delete(int id)
        {
            var user = _unitOfWork.User.GetUser(id);

            if (user == null)
            {
                return(NotFound());
            }

            user.Cancel();
            _unitOfWork.Complete();

            return(RedirectToAction("Index", "Admin"));
        }
예제 #13
0
        public void AddGender(Gender gender)
        {
            var genderData = _genderFactory.CreateGenderData(gender);

            if (genderData != null)
            {
                _unitofwork.GenderRepository.Add(genderData);
                _unitofwork.Complete();
            }
            else
            {
                throw new MappingFailedException("The Gender was not mapped");
            }
        }
예제 #14
0
        public async Task <Order> CreateOrderAsync(string buyerEmail, int deliveryMethodId, string basketId,
                                                   Address shippingAddress)
        {
            // get basket from the repo
            var basket = await _basketRepo.GetBasketAsync(basketId);

            // get items from the product repo
            var items = new List <OrderItem>();

            foreach (var item in basket.Items)
            {
                var productItem = await _unitofWork.Repository <Product>().GetByIdAsync(item.Id);

                var itemOrdered = new ProductItemOrdered(productItem.Id, productItem.Name,
                                                         productItem.PictureUrl);
                var orderItem = new OrderItem(itemOrdered, productItem.Price, item.Quantity);
                items.Add(orderItem);
            }
            // get delivery method from repo
            var deliveryMethod = await _unitofWork.Repository <DeliveryMethod>().GetByIdAsync(deliveryMethodId);

            // calc subtotal
            var subtotal = items.Sum(item => item.Price * item.Quantity);

            // create order
            var order = new Order(items, buyerEmail, shippingAddress, deliveryMethod, subtotal);

            _unitofWork.Repository <Order>().Add(order);

            // save to db
            var result = await _unitofWork.Complete();

            if (result <= 0)
            {
                return(null);
            }

            //delete basket
            await _basketRepo.DeleteBasketAsync(basketId);

            // return order
            return(order);
        }
예제 #15
0
        public async Task <Order> CreateOrderAync(string buyerEmail, int deliveryMethodId, string basketId, Address shippingAddress)
        {
            var basket = await _basketRepo.GetBasketAsync(basketId);

            var items = new List <OrderItem>();

            foreach (var item in basket.Items)
            {
                var productItem = await _unitofWork.Repository <Product>().GetByIdAsync(item.Id);

                var itemOrdered = new ProductItemOrdered(productItem.Id, productItem.Name, productItem.PictureUrl);
                var orderItem   = new OrderItem(itemOrdered, productItem.Price, item.Quantity);
                items.Add(orderItem);
            }

            var deliveryMethod = await _unitofWork.Repository <DeliveryMethod>().GetByIdAsync(deliveryMethodId);

            var subtotal = items.Sum(item => item.Price * item.Quantity);

            var spec          = new OrderByPaymentIntentIdSpecification(basket.PaymentIntentId);
            var existingOrder = await _unitofWork.Repository <Order>().GetEntityWithSpec(spec);

            if (existingOrder != null)
            {
                _unitofWork.Repository <Order>().Delete(existingOrder);
                await _paymentService.CreateOrUpdatePaymentIntent(basket.PaymentIntentId);
            }

            var order = new Order(items, buyerEmail, shippingAddress, deliveryMethod, subtotal, basket.PaymentIntentId);

            _unitofWork.Repository <Order>().Add(order);

            var result = await _unitofWork.Complete();

            if (result <= 0)
            {
                return(null);
            }

            return(order);
        }
예제 #16
0
        public async Task <int> SaveInvoice(Invoice data)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    var model = new Invoice
                    {
                        Amount       = data.Amount,
                        DeliveryDate = data.DeliveryDate,
                        Description  = data.Description,
                        InvoiceDate  = data.InvoiceDate,
                        SettleDate   = data.SettleDate,
                        Client       = data.Client,
                        Currency     = data.Currency,
                        ExchangeRate = data.ExchangeRate,
                        InvoiceNo    = data.InvoiceNo,
                        OrderNumber  = data.OrderNumber,
                        SalesAgent   = data.SalesAgent,
                        Vat          = data.Vat
                    };


                    await _uow.Invoice.AddAsync(data);

                    int bit = _uow.Complete();
                    ts.Complete();
                    if (bit > 0)
                    {
                        return(data.Id);
                    }
                    return(0);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #17
0
        public IHttpActionResult Cancel(int id)
        {
            if (id != 0)
            {
                var userid = User.Identity.GetUserId();

                try
                {
                    var contact = _unitofWork.Contacts.FindContactUsingId(id);
                    _unitofWork.Contacts.Remove(contact);
                    _unitofWork.Complete();
                }
                catch (Exception e)
                {
                    Console.WriteLine("" + e.Message);
                    return(NotFound());
                }
                return(Ok());
            }

            return(NotFound());
        }
 public Declaration Add(Declaration declaration)
 {
     _uow.Declaration.Add(declaration);
     _uow.Complete();
     return(declaration);
 }
예제 #19
0
 public void AddProductCategory(IEnumerable <ProductCategory> listProductCategory)
 {
     _unitofwork.ProductCategoryRepository.AddRange(listProductCategory);
     _unitofwork.Complete();
 }
예제 #20
0
        public IActionResult EditEppGrpSetup(GroupSetupModel groupSetupModel)
        {
            try
            {
                var grpId = long.Parse(groupSetupModel.GrpId);

                var grpMstdata = _unitofWork.GroupMasterRepository.Find(x => x.GrpId == grpId).Result.FirstOrDefault();
                if (grpMstdata == null)
                {
                    return(BadRequest("Incorrect group id"));
                }

                if (!string.IsNullOrEmpty(groupSetupModel.EmlAddrss))
                {
                    // get partner id
                    var enrlmntPrtnr = _unitofWork.eppEnrlmntPrtnrsRepository.GetEnrlmntPrtnrId(groupSetupModel.EmlAddrss);
                    if (enrlmntPrtnr != null)
                    {
                        groupSetupModel.EnrlmntPrtnrsId = enrlmntPrtnr.EnrlmntPrtnrsId.ToString();
                    }
                    else
                    {
                        _unitofWork.eppEnrlmntPrtnrsRepository.Add(new EppEnrlmntPrtnrs
                        {
                            EnrlmntPrtnrsId = Helper.GetRandomNumber(),
                            CrtdBy          = "",
                            EmlAddrss       = groupSetupModel.EmlAddrss,
                            EnrlmntPrtnrsNm = groupSetupModel.EnrlmntPrtnrsNm
                        });
                    }
                }

                grpMstdata.GrpNbr            = groupSetupModel.GrpNbr;
                grpMstdata.GrpNm             = groupSetupModel.GrpNm;
                grpMstdata.ActvFlg           = groupSetupModel.ActvFlg;
                grpMstdata.EnrlmntPrtnrsId   = long.Parse(groupSetupModel.EnrlmntPrtnrsId);
                grpMstdata.AcctMgrNm         = groupSetupModel.AcctMgrNm;
                grpMstdata.AcctMgrEmailAddrs = groupSetupModel.AcctMgrEmailAddrs;
                grpMstdata.GrpEfftvDt        = groupSetupModel.GrpEfftvDt;
                grpMstdata.GrpSitusSt        = groupSetupModel.GrpSitusSt;

                grpMstdata.GrpPymnId = groupSetupModel.GrpPymn;
                grpMstdata.OccClass  = groupSetupModel.OccClass;
                grpMstdata.CrtdBy    = CrtdBy;
                // update group Master

                _unitofWork.GroupMasterRepository.Update(grpMstdata);

                UpdateAgent(groupSetupModel.GrpAgents, grpId);

                // add  update enrollment partner
                if (!string.IsNullOrEmpty(groupSetupModel.EmlAddrss))
                {
                    // get partner id
                    var enrlmntPrtnr = _unitofWork.eppEnrlmntPrtnrsRepository.GetEnrlmntPrtnrId(groupSetupModel.EmlAddrss);
                    if (enrlmntPrtnr != null)
                    {
                        groupSetupModel.EnrlmntPrtnrsId = enrlmntPrtnr.EnrlmntPrtnrsId.ToString();
                    }
                    else
                    {
                        groupSetupModel.EnrlmntPrtnrsId = Helper.GetRandomNumber().ToString();
                        _unitofWork.eppEnrlmntPrtnrsRepository.Add(new EppEnrlmntPrtnrs
                        {
                            EnrlmntPrtnrsId = long.Parse(groupSetupModel.EnrlmntPrtnrsId),
                            CrtdBy          = CrtdBy,
                            EmlAddrss       = groupSetupModel.EmlAddrss,
                            EnrlmntPrtnrsNm = groupSetupModel.EnrlmntPrtnrsNm
                        });
                    }
                }
                // goup product for existing products

                var Grpprdcts = _unitofWork.eppGrpprdctRepository.Find(x => x.GrpId == grpId).Result;

                // For Edit
                foreach (var prod in Grpprdcts)
                {
                    var prodData = _unitofWork.EppProductRepository.SingleOrDefault(x => x.ProductId == prod.ProductId).Result;
                    switch (prodData.ProductNm)
                    {
                    case "FPPG":
                    {
                        var prdid = Helper.GetProductIdbyName(prodData.ProductNm, _unitofWork);
                        // add Product code
                        if (!string.IsNullOrEmpty(groupSetupModel.FPPG.emp_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.FPPG.emp_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.FPPG.emp_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }

                        if (!string.IsNullOrEmpty(groupSetupModel.FPPG.sp_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.FPPG.sp_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.FPPG.sp_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }

                        if (!string.IsNullOrEmpty(groupSetupModel.FPPG.ch_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.FPPG.ch_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.FPPG.ch_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }
                        UpdateBulkRefTable(groupSetupModel.FPPG, prod.GrpprdctId);
                        groupSetupModel.isFPPGActive = false;

                        break;
                    }

                    case "ACC_HI":
                    {
                        UpdateBulkRefTable(groupSetupModel.ACC_HI, prod.GrpprdctId);
                        groupSetupModel.isACC_HIActive = false;
                        break;
                    }

                    case "ER_CI":
                    {
                        var prdid = Helper.GetProductIdbyName(prodData.ProductNm, _unitofWork);
                        // add Product code
                        if (!string.IsNullOrEmpty(groupSetupModel.ER_CI.emp_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.ER_CI.emp_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.ER_CI.emp_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }
                        if (!string.IsNullOrEmpty(groupSetupModel.ER_CI.sp_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.ER_CI.sp_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.ER_CI.sp_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }
                        if (!string.IsNullOrEmpty(groupSetupModel.ER_CI.ch_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.ER_CI.ch_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.ER_CI.ch_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }

                        UpdateBulkRefTable(groupSetupModel.ER_CI, prod.GrpprdctId);
                        groupSetupModel.isER_CIActive = false;
                        break;
                    }

                    case "VOL_CI":
                    {
                        var prdid = Helper.GetProductIdbyName(prodData.ProductNm, _unitofWork);
                        if (!string.IsNullOrEmpty(groupSetupModel.VOL_CI.emp_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.VOL_CI.emp_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.VOL_CI.emp_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }
                        if (!string.IsNullOrEmpty(groupSetupModel.VOL_CI.sp_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.VOL_CI.sp_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.VOL_CI.sp_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }
                        if (!string.IsNullOrEmpty(groupSetupModel.VOL_CI.ch_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.VOL_CI.ch_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.VOL_CI.ch_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }


                        UpdateBulkRefTable(groupSetupModel.VOL_CI, prod.GrpprdctId);
                        groupSetupModel.isVOL_CIActive = false;
                        break;
                    }

                    case "VGL":
                    {
                        UpdateBulkRefTable(groupSetupModel.VGL, prod.GrpprdctId);
                        groupSetupModel.isVGLActive = false;
                        break;
                    }

                    case "BGL":
                    {
                        UpdateBulkRefTable(groupSetupModel.BGL, prod.GrpprdctId);
                        groupSetupModel.isBGLActive = false;
                        break;
                    }

                    case "FPPI":
                    {
                        var prdid = Helper.GetProductIdbyName(prodData.ProductNm, _unitofWork);
                        if (!string.IsNullOrEmpty(groupSetupModel.FPPI.emp_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.FPPI.emp_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.FPPI.emp_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }
                        if (!string.IsNullOrEmpty(groupSetupModel.FPPI.sp_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.FPPI.sp_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.FPPI.sp_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }
                        if (!string.IsNullOrEmpty(groupSetupModel.FPPI.ch_ProductCode))
                        {
                            PlanCodeViewModel planCodeViewModel = new PlanCodeViewModel
                            {
                                ProductCode = groupSetupModel.FPPI.ch_ProductCode,
                                ProductId   = prdid
                            };
                            groupSetupModel.FPPI.ch_plan_cd = DataHelper.UpdatePlanCode(planCodeViewModel, _unitofWork).ProdctCdId.ToString();
                        }

                        UpdateBulkRefTable(groupSetupModel.FPPI, prod.GrpprdctId);
                        groupSetupModel.isFPPIActive = false;
                        break;
                    }

                    case "HI":
                    {
                        UpdateBulkRefTable(groupSetupModel.HI, prod.GrpprdctId);
                        groupSetupModel.isHIActive = false;
                        break;
                    }
                    }
                }

                // for  New Add
                // Add BulkRef data
                List <EppBulkRefTbl> bulkRefTbls = new List <EppBulkRefTbl>();
                if (groupSetupModel.isFPPGActive)
                {
                    AddFPPG(groupSetupModel.FPPG, "FPPG", grpId, bulkRefTbls);
                }
                if (groupSetupModel.isACC_HIActive)
                {
                    AddACCHI(groupSetupModel.ACC_HI, "ACC_HI", grpId, bulkRefTbls);
                }
                if (groupSetupModel.isER_CIActive)
                {
                    AddER_CI(groupSetupModel.ER_CI, "ER_CI", grpId, bulkRefTbls);
                }
                if (groupSetupModel.isVOL_CIActive)
                {
                    AddVOL_CI(groupSetupModel.VOL_CI, "VOL_CI", grpId, bulkRefTbls);
                }
                if (groupSetupModel.isVGLActive)
                {
                    AddVGL(groupSetupModel.VGL, "VGL", grpId, bulkRefTbls);
                }
                if (groupSetupModel.isBGLActive)
                {
                    AddBGL(groupSetupModel.BGL, "BGL", grpId, bulkRefTbls);
                }
                if (groupSetupModel.isFPPIActive)
                {
                    AddFPPI(groupSetupModel.FPPI, "FPPI", grpId, bulkRefTbls);
                }
                if (groupSetupModel.isHIActive)
                {
                    AddHI(groupSetupModel.HI, "HI", grpId, bulkRefTbls);
                }
                if (bulkRefTbls.Count > 0)
                {
                    _unitofWork.eppBulkRefTblRepository.AddRange(bulkRefTbls);
                }
                var id = _unitofWork.Complete().Result;
                return(Ok($"Group No. {groupSetupModel.GrpNbr} updated sucessfully!"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #21
0
 /// <summary>
 /// InfoSec : To Log the Audits (Changes related to user, roles, permission etc)
 /// </summary>
 /// <param name="auditLog"></param>
 public void LogAudit(AuditLog auditLog)
 {
     _unitofWork.AuditLogs.Add(auditLog);
     _unitofWork.Complete();
 }
        public async Task AddPlaylist(Playlist playlist)
        {
            await _unitofWork.PlaylistRepository.AddAsync(playlist);

            _unitofWork.Complete();
        }
예제 #23
0
 // POST api/values
 public void Post([FromBody] QuoteSchedule QS)
 {
     _unitwork.QuoteSchedules.Post(QS);
     _unitwork.Complete();
 }
예제 #24
0
        public async Task AddTrack(Track track)
        {
            await _unitofWork.TrackRepository.AddAsync(track);

            _unitofWork.Complete();
        }
예제 #25
0
        public IActionResult EppEditPrdctAttrbt(EppAddPrdAttrbt eppAddPrdAttrbt)
        {
            try
            {
                long grpprdctId = long.Parse(eppAddPrdAttrbt.GrpprdctId);
                List <EppPrdctattrbt> EppPrdctattrbts = new List <EppPrdctattrbt>();
                foreach (var item in eppAddPrdAttrbt.EppPrdAttrFields)
                {
                    //var data = _unitofWork.eppAttributeRepository.GetAttrId(item.DbAttrNm);
                    // if (data != null)
                    // {

                    EppPrdctattrbts.Add(new EppPrdctattrbt
                    {
                        AttrId        = long.Parse(item.AttrId),
                        GrpprdctId    = grpprdctId,
                        ClmnOrdr      = long.Parse(item.ClmnOrdr),
                        RqdFlg        = item.RqdFlg == true ? 'Y' : 'N',
                        PrdctAttrbtId = long.Parse(item.PrdctAttrbtId),
                        CrtdBy        = "",
                    });

                    //}
                }

                foreach (var data in EppPrdctattrbts)
                {
                    if (data.PrdctAttrbtId != 0)
                    {
                        var modifiabledata = _unitofWork.eppPrdctattrbtRepository.SingleOrDefault(x => x.PrdctAttrbtId == data.PrdctAttrbtId).Result;
                        if (modifiabledata != null)
                        {
                            modifiabledata.ClmnOrdr = data.ClmnOrdr;
                            modifiabledata.RqdFlg   = data.RqdFlg;
                            modifiabledata.AttrId   = data.AttrId;
                            _unitofWork.eppPrdctattrbtRepository.Update(modifiabledata);
                        }
                    }

                    else
                    {
                        data.PrdctAttrbtId = Helper.GetRandomNumber();
                        _unitofWork.eppPrdctattrbtRepository.Add(data);
                    }
                }
                var result = _unitofWork.Complete().Result;
                // deleted rows
                List <EppPrdctattrbt> eppPrdctattrbts_1 = new List <EppPrdctattrbt>();
                var deletableDataList = _unitofWork.eppPrdctattrbtRepository.Find(x => x.GrpprdctId == grpprdctId).Result;
                foreach (var data in deletableDataList)
                {
                    var bfound = EppPrdctattrbts.Find(x => x.PrdctAttrbtId == data.PrdctAttrbtId);
                    if (bfound == null)
                    {
                        eppPrdctattrbts_1.Add(data);
                        // _unitofWork.eppPrdctattrbtRepository.Remove(data);
                    }
                }

                if (eppPrdctattrbts_1.Count > 0)
                {
                    _unitofWork.eppPrdctattrbtRepository.RemoveRange(eppPrdctattrbts_1);
                    var id = _unitofWork.Complete().Result;
                }



                return(Ok("Custom layout template updated successfully!"));
            } catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #26
0
 public void AddCategory(Category category)
 {
     _unitofwork.CategoryRepository.Add(_categoriesFactory.CreateCategoryPersistence(category));
     _unitofwork.Complete();
 }
예제 #27
0
        public async Task AddOutlet(Outlet outlet)
        {
            await _unitofWork.OutletRepository.AddAsync(outlet);

            _unitofWork.Complete();
        }