Ejemplo n.º 1
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     lblError.Text   = "";
     lblSuccess.Text = "";
     try
     {
         if (txtServer.Text.ToString().Trim() != "")
         {
             objclsBALApplication = new clsBALApplication();
             string strServerName = txtServer.Text.ToString();
             int    servertypeID  = Convert.ToInt32(ddlDBServerType.SelectedValue);
             bool   flag          = CheckIFDBServerExists(strServerName, servertypeID);
             if (flag == true)
             {
                 bool flag1 = CheckIFDBServerExists1(strServerName, servertypeID);
                 if (flag1 == true)
                 {
                     bool bln = objclsBALApplication.UpdateDBServerStatus(strServerName, servertypeID);
                     lblError.Text = "Database server saved successfully";
                     PopulateGrid();
                 }
                 else
                 {
                     lblError.Text = "Database server already exist";
                 }
             }
             else
             {
                 bool bln = objclsBALApplication.SaveDBServer(strServerName, servertypeID);
                 lblSuccess.Text = "Database server saved successfully";
                 txtServer.Text  = "";
                 PopulateGrid();
             }
         }
         else
         {
             lblError.Text = "Please fill server name.";
         }
     }
     catch (NullReferenceException)
     {
         Response.Redirect("wfrmErrorPage.aspx", true);
     }
     catch (Exception ex)
     {
         HttpContext  context            = HttpContext.Current;
         LogException objclsLogException = new LogException();
         objclsLogException.LogErrorInDataBase(ex, context);
         Response.Redirect("wfrmErrorPage.aspx", true);
     }
 }