protected void lnkBtnSave_Click(object sender, EventArgs e) { string name = CancelChargeName.Text.Trim(); string price = PercentPrice.Text; string date = DateCancel.Text; if ((!cancel.CancelChargeName.Equals(name)) && (BLLCancelCharge.checkCancelChargeExist(name) != 0)) { ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Cancel Charge Name existed. Please try again');", true); } else { CancelCharge newCancel = new CancelCharge(); newCancel.CancelChargeNo = cancel.CancelChargeNo; newCancel.CancelChargeName = name; newCancel.PercentPrice = Int32.Parse(price); newCancel.DateCancel = Int32.Parse(date); if (cbStatus.Checked) { newCancel.Status = true; } else { newCancel.Status = true; } BLLCancelCharge.UpdateCancelCharge(newCancel); Response.Redirect("CancelChargeList.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { int cancelId = Convert.ToInt32(Request.QueryString["CancelChargeNo"].ToString()); cancel = BLLCancelCharge.getCancelChargeByID(cancelId)[0]; if (!Page.IsPostBack) { fillData(); } }
protected void LoadData() { DataTable dt = BLLCancelCharge.getAllCancelCharge(); dv = new DataView(dt); dv.Sort = "CancelChargeNo ASC"; total.Text = dv.Count.ToString(); gvCancelChargeList.DataSource = dv; gvCancelChargeList.DataBind(); if (gvCancelChargeList.HeaderRow != null) { gvCancelChargeList.HeaderRow.TableSection = TableRowSection.TableHeader; } }
protected void lnkDelete_Click(object sender, EventArgs e) { int test = 0; foreach (GridViewRow row in gvCancelChargeList.Rows) { CheckBox cb = (CheckBox)row.FindControl("chkSel"); if (cb.Checked) { ++test; int id = int.Parse(row.Cells[1].Text); int k = BLLCancelCharge.DeleteCancelCharge(id); } } if (test == 0) { ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Please select a Cancel Charge from the list to delete');", true); } else { Response.Redirect("CancelChargeList.aspx"); } }