public RedirectToRouteResult SelectEventType(FormCollection values)
        {
            List <EventType> selectedET = new List <EventType>();

            foreach (var value in values)
            {
                object o = values[value.ToString()];
                if (o.ToString().Contains("true"))
                {
                    selectedET.Add(eventTypeRepository.Get(Convert.ToInt32(value.ToString().Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries)[2])));
                }
            }

            ViewData.Model = selectedET;
            ClosetState.SetEventTypes(selectedET);

            return(RedirectToAction("Index", "GarmentSelector"));
        }
示例#2
0
        public RedirectToRouteResult SelectEventType(FormCollection values)
        {
            List <EventType> selectedET = new List <EventType>();

            foreach (var value in values)
            {
                object o = values[value.ToString()];
                if (o.ToString().Contains("true"))
                {
                    selectedET.Add(eventTypeRepository.Get(Convert.ToInt32(value.ToString().Split('_')[2])));
                }
            }

            Session["EventTypeSelected"] = selectedET;

            bool previous = ((NameValueCollection)(values)).AllKeys[6].ToLower().Contains("previous");

            if (previous)
            {
                return(RedirectToAction(Session["previousUrl"].ToString()));
            }

            return(RedirectToAction("GarmentSelector"));;
        }
示例#3
0
        private ArrayList GetFormatedValues(FormCollection values)
        {
            ArrayList   lst       = new ArrayList();
            UserGarment ug        = new UserGarment();
            int         controlId = int.Parse(((NameValueCollection)(values)).AllKeys[0].Substring(
                                                  ((NameValueCollection)(values)).AllKeys[0].Length - 1, 1));

            foreach (string tag in values)
            {
                if (tag == "x" || tag == "y")
                {
                    continue;
                }

                if (int.Parse(tag.Substring(tag.Length - 1)) != controlId)
                {
                    lst.Add(ug);
                    ug = new UserGarment();
                    controlId++;
                }

                string propName  = tag.Substring(0, tag.Length - 1);
                string propValue = values[tag.ToString()];

                if (propValue == "")
                {
                    continue;
                }

                switch (propName)
                {
                case "Title":
                    Silouhette s = silouhetteRepository.Get(int.Parse(propValue));
                    ug.Title           = s.Category.Description + " " + s.Description;
                    ug.Tags.Silouhette = s;
                    break;

                case "Fabric":
                    ug.Tags.Fabric = fabricRepository.Get(int.Parse(propValue));
                    break;

                case "PrimaryColor":
                    ug.Tags.Colors.Add(colorRepository.Get(int.Parse(propValue)));
                    break;

                case "Pattern":
                    ug.Tags.Pattern = patternRepository.Get(int.Parse(propValue));
                    break;

                case "Season":
                    ug.Tags.Seasons.Add((Season)int.Parse(propValue));
                    break;

                case "EventType":
                    ug.Tags.EventTypes.Add(eventTypeRepository.Get(int.Parse(propValue)));
                    break;

                case "PrivacyStatus":
                    ug.Visibility = (Convert.ToBoolean(propValue)) ? GarmentVisibility.Private : GarmentVisibility.Public;
                    break;
                }
            }

            lst.Add(ug);
            return(lst);
        }
示例#4
0
        private ArrayList GetFormatedValues(FormCollection values)
        {
            ArrayList   lst = new ArrayList();
            UserGarment ug  = new UserGarment();

            if (values.Count == 0)
            {
                return(lst);
            }

            int controlId = int.Parse(((NameValueCollection)(values)).AllKeys[0].Substring(
                                          ((NameValueCollection)(values)).AllKeys[0].Length - 1, 1));

            string titleSilouhette = string.Empty;
            string titleCategory   = string.Empty;
            string titleColor      = string.Empty;
            string titlePattern    = string.Empty;
            string titleFabric     = string.Empty;

            foreach (string tag in values)
            {
                if (tag == "x" || tag == "y")
                {
                    continue;
                }

                if (int.Parse(tag.Substring(tag.Length - 1)) != controlId)
                {
                    ug.Title = string.Format("{0} {1} {2} {3} {4}", titleSilouhette, titleColor, titlePattern, titleCategory, titleFabric);
                    lst.Add(ug);
                    ug = new UserGarment();
                    titleSilouhette = string.Empty;
                    titleCategory   = string.Empty;
                    titleColor      = string.Empty;
                    titlePattern    = string.Empty;
                    titleFabric     = string.Empty;
                    controlId++;
                }

                string propName  = tag.Substring(0, tag.Length - 1);
                string propValue = values[tag.ToString()];

                if (propValue == "")
                {
                    continue;
                }

                switch (propName)
                {
                case "Title":
                    Silouhette s = silouhetteRepository.Get(int.Parse(propValue));
                    titleSilouhette    = s.Description;
                    titleCategory      = s.Category.Description;
                    ug.Tags.Silouhette = s;
                    break;

                case "Fabric":
                    Fabric f = fabricRepository.Get(int.Parse(propValue));
                    ug.Tags.Fabric = f;
                    titleFabric    = f.Description;
                    break;

                case "PrimaryColor":
                    FashionAde.Core.Clothing.Color col = colorRepository.Get(int.Parse(propValue));
                    ug.Tags.Colors.Add(col);
                    ug.Tags.DefaultColor = col;
                    titleColor           = col.Description;
                    break;

                case "Pattern":
                    Pattern p = patternRepository.Get(int.Parse(propValue));
                    ug.Tags.Pattern = p;
                    titlePattern    = p.Description;
                    break;

                case "Season":
                    ug.Tags.Seasons.Add((Season)int.Parse(propValue));
                    break;

                case "EventType":
                    ug.Tags.EventTypes.Add(eventTypeRepository.Get(int.Parse(propValue)));
                    break;

                case "PrivacyStatus":
                    ug.SetVisibility((Convert.ToBoolean(propValue)) ? GarmentVisibility.Private : GarmentVisibility.Public);
                    break;
                }
            }
            ug.Title = string.Format("{0} {1} {2} {3} {4}", titleSilouhette, titleColor, titlePattern, titleCategory, titleFabric);

            if (ug.Title != "    ")
            {
                lst.Add(ug);
            }
            return(lst);
        }