/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CustomizedProductDisplay cpd = new CustomizedProductDisplay(CustomizedProductDisplay.Columns.RegionId, base.RegionId); CustomizedProductDisplayTypeProductMapCollection cpdmColl = new CustomizedProductDisplayTypeProductMapCollection() .Where(CustomizedProductDisplayTypeProductMap.Columns.CustomizedProductDisplayTypeId, cpd.CustomizedProductDisplayTypeId) .Load(); dlProducts.DataSource = cpdmColl; dlProducts.DataBind(); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CustomizedProductDisplay cpd = new CustomizedProductDisplay(CustomizedProductDisplay.Columns.RegionId, base.RegionId); CustomizedProductDisplayTypeProductMapCollection cpdmColl = new CustomizedProductDisplayTypeProductMapCollection() .Where(CustomizedProductDisplayTypeProductMap.Columns.CustomizedProductDisplayTypeId, cpd.CustomizedProductDisplayTypeId) .Load(); dlProducts.DataSource = cpdmColl; dlProducts.DataBind(); } }
/// <summary> /// Loads the customized product display. /// </summary> /// <returns></returns> private CustomizedProductDisplay LoadCustomizedProductDisplay() { CustomizedProductDisplay customizedProductDisplay; if (regionId <= 0) { customizedProductDisplay = new CustomizedProductDisplay(); } else { customizedProductDisplay = new CustomizedProductDisplay(CustomizedProductDisplay.Columns.RegionId, regionId); } return(customizedProductDisplay); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { if (base.RegionId == 0) { regionId = SubSonic.Sugar.Web.QueryString <int>("regionId"); } else { regionId = base.RegionId; } if (!IsPostBack) { _currentDisplay = LoadCustomizedProductDisplay(); LoadDropDownMenu(); ddlDisplayTypes.SelectedValue = _currentDisplay.CustomizedProductDisplayTypeId.ToString(); LoadProducts(); } }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { //Select all the items in the Added list so that SaveProductMap will insert them into the the map table. foreach (ListItem item in lbAddedItems.Items) { item.Selected = true; } CustomizedProductDisplayType.SaveProductMap(int.Parse(ddlDisplayTypes.SelectedValue), lbAddedItems.Items); if (_currentDisplay == null) { _currentDisplay = LoadCustomizedProductDisplay(); } try { _currentDisplay.RegionId = regionId; _currentDisplay.CustomizedProductDisplayTypeId = int.Parse(ddlDisplayTypes.SelectedValue); _currentDisplay.Save(); MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblPageSaved")); } catch (Exception ex) { MasterPage.MessageCenter.DisplayFailureMessage(string.Format(LocalizationUtility.GetText("lblCriticalError"), ex.Message)); } }
/// <summary> /// Loads the customized product display. /// </summary> /// <returns></returns> private CustomizedProductDisplay LoadCustomizedProductDisplay() { CustomizedProductDisplay customizedProductDisplay; if (regionId <= 0) customizedProductDisplay = new CustomizedProductDisplay(); else customizedProductDisplay = new CustomizedProductDisplay(CustomizedProductDisplay.Columns.RegionId, regionId); return customizedProductDisplay; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { if (base.RegionId == 0) regionId = SubSonic.Sugar.Web.QueryString<int>("regionId"); else regionId = base.RegionId; if (!IsPostBack) { _currentDisplay = LoadCustomizedProductDisplay(); LoadDropDownMenu(); ddlDisplayTypes.SelectedValue = _currentDisplay.CustomizedProductDisplayTypeId.ToString(); LoadProducts(); } }
/// <summary> /// Handles the SelectedIndexChanged event of the ddlDisplayTypes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void ddlDisplayTypes_SelectedIndexChanged(object sender, EventArgs e) { _currentDisplay = new CustomizedProductDisplay(CustomizedProductDisplay.Columns.CustomizedProductDisplayTypeId, ddlDisplayTypes.SelectedValue); ClearListBoxes(); LoadProducts(); }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { //Select all the items in the Added list so that SaveProductMap will insert them into the the map table. foreach (ListItem item in lbAddedItems.Items) { item.Selected = true; } CustomizedProductDisplayType.SaveProductMap(int.Parse(ddlDisplayTypes.SelectedValue), lbAddedItems.Items); if (_currentDisplay == null) _currentDisplay = LoadCustomizedProductDisplay(); try { _currentDisplay.RegionId = regionId; _currentDisplay.CustomizedProductDisplayTypeId = int.Parse(ddlDisplayTypes.SelectedValue); _currentDisplay.Save(); MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblPageSaved")); } catch (Exception ex) { MasterPage.MessageCenter.DisplayFailureMessage(string.Format(LocalizationUtility.GetText("lblCriticalError"), ex.Message)); } }
public void Insert(int CustomizedProductDisplayTypeId,int RegionId,bool IsActive,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn) { CustomizedProductDisplay item = new CustomizedProductDisplay(); item.CustomizedProductDisplayTypeId = CustomizedProductDisplayTypeId; item.RegionId = RegionId; item.IsActive = IsActive; item.CreatedBy = CreatedBy; item.CreatedOn = CreatedOn; item.ModifiedBy = ModifiedBy; item.ModifiedOn = ModifiedOn; item.Save(UserName); }
/// <summary> /// Handles the SelectedIndexChanged event of the ddlDisplayTypes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void ddlDisplayTypes_SelectedIndexChanged(object sender, EventArgs e) { _currentDisplay = new CustomizedProductDisplay(CustomizedProductDisplay.Columns.CustomizedProductDisplayTypeId, ddlDisplayTypes.SelectedValue); ClearListBoxes(); LoadProducts(); }