Ejemplo n.º 1
0
      protected void saveButton_Click(object sender, EventArgs e)
      {
          Center aCenter = new Center();

          aCenter.Name       = nameTextBox.Text;
          aCenter.DistrictId = Convert.ToInt32(districtDropDownList.SelectedValue);
          aCenter.ThanaId    = Convert.ToInt32(thanaDropDownList.SelectedValue);
          Center center = aCenterManager.Find(aCenter);

          if (center == null)
          {
              aCenterManager.Save(aCenter);
              string centerCode     = aCenterManager.GenerateRandomNumber(6);
              string centerPassword = aCenterManager.GenerateRandomNumber(8);
              Center centerFound    = aCenterManager.Find(aCenter);
              aCenterManager.SaveCenterCodeAndPassword(centerFound.Id, centerCode, centerPassword);
              Response.Redirect("CenterInformation.aspx?name=" + centerFound.Name + "&code=" + centerCode + "&password="******"This name already exist.";
          }
      }