protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { string message = ""; try { SectionError m_SectionError = new SectionError(); m_SectionError.SectionErrorId = System.Int32.Parse(m_grid.DataKeys[e.RowIndex].Value.ToString()); m_SectionError.Delete(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } ShowGrid(); }
private void bindData() { System.Int32 EditId; if (Request.QueryString["id"] == null) { return; } else { EditId = System.Int32.Parse(Request.QueryString["id"].ToString()); SectionError m_SectionError = new SectionError(); m_SectionError.SectionErrorId = EditId; m_SectionError = m_SectionError.Get(); txSectionErrorName.Text = m_SectionError.SectionErrorName.ToString(); txSectionErrorDesc.Text = m_SectionError.SectionErrorDesc.ToString(); txDisplayOrder.Text = m_SectionError.DisplayOrder.ToString(); txSectionServiceId.Text = m_SectionError.SectionServiceId.ToString(); txErrorTypeStatusId.Text = m_SectionError.ErrorTypeStatusId.ToString(); } }
//-------------------------------------------------------------------------------- private void ShowGrid() { try { SectionError m_SectionError = new SectionError(); m_SectionError.SectionErroName = txtSearch.Text; string DateFrom = txtDateFrom.Text; string DateTo = txtDateTo.Text; int RowCount = 0; List <SectionError> l_SectionError = m_SectionError.GetPage("", "", ddlOrderBy.SelectedValue, m_grid.PageSize, CustomPaging.PageIndex - 1, ref RowCount); m_grid.DataSource = l_SectionError; m_grid.DataBind(); lblTong.Text = RowCount.ToString(); CustomPaging.TotalPage = (RowCount == 0) ? 1 : (RowCount % m_grid.PageSize == 0) ? RowCount / m_grid.PageSize : (RowCount - RowCount % m_grid.PageSize) / m_grid.PageSize + 1; } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } }
protected void lbDelete_Click(object sender, EventArgs e) { try { SectionError m_SectionError = new SectionError(); foreach (GridViewRow m_Row in m_grid.Rows) { CheckBox chkAction = (CheckBox)m_Row.FindControl("chkAction"); if (chkAction != null) { if (chkAction.Checked) { m_SectionError.SectionErrorId = System.Int32.Parse(m_grid.DataKeys[m_Row.RowIndex].Value.ToString()); m_SectionError.Delete(); } } } ShowGrid(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } }
protected void btnSave_Click(object sender, System.EventArgs e) { byte SysMessageTypeId = 0; int SysMessageId = 0; System.Int32 EditId; SectionError m_SectionError = new SectionError(); if (Request.QueryString["id"] == null) { EditId = 0; } else { EditId = System.Int32.Parse(Request.QueryString["id"].ToString()); m_SectionError.SectionErrorId = EditId; m_SectionError = m_SectionError.Get(); } try { if (txSectionErrorName.Text == "") { JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this); return; } if (txSectionErrorDesc.Text == "") { JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this); return; } if (txDisplayOrder.Text == "") { JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this); return; } if (txSectionServiceId.Text == "") { JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this); return; } if (txErrorTypeStatusId.Text == "") { JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this); return; } m_SectionError.CrUserId = ActUserId; if (txSectionErrorName.Text != "") { m_SectionError.SectionErrorName = txSectionErrorName.Text; } if (txSectionErrorDesc.Text != "") { m_SectionError.SectionErrorDesc = txSectionErrorDesc.Text; } m_SectionError.DisplayOrder = byte.Parse(txDisplayOrder.Text); m_SectionError.SectionServiceId = int.Parse(txSectionServiceId.Text); m_SectionError.ErrorTypeStatusId = byte.Parse(txErrorTypeStatusId.Text); m_SectionError.SectionErrorId = EditId; SysMessageTypeId = m_SectionError.InsertOrUpdate(ConstantHelpers.Replicated, ActUserId, ref SysMessageId); StringBuilder csText = new StringBuilder(); Type cstype = this.GetType(); ClientScriptManager cs = Page.ClientScript; csText.Clear(); csText.Append("<script type=\"text/javascript\">"); csText.Append("window.parent.jQuery('#divEdit').dialog('close');"); csText.Append("</script>"); cs = Page.ClientScript; cs.RegisterClientScriptBlock(this.GetType(), "system_message", csText.ToString()); } catch (Exception ex) { sms.utils.LogFiles.LogError(((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name + "\t" + ex.ToString()); JSAlertHelpers.Alert(ex.Message, this); } }