protected void creatCenterButton_Click(object sender, EventArgs e) { Center aCenter = new Center(); aCenter.Name = centerNameTextBox.Text; aCenter.DistrictId = Convert.ToInt32(districtDropDownList.SelectedValue); aCenter.ThanaId = Convert.ToInt32(thanaDropDownList.SelectedValue); aCenter.CenterCode = aCenter.Name + centerManager.RandomCode(); aCenter.Password = centerManager.Encryptdata(centerManager.RandomPassword()); int num = centerManager.CreateCenter(aCenter); if (num == 0) { Session["CENTER"] = aCenter; Response.Redirect("~/UI/Admin/MessageUI.aspx"); } else if (num == 1) { messageLabel.Text = "Sorry this Tenter Name already exists in" + thanaDropDownList.SelectedValue; } else if (num == 2) { messageLabel.Text = "Sorry this center code already exists. Please try again"; Server.TransferRequest(Request.Url.AbsolutePath, false); messageLabel.ForeColor = Color.Red; } else { messageLabel.Text = "Sorry save failed"; messageLabel.ForeColor = Color.Red; } }