private void form2obj(StaticPage page1) { page1.PageName = TxtPageName.Text; page1.Visible = ChkVisibile.Checked; page1.ShowPageTitle = ChkShowPageTitle.Checked; page1.PageTitleTranslations.Clear(); page1.PageContentTranslations.Clear(); foreach (KeyValuePair<string, string> item in Config.CultureList) { TextBox t1 = new TextBox(); t1 = (TextBox)PanelPageTitle.FindControl("TxtPageTitle" + item.Value); page1.PageTitleTranslations.Add(item.Key, t1.Text); var html1 = new Controls_ContentEditorControl(); html1 = Utility.FindControlRecursive<Controls_ContentEditorControl>(this, "HtmlText"+item.Value); page1.PageContentTranslations.Add(item.Key, html1.Text); } }
private void obj2form(StaticPage page1) { TxtPageName.Text = page1.PageName; ChkVisibile.Checked = page1.Visible; ChkShowPageTitle.Checked = page1.ShowPageTitle; foreach (KeyValuePair<string, string> item in Config.CultureList) { string sTitleTranslation = ""; TextBox t1 = new TextBox(); t1 = (TextBox)PanelPageTitle.FindControl("TxtPageTitle" + item.Value); page1.PageTitleTranslations.TryGetValue(item.Key, out sTitleTranslation); t1.Text = sTitleTranslation; string sPageContentTraslation = ""; var html1 = new Controls_ContentEditorControl(); html1 = Utility.FindControlRecursive<Controls_ContentEditorControl>(this, "HtmlText" + item.Value); page1.PageContentTranslations.TryGetValue(item.Key, out sPageContentTraslation); html1.Text = sPageContentTraslation; } }
private void obj2form(Item obj) { LblId.Text = obj.Id.ToString(); LblOrderId.Text = obj.Ordering.ToString(); LblUpdated.Text = obj.DateUpdated.ToString() + " by " + obj.UserUpdated; LblCreated.Text = obj.DateInserted.ToString() + " by " + obj.UserInserted; ChkEnabled.Checked = obj.Enabled; TxtAlias.Text = obj.Alias; TxtCssClass.Text = obj.CssClass; TxtExtId.Text = obj.ExtId; Utility.SetDropByValue(DropCategories, obj.CategoryId.ToString()); foreach (KeyValuePair<string, string> item in Config.CultureList) { string sTitleTranslation = ""; TextBox t1 = new TextBox(); t1 = (TextBox)PanelTitle.FindControl("TxtTitle" + item.Value); obj.TitleTranslations.TryGetValue(item.Key, out sTitleTranslation); t1.Text = sTitleTranslation; string sDescriptionTraslation = ""; var txt2 = new Controls_ContentEditorControl(); txt2 = Utility.FindControlRecursive<Controls_ContentEditorControl>(this, "TxtDescription" + item.Value); obj.DescriptionTranslations.TryGetValue(item.Key, out sDescriptionTraslation); txt2.Text = sDescriptionTraslation; //string sDescriptionTraslation = ""; //FCKeditor t2 = new FCKeditor(); //t2 = (FCKeditor)PanelDescription.FindControl("TxtDescription" + item.Value); //obj.DescriptionTranslations.TryGetValue(item.Key, out sDescriptionTraslation); //t2.Value = sDescriptionTraslation; } ItemParams1.ClearParams(); ItemFields1.ClearParams(); ItemParams1.LoadParams(obj); ItemFields1.LoadFields(obj); PermissionsControl1.Obj2form(obj); LitSection.Text = obj.Category.Section.Title; LitItemType.Text = obj.ItemTypeName; this.ItemDate = obj.ItemDate; this.ValidFrom = obj.ValidFrom; this.ValidTo = obj.ValidTo; }
private void editPage(string pageName) { LblOk.Text = ""; LblErr.Text = ""; TxtPageName.Text = pageName; TxtPageName.Enabled = true; TxtId.Text = ""; ChkShowPageTitle.Checked = true; foreach (KeyValuePair<string, string> item in Config.CultureList) { TextBox t1 = new TextBox(); t1 = (TextBox)PanelPageTitle.FindControl("TxtPageTitle" + item.Value); t1.Text = ""; var html1 = new Controls_ContentEditorControl(); html1 = Utility.FindControlRecursive<Controls_ContentEditorControl>(this, "HtmlText" + item.Value); html1.Text = ""; } if (pageName != "") { TxtId.Text = "1"; TxtPageName.Enabled = false; StaticPage currPage = new StaticPage(); currPage = new StaticPagesManager().GetStaticPageByName(pageName); obj2form(currPage); } MultiView1.ActiveViewIndex = 1; }
private void form2obj(Item obj) { obj.Id = CurrentId; obj.Enabled = ChkEnabled.Checked; obj.TitleTranslations.Clear(); obj.DescriptionTranslations.Clear(); obj.CategoryId = int.Parse(DropCategories.SelectedValue); obj.Alias = TxtAlias.Text; obj.CssClass = TxtCssClass.Text; obj.ExtId = TxtExtId.Text; obj.ItemDate = this.ItemDate; obj.ValidFrom = this.ValidFrom; obj.ValidTo = this.ValidTo; if (CurrentId == 0) obj.ItemTypeName = LitItemType.Text; foreach (KeyValuePair<string, string> item in Config.CultureList) { TextBox t1 = new TextBox(); t1 = (TextBox)PanelTitle.FindControl("TxtTitle" + item.Value); obj.TitleTranslations.Add(item.Key, t1.Text); var txt2 = new Controls_ContentEditorControl(); txt2 = Utility.FindControlRecursive<Controls_ContentEditorControl>(this, "TxtDescription" + item.Value); obj.DescriptionTranslations.Add(item.Key, txt2.Text); } obj.ItemParams = FormBuilder.GetParamsString(obj.ItemType.Params, ItemParams1); string fieldsString = FormBuilder.GetParamsString(obj.ItemType.Fields, ItemFields1); obj.LoadCustomFieldsFromString(fieldsString); PermissionsControl1.Form2obj(obj); }
private void clearForm() { LblId.Text = ""; LblOrderId.Text = ""; LitSection.Text = ""; LitItemType.Text = ""; LblCreated.Text = ""; LblUpdated.Text = ""; ChkEnabled.Checked = true; TxtAlias.Text = ""; TxtCssClass.Text = ""; TxtExtId.Text = ""; this.ItemDate = DateTime.MinValue; this.ValidFrom = DateTime.MinValue; this.ValidTo = DateTime.MinValue; foreach (KeyValuePair<string, string> item in Config.CultureList) { TextBox t1 = new TextBox(); t1 = (TextBox)PanelTitle.FindControl("TxtTitle" + item.Value); t1.Text = ""; var txt2 = new Controls_ContentEditorControl(); txt2 = Utility.FindControlRecursive<Controls_ContentEditorControl>(this, "TxtDescription" + item.Value); txt2.Text = ""; //FCKeditor t2 = new FCKeditor(); //t2 = (FCKeditor)PanelDescription.FindControl("TxtDescription" + item.Value); //t2.Value = ""; } PermissionsControl1.ClearForm(); }
private List<ItemAttributeValue> form2obj(ProductItem obj) { obj.Id = CurrentId; obj.Enabled = ChkEnabled.Checked; obj.TitleTranslations.Clear(); obj.DescriptionTranslations.Clear(); obj.CategoryId = int.Parse(DropCategories.SelectedValue); obj.Alias = TxtAlias.Text; obj.CssClass = TxtCssClass.Text; obj.ItemDate = this.ItemDate; obj.ValidFrom = this.ValidFrom; obj.ValidTo = this.ValidTo; // product fields // Product Type int type = 0; int.TryParse(DropNew.SelectedValue, out type); if (type > 0) { obj.ProductType = (ProductItem.ProductTypeEnum)type; } // Attribute Set int attributeSetId = 0; int.TryParse(DropSets.SelectedValue, out attributeSetId); obj.AttributeSet = attributeSetId; // Draft obj.IsDraft = false; // SKU obj.SKU = TxtSKU.Text; // Regular Price decimal regPrice = 0m; decimal.TryParse(TxtRegularPrice.Text, out regPrice); if (regPrice > 0) obj.RegularPrice = regPrice; // Sale Price decimal salePrice = 0m; decimal.TryParse(TxtSalePrice.Text, out salePrice); if(salePrice > 0) obj.SalePrice = salePrice; // Weight decimal weight = 0m; decimal.TryParse(TxtWeight.Text, out weight); if(weight > 0) obj.Weight = weight; // Qty int qty = 0; int.TryParse(TxtQty.Text, out qty); if (weight > 0) obj.Availability = qty; // Stock int inStock = 0; int.TryParse(DropStock.SelectedValue, out inStock); if (inStock > 0) obj.InStock = (inStock == 1) ? true : false; if (CurrentId == 0) obj.ItemTypeName = LitItemType.Text; foreach (KeyValuePair<string, string> item in Config.CultureList) { TextBox t1 = new TextBox(); t1 = (TextBox)PanelTitle.FindControl("TxtTitle" + item.Value); obj.TitleTranslations.Add(item.Key, t1.Text); var txt2 = new Controls_ContentEditorControl(); txt2 = Utility.FindControlRecursive<Controls_ContentEditorControl>(this, "TxtDescription" + item.Value); obj.DescriptionTranslations.Add(item.Key, txt2.Text); } foreach(GridViewRow r in GridViewSimple.Rows) { CheckBox cb = (CheckBox)r.FindControl("chkRow"); string IdString = r.Cells[5].Text; int Id = 0; int.TryParse(IdString, out Id); var p = new ProductItemsManager().GetByKey(Id); if (cb.Checked) { p.ThreadId = CurrentId; } else { if (p.ThreadId == CurrentId ) p.ThreadId = p.Id; } try { new ProductItemsManager().Update(p); } catch (Exception e1) { LblErr.Text = RenderError(Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString()); } } foreach (GridViewRow r in GridRelated.Rows) { CheckBox cb = (CheckBox)r.FindControl("chkRow"); string IdString = r.Cells[5].Text; int Id = 0; int.TryParse(IdString, out Id); var p = new ProductItemsManager().GetByKey(Id); if (cb.Checked) { try { new ProductItemsManager().SetRelated(CurrentId, p.Id); } catch (Exception e1) { LblErr.Text = RenderError(Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString()); } } else { try { new ProductItemsManager().DeleteRelated(CurrentId, p.Id); } catch (Exception e1) { LblErr.Text = RenderError(Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString()); } } } var atts = new List<ItemAttributeValue>(); // Store ItemAttributeValues var set = sman.GetByKey(attributeSetId); attributes.Clear(); foreach (var attributeId in set.AttributesList) { var attribute = aman.GetByKey(attributeId); attributes.Add(attribute); } foreach (var attribute in attributes) { if (!attribute.AllowCustomValue) { DropDownList d1 = new DropDownList(); d1 = (DropDownList)PanelAttributes.FindControl("DropAttributeValues" + attribute.Name); int attributeValueId = 0; int.TryParse(d1.SelectedValue, out attributeValueId); var record = new ItemAttributeValue(); record.AttributeId = attribute.Id; record.AttributeValueId = attributeValueId; record.ItemId = CurrentId; atts.Add(record); } else { TextBox t1 = new TextBox(); t1 = (TextBox)QuickAttributes.FindControl("TxtCustomField" + attribute.Name); var record = new ItemAttributeValue(); record.AttributeId = attribute.Id; record.AttributeValueId = 0; record.CustomValueString = t1.Text; record.ItemId = CurrentId; atts.Add(record); } } obj.ItemParams = FormBuilder.GetParamsString(obj.ItemType.Params, ItemParams1); string fieldsString = FormBuilder.GetParamsString(obj.ItemType.Fields, ItemFields1); obj.LoadCustomFieldsFromString(fieldsString); PermissionsControl1.Form2obj(obj); return atts; }
private void clearForm() { LblId.Text = ""; LblOrderId.Text = ""; LitItemType.Text = ""; LblCreated.Text = ""; LblUpdated.Text = ""; ChkEnabled.Checked = true; TxtAlias.Text = ""; TxtCssClass.Text = ""; TxtRegularPrice.Text = ""; TxtSalePrice.Text = ""; TxtSKU.Text = ""; TxtRegularPrice.Text = ""; TxtSalePrice.Text = ""; TxtWeight.Text = ""; TxtQty.Text = ""; //DropSets.SelectedValue = "-1"; this.ItemDate = DateTime.MinValue; this.ValidFrom = DateTime.MinValue; this.ValidTo = DateTime.MinValue; foreach (KeyValuePair<string, string> item in Config.CultureList) { TextBox t1 = new TextBox(); t1 = (TextBox)PanelTitle.FindControl("TxtTitle" + item.Value); t1.Text = ""; var txt2 = new Controls_ContentEditorControl(); txt2 = Utility.FindControlRecursive<Controls_ContentEditorControl>(this, "TxtDescription" + item.Value); txt2.Text = ""; } foreach (var attribute in attributes) { if (!attribute.AllowCustomValue) { DropDownList d1 = new DropDownList(); d1 = (DropDownList)PanelAttributes.FindControl("DropAttributeValues" + attribute.Name); d1.SelectedValue = ""; } else { TextBox t1 = new TextBox(); t1 = (TextBox)PanelAttributes.FindControl("TxtCustomField" + attribute.Name); t1.Text = ""; } } PermissionsControl1.ClearForm(); }
private void obj2form(ProductItem obj) { LblId.Text = obj.Id.ToString(); LblOrderId.Text = obj.Ordering.ToString(); LblUpdated.Text = obj.DateUpdated.ToString() + " by " + obj.UserUpdated; LblCreated.Text = obj.DateInserted.ToString() + " by " + obj.UserInserted; ChkEnabled.Checked = obj.Enabled; TxtAlias.Text = obj.Alias; TxtCssClass.Text = obj.CssClass; Utility.SetDropByValue(DropCategories, obj.CategoryId.ToString()); foreach (KeyValuePair<string, string> item in Config.CultureList) { string sTitleTranslation = ""; TextBox t1 = new TextBox(); t1 = (TextBox)PanelTitle.FindControl("TxtTitle" + item.Value); obj.TitleTranslations.TryGetValue(item.Key, out sTitleTranslation); t1.Text = sTitleTranslation; string sDescriptionTraslation = ""; var txt2 = new Controls_ContentEditorControl(); txt2 = Utility.FindControlRecursive<Controls_ContentEditorControl>(this, "TxtDescription" + item.Value); obj.DescriptionTranslations.TryGetValue(item.Key, out sDescriptionTraslation); txt2.Text = sDescriptionTraslation; } // QUI popolo le varianti se son già salvate attributes.Clear(); for (int i = 0; i < obj.Attributes.Count; i++) { DropDownList d1 = new DropDownList(); d1 = (DropDownList)PanelAttributes.FindControl("DropAttributeValues" + obj.Attributes[i].Name); Utility.SetDropByValue(d1, obj.AttributeValues[i].Id.ToString()); } for (int i = 0; i < obj.CustomAttributes.Count; i++) { TextBox t1 = new TextBox(); t1 = (TextBox)PanelAttributes.FindControl("TxtCustomField" + obj.CustomAttributes[i].Name); t1.Text = obj.CustomAttributeValues[i]; } //product fields TxtSKU.Text = obj.SKU; TxtRegularPrice.Text = (obj.RegularPrice > 0) ? obj.RegularPrice.ToString() : "" ; TxtSalePrice.Text = (obj.SalePrice > 0) ? obj.SalePrice.ToString() : ""; TxtWeight.Text = (obj.Weight > 0) ? obj.Weight.ToString() : ""; TxtQty.Text = (obj.Availability > 0) ? obj.Availability.ToString() : ""; DropStock.SelectedValue = (obj.InStock) ? "1" : "0"; if (obj.AttributeSet > 0) { DropSets.SelectedValue = (obj.AttributeSet.ToString()); DropSets.Enabled = false; } else { DropSets.Enabled = true; } ItemParams1.ClearParams(); ItemFields1.ClearParams(); ItemParams1.LoadParams(obj); ItemFields1.LoadFields(obj); PermissionsControl1.Obj2form(obj); LitItemType.Text = obj.ItemTypeName; this.ItemDate = obj.ItemDate; this.ValidFrom = obj.ValidFrom; this.ValidTo = obj.ValidTo; int itemType = 0; int.TryParse(DropNew.SelectedValue, out itemType); if ((ProductItem.ProductTypeEnum)itemType == ProductItem.ProductTypeEnum.Configurable || obj.ProductType == ProductItem.ProductTypeEnum.Configurable) { PlhConfigurableProductPane.Visible = true; plhConfigurableProductTab.Visible = true; } else { PlhConfigurableProductPane.Visible = false; plhConfigurableProductTab.Visible = false; } }