protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteMailFormat") { MailFormatService.Delete(SQLDataHelper.GetInt(e.CommandArgument)); } }
private void ShowMailFormatTypeDescription() { int mailFormatTypeId = Int32.Parse(ddlTypes.SelectedValue); MailFormatType mailFormatType = MailFormatService.GetMailFormatType(mailFormatTypeId); txtDescription.Text = mailFormatType.Comment; }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteMailFormat") { MailFormatService.DeleteMailFormat(Convert.ToInt32(e.CommandArgument)); } }
private void ShowMailFormatTypeDescription() { int mailFormatTypeId = Int32.Parse(ddlTypes.SelectedValue); MailFormatType mailFormatType = MailFormatService.GetMailFormatType(mailFormatTypeId); txtDescription.Text = mailFormatType.Comment; Page.Title = string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resource.Admin_MailFormat_Header); }
protected void Page_PreRender(object sender, EventArgs e) { if (grid.UpdatedRow != null) { var temp = MailFormatService.Get(SQLDataHelper.GetInt(grid.UpdatedRow["ID"])); temp.FormatName = grid.UpdatedRow["FormatName"]; temp.Enable = SQLDataHelper.GetBoolean(grid.UpdatedRow["Enable"]); temp.SortOrder = SQLDataHelper.GetInt(grid.UpdatedRow["SortOrder"]); temp.FormatType = (MailType)SQLDataHelper.GetInt(grid.UpdatedRow["FormatType"]); MailFormatService.Update(temp); } DataTable data = _paging.PageItems; while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1) { _paging.CurrentPageIndex--; data = _paging.PageItems; } var clmn = new DataColumn("IsSelected", typeof(bool)) { DefaultValue = _inverseSelection }; data.Columns.Add(clmn); if ((_selectionFilter != null) && (_selectionFilter.Values != null)) { for (int i = 0; i <= data.Rows.Count - 1; i++) { int intIndex = i; if (Array.Exists(_selectionFilter.Values, c => c == (data.Rows[intIndex]["ID"]).ToString())) { data.Rows[i]["IsSelected"] = !_inverseSelection; } } } if (data.Rows.Count < 1) { goToPage.Visible = false; } grid.DataSource = data; grid.DataBind(); pageNumberer.PageCount = _paging.PageCount; lblFound.Text = _paging.TotalRowsCount.ToString(CultureInfo.InvariantCulture); }
private void LoadMailFormat() { if (!AddingNew) { ddlTypes.DataBind(); MailFormat mailFormat = MailFormatService.GetMailFormat(MailFormatId); txtName.Text = mailFormat.FormatName; lblHead.Text = mailFormat.FormatName; CKEditorControl1.Text = mailFormat.FormatText; chkActive.Checked = mailFormat.Enable; txtSortOrder.Text = mailFormat.SortOrder.ToString(CultureInfo.InvariantCulture); ddlTypes.SelectedValue = ((int)mailFormat.FormatType).ToString(CultureInfo.InvariantCulture); ShowMailFormatTypeDescription(); Page.Title = string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, mailFormat.FormatName); } }
protected void btnSave_Click(object sender, EventArgs e) { if (txtName.Text.Trim().Length == 0 || txtSubject.Text.Trim().Length == 0) { MsgErr(Resource.Admin_MailFormat_NoName); return; } if (CKEditorControl1.Text.Trim().Length == 0) { MsgErr(Resource.Admin_MailFormat_NoText); return; } int result = 0; if (!Int32.TryParse(txtSortOrder.Text, out result)) { MsgErr(Resource.Admin_MailFormat_SortNotNum); return; } MailFormat mailFormat = AddingNew ? new MailFormat() : MailFormatService.Get(MailFormatId); mailFormat.FormatName = txtName.Text.Trim(); mailFormat.FormatSubject = txtSubject.Text.Trim(); mailFormat.FormatText = CKEditorControl1.Text.Trim(); mailFormat.Enable = chkActive.Checked; mailFormat.SortOrder = Int32.Parse(txtSortOrder.Text); mailFormat.FormatType = (MailType)Int32.Parse(ddlTypes.SelectedValue); if (AddingNew) { MailFormatService.Add(mailFormat); Response.Redirect("MailFormat.aspx"); } else { lblMessage.Text = Resource.Admin_MailFormatDetail_Saved + "<br />"; lblMessage.Visible = true; MailFormatService.Update(mailFormat); LoadMailFormat(); } }
protected void lbDeleteSelected_Click(object sender, EventArgs e) { if ((_selectionFilter != null) && (_selectionFilter.Values != null)) { if (!_inverseSelection) { foreach (var id in _selectionFilter.Values) { MailFormatService.Delete(SQLDataHelper.GetInt(id)); } } else { var itemsIds = _paging.ItemsIds <int>("MailFormatID as ID"); foreach (int id in itemsIds.Where(cId => !_selectionFilter.Values.Contains(cId.ToString(CultureInfo.InvariantCulture)))) { MailFormatService.Delete(id); } } } }