protected void btnEdit_Click(object sender, EventArgs e) { WaterLevelDam WaterLevelDam = new WaterLevelDam(); WaterLevelDamTableAdapter WaterLevelDamTableAdapter = new WaterLevelDamTableAdapter(); WaterLevelDam originalWaterLevelDam = WaterLevelDamTableAdapter.GetWaterLevelByID(Convert.ToInt32(Request["WaterLevelDamID"])); if (IsValidData()) { WaterLevelDam.ID = originalWaterLevelDam.ID; WaterLevelDam.DamID = Convert.ToInt32(ddlDamName.SelectedValue); WaterLevelDam.DamName = ddlDamName.SelectedItem.ToString(); WaterLevelDam.LevelFeet = txtWaterLevelFeet.Text.Trim(); WaterLevelDam.Remark = txtRemark.Text.Trim(); WaterLevelDam.CreatedDate = Convert.ToDateTime(txtDate.Text); WaterLevelDam.CreatedTime = txtTime.Text; WaterLevelDam.Status = "ACTIVE"; if (WaterLevelDamTableAdapter.Update(WaterLevelDam) > 0) { ltlMessage.Text = "<div class=\"alert alert-success alert-dismissible\"><button type = \"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button> <h4><i class=\"icon fa fa-check\"></i> Alert!</h4> Sucessfully Updated <b>" + txtWaterLevelFeet.Text.Trim() + "</b>.</div>"; Response.Redirect("~/WaterLevelsDam/waterlevellistdam.aspx"); } } }
protected void btnYes_Click(object sender, EventArgs e) { WaterLevelDamTableAdapter WaterLevelDamTableAdapter = new WaterLevelDamTableAdapter(); WaterLevelDam originalWaterLevelDam = WaterLevelDamTableAdapter.GetWaterLevelByID(Convert.ToInt32(Request["WaterLevelDamID"])); WaterLevelDam WaterLevelDam = new WaterLevelDam(); WaterLevelDam.ID = originalWaterLevelDam.ID; WaterLevelDam.DamID = originalWaterLevelDam.DamID; WaterLevelDam.DamName = originalWaterLevelDam.DamName; WaterLevelDam.LevelFeet = originalWaterLevelDam.LevelFeet; WaterLevelDam.Remark = originalWaterLevelDam.Remark; WaterLevelDam.CreatedDate = originalWaterLevelDam.CreatedDate; WaterLevelDam.CreatedTime = originalWaterLevelDam.CreatedTime; WaterLevelDam.Status = "INACTIVE"; if (WaterLevelDamTableAdapter.Update(WaterLevelDam) > 0) { ltlMessage.Text = "<div class=\"alert alert-success alert-dismissible\"><button type = \"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button> <h4><i class=\"icon fa fa-check\"></i> Alert!</h4> Sucessfully Deleted <b>" + originalWaterLevelDam.DamName + "</b>.</div>"; Response.Redirect("~/WaterLevelsDam/waterlevellistdam.aspx"); } }