protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { string message = ""; try { SectionErrorType m_SectionErrorType = new SectionErrorType(); m_SectionErrorType.SectionErrorTypeId = System.Int32.Parse(m_grid.DataKeys[e.RowIndex].Value.ToString()); m_SectionErrorType.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()); SectionErrorType m_SectionErrorType = new SectionErrorType(); m_SectionErrorType.SectionErrorTypeId = EditId; m_SectionErrorType = m_SectionErrorType.Get(); txSectionErrorTypeName.Text = m_SectionErrorType.SectionErrorTypeName.ToString(); txSectionErrorTypeDesc.Text = m_SectionErrorType.SectionErrorTypeDesc.ToString(); txErrorCount.Text = m_SectionErrorType.ErrorCount.ToString(); txDisplayOrder.Text = m_SectionErrorType.DisplayOrder.ToString(); txSectionErrorId.Text = m_SectionErrorType.SectionErrorId.ToString(); } }
//-------------------------------------------------------------------------------- private void ShowGrid() { try { SectionErrorType m_SectionErrorType = new SectionErrorType(); m_SectionErrorType.SectionErrorTypName = txtSearch.Text; string DateFrom = txtDateFrom.Text; string DateTo = txtDateTo.Text; int RowCount = 0; List <SectionErrorType> l_SectionErrorType = m_SectionErrorType.GetPage("", "", ddlOrderBy.SelectedValue, m_grid.PageSize, CustomPaging.PageIndex - 1, ref RowCount); m_grid.DataSource = l_SectionErrorType; 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 { SectionErrorType m_SectionErrorType = new SectionErrorType(); foreach (GridViewRow m_Row in m_grid.Rows) { CheckBox chkAction = (CheckBox)m_Row.FindControl("chkAction"); if (chkAction != null) { if (chkAction.Checked) { m_SectionErrorType.SectionErrorTypeId = System.Int32.Parse(m_grid.DataKeys[m_Row.RowIndex].Value.ToString()); m_SectionErrorType.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; SectionErrorType m_SectionErrorType = new SectionErrorType(); if (Request.QueryString["id"] == null) { EditId = 0; } else { EditId = System.Int32.Parse(Request.QueryString["id"].ToString()); m_SectionErrorType.SectionErrorTypeId = EditId; m_SectionErrorType = m_SectionErrorType.Get(); } try { if (txSectionErrorTypeName.Text == "") { JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this); return; } if (txSectionErrorTypeDesc.Text == "") { JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this); return; } if (txErrorCount.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; } m_SectionErrorType.CrUserId = ActUserId; if (txSectionErrorTypeName.Text != "") { m_SectionErrorType.SectionErrorTypeName = txSectionErrorTypeName.Text; } if (txSectionErrorTypeDesc.Text != "") { m_SectionErrorType.SectionErrorTypeDesc = txSectionErrorTypeDesc.Text; } m_SectionErrorType.ErrorCount = byte.Parse(txErrorCount.Text); m_SectionErrorType.DisplayOrder = byte.Parse(txDisplayOrder.Text); m_SectionErrorType.SectionErrorId = int.Parse(txSectionErrorId.Text); m_SectionErrorType.SectionErrorTypeId = EditId; SysMessageTypeId = m_SectionErrorType.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); } }