// GET: Invoice/Edit/By ID
        public ActionResult Edit(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _SampleSubmissionService.BMSUnit.SampleSubmissionRepository.GetByID(id);

                Session["SampleSubmissionId"] = model.Id;

                var customerList     = SelectListItemExtension.PopulateDropdownList(_SampleSubmissionService.BMSUnit.CustomerRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblCustomer>(), "Id", "CustomerName", isEdit: true).ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_SampleSubmissionService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();
                //var cusContactsList = SelectListItemExtension.PopulateDropdownList(_SampleSubmissionService.BMSUnit.TransporterRepository.GetAll().ToList<tblTransporter>(), "Id", "TransporterName").ToList();
                //var deliveryStateList = Common.PopulateDeliveryStateDDList();


                var sampleDocumentModels = _SampleSubmissionService.BMSUnit.SampleDocumentRequiredRepository.GetAll().ToList().Select(
                    md => new SampleDocumentModel
                {
                    Id         = md.Id,
                    DocName    = md.DocName,
                    IsSelected = _SampleSubmissionService.BMSUnit.SampleSubmissionDocumentRepository.GetAll().ToList().Where(x => x.SubmissionId == model.Id && x.DocumentId == md.Id).Count() > 0 ? true : false

                                 //md.IsSelected
                }).OrderBy(o => o.DocName).ThenBy(ot => ot.Id);


                if (model != null)
                {
                    SampleSubmissionModel viewModel = new SampleSubmissionModel
                    {
                        Id                   = Convert.ToInt64(model.Id),
                        SubmissionNo         = model.SubmissionNo,
                        SubmissionDate       = model.SubmissionDate,
                        ddlOrganization      = organizationList,
                        OrganizationId       = Convert.ToInt64(model.OrganizationId),
                        ddlCustomer          = customerList,
                        CustomerId           = model.CustomerId,
                        sampleDocumentModels = sampleDocumentModels.ToList()

                                               //Designation = _SampleSubmissionService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).Address,
                                               //ddlContactPerson = cusContactsList,
                                               //CusContactId=Convert.ToInt32(model.CusContactId),
                                               //,IsActive = Convert.ToBoolean(model.IsActive)
                    };

                    return(PartialView("_Edit", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
        public ActionResult EditMasterDetails(int id)
        {
            var category = _db.Categories.SingleOrDefault(x => x.CategoryId == id);

            var categories = SelectListItemExtension.PopulateDropdownList(_db.Categories.ToList <Category>(), "CategoryId", "Name").ToList();

            if (category != null)
            {
                var products = _db.Products.Where(x => x.CategoryId == category.CategoryId).ToList();

                var productViewModel = new ProductViewModel()
                {
                    CategoryId    = category.CategoryId,
                    CategoryName  = category.Name,
                    ddlCategories = categories,
                    Products      = products
                };

                return(View(productViewModel));
            }
            else
            {
                return(RedirectToAction("Index", "Product"));
            }
        }
        //
        // GET: /MemberHospital/Edit/By ID

        public ActionResult Edit(int id)
        {
            try
            {
                var memberHospital = _db.MemberHospitals.Find(id);
                if (memberHospital != null)
                {
                    var memberZones = SelectListItemExtension.PopulateDropdownList(_db.MemberZones.ToList <MemberZone>(), "Id", "ZoneName", isEdit: true, selectedValue: memberHospital != null ? memberHospital.MemberZoneId.ToString() : "0").ToList();

                    var memberHospitalViewModel = new MemberHospitalViewModel {
                        Id = memberHospital.Id, HospitalName = memberHospital.HospitalName, Address = memberHospital.Address, LocationX = memberHospital.LocationX, LocationY = memberHospital.LocationY, MemberZoneId = memberHospital.MemberZoneId, ddlMemberZones = memberZones
                    };

                    return(PartialView("_Edit", memberHospitalViewModel));
                }
                else
                {
                    return(RedirectToAction("Index", "MemberHospital"));
                }
            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex, true);
                return(RedirectToAction("Index", "MemberHospital"));
            }
        }
        //ExpenseBudget Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var SalesPersonName = HttpContext.User.Identity.Name;
                var SalesPersonId   = _ExpenseBudgetService.BMSUnit.UserInfoNameRepository.GetAll().Where(c => c.UserName == SalesPersonName).FirstOrDefault().Id;
                var divisionList    = SelectListItemExtension.PopulateDropdownList(_ExpenseBudgetService.BMSUnit.DivisionRepository.GetAll().ToList <tblDivision>(), "Id", "DivisionName").ToList();
                var sbuList         = SelectListItemExtension.PopulateDropdownList(_ExpenseBudgetService.BMSUnit.SBURepository.GetAll().ToList <tblSBU>(), "Id", "SBUName").ToList();

                var model = new ExpenseBudgetModel()
                {
                    BudgetYear      = DateTime.Now.Year.ToString(),
                    SalesPersonId   = Convert.ToInt64(SalesPersonId),
                    SalesPersonName = SalesPersonName,
                    ddlDivision     = divisionList,
                    ddlSBU          = sbuList
                };

                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Esempio n. 5
0
        // GET: /Project/Create
        public ActionResult CreateProject()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var userName                 = HttpContext.User.Identity.Name;
                var currentStageList         = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.CurrentStageRepository.GetAll().ToList <tblCurrentStage>(), "Id", "CurrentStage").ToList();
                var supplierList             = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.SupplierRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblSupplier>(), "Id", "SupplierName", isEdit: true).ToList();
                var customerList             = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.CustomerRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblCustomer>(), "Id", "CustomerName", isEdit: true).ToList();
                var communicationChannelList = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.CommunicationChannelRepository.GetAll().ToList <tblCommunicationChannel>(), "Id", "CommunicationChannel").ToList();

                var model = new CallReportProjectInfoModel()
                {
                    CreateDate              = DateTime.Now,
                    ddlCurrentStage         = currentStageList,
                    ddlCustomer             = customerList,
                    ddlSupplier             = supplierList,
                    ddlCommunicationChannel = communicationChannelList,
                    SalesPerson             = userName
                };

                return(PartialView("_CreateProject", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Esempio n. 6
0
        //
        // GET: /Member/Edit/By ID

        public ActionResult Edit(int id)
        {
            try
            {
                var member = _db.Members.Find(id);
                if (member != null)
                {
                    var user = _db.Users.Find(member.UserName);

                    var memberBloodGroups = SelectListItemExtension.PopulateDropdownList(_db.MemberBloodGroups.ToList <MemberBloodGroup>(), "Id", "BloodGroupName", isEdit: true, selectedValue: member != null ? member.MemberBloodGroupId.ToString() : "0").ToList();
                    var memberDistricts   = SelectListItemExtension.PopulateDropdownList(_db.MemberDistricts.ToList <MemberDistrict>(), "Id", "DistrictName", isEdit: true, selectedValue: member != null ? member.MemberDistrictId.ToString() : "0").ToList();
                    var memberZones       = SelectListItemExtension.PopulateDropdownList(_db.MemberZones.ToList <MemberZone>(), "Id", "ZoneName", isEdit: true, selectedValue: member != null ? member.MemberZoneId.ToString() : "0").ToList();
                    var memberHospitals   = SelectListItemExtension.PopulateDropdownList(_db.MemberHospitals.ToList <MemberHospital>(), "Id", "HospitalName", isEdit: true, selectedValue: member != null ? member.MemberHospitalId.ToString() : "0").ToList();

                    var memberViewModel = new CreateOrEditMemberViewModel {
                        MemberId = member.Id, UserName = user.UserName, UserEmail = user.Email, FirstName = member.FirstName, LastName = member.LastName, SurName = member.SurName, DateOfBirth = member.DateOfBirth, Address = member.Address, PhoneNumber = member.PhoneNumber, MobileNumber = member.MobileNumber, ThumbImageUrl = member.ThumbImageUrl, SmallImageUrl = member.SmallImageUrl, ddlMemberBloodGroups = memberBloodGroups, ddlMemberDistricts = memberDistricts, ddlMemberZones = memberZones, ddlMemberHospitals = memberHospitals, MemberBloodGroupId = member.MemberBloodGroupId, MemberBloodGroupName = member.MemberBloodGroup != null ? member.MemberBloodGroup.BloodGroupName : null, MemberDistrictId = member.MemberDistrictId, MemberDistrictName = member.MemberDistrict != null ? member.MemberDistrict.DistrictName : null, MemberZoneId = member.MemberZoneId, MemberZoneName = member.MemberZone != null ? member.MemberZone.ZoneName : null, MemberHospitalId = member.MemberHospitalId, MemberHospitalName = member.MemberHospital != null ? member.MemberHospital.HospitalName : null
                    };

                    return(View(memberViewModel));
                }
                else
                {
                    return(RedirectToAction("Index", "Member"));
                }
            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex, true);
                return(RedirectToAction("Index", "Member"));
            }
        }
Esempio n. 7
0
        public ActionResult Edit(CreateOrEditMemberViewModel viewModel)
        {
            var memberBloodGroups = SelectListItemExtension.PopulateDropdownList(_db.MemberBloodGroups.ToList <MemberBloodGroup>(), "Id", "BloodGroupName", isEdit: true, selectedValue: viewModel.MemberBloodGroupId != 0 ? viewModel.MemberBloodGroupId.ToString() : "0").ToList();
            var memberDistricts   = SelectListItemExtension.PopulateDropdownList(_db.MemberDistricts.ToList <MemberDistrict>(), "Id", "DistrictName", isEdit: true, selectedValue: viewModel.MemberDistrictId != 0 ? viewModel.MemberDistrictId.ToString() : "0").ToList();
            var memberZones       = SelectListItemExtension.PopulateDropdownList(_db.MemberZones.ToList <MemberZone>(), "Id", "ZoneName", isEdit: true, selectedValue: viewModel.MemberZoneId != 0 ? viewModel.MemberZoneId.ToString() : "0").ToList();
            var memberHospitals   = SelectListItemExtension.PopulateDropdownList(_db.MemberHospitals.ToList <MemberHospital>(), "Id", "HospitalName", isEdit: true, selectedValue: viewModel.MemberHospitalId != 0 ? viewModel.MemberHospitalId.ToString() : "0").ToList();

            viewModel.ddlMemberBloodGroups = memberBloodGroups;
            viewModel.ddlMemberDistricts   = memberDistricts;
            viewModel.ddlMemberZones       = memberZones;
            viewModel.ddlMemberHospitals   = memberHospitals;

            try
            {
                if (ModelState.IsValid)
                {
                    var member = new OSNB.Models.Member {
                        Id = viewModel.MemberId, FirstName = viewModel.FirstName, LastName = viewModel.LastName, SurName = viewModel.SurName, DateOfBirth = viewModel.DateOfBirth, Address = viewModel.Address, PhoneNumber = viewModel.PhoneNumber, MobileNumber = viewModel.MobileNumber, ThumbImageUrl = viewModel.ThumbImageUrl, SmallImageUrl = viewModel.SmallImageUrl, MemberBloodGroupId = viewModel.MemberBloodGroupId, MemberDistrictId = viewModel.MemberDistrictId == 0 ? 1 : viewModel.MemberDistrictId, MemberZoneId = viewModel.MemberZoneId, MemberHospitalId = viewModel.MemberHospitalId, UserName = viewModel.UserName
                    };

                    _db.Entry(member).State = EntityState.Modified;
                    _db.SaveChanges();

                    return(RedirectToAction("Index", "Member"));
                    //return Content(Boolean.TrueString);
                }

                return(Content(ExceptionHelper.ModelStateErrorFormat(ModelState)));
            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex, true);
                return(Content("Sorry! Unable to edit this member."));
            }
        }
Esempio n. 8
0
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var customerList = SelectListItemExtension.PopulateDropdownList(_PriceRequestService.BMSUnit.CustomerRepository.GetAll().ToList <tblCustomer>(), "Id", "CustomerName").ToList();
                var supplierList = SelectListItemExtension.PopulateDropdownList(_PriceRequestService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();

                var SalesCallId = 34;

                var model = new PriceRequestModel()
                {
                    SalesCallId      = Convert.ToInt64(SalesCallId),
                    PriceRequestDate = DateTime.Now,
                    ddlSupplier      = supplierList,
                    ddlCustomer      = customerList
                };

                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Esempio n. 9
0
        public ActionResult AddMember(string id)
        {
            try
            {
                var user = _db.Users.Find(id);
                if (user != null)
                {
                    var memberBloodGroups = SelectListItemExtension.PopulateDropdownList(_db.MemberBloodGroups.ToList <MemberBloodGroup>(), "Id", "BloodGroupName").ToList();
                    var memberDistricts   = SelectListItemExtension.PopulateDropdownList(_db.MemberDistricts.ToList <MemberDistrict>(), "Id", "DistrictName").ToList();
                    var memberZones       = SelectListItemExtension.PopulateDropdownList(_db.MemberZones.ToList <MemberZone>(), "Id", "ZoneName").ToList();
                    var memberHospitals   = SelectListItemExtension.PopulateDropdownList(_db.MemberHospitals.ToList <MemberHospital>(), "Id", "HospitalName").ToList();
                    var memberStatues     = SelectListItemExtension.PopulateDropdownList(_db.MemberStatues.ToList <MemberStatus>(), "Id", "MemberStatusTitle").ToList();

                    var memberViewModel = new CreateOrEditMemberViewModel {
                        UserName = user.UserName, UserEmail = user.Email, ddlMemberBloodGroups = memberBloodGroups, ddlMemberDistricts = memberDistricts, ddlMemberZones = memberZones, ddlMemberHospitals = memberHospitals, ddlMemberStatus = memberStatues
                    };

                    return(View(memberViewModel));
                }
                else
                {
                    return(RedirectToAction("Index", "User"));
                }
            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex, true);
                return(RedirectToAction("Index", "User"));
            }
        }
Esempio n. 10
0
        // GET: DebitNote/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var supplieerList    = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();

                var bankList = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.BankRepository.GetAll().ToList <tblBank>(), "Id", "BankName").ToList();

                var userOrganization = 3;     // Query and Set Defaul Organization Here
                var model            = new DebitNoteModel()
                {
                    ddlSupplier     = supplieerList,
                    DebitNoteDate   = DateTime.Now,
                    ddlOrganization = organizationList,
                    OrganizationId  = Convert.ToInt64(userOrganization),
                    ddlBank         = bankList,
                    //OrganizationId = Convert.ToInt64(userOrganization)
                };


                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Esempio n. 11
0
        public ActionResult ForBlood(BloodRequestViewModel viewModel)
        {
            var memberBloodGroups = SelectListItemExtension.PopulateDropdownList(_db.MemberBloodGroups.ToList <MemberBloodGroup>(), "Id", "BloodGroupName", isEdit: true, selectedValue: viewModel.RequiredBloodGroupId != 0 ? viewModel.RequiredBloodGroupId.ToString() : "0").ToList();


            viewModel.ddlMemberBloodGroups = memberBloodGroups;


            try
            {
                if (ModelState.IsValid)
                {
                    BloodRequest model = new BloodRequest {
                        RequesterName = viewModel.RequesterName, RequesterContactNo = viewModel.RequesterContactNo, RequesterAmount = viewModel.RequesterAmount, PresentLocation = viewModel.PresentLocation, DateOfDonation = Convert.ToDateTime(viewModel.DateOfDonation), AppealMessage = viewModel.AppealMessage, RequiredBloodGroupId = viewModel.RequiredBloodGroupId
                    };

                    _db.BloodRequests.Add(model);
                    _db.SaveChanges();

                    return(RedirectToAction("Index", "BloodRequest"));
                }

                //return Content(ExceptionHelper.ModelStateErrorFormat(ModelState));
                return(View(viewModel));
            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex, true);
                return(View(viewModel));
            }
        }
Esempio n. 12
0
        public ActionResult AddMember(CreateOrEditMemberViewModel viewModel)
        {
            var memberBloodGroups = SelectListItemExtension.PopulateDropdownList(_db.MemberBloodGroups.ToList <MemberBloodGroup>(), "Id", "BloodGroupName", isEdit: true, selectedValue: viewModel.MemberBloodGroupId != 0 ? viewModel.MemberBloodGroupId.ToString() : "0").ToList();
            var memberDistricts   = SelectListItemExtension.PopulateDropdownList(_db.MemberDistricts.ToList <MemberDistrict>(), "Id", "DistrictName", isEdit: true, selectedValue: viewModel.MemberDistrictId != 0 ? viewModel.MemberDistrictId.ToString() : "0").ToList();
            var memberZones       = SelectListItemExtension.PopulateDropdownList(_db.MemberZones.ToList <MemberZone>(), "Id", "ZoneName", isEdit: true, selectedValue: viewModel.MemberZoneId != 0 ? viewModel.MemberZoneId.ToString() : "0").ToList();
            var memberHospitals   = SelectListItemExtension.PopulateDropdownList(_db.MemberHospitals.ToList <MemberHospital>(), "Id", "HospitalName", isEdit: true, selectedValue: viewModel.MemberHospitalId != 0 ? viewModel.MemberHospitalId.ToString() : "0").ToList();
            var memberStatues     = SelectListItemExtension.PopulateDropdownList(_db.MemberStatues.ToList <MemberStatus>(), "Id", "MemberStatusTitle").ToList();

            viewModel.ddlMemberBloodGroups = memberBloodGroups;
            viewModel.ddlMemberDistricts   = memberDistricts;
            viewModel.ddlMemberZones       = memberZones;
            viewModel.ddlMemberHospitals   = memberHospitals;
            viewModel.ddlMemberStatus      = memberStatues;

            try
            {
                if (ModelState.IsValid)
                {
                    var file = viewModel.ImageFile;

                    if (file != null && file.ContentLength > 0)
                    {
                        var fileName     = Path.GetFileName(file.FileName);
                        var physicalPath = Path.Combine(Server.MapPath("~/Images"), fileName);

                        // The files are not actually saved in this demo
                        file.SaveAs(physicalPath);

                        string imageUrl = @"/Images/" + fileName;

                        viewModel.SmallImageUrl = imageUrl;
                        viewModel.ThumbImageUrl = imageUrl;
                    }

                    var memberStatus     = _db.MemberStatues.SingleOrDefault(x => x.Id == viewModel.MemberStatusId);
                    var memberStatusList = new List <MemberStatus>();
                    memberStatusList.Add(memberStatus);

                    OSNB.Models.Member model = new OSNB.Models.Member {
                        FirstName = viewModel.FirstName, LastName = viewModel.LastName, SurName = viewModel.SurName, DateOfBirth = viewModel.DateOfBirth, Address = viewModel.Address, PhoneNumber = viewModel.PhoneNumber, MobileNumber = viewModel.MobileNumber, ThumbImageUrl = viewModel.ThumbImageUrl, SmallImageUrl = viewModel.SmallImageUrl, UserName = viewModel.UserName, MemberBloodGroupId = viewModel.MemberBloodGroupId, MemberDistrictId = viewModel.MemberDistrictId == 0 ? 1 : viewModel.MemberDistrictId, MemberZoneId = viewModel.MemberZoneId, MemberHospitalId = viewModel.MemberHospitalId, MemberStatues = memberStatusList
                    };

                    _db.Members.Add(model);
                    _db.SaveChanges();

                    return(RedirectToAction("Index", "Member"));
                }

                //return Content(ExceptionHelper.ModelStateErrorFormat(ModelState));
                return(View(viewModel));
            }
            catch (Exception ex)
            {
                ExceptionHelper.ExceptionMessageFormat(ex, true);
                return(View(viewModel));
            }
        }
Esempio n. 13
0
        //
        // GET: /Menu/Edit/By ID

        public ActionResult Edit(int id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                //var menu = _menuRepository.GetById(id);
                var menu = _menuRepository.GetAll().SingleOrDefault(x => x.MenuId == id);
                if (menu != null)
                {
                    var parentMenuList = SelectListItemExtension.PopulateDropdownList(_menuRepository.GetAll().ToList <TblMenu>(), "MenuId", "MenuName", isEdit: true, selectedValue: menu.ParentMenuId.ToString()).ToList();

                    var moduleList = SelectListItemExtension.PopulateDropdownList(_moduleRepository.GetAll().ToList <TblModule>(), "ModuleId", "ModuleName", isEdit: true, selectedValue: menu.ModuleId.ToString()).ToList();

                    var applicationList = SelectListItemExtension.PopulateDropdownList(_applicationRepository.GetAll().ToList <TblApplication>(), "ApplicationId", "ApplicationName", isEdit: true, selectedValue: menu.ApplicationId.ToString()).ToList();

                    var singleOrDefaultParentMenu = _menuRepository.GetAll().SingleOrDefault(x => x.MenuId == menu.ParentMenuId);

                    var singleOrDefaultApplication = _applicationRepository.GetAll().SingleOrDefault(x => x.ApplicationId == menu.ApplicationId);

                    var singleOrDefaultModule = _moduleRepository.GetAll().SingleOrDefault(x => x.ModuleId == menu.ModuleId);

                    if (singleOrDefaultApplication != null && singleOrDefaultModule != null)
                    {
                        var viewModel = new MenuViewModel()
                        {
                            MenuId          = menu.MenuId,
                            MenuName        = menu.MenuName,
                            MenuCaption     = menu.MenuCaption,
                            MenuCaptionBng  = menu.MenuCaptionBng,
                            PageUrl         = menu.PageUrl,
                            SerialNo        = Convert.ToInt32(menu.SerialNo),
                            OrderNo         = Convert.ToInt32(menu.OrderNo),
                            ParentMenuId    = Convert.ToInt32(menu.ParentMenuId),
                            ParentMenuName  = singleOrDefaultParentMenu != null ? singleOrDefaultParentMenu.MenuName : null,
                            ddlParentMenus  = parentMenuList,
                            ApplicationId   = menu.ApplicationId,
                            ApplicationName = singleOrDefaultApplication != null ? singleOrDefaultApplication.ApplicationName : null,
                            ddlApplications = applicationList,
                            ModuleId        = menu.ModuleId,
                            ModuleName      = singleOrDefaultModule != null ? singleOrDefaultModule.ModuleName : null,
                            ddlModules      = moduleList
                        };
                        return(PartialView("_AddOrEdit", viewModel));
                    }
                }

                errorViewModel = ExceptionHelper.ExceptionErrorMessageForNullObject();
            }
            catch (Exception ex)
            {
                errorViewModel = ExceptionHelper.ExceptionErrorMessageFormat(ex);
            }

            return(PartialView("_ErrorPopup", errorViewModel));
        }
Esempio n. 14
0
        // GET: Sales Budget/Edit/By ID
        public ActionResult Edit(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _SalesBudgetService.BMSUnit.SalesBudgetRepository.GetByID(id);

                Session["SalesBudgetMasterId"] = model.Id;

                var sbuList     = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.SBURepository.GetAll().ToList <tblSBU>(), "Id", "SBUName").ToList();
                var productList = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.ProductRepository.GetAll().ToList <tblProduct>(), "Id", "ProductName").ToList();

                var SalesPersonName = HttpContext.User.Identity.Name;
                var SalesPersonId   = _SalesBudgetService.BMSUnit.UserInfoNameRepository.GetAll().Where(c => c.UserName == SalesPersonName).ToList().FirstOrDefault().Id;
                //var divisionName =
                var    divCount     = _SalesBudgetService.BMSUnit.SalesPersonRepository.GetAll().Where(c => c.SalesPersonId == SalesPersonName).ToList().Count();
                string divisionName = null;

                if (divCount > 0)
                {
                    var divisionId = _SalesBudgetService.BMSUnit.SalesPersonRepository.GetAll().Where(c => c.SalesPersonId == SalesPersonName).ToList().FirstOrDefault().DivisionId;
                    divisionName = _SalesBudgetService.BMSUnit.DivisionRepository.GetAll().Where(c => c.Id == divisionId).ToList().FirstOrDefault().DivisionName;
                }



                if (model != null)
                {
                    SalesBudgetModel viewModel = new SalesBudgetModel
                    {
                        Id              = Convert.ToInt64(model.Id),
                        SalesPersonId   = Convert.ToInt64(model.SalesPersonId),
                        SalesPersonName = SalesPersonName,
                        DivisionName    = divisionName,
                        BudgetYear      = model.BudgetYear,
                        SBUId           = Convert.ToInt64(model.SBUId),
                        ProductId       = Convert.ToInt64(model.ProductId),
                        ddlSBU          = sbuList,
                        ddlProduct      = productList
                    };

                    return(PartialView("_Edit", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Esempio n. 15
0
        private List <ProductModel> GetProduct()
        {
            var productList = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.ProductRepository.GetAll().Where(x => x.IsActive).ToList <tblProduct>(), "Id", "ArticleName").ToList().Select(
                md => new ProductModel
            {
                ProductName = md.Text
            });

            return(productList.ToList());
        }
Esempio n. 16
0
        // GET: SampleRequest/SearchArticle

        /*
         *          public ActionResult SearchArticle()
         *          {
         *              var errorViewModel = new ErrorViewModel();
         *
         *              try
         *              {
         *
         *                  var articleList = SelectListItemExtension.PopulateDropdownList(_SampleRequestService.BMSUnit.ArticleRepository.GetAll().Where(x=> x.IsActive) .ToList<tblArticle>(), "Id", "ArticleName").ToList();
         *
         *                  var model = new InvoiceDetailModel()
         *                  {
         *                      ddlArticle = articleList
         *                  };
         *
         *                  return PartialView("_SearchArticle", model);
         *              }
         *              catch (Exception ex)
         *              {
         *                  errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
         *                  return PartialView("_ErrorPopUp", errorViewModel);
         *              }
         *          }
         *
         *          // POST: Invoice/SearchArticle
         *          [HttpPost]
         *          public ActionResult SearchArticle(InvoiceDetailModel viewModel)
         *          {
         *              var strMessage = string.Empty;
         *              try
         *              {
         *                  if (ModelState.IsValid)
         *                  {
         *
         *                      //var entity = viewModel.ToEntity();
         *                      //_invSampleRequestService.BMSUnit.SampleRequestRepository.Add(entity);
         *                      //_invSampleRequestService.BMSUnit.SampleRequestRepository.SaveChanges();
         *
         *                      return Content(Boolean.TrueString);
         *                      //return Content("Information has been saved successfully");
         *                  }
         *
         *                  strMessage = Common.GetModelStateErrorMessage(ModelState);
         *              }
         *              catch (Exception ex)
         *              {
         *                  strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
         *              }
         *
         *              return Content(strMessage);
         *          }
         */

        // GET: SampleRequest/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var supplierList      = SelectListItemExtension.PopulateDropdownList(_SampleRequestService.BMSUnit.SupplierRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblSupplier>(), "Id", "SupplierName", isEdit: true).ToList();
                var organizationList  = SelectListItemExtension.PopulateDropdownList(_SampleRequestService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();
                var transporterList   = SelectListItemExtension.PopulateDropdownList(_SampleRequestService.BMSUnit.TransporterRepository.GetAll().ToList <tblTransporter>(), "Id", "TransporterName").ToList();
                var deliveryStateList = Common.PopulateDeliveryStateDDList();


                var sampleDocumentModels = _SampleRequestService.BMSUnit.SampleDocumentRequiredRepository.GetAll().ToList().Select(
                    md => new SampleDocumentModel
                {
                    Id         = md.Id,
                    DocName    = md.DocName,
                    IsSelected = md.IsSelected
                }).OrderBy(o => o.DocName).ThenBy(ot => ot.Id);


                //List<SampleDocumentModel> fr = new List<SampleDocumentModel>();
                //fr.Add(new SampleDocumentModel() { Id = 1, DocName = "asdad", IsSelected = true });
                //fr.Add(new SampleDocumentModel() { Id = 2, DocName = "sfsfsfs", IsSelected = false });



                //DocumentList docList = new DocumentList();
                //docList.sampleDocumentModels = fr;

                var userOrganization     = 3; // Query and Set Defaul Organization Here
                var defaultDeliveryState = Common.DeliveryStateEnum.Undelivered;

                var model = new SampleRequestModel()
                {
                    ddlSupplier          = supplierList,
                    RequestDate          = DateTime.Now,
                    ddlOrganization      = organizationList,
                    OrganizationId       = Convert.ToInt64(userOrganization),
                    ddlTransporter       = transporterList,
                    ddlDeliveryState     = deliveryStateList,
                    DeliveryStateId      = Convert.ToInt32(defaultDeliveryState),
                    sampleDocumentModels = sampleDocumentModels.ToList()
                };


                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Esempio n. 17
0
        // GET: DebitNote/Edit/By ID
        public ActionResult Edit(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _DebitNoteService.BMSUnit.DebitNoteRepository.GetByID(id);

                Session["DebitNoteId"] = model.Id;

                var supplieerList    = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();
                var bankList         = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.BankRepository.GetAll().ToList <tblBank>(), "Id", "BankName").ToList();

                if (model != null)
                {
                    DebitNoteModel viewModel = new DebitNoteModel
                    {
                        Id            = model.Id,
                        DebitNoteNo   = model.DebitNoteNo,
                        DebitNoteDate = model.DebitNoteDate,

                        ddlSupplier = supplieerList,
                        SupplierId  = model.SupplierId,

                        ddlOrganization = organizationList,
                        OrganizationId  = Convert.ToInt64(model.OrganizationId),

                        ddlBank = bankList,
                        BankId  = model.BankId,

                        SupplierName    = _DebitNoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).SupplierName,
                        SupplierAddress = _DebitNoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).Address,
                        AttentionPerson = _DebitNoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).Phone
                                          //LCNo=model.LCNo,
                                          //Total= model.tot`al

                                          //,IsActive = Convert.ToBoolean(model.IsActive)
                    };

                    return(PartialView("_Edit", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
        public ActionResult DuplicateDetails()
        {
            var categories = SelectListItemExtension.PopulateDropdownList(_db.Categories.ToList <Category>(), "CategoryId", "Name").ToList();

            var productViewModel = new Product2ViewModel()
            {
                ddlCategories = categories
            };

            return(View(productViewModel));
        }
Esempio n. 19
0
        public ActionResult NumberUI()
        {
            var categories = SelectListItemExtension.PopulateDropdownList(_db.Categories.ToList <Category>(), "CategoryId", "Name").ToList();

            var model = new CreateOrEditProductViewModel()
            {
                ddlCategories = categories
            };

            return(View(model));
        }
        public ActionResult Register(RegisterViewModel model)
        {
            var memberBloodGroups = SelectListItemExtension.PopulateDropdownList(_db.MemberBloodGroups.ToList <MemberBloodGroup>(), "Id", "BloodGroupName").ToList();
            var memberDistricts   = SelectListItemExtension.PopulateDropdownList(_db.MemberDistricts.ToList <MemberDistrict>(), "Id", "DistrictName").ToList();
            var memberZones       = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Selected = true, Text = "- Select -", Value = "0"
                }
            }.ToList();
            var memberHospitals = SelectListItemExtension.PopulateDropdownList(_db.MemberHospitals.ToList <MemberHospital>(), "Id", "HospitalName").ToList();

            model.ddlMemberBloodGroups = memberBloodGroups;
            model.ddlMemberDistricts   = memberDistricts;
            model.ddlMemberZones       = memberZones;
            model.ddlMemberHospitals   = memberHospitals;

            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    OSNB.Models.User user = _db.Users.Find(model.UserName);
                    OSNB.Models.Role role = _db.Roles.Find("User");
                    user.Roles = new List <Role> {
                        role
                    };

                    _db.Entry(user).State = EntityState.Modified;

                    OSNB.Models.Member member = new OSNB.Models.Member {
                        FirstName = model.UserName, LastName = null, SurName = model.UserName, DateOfBirth = null, Address = null, PhoneNumber = null, MobileNumber = model.ContactNo, ThumbImageUrl = null, SmallImageUrl = null, UserName = model.UserName, MemberBloodGroupId = model.MemberBloodGroupId, MemberDistrictId = model.MemberDistrictId, MemberHospitalId = model.MemberHospitalId, MemberZoneId = model.MemberZoneId
                    };

                    _db.Members.Add(member);
                    _db.SaveChanges();

                    FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Esempio n. 21
0
        //
        // GET: /Application/Add

        public ActionResult Add()
        {
            var companyList = SelectListItemExtension.PopulateDropdownList(_companyRepository.GetAll().ToList <TblCompany>(), "CompanyId", "CompanyName").ToList();

            var viewModel = new ApplicationViewModel()
            {
                ApplicationId = 0, ddlCompanies = companyList
            };

            //return View();
            return(PartialView("_AddOrEdit", viewModel));
        }
Esempio n. 22
0
        // GET: /Project/Edit/By ID
        public ActionResult EditProject(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _CallReportInfoService.BMSUnit.CallReportProjectRepository.GetByID(id);

                var currentStageList         = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.CurrentStageRepository.GetAll().ToList <tblCurrentStage>(), "Id", "CurrentStage").ToList();
                var supplierList             = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.SupplierRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblSupplier>(), "Id", "SupplierName", isEdit: true).ToList();
                var customerList             = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.CustomerRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblCustomer>(), "Id", "CustomerName", isEdit: true).ToList();
                var communicationChannelList = SelectListItemExtension.PopulateDropdownList(_CallReportInfoService.BMSUnit.CommunicationChannelRepository.GetAll().ToList <tblCommunicationChannel>(), "Id", "CommunicationChannel").ToList();

                if (model != null)
                {
                    CallReportProjectInfoModel viewModel = new CallReportProjectInfoModel
                    {
                        ddlCurrentStage         = currentStageList,
                        ddlCustomer             = customerList,
                        ddlSupplier             = supplierList,
                        ddlCommunicationChannel = communicationChannelList,
                        Id                     = model.Id,
                        CreateDate             = model.CreateDate,
                        ProjectName            = model.ProjectName,
                        CurrentStageId         = model.CurrentStageId,
                        CustomerId             = model.CustomerId,
                        SupplierId             = model.SupplierId,
                        Description            = model.Description,
                        SellingOpportunity     = model.SellingOpportunity,
                        PotVolPerYear          = model.PotVolPerYear,
                        PotAmountPerYear       = model.PotAmountPerYear,
                        RemarkNextAction       = model.RemarkNextAction,
                        CommunicationChannelId = model.CommunicationChannelId,
                        SalesPerson            = model.SalesPerson
                    };

                    //CallReportProjectInfoModel viewModel = new CallReportProjectInfoModel();
                    //viewModel = model.ToModel();

                    return(PartialView("_EditProject", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Esempio n. 23
0
        //
        // GET: /Module/Add

        public ActionResult Add()
        {
            var applicationList = SelectListItemExtension.PopulateDropdownList(_applicationRepository.GetAll().ToList <TblApplication>(), "ApplicationId", "ApplicationName").ToList();

            var viewModel = new ModuleViewModel()
            {
                ModuleId = 0, ddlApplications = applicationList
            };

            //return View();
            return(PartialView("_AddOrEdit", viewModel));
        }
Esempio n. 24
0
        public JsonResult GetModuleList(KendoDropDownParamViewModel model)
        {
            var moduleList = new List <SelectListItem>();

            if (model.Value == null)
            {
                moduleList = SelectListItemExtension.PopulateDropdownList(_moduleRepository.GetAll().ToList <TblModule>(), "ModuleId", "ModuleTitle").ToList();
            }
            else
            {
                moduleList = SelectListItemExtension.PopulateDropdownList(_moduleRepository.GetAll().Where(x => x.ApplicationId == Convert.ToInt32(model.Value)).ToList <TblModule>(), "ModuleId", "ModuleTitle").ToList();
            }

            return(Json(moduleList, JsonRequestBehavior.AllowGet));
        }
Esempio n. 25
0
        //
        // GET: /Menu/Add

        public ActionResult Add()
        {
            var applicationList = SelectListItemExtension.PopulateDropdownList(_applicationRepository.GetAll().ToList <TblApplication>(), "ApplicationId", "ApplicationName").ToList();

            var moduleList = SelectListItemExtension.PopulateDropdownList(_moduleRepository.GetAll().ToList <TblModule>(), "ModuleId", "ModuleTitle").ToList();

            var parentMenuList = SelectListItemExtension.PopulateDropdownList(_menuRepository.GetAll().ToList <TblMenu>(), "MenuId", "MenuName").ToList();

            var viewModel = new MenuViewModel()
            {
                MenuId = 0, ddlApplications = applicationList, ddlModules = moduleList, ddlParentMenus = parentMenuList
            };

            //return View();
            return(PartialView("_AddOrEdit", viewModel));
        }
        //
        // GET: /Product/Create

        public ActionResult Create()
        {
            //var categories = _db.Categories.ToList<Category>().PopulateDropdownList("CategoryId", "Name").ToList();
            var categories = SelectListItemExtension.PopulateDropdownList(_db.Categories.ToList <Category>(), "CategoryId", "Name").ToList();
            //ViewBag.CategoryId = new SelectList(_db.Categories, "CategoryId", "Name");

            var model = new ProductViewModel()
            {
                ddlCategories = categories
            };

            //return View();
            //return PartialView("_Create");
            //return View("_Create");
            return(View("_Create", model));
        }
Esempio n. 27
0
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var sbuList     = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.SBURepository.GetAll().ToList <tblSBU>(), "Id", "SBUName").ToList();
                var productList = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.ProductRepository.GetAll().ToList <tblProduct>(), "Id", "ProductName").ToList();

                var customerList = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.CustomerRepository.GetAll().ToList <tblCustomer>(), "Id", "CustomerName").ToList();



                var supplierList = SelectListItemExtension.PopulateDropdownList(_SalesBudgetService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();

                var SalePersonName = HttpContext.User.Identity.Name;
                var SalePersonId   = _SalesBudgetService.BMSUnit.UserInfoNameRepository.GetAll().Where(c => c.UserName == SalePersonName).ToList().FirstOrDefault().Id;
                //var divisionName =
                var    divCount     = _SalesBudgetService.BMSUnit.SalesPersonRepository.GetAll().Where(c => c.SalesPersonId == SalePersonName).ToList().Count();
                string divisionName = null;

                if (divCount > 0)
                {
                    var divisionId = _SalesBudgetService.BMSUnit.SalesPersonRepository.GetAll().Where(c => c.SalesPersonId == SalePersonName).ToList().FirstOrDefault().DivisionId;
                    divisionName = _SalesBudgetService.BMSUnit.DivisionRepository.GetAll().Where(c => c.Id == divisionId).ToList().FirstOrDefault().DivisionName;
                }



                var model = new SalesBudgetModel()
                {
                    BudgetYear      = DateTime.Now.Year.ToString(),
                    SalesPersonId   = Convert.ToInt64(SalePersonId),
                    SalesPersonName = SalePersonName,
                    DivisionName    = divisionName,
                    ddlSBU          = sbuList,
                    ddlProduct      = productList
                };

                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Esempio n. 28
0
        //
        // GET: /Right/Edit/By ID

        public ActionResult Edit(int id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                //var right = _rightRepository.GetById(id);
                var right = _rightRepository.GetAll().SingleOrDefault(x => x.RightId == id);
                if (right != null)
                {
                    var moduleList = SelectListItemExtension.PopulateDropdownList(_moduleRepository.GetAll().ToList <TblModule>(), "ModuleId", "ModuleName", isEdit: true, selectedValue: right.ModuleId.ToString()).ToList();

                    var applicationList = SelectListItemExtension.PopulateDropdownList(_applicationRepository.GetAll().ToList <TblApplication>(), "ApplicationId", "ApplicationName", isEdit: true, selectedValue: right.ApplicationId.ToString()).ToList();


                    var singleOrDefaultApplication = _applicationRepository.GetAll().SingleOrDefault(x => x.ApplicationId == right.ApplicationId);

                    var singleOrDefaultModule = _moduleRepository.GetAll().SingleOrDefault(x => x.ModuleId == right.ModuleId);

                    if (singleOrDefaultApplication != null && singleOrDefaultModule != null)
                    {
                        var viewModel = new RightViewModel()
                        {
                            RightId         = right.RightId,
                            RightName       = right.RightName,
                            RightTitle      = right.RightTitle,
                            Description     = right.Description,
                            ApplicationId   = Convert.ToInt32(right.ApplicationId),
                            ApplicationName = singleOrDefaultApplication != null ? singleOrDefaultApplication.ApplicationName : null,
                            ddlApplications = applicationList,
                            ModuleId        = Convert.ToInt32(right.ModuleId),
                            ModuleName      = singleOrDefaultModule != null ? singleOrDefaultModule.ModuleName : null,
                            ddlModules      = moduleList
                        };
                        return(PartialView("_AddOrEdit", viewModel));
                    }
                }

                errorViewModel = ExceptionHelper.ExceptionErrorMessageForNullObject();
            }
            catch (Exception ex)
            {
                errorViewModel = ExceptionHelper.ExceptionErrorMessageFormat(ex);
            }

            return(PartialView("_ErrorPopup", errorViewModel));
        }
Esempio n. 29
0
        // GET: Quote/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                //SupplierName = _QuoteService.BMSUnit.SupplierRepository.GetAll().Where(c => c.Id == QuoteDetail.SupplierId).FirstOrDefault().SupplierName,
                var customerList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.CustomerRepository.GetAll().Where(c => c.IUser.ToUpper() != "SYSTEM").ToList <tblCustomer>(), "Id", "CustomerName").ToList();
                //var customerList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.CustomerRepository.GetAll().ToList<tblCustomer>(), "Id", "CustomerName").ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();
                //var cusContactsList = SelectListItemExtension.PopulateDropdownList(_QuoteService.BMSUnit.TransporterRepository.GetAll().ToList<tblTransporter>(), "Id", "TransporterName").ToList();
                //var deliveryStateList = Common.PopulateDeliveryStateDDList();


                var documentModels = _QuoteService.BMSUnit.SampleDocumentRequiredRepository.GetAll().ToList().Select(
                    md => new DocumentModel
                {
                    Id         = md.Id,
                    DocName    = md.DocName,
                    IsSelected = md.IsSelected
                }).OrderBy(o => o.DocName).ThenBy(ot => ot.Id);


                var userOrganization = 3;     // Query and Set Defaul Organization Here


                var model = new QuoteModel()
                {
                    ddlCustomer     = customerList,
                    SalesCallId     = 34,
                    QuoteDate       = DateTime.Now,
                    ddlOrganization = organizationList,
                    OrganizationId  = Convert.ToInt64(userOrganization),
                    documentModels  = documentModels.ToList()
                                      //ddlContactPerson = cusContactsList,
                };


                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
Esempio n. 30
0
        // GET: Invoice/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var customerList     = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.CustomerRepository.GetAll().ToList <tblCustomer>(), "Id", "CustomerName").ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();

                var currencyList        = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.CurrencyRepository.GetAll().ToList <tblCurrency>(), "Id", "CurrencyName").ToList();
                var priceTermList       = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.PriceTermRepository.GetAll().ToList <tblPriceTerm>(), "Id", "PriceTermName").ToList();
                var commTypeList        = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.CommCalculationTypeRepository.GetAll().ToList <tblCommCalculationType>(), "Id", "CommissionCalculationTerm").ToList();
                var shipmentCountryList = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.CountryRepository.GetAll().ToList <tblCountry>(), "Id", "CountryName").ToList();
                var portOfDischargeList = SelectListItemExtension.PopulateDropdownList(_InvoiceService.BMSUnit.PortRepository.GetAll().ToList <tblPort>(), "Id", "PortName").ToList();

                var invoiceTypeList = Common.PopulateInvoiceTypeDDList();

                var userOrganization   = 3;   // Query and Set Defaul Organization Here
                var defaultInvoiceType = Common.InvoiceType.PI;
                var model = new InvoiceModel()
                {
                    ddlCustomer        = customerList,
                    InvoiceDate        = DateTime.Now,
                    InvoicePeriod      = 201605,
                    ddlOrganization    = organizationList,
                    OrganizationId     = Convert.ToInt64(userOrganization),
                    ddlInvoiceType     = invoiceTypeList,
                    InvoiceTypeId      = Convert.ToInt32(defaultInvoiceType),
                    ddlPriceTerm       = priceTermList,
                    ddlCurrency        = currencyList,
                    ddlShipmentCountry = shipmentCountryList,
                    ddlPortOfDischarge = portOfDischargeList,
                    ddlCommissionTerm  = commTypeList
                                         //OrganizationId = Convert.ToInt64(userOrganization)
                };


                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }