protected void btnAdd_Click(object sender, EventArgs e) { try { CMSBL cmsBL = new CMSBL(); int returnNumber = -1; int folderNumber = -1; int siteNumber = -1; string siteName = txtSiteName.Text.Replace("'", "''"); string companyName = ddlCompany.SelectedValue.ToString(); folderNumber = cmsBL.GetDuplicateFolder(txtFolderName.Text); if (lblTitle.Text == "Add Company-Site") { siteNumber = cmsBL.GetDuplicateSite(siteName, companyName); if (siteNumber == 0 && folderNumber == 0) { returnNumber = cmsBL.CreateSite(companyName, siteName, "", ddlStyleSheet.SelectedValue.ToString(), "", txtFolderName.Text, _userName); if (returnNumber == 1) { createFolder(txtFolderName.Text); cmsBL.UpdateModuleMaster(companyName, siteName, _userName); } } } else if (lblTitle.Text == "Update Company-Site") { returnNumber = cmsBL.UpdateSite(ddlCompany.SelectedValue.ToString(), siteName, "", ddlStyleSheet.SelectedValue.ToString(), "", txtFolderName.Text, _userName); } if (returnNumber == 1) { if (lblTitle.Text == "Add Company-Site") { lblMessage.Text = "Successfully added a new site."; } else { lblMessage.Text = "Successfully updated the site."; } lblMessage.ForeColor = System.Drawing.Color.Green; } else if (siteNumber == 10) { lblMessage.Text = "Site already exist"; lblMessage.ForeColor = System.Drawing.Color.Red; } else if (folderNumber == 11) { lblMessage.Text = "Folder already exist"; lblMessage.ForeColor = System.Drawing.Color.Red; } else { lblMessage.Text = "Site Not Updated"; lblMessage.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { } }