public UserListViewModel()
        {
            IList <UserAction> actions = new List <UserAction>
            {
                new UserAction
                {
                    Id    = 1,
                    Value = "Select Action"
                },
                new UserAction
                {
                    Id    = 2,
                    Value = "Reset Password"
                },
                new UserAction
                {
                    Id    = 3,
                    Value = "Lock User Account"
                },
                new UserAction
                {
                    Id    = 4,
                    Value = "Unlock User Account"
                }
            };

            ActionsList = new System.Web.Mvc.SelectList(actions, "Id", "Value");
        }
Пример #2
0
        public GetCentrosResponse GetCentros()
        {
            var response = new GetCentrosResponse();

            try
            {
                var centroList = _centroRepository
                                 .GetByCriteria(x => x.IsActivo)
                                 .OrderBy(p => p.Nombre)
                                 .ToList();

                var listaDeCentroViewModel = centroList.ConvertToDatosCentroViewModel();

                var selectList = new System.Web.Mvc.SelectList(listaDeCentroViewModel, "CentroId", "Nombre");

                response.ListaCentrosIdNombre = selectList;

                response.IsValid = true;
            }
            catch (Exception ex)
            {
                response.IsValid      = false;
                response.ErrorMessage = ex.Message;
            }

            return(response);
        }
        public UserListViewModel()
        {
            IList<UserAction> actions = new List<UserAction>
            {
                new UserAction
                {
                    Id = 1,
                    Value = "Select Action"
                },
                new UserAction
                {
                    Id = 2,
                    Value = "Reset Password"
                },
                new UserAction
                {
                    Id = 3,
                    Value = "Lock User Account"
                },
                new UserAction
                {
                    Id = 4,
                    Value = "Unlock User Account"
                }
            };

            ActionsList = new System.Web.Mvc.SelectList(actions, "Id", "Value");
        }
Пример #4
0
        public EditProfile(User row)
        {
            UserId         = row.Id;
            Title          = row.Title;
            FirstName      = row.FirstName;
            LastName       = row.LastName;
            OtherNames     = row.OtherNames;
            Profile        = row.Profile;
            Gender         = row.Gender;
            DOB            = row.DOB;
            Phone          = row.PhoneNumber;
            PhoneNumberRaw = row.PhoneNumber;
            Email          = row.Email;
            Profession     = row.Profession;
            ImageString    = db.Images.Where(x => x.UserId == row.Id).Select(x => x.Image1).FirstOrDefault();

            IEnumerable <SelectListModel> genders = new List <SelectListModel>()
            {
                new SelectListModel {
                    Text = "Male", Value = "Male"
                },
                new SelectListModel {
                    Text = "Female", Value = "Female"
                }
            };

            GenderList = new System.Web.Mvc.SelectList(genders, "Value", "Text", genders.Where(x => x.Value == row.Gender));



            SetAddress(row.AddressId);
        }
Пример #5
0
        public GetOficinasResponse GetOficinas()
        {
            var response = new GetOficinasResponse();

            try
            {
                var oficinaList = _oficinaRepository
                                  .GetByCriteria(x => x.IsActivo)
                                  .OrderBy(p => p.Nombre)
                                  .ToList();

                var listaDeOficinasViewModel = oficinaList.ConvertToDatosOficinaViewModel();

                var selectList = new System.Web.Mvc.SelectList(listaDeOficinasViewModel, "OficinaId", "Nombre");

                response.ListaOficinasIdNombre = selectList;

                response.IsValid = true;
            }
            catch (Exception ex)
            {
                response.IsValid      = false;
                response.ErrorMessage = ex.Message;
            }

            return(response);
        }
Пример #6
0
 public DivisionEditViewModel(Division division, System.Web.Mvc.SelectList Plants)
 {
     Key         = division.Key;
     Code        = division.Code;
     Name        = division.Name;
     Plant       = division.Plant.Key;
     this.Plants = Plants;
 }
Пример #7
0
 public RegisterViewModel()
 {
     using (var context = new ApplicationDbContext())
     {
         Region_List = new System.Web.Mvc.SelectList(context.Regions.OrderBy(a => a.Name).ToList <Region>(), "Id", "Name");
         Idol_List   = new System.Web.Mvc.SelectList(context.Idols.OrderBy(a => a.Name).ToList <Idol>(), "Id", "Name");
     }
 }
 public static System.Web.Mvc.SelectList SetSelectedValue
     (this System.Web.Mvc.SelectList list, string value)
 {
     if (value != null)
     {
         var selected = list.Where(x => x.Text == value).FirstOrDefault();
         selected.Selected = true;
     }
     return(list);
 }
Пример #9
0
        public RegisterViewModel()
        {
            ApplicationDbContext context = new ApplicationDbContext();

            if (HttpContext.Current.User.IsInRole("Manager"))
            {
                RoleList = new System.Web.Mvc.SelectList(context.Roles.Where(r => r.Name != "User" && r.Name != "Manager" && r.Name != "Admin").Select(r => r.Name));
            }
            else
            {
                RoleList = new System.Web.Mvc.SelectList(context.Roles.Where(r => r.Name != "User").Select(r => r.Name));
            }
            Salaries = new List <int>(context.Salaries.Select(s => s.Size));
        }
Пример #10
0
        public GetOficinasResponse GetOficinasByCentro(int centroId)
        {
            var response = new GetOficinasResponse();
            var _correoPlantillaRepository = new CorreoPlantillaRepository();

            try
            {
                var oficinaListTemp = _oficinaRepository
                                      .GetByCriteria(x => x.IsActivo && x.Centro == centroId)
                                      .OrderBy(p => p.Nombre)
                                      .ToList();

                var oficinaList = new List <Oficina>();

                foreach (var oficina in oficinaListTemp)
                {
                    var listaCorreoOficina = _correoPlantillaRepository.GetByCriteria(x => x.IsActivo && x.OficinaId == oficina.OficinaId);
                    if (listaCorreoOficina.Count() > 0)
                    {
                        oficinaList.Add(oficina);
                    }
                }

                var listaDeOficinasViewModel = oficinaList.ConvertToDatosOficinaViewModel();

                var listaDeOficinasViewModelConCentroGenerico = new List <OficinaViewModel>();
                var oficinaGenerica = new OficinaViewModel()
                {
                    OficinaId = null,
                    Nombre    = "Genérica",
                    Centro    = null
                };
                listaDeOficinasViewModelConCentroGenerico.Add(oficinaGenerica);
                listaDeOficinasViewModelConCentroGenerico.AddRange(listaDeOficinasViewModel);

                var selectList = new System.Web.Mvc.SelectList(listaDeOficinasViewModelConCentroGenerico, "OficinaId", "Nombre");

                response.ListaOficinasIdNombre = selectList;

                response.IsValid = true;
            }
            catch (Exception ex)
            {
                response.IsValid      = false;
                response.ErrorMessage = ex.Message;
            }

            return(response);
        }
        public virtual void LoadData(ccEntities db, IPermissionsBase permissions)
        {
            var services = (from c in db.Clients
                            where c.Id == ClientId
                            from a in c.Agency.AppBudgetServices
                            where a.Service.ReportingMethodId == (int)Service.ReportingMethods.Homecare ||
                            a.Service.ReportingMethodId == (int)Service.ReportingMethods.HomecareWeekly
                            group a by new
            {
                id = a.Service.Id,
                name = a.Service.Name
            } into ag
                            orderby ag.Key.name
                            select ag.Key);


            this.ServicesSelectList = new System.Web.Mvc.SelectList(services, "id", "name");
        }
Пример #12
0
 public RatingViewModel(
     int productId,
     string productName,
     string comment,
     bool hasBadWords,
     bool editing,
     bool submittedSuccessfully,
     int rating,
     System.Web.Mvc.SelectList ratingOptions)
 {
     ProductId             = productId;
     ProductName           = productName;
     Comment               = comment;
     HasBadWords           = hasBadWords;
     Editing               = editing;
     SubmittedSuccessfully = submittedSuccessfully;
     Rating        = rating;
     RatingOptions = ratingOptions;
 }
Пример #13
0
 public AccountInfoVm()
 {
     SexSelectList = new System.Web.Mvc.SelectList( new string[] { "Male", "Female" });
 }
Пример #14
0
        /// <summary>
        /// Use this to create buy sell orders programatically
        /// </summary>
        /// <param name="productChild"></param>
        /// <param name="ownerProductChild"></param>
        /// <param name="quantity"></param>
        /// <param name="customerUser"></param>
        /// <param name="selectListOwner"></param>
        /// <param name="selectListCustomer"></param>
        /// <param name="addressBillToId"></param>
        /// <param name="addressShipToId"></param>
        /// <param name="selectListBillTo"></param>
        /// <param name="selectListShipTo"></param>
        /// <param name="buySellDocStateEnum"></param>
        /// <returns></returns>


        public BuySellDoc CreateSale(
            ProductChild productChild,
            Owner ownerProductChild,
            int quantity,
            decimal salePrice,
            Customer customerUser,
            System.Web.Mvc.SelectList selectListOwner,
            System.Web.Mvc.SelectList selectListCustomer,
            string addressBillToId,
            string addressShipToId,
            System.Web.Mvc.SelectList selectListBillTo,
            System.Web.Mvc.SelectList selectListShipTo,
            BuySellDocStateENUM buySellDocStateEnum,
            BuySellDocStateModifierENUM buySellDocStateModifierEnum,
            DateTime pleasePickupOnDate_End,
            DateTime expectedDeliveryDate,
            string shopId)
        {
            BuySellDoc sale = BuySellDocBiz.Factory() as BuySellDoc;

            sale.ShopId = shopId;

            sale.Initialize(
                ownerProductChild.Id,
                customerUser.Id,
                addressBillToId,
                addressShipToId,
                selectListOwner,
                selectListCustomer,
                selectListBillTo,
                selectListShipTo);

            if (pleasePickupOnDate_End == DateTime.MaxValue || pleasePickupOnDate_End == DateTime.MinValue)
            {
            }
            else
            {
                sale.PleasePickupOnDate_End = pleasePickupOnDate_End;
            }

            if (expectedDeliveryDate == DateTime.MaxValue || expectedDeliveryDate == DateTime.MinValue)
            {
            }
            else
            {
                sale.ExpectedDeliveryDate = expectedDeliveryDate;
            }


            //dont really need this, but it is good for consistancy.
            sale.BuySellDocumentTypeEnum     = BuySellDocumentTypeENUM.Purchase;
            sale.BuySellDocStateModifierEnum = buySellDocStateModifierEnum;
            sale.BuySellDocStateEnum         = buySellDocStateEnum;
            sale.ExpectedDeliveryDate        = expectedDeliveryDate;
            BuySellItem buySellItem = new BuySellItem(sale.Id, productChild.Id, quantity, salePrice, productChild.FullName());

            sale.Add(buySellItem);



            BuySellDocBiz.GetDefaultVehicalType(sale);
            //add the owners address
            sale.AddressShipFromId = productChild.ShipFromAddressId;

            setStatusDate(sale);
            ControllerCreateEditParameter parm = new ControllerCreateEditParameter();

            parm.Entity       = sale as ICommonWithId;
            parm.GlobalObject = GetGlobalObject();
            getCustomerSalesmanAndOwnerSalesman(sale);


            //add the payment amount.



            BuySellDocBiz.Create(parm);

            return(sale);
        }
Пример #15
0
        public string AddToSale(string userId, string productChildId, string poNumber, DateTime poDate)
        {
            userId.IsNullOrWhiteSpaceThrowException("No user");

            double totalThisItem = 0;

            //who is the owner:The product Child owner is the owner
            //get the productChild

            productChildId.IsNullOrWhiteSpaceThrowException("No Product");
            ProductChild productChild = ProductChildBiz.Find(productChildId);

            productChild.IsNullThrowException("productChild");



            //get the product child's owner
            Owner ownerProductChild = productChild.Owner;

            ownerProductChild.IsNullThrowException("productChildOwner");

            //get the owner
            //Get the select list for owner
            Person ownerPerson = ownerProductChild.Person;

            ownerPerson.IsNullThrowException("ownerPerson");
            System.Web.Mvc.SelectList ownerSelectList = OwnerBiz.SelectListOnlyWith(ownerProductChild);


            ////the user is the customer user;
            //get the customer
            Customer customerUser = CustomerBiz.GetPlayerFor(userId);

            //Get the select list for Customer
            //remove the owner from the list... owner cannot sell to self.
            System.Web.Mvc.SelectList customerSelectList = CustomerBiz.SelectListWithout(ownerPerson);
            System.Web.Mvc.SelectList selectListOwner    = OwnerBiz.SelectListOnlyWith(ownerProductChild);
            System.Web.Mvc.SelectList selectListCustomer = CustomerBiz.SelectListWithout(ownerPerson);

            //this is the address in the customer
            AddressMain    addressBillTo          = customerUser.DefaultBillAddress;
            AddressMain    addressShipTo          = customerUser.DefaultShipAddress;
            AddressComplex addressShipFromComplex = productChild.ShipFromAddressComplex;

            string addressBillToId = "";
            string addressShipToId = "";

            if (!addressBillTo.IsNull())
            {
                addressBillToId = addressBillTo.Id;
            }

            if (!addressShipTo.IsNull())
            {
                addressShipToId = addressShipTo.Id;
            }


            //Get the select list for AddressInform
            System.Web.Mvc.SelectList selectListBillTo = AddressBiz.SelectListBillAddressCurrentUser();
            //Get the select list for AddressShipTo
            System.Web.Mvc.SelectList selectListShipTo = AddressBiz.SelectListShipAddressCurrentuser();



            //check to see if there is any open sale which belongs to the same buyer and seller
            BuySellDoc sale = BuySellDocBiz.GetOpenSaleWithSameCustomerAndSeller(customerUser.Id, ownerProductChild.Id, productChild);

            //create the itemList.
            List <BuySellItem> buySellItems = new List <BuySellItem>();
            string             shopId       = "";

            if (sale.IsNull())
            {
                //otherwise add a new sale
                sale = CreateSale(
                    productChild,
                    ownerProductChild,
                    1,
                    productChild.Sell.SellPrice,
                    customerUser,
                    selectListOwner,
                    selectListCustomer,
                    addressBillToId,
                    addressShipToId,
                    selectListBillTo,
                    selectListShipTo,
                    BuySellDocStateENUM.RequestUnconfirmed,
                    BuySellDocStateModifierENUM.Unknown,
                    DateTime.Now,
                    DateTime.Now,
                    shopId);

                totalThisItem++;
            }

            else
            {
                //dont really need this, but it is good for consistancy.
                sale.BuySellDocumentTypeEnum = BuySellDocumentTypeENUM.Purchase;
                sale.BuySellDocStateEnum     = BuySellDocStateENUM.RequestUnconfirmed;

                //now check to see if it is the same item... or is it a new item
                //get list of items for the sale
                List <BuySellItem> itemList = sale.BuySellItems.Where(x => x.MetaData.IsDeleted == false).ToList();

                if (itemList.IsNullOrEmpty())
                {
                    BuySellItem buySellItem = new BuySellItem(sale.Id, productChild.Id, 1, productChild.Sell.SellPrice, productChild.FullName());
                    sale.Add(buySellItem);
                }
                else
                {
                    //there are items in the list
                    BuySellItem itemFound = itemList.FirstOrDefault(x => x.ProductChildId == productChild.Id);
                    if (itemFound.IsNull())
                    {
                        BuySellItem buySellItem = new BuySellItem(sale.Id, productChild.Id, 1, productChild.Sell.SellPrice, productChild.FullName());
                        sale.Add(buySellItem);
                    }
                    else
                    {
                        totalThisItem                     = itemFound.Quantity.Order;
                        itemFound.Quantity.Order         += 1;
                        itemFound.Quantity.Order_Original = itemFound.Quantity.Order;
                        //itemFound.Quantity.Ship += 1;
                    }
                }

                totalThisItem++;
                sale.AddressShipFromComplex = addressShipFromComplex;

                BuySellDocBiz.GetDefaultVehicalType(sale);
                sale.AddressShipFromId = productChild.ShipFromAddressId;

                sale.RequestUnconfirmed.SetToTodaysDate(UserName, UserId);

                ControllerCreateEditParameter parm = new ControllerCreateEditParameter();
                parm.Entity       = sale as ICommonWithId;
                parm.GlobalObject = GetGlobalObject();

                BuySellDocBiz.Update(parm);
            }

            BuySellDocBiz.SaveChanges();
            string message = string.Format("Success. You ordered {0:N2} for {1:N2} (X{2:N2})", productChild.FullName(), productChild.Sell.SellPrice, totalThisItem);

            return(message);
        }