protected void saveButton_Click(object sender, EventArgs e)
        {
            CenterCreate aCenterCreate = new CenterCreate();
            ShowCenterUI aShowCenterUi = new ShowCenterUI();

            aCenterCreate.Name = centerNameTextBox.Text;
            string thana = thanaDropDownList.SelectedItem.ToString();
            aCenterCreate.ThanaID = aCenterCreateManager.GetIDByThanaName(thana);
            aCenterCreate.DistrictID = aCenterCreateManager.GetDistrictIDByThanaName(thana);
            aCenterCreate.Code = GenerateCode(thana);
            aCenterCreate.Password = CreateRandomPassword();

            if (aCenterCreate.Name != "")
            {
                showLabel.Text = aCenterCreateManager.Save(aCenterCreate);
                Session["Name"] = centerNameTextBox.Text;
                Session["Code"] = aCenterCreate.Code;
                Session["Password"] = aCenterCreate.Password;
                Response.Redirect("ShowCenterUI.aspx");
            }
            else
            {
                showLabel.Text = "Not saved. Please enter information correctly.";
            }
        }
 public string Save(CenterCreate aCenterCreate)
 {
     if (aCenterCreateGateway.Save(aCenterCreate) > 0)
     {
         return "Data saved Sccessfully.";
     }
     else
     {
         return "Data not saved.";
     }
 }
        public List<CenterCreate> CenterList(string thana)
        {
            int thanaID = GetThanaIDByThana(thana);

            SqlConnection connection = new SqlConnection(connectionstring);
            string query = "select * from tbl_CenterCreate where ThanaID = '"+thanaID+"'";
            SqlCommand command = new SqlCommand(query,connection);
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            List<CenterCreate> centerList = new List<CenterCreate>();
            while (reader.Read())
            {
                CenterCreate aCenterCreate = new CenterCreate();
                aCenterCreate.ID = int.Parse(reader["ID"].ToString());
                aCenterCreate.Name = reader["Name"].ToString();
                centerList.Add(aCenterCreate);
            }
            reader.Close();
            connection.Close();
            return centerList;
        }
 public int Save(CenterCreate aCenterCreate)
 {
     SqlConnection connection = new SqlConnection(connectionstring);
     string query = "insert into tbl_CenterCreate values ('" + aCenterCreate.Name + "','" + aCenterCreate.ThanaID + "','" + aCenterCreate.DistrictID + "','" + aCenterCreate.Code + "','" + aCenterCreate.Password + "')";
     SqlCommand command = new SqlCommand(query,connection);
     connection.Open();
     int rowAffected = command.ExecuteNonQuery();
     connection.Close();
     return rowAffected;
 }