Пример #1
0
    protected void Wizard_Create_Web_NextButtonClick(object sender, WizardNavigationEventArgs e)
    {
        if (Wizard_Create_Web.ActiveStepIndex == 0)
        {
            Message   m  = new Message();
            datalayer dl = new datalayer();

            System.Web.Security.MembershipUser mu;
            if (!Request.IsAuthenticated)
            {
                mu = null;
                Response.Redirect("~/login.aspx");
            }
            else

            if (txt_website_name.Text.Trim() == "")
            {
                e.Cancel = true;
                error_div.Controls.Add(m.Error(Constants.ENTER_WEBSITE_NAME));
            }
            else
            {
                Guid userid;
                mu     = System.Web.Security.Membership.GetUser();
                userid = (Guid)mu.ProviderUserKey;
                if (dl.SaveWebsite(Session[Constants.Session.USERNAME].ToString(), txt_website_name.Text.Trim(), userid) == Constants.SUCCESS)
                {
                    e.Cancel = false;
                    Session[Constants.WEBSITE_NAME] = txt_website_name.Text.Trim();

                    //  pnl_create_pages.Visible = true;
                    //  pnl_website_name.Visible = false;
                }
                else
                if (dl.SaveWebsite(Session[Constants.Session.USERNAME].ToString(), txt_website_name.Text.Trim(), userid) == Constants.WEBSITE_ALREADY_EXIST)
                {
                    e.Cancel = true;

                    Session[Constants.ERROR] = Constants.WEBSITE_ALREADY_EXIST;
                    error_div.Controls.Add(m.Error(Constants.WEBSITE_ALREADY_EXIST));
                }
                else
                if (dl.SaveWebsite(Session[Constants.Session.USERNAME].ToString(), txt_website_name.Text.Trim(), userid) == Constants.ERROR)
                {
                    Session[Constants.ERROR] = Constants.ERROR;
                    e.Cancel = true;

                    error_div.Controls.Add(m.Error(Constants.ERROR));
                }
                //  userid = (Guid)string.Empty;
            }
        }
    }
Пример #2
0
 protected void btn_create_website_Click(object sender, EventArgs e)
 {
     if (txt_websitename.Text.Trim() == "")
     {
         lbl_message.ForeColor = System.Drawing.Color.Red;
         lbl_message.Text      = "Please enter a website name.";
     }
     else
     {
         System.Web.Security.MembershipUser mu;
         Guid userid;
         mu     = System.Web.Security.Membership.GetUser();
         userid = (Guid)mu.ProviderUserKey;
         if (dl.SaveWebsite(Session[Constants.Session.USERNAME].ToString(), txt_websitename.Text.Trim(), userid) == Constants.SUCCESS)
         {
             ddl_select_website.Items.Add(txt_websitename.Text.Trim());
             lbl_message.ForeColor           = System.Drawing.Color.Green;
             lbl_message.Text                = "Website created successfully!";
             txt_websitename.Text            = "";
             Session[Constants.WEBSITE_NAME] = txt_websitename.Text.Trim();
             //  pnl_create_pages.Visible = true;
             //  pnl_website_name.Visible = false;
         }
         else
         if (dl.SaveWebsite(Session[Constants.Session.USERNAME].ToString(), txt_websitename.Text.Trim(), userid) == Constants.WEBSITE_ALREADY_EXIST)
         {
             lbl_message.ForeColor = System.Drawing.Color.Red;
             lbl_message.Text      = "Website already exist.";
         }
         else
         {
             lbl_message.ForeColor = System.Drawing.Color.Red;
             lbl_message.Text      = "An error occurred.";
         }
     }
 }