protected void btnUpdate_Click(object sender, EventArgs e) { mbw = new MBoreWater(); bbw = new BBoreWater(); int Result = 0; mbw.BoreWaterId = string.IsNullOrEmpty(hId.Value) ? 0 : Convert.ToInt32(hId.Value); mbw.BoreWaterDate = Convert.ToDateTime(txtDate.Text.ToString()); mbw.BoreWaterShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); mbw.OperatedBy = string.IsNullOrEmpty(txtOperatedBy.Text) ? string.Empty : txtOperatedBy.Text; mbw.StartingTime = string.IsNullOrEmpty(txtStartingTime.Text) ? string.Empty : txtStartingTime.Text; mbw.EndTime = string.IsNullOrEmpty(txtEndTime.Text) ? string.Empty : txtEndTime.Text; mbw.TotalHours = string.IsNullOrEmpty(txtTotalHours.Text) ? string.Empty : txtTotalHours.Text; mbw.flag = "Update"; Result = bbw.borewaterdata(mbw); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Bore Water Data Updated Successfully"; pnlError.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblSuccess.Text = "Something went wrong plz contact site admin"; pnlError.Update(); } }
protected void btnAdd_Click(object sender, EventArgs e) { mbw = new MBoreWater(); bbw = new BBoreWater(); int Result = 0; mbw.BoreWaterId = 0; mbw.BoreWaterDate = Convert.ToDateTime(txtDate.Text.ToString()); mbw.BoreWaterShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); mbw.OperatedBy = string.IsNullOrEmpty(txtOperatedBy.Text)?string.Empty :txtOperatedBy.Text; mbw.StartingTime = string.IsNullOrEmpty(txtStartingTime.Text) ? string.Empty : txtStartingTime.Text; mbw.EndTime = string.IsNullOrEmpty(txtEndTime.Text) ? string.Empty : txtEndTime.Text; mbw.TotalHours = string.IsNullOrEmpty(txtTotalHours.Text) ? string.Empty : txtTotalHours.Text; mbw.flag = "insert"; Result = bbw.borewaterdata(mbw); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Bore Water Data Added Successfully"; ScriptManager.RegisterStartupScript(this, this.GetType(), "sel3", "$('#bx2').removeClass('collapsed-box');", true); pnlError.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblSuccess.Text = "Something went wrong plz contact site admin"; pnlError.Update(); } }