Ejemplo n.º 1
0
        public ActionResult Edit([Bind(Include =
                                           " ItemOptionId"
                                           + ",Description"
                                       )] ItemOption ItemOption)
        {
            ItemOption oItemOption = new ItemOption();

            oItemOption.ItemOptionId = System.Convert.ToInt32(ItemOption.ItemOptionId);
            oItemOption = ItemOptionData.Select_Record(ItemOption);

            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = ItemOptionData.Update(oItemOption, ItemOption);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Update");
                }
            }

            return(View(ItemOption));
        }
Ejemplo n.º 2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogObject other &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((IsDeleted == null && other.IsDeleted == null) || (IsDeleted?.Equals(other.IsDeleted) == true)) &&
                   ((CustomAttributeValues == null && other.CustomAttributeValues == null) || (CustomAttributeValues?.Equals(other.CustomAttributeValues) == true)) &&
                   ((CatalogV1Ids == null && other.CatalogV1Ids == null) || (CatalogV1Ids?.Equals(other.CatalogV1Ids) == true)) &&
                   ((PresentAtAllLocations == null && other.PresentAtAllLocations == null) || (PresentAtAllLocations?.Equals(other.PresentAtAllLocations) == true)) &&
                   ((PresentAtLocationIds == null && other.PresentAtLocationIds == null) || (PresentAtLocationIds?.Equals(other.PresentAtLocationIds) == true)) &&
                   ((AbsentAtLocationIds == null && other.AbsentAtLocationIds == null) || (AbsentAtLocationIds?.Equals(other.AbsentAtLocationIds) == true)) &&
                   ((ImageId == null && other.ImageId == null) || (ImageId?.Equals(other.ImageId) == true)) &&
                   ((ItemData == null && other.ItemData == null) || (ItemData?.Equals(other.ItemData) == true)) &&
                   ((CategoryData == null && other.CategoryData == null) || (CategoryData?.Equals(other.CategoryData) == true)) &&
                   ((ItemVariationData == null && other.ItemVariationData == null) || (ItemVariationData?.Equals(other.ItemVariationData) == true)) &&
                   ((TaxData == null && other.TaxData == null) || (TaxData?.Equals(other.TaxData) == true)) &&
                   ((DiscountData == null && other.DiscountData == null) || (DiscountData?.Equals(other.DiscountData) == true)) &&
                   ((ModifierListData == null && other.ModifierListData == null) || (ModifierListData?.Equals(other.ModifierListData) == true)) &&
                   ((ModifierData == null && other.ModifierData == null) || (ModifierData?.Equals(other.ModifierData) == true)) &&
                   ((TimePeriodData == null && other.TimePeriodData == null) || (TimePeriodData?.Equals(other.TimePeriodData) == true)) &&
                   ((ProductSetData == null && other.ProductSetData == null) || (ProductSetData?.Equals(other.ProductSetData) == true)) &&
                   ((PricingRuleData == null && other.PricingRuleData == null) || (PricingRuleData?.Equals(other.PricingRuleData) == true)) &&
                   ((ImageData == null && other.ImageData == null) || (ImageData?.Equals(other.ImageData) == true)) &&
                   ((MeasurementUnitData == null && other.MeasurementUnitData == null) || (MeasurementUnitData?.Equals(other.MeasurementUnitData) == true)) &&
                   ((SubscriptionPlanData == null && other.SubscriptionPlanData == null) || (SubscriptionPlanData?.Equals(other.SubscriptionPlanData) == true)) &&
                   ((ItemOptionData == null && other.ItemOptionData == null) || (ItemOptionData?.Equals(other.ItemOptionData) == true)) &&
                   ((ItemOptionValueData == null && other.ItemOptionValueData == null) || (ItemOptionValueData?.Equals(other.ItemOptionValueData) == true)) &&
                   ((CustomAttributeDefinitionData == null && other.CustomAttributeDefinitionData == null) || (CustomAttributeDefinitionData?.Equals(other.CustomAttributeDefinitionData) == true)) &&
                   ((QuickAmountsSettingsData == null && other.QuickAmountsSettingsData == null) || (QuickAmountsSettingsData?.Equals(other.QuickAmountsSettingsData) == true)));
        }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include =
                                             "Description"
                                         )] ItemOption ItemOption)
        {
            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = ItemOptionData.Add(ItemOption);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Insert");
                }
            }

            return(View(ItemOption));
        }
Ejemplo n.º 4
0
        public ActionResult DeleteConfirmed(
            Int32?ItemOptionId
            )
        {
            ItemOption ItemOption = new ItemOption();

            ItemOption.ItemOptionId = System.Convert.ToInt32(ItemOptionId);
            ItemOption = ItemOptionData.Select_Record(ItemOption);

            bool bSucess = false;

            bSucess = ItemOptionData.Delete(ItemOption);
            if (bSucess == true)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", "Can Not Delete");
            }
            return(null);
        }
Ejemplo n.º 5
0
        // GET: /ItemOption/Delete/<id>
        public ActionResult Delete(
            Int32?ItemOptionId
            )
        {
            if (
                ItemOptionId == null
                )
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            ItemOption ItemOption = new ItemOption();

            ItemOption.ItemOptionId = System.Convert.ToInt32(ItemOptionId);
            ItemOption = ItemOptionData.Select_Record(ItemOption);

            if (ItemOption == null)
            {
                return(HttpNotFound());
            }
            return(View(ItemOption));
        }
Ejemplo n.º 6
0
        public override int GetHashCode()
        {
            int hashCode = -1814270990;

            if (Type != null)
            {
                hashCode += Type.GetHashCode();
            }

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (UpdatedAt != null)
            {
                hashCode += UpdatedAt.GetHashCode();
            }

            if (Version != null)
            {
                hashCode += Version.GetHashCode();
            }

            if (IsDeleted != null)
            {
                hashCode += IsDeleted.GetHashCode();
            }

            if (CustomAttributeValues != null)
            {
                hashCode += CustomAttributeValues.GetHashCode();
            }

            if (CatalogV1Ids != null)
            {
                hashCode += CatalogV1Ids.GetHashCode();
            }

            if (PresentAtAllLocations != null)
            {
                hashCode += PresentAtAllLocations.GetHashCode();
            }

            if (PresentAtLocationIds != null)
            {
                hashCode += PresentAtLocationIds.GetHashCode();
            }

            if (AbsentAtLocationIds != null)
            {
                hashCode += AbsentAtLocationIds.GetHashCode();
            }

            if (ImageId != null)
            {
                hashCode += ImageId.GetHashCode();
            }

            if (ItemData != null)
            {
                hashCode += ItemData.GetHashCode();
            }

            if (CategoryData != null)
            {
                hashCode += CategoryData.GetHashCode();
            }

            if (ItemVariationData != null)
            {
                hashCode += ItemVariationData.GetHashCode();
            }

            if (TaxData != null)
            {
                hashCode += TaxData.GetHashCode();
            }

            if (DiscountData != null)
            {
                hashCode += DiscountData.GetHashCode();
            }

            if (ModifierListData != null)
            {
                hashCode += ModifierListData.GetHashCode();
            }

            if (ModifierData != null)
            {
                hashCode += ModifierData.GetHashCode();
            }

            if (TimePeriodData != null)
            {
                hashCode += TimePeriodData.GetHashCode();
            }

            if (ProductSetData != null)
            {
                hashCode += ProductSetData.GetHashCode();
            }

            if (PricingRuleData != null)
            {
                hashCode += PricingRuleData.GetHashCode();
            }

            if (ImageData != null)
            {
                hashCode += ImageData.GetHashCode();
            }

            if (MeasurementUnitData != null)
            {
                hashCode += MeasurementUnitData.GetHashCode();
            }

            if (SubscriptionPlanData != null)
            {
                hashCode += SubscriptionPlanData.GetHashCode();
            }

            if (ItemOptionData != null)
            {
                hashCode += ItemOptionData.GetHashCode();
            }

            if (ItemOptionValueData != null)
            {
                hashCode += ItemOptionValueData.GetHashCode();
            }

            if (CustomAttributeDefinitionData != null)
            {
                hashCode += CustomAttributeDefinitionData.GetHashCode();
            }

            if (QuickAmountsSettingsData != null)
            {
                hashCode += QuickAmountsSettingsData.GetHashCode();
            }

            return(hashCode);
        }
Ejemplo n.º 7
0
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"Type = {(Type == null ? "null" : Type.ToString())}");
     toStringOutput.Add($"Id = {(Id == null ? "null" : Id == string.Empty ? "" : Id)}");
     toStringOutput.Add($"UpdatedAt = {(UpdatedAt == null ? "null" : UpdatedAt == string.Empty ? "" : UpdatedAt)}");
     toStringOutput.Add($"Version = {(Version == null ? "null" : Version.ToString())}");
     toStringOutput.Add($"IsDeleted = {(IsDeleted == null ? "null" : IsDeleted.ToString())}");
     toStringOutput.Add($"CustomAttributeValues = {(CustomAttributeValues == null ? "null" : CustomAttributeValues.ToString())}");
     toStringOutput.Add($"CatalogV1Ids = {(CatalogV1Ids == null ? "null" : $"[{ string.Join(", ", CatalogV1Ids)} ]")}");
     toStringOutput.Add($"PresentAtAllLocations = {(PresentAtAllLocations == null ? "null" : PresentAtAllLocations.ToString())}");
     toStringOutput.Add($"PresentAtLocationIds = {(PresentAtLocationIds == null ? "null" : $"[{ string.Join(", ", PresentAtLocationIds)} ]")}");
     toStringOutput.Add($"AbsentAtLocationIds = {(AbsentAtLocationIds == null ? "null" : $"[{ string.Join(", ", AbsentAtLocationIds)} ]")}");
     toStringOutput.Add($"ImageId = {(ImageId == null ? "null" : ImageId == string.Empty ? "" : ImageId)}");
     toStringOutput.Add($"ItemData = {(ItemData == null ? "null" : ItemData.ToString())}");
     toStringOutput.Add($"CategoryData = {(CategoryData == null ? "null" : CategoryData.ToString())}");
     toStringOutput.Add($"ItemVariationData = {(ItemVariationData == null ? "null" : ItemVariationData.ToString())}");
     toStringOutput.Add($"TaxData = {(TaxData == null ? "null" : TaxData.ToString())}");
     toStringOutput.Add($"DiscountData = {(DiscountData == null ? "null" : DiscountData.ToString())}");
     toStringOutput.Add($"ModifierListData = {(ModifierListData == null ? "null" : ModifierListData.ToString())}");
     toStringOutput.Add($"ModifierData = {(ModifierData == null ? "null" : ModifierData.ToString())}");
     toStringOutput.Add($"TimePeriodData = {(TimePeriodData == null ? "null" : TimePeriodData.ToString())}");
     toStringOutput.Add($"ProductSetData = {(ProductSetData == null ? "null" : ProductSetData.ToString())}");
     toStringOutput.Add($"PricingRuleData = {(PricingRuleData == null ? "null" : PricingRuleData.ToString())}");
     toStringOutput.Add($"ImageData = {(ImageData == null ? "null" : ImageData.ToString())}");
     toStringOutput.Add($"MeasurementUnitData = {(MeasurementUnitData == null ? "null" : MeasurementUnitData.ToString())}");
     toStringOutput.Add($"SubscriptionPlanData = {(SubscriptionPlanData == null ? "null" : SubscriptionPlanData.ToString())}");
     toStringOutput.Add($"ItemOptionData = {(ItemOptionData == null ? "null" : ItemOptionData.ToString())}");
     toStringOutput.Add($"ItemOptionValueData = {(ItemOptionValueData == null ? "null" : ItemOptionValueData.ToString())}");
     toStringOutput.Add($"CustomAttributeDefinitionData = {(CustomAttributeDefinitionData == null ? "null" : CustomAttributeDefinitionData.ToString())}");
     toStringOutput.Add($"QuickAmountsSettingsData = {(QuickAmountsSettingsData == null ? "null" : QuickAmountsSettingsData.ToString())}");
 }
Ejemplo n.º 8
0
        // GET: /ItemOption/
        public ActionResult Index(string sortOrder,
                                  String SearchField,
                                  String SearchCondition,
                                  String SearchText,
                                  String Export,
                                  int?PageSize,
                                  int?page,
                                  string command)
        {
            if (command == "Show All")
            {
                SearchField                = null;
                SearchCondition            = null;
                SearchText                 = null;
                Session["SearchField"]     = null;
                Session["SearchCondition"] = null;
                Session["SearchText"]      = null;
            }
            else if (command == "Add New Record")
            {
                return(RedirectToAction("Create"));
            }
            else if (command == "Export")
            {
                Session["Export"] = Export;
            }
            else if (command == "Search" | command == "Page Size")
            {
                if (!string.IsNullOrEmpty(SearchText))
                {
                    Session["SearchField"]     = SearchField;
                    Session["SearchCondition"] = SearchCondition;
                    Session["SearchText"]      = SearchText;
                }
            }
            if (command == "Page Size")
            {
                Session["PageSize"] = PageSize;
            }

            ViewData["SearchFields"]     = GetFields((Session["SearchField"] == null ? "Item Option Id" : Convert.ToString(Session["SearchField"])));
            ViewData["SearchConditions"] = Library.GetConditions((Session["SearchCondition"] == null ? "Contains" : Convert.ToString(Session["SearchCondition"])));
            ViewData["SearchText"]       = Session["SearchText"];
            ViewData["Exports"]          = Library.GetExports((Session["Export"] == null ? "Pdf" : Convert.ToString(Session["Export"])));
            ViewData["PageSizes"]        = Library.GetPageSizes();

            ViewData["CurrentSort"]          = sortOrder;
            ViewData["ItemOptionIdSortParm"] = sortOrder == "ItemOptionId_asc" ? "ItemOptionId_desc" : "ItemOptionId_asc";
            ViewData["DescriptionSortParm"]  = sortOrder == "Description_asc" ? "Description_desc" : "Description_asc";

            dtItemOption = ItemOptionData.SelectAll();

            try
            {
                if (!string.IsNullOrEmpty(Convert.ToString(Session["SearchField"])) & !string.IsNullOrEmpty(Convert.ToString(Session["SearchCondition"])) & !string.IsNullOrEmpty(Convert.ToString(Session["SearchText"])))
                {
                    dtItemOption = ItemOptionData.Search(Convert.ToString(Session["SearchField"]), Convert.ToString(Session["SearchCondition"]), Convert.ToString(Session["SearchText"]));
                }
            }
            catch { }

            var Query = from rowItemOption in dtItemOption.AsEnumerable()
                        select new ItemOption()
            {
                ItemOptionId  = rowItemOption.Field <Int32>("ItemOptionId")
                , Description = rowItemOption.Field <String>("Description")
            };

            switch (sortOrder)
            {
            case "ItemOptionId_desc":
                Query = Query.OrderByDescending(s => s.ItemOptionId);
                break;

            case "ItemOptionId_asc":
                Query = Query.OrderBy(s => s.ItemOptionId);
                break;

            case "Description_desc":
                Query = Query.OrderByDescending(s => s.Description);
                break;

            case "Description_asc":
                Query = Query.OrderBy(s => s.Description);
                break;

            default:      // Name ascending
                Query = Query.OrderBy(s => s.ItemOptionId);
                break;
            }

            if (command == "Export")
            {
                GridView  gv = new GridView();
                DataTable dt = new DataTable();
                dt.Columns.Add("Item Option Id", typeof(string));
                dt.Columns.Add("Description", typeof(string));
                foreach (var item in Query)
                {
                    dt.Rows.Add(
                        item.ItemOptionId
                        , item.Description
                        );
                }
                gv.DataSource = dt;
                gv.DataBind();
                ExportData(Export, gv, dt);
            }

            int pageNumber = (page ?? 1);
            int?pageSZ     = (Convert.ToInt32(Session["PageSize"]) == 0 ? 5 : Convert.ToInt32(Session["PageSize"]));

            return(View(Query.ToPagedList(pageNumber, (pageSZ ?? 5))));
        }