protected void UpdateDivisionButton_Click(object sender, EventArgs e) { string divisionName = divisionNameTextBox.Text; if (!string.IsNullOrEmpty(divisionName) && Request.QueryString["Id"] != null) { Models.DivisionInfo aDivisionInfo = new Models.DivisionInfo(); int id = Convert.ToInt32(Request.QueryString["Id"]); aDivisionInfo.Id = id; aDivisionInfo.DivisionName = divisionName; string msg = _divisionInfoManager.UpdateDivisionInfo(aDivisionInfo); if (msg == "update") { DisplayMessage("Updated Successfully", Color.ForestGreen); } else if (msg == "failed") { DisplayMessage("Update data failed.", Color.ForestGreen); } else if (msg == "exist") { DisplayMessage("Duplicate Data Required! Same Division Name Exist.", Color.Red); } } else { DisplayMessage("Empty Fields Are Required! Try Again", Color.Red); } }
protected void divisionNameSaveButton_Click1(object sender, EventArgs e) { string a = divisionNameTextBox.Text.Trim(); if (!string.IsNullOrEmpty(a)) { Models.DivisionInfo aDivisionInfo = new Models.DivisionInfo(); aDivisionInfo.DivisionName = a; string msg = _divisionInfoManager.SaveDivisionName(aDivisionInfo); if (msg == "success") { DisplayMessage("Save Successfully.", Color.ForestGreen); Response.Redirect("AllDivisions.aspx"); } else if (msg == "failed") { DisplayMessage("Failed! Try Again.", Color.Red); } else if (msg == "exist") { DisplayMessage("Duplicate Data Exist! Try Again.", Color.Red); } } else { DisplayMessage("Empty Fields Are Required!", Color.Red); } }
private void GetDataById(int id) { Models.DivisionInfo aDivisionInfo = _divisionInfoManager.GetDataById(id) ?? new Models.DivisionInfo(); divisionNameTextBox.Text = aDivisionInfo.DivisionName; }