コード例 #1
0
    protected void imgContinue_Click(object sender, ImageClickEventArgs e)
    {
        int       SaveCompanyID      = 0;
        string    ErrMsg             = String.Empty;
        string    PhoneNumber        = txtPhoneNumber.Text.Trim();
        string    FaxNumber          = txtFaxNumber.Text.Trim();
        string    Email              = txtEMail.Text.Trim();
        ArrayList arrSelectedSectors = new ArrayList();

        if (Request.Form[lbSelectedSectors.UniqueID] != null)
        {
            arrSelectedSectors.AddRange(Request.Form[lbSelectedSectors.UniqueID].Split(','));
        }

        PIKCV.BUS.Company objCompany = new PIKCV.BUS.Company();
        if (this.smIsLogin == true)
        {
            SaveCompanyID = objCompany.UpdateCompanyInfo(this.smCompanyID, arrSelectedSectors, txtCompanyName.Text,
                                                         txtCompanyDescription.Text, Convert.ToInt32(txtNumberOfWorkers.Text), txtContactName.Text, txtContactLastName.Text,
                                                         txtPhoneNumber.Text, txtFaxNumber.Text, txtEMail.Text, this.PhotoFileName, txtSecretQuestion.Text, txtSecretAnswer.Text);
            //imgCompanyLogo.ImageUrl = "~/" + this.Config(PIKCV.COM.EnumUtil.Config.CompanyImagePath) + this.PhotoFileName;
            if (SaveCompanyID > 0)
            {
                pnlSuccess.Visible = true;
                ltlSuccess.Text    = "Üyelik bilgileriniz baþarýyla deðiþtirilmiþtir";
                pnlError.Visible   = false;
                this.smCompanyName = txtCompanyName.Text;
                this.smFirstName   = txtContactName.Text;
                this.smLastName    = txtContactLastName.Text;
            }
            else
            {
                pnlError.Visible   = true;
                ltlError.Text      = "Üyelik bilgileri deðiþtirilirken bir hata oluþtu lütfen tekrar deneyin";
                pnlSuccess.Visible = false;
            }
        }
        else
        {
            int CompanyUserExistance = objCompany.CompanyExistanceControlForEmail(txtEMail.Text);
            if (CompanyUserExistance == 0)
            {
                SaveCompanyID = objCompany.InsertCompanyInfo(arrSelectedSectors, txtCompanyName.Text, txtCompanyDescription.Text,
                                                             Convert.ToInt32(txtNumberOfWorkers.Text), txtContactName.Text, txtContactLastName.Text,
                                                             PhoneNumber, FaxNumber, Email, txtSecretQuestion.Text, txtSecretAnswer.Text);
                if (SaveCompanyID > 0)
                {
                    this.smCompanyID = SaveCompanyID;
                    UImageUpload1.SendFile();
                    this.smCompanyID = 0;
                    string ActivationCode = PIKCV.COM.Util.CreateActivationNumber(SaveCompanyID);
                    if (objCompany.SaveActivation(SaveCompanyID, ActivationCode))
                    {
                        //Aktivasyon Linkini Mail Yolla
                        if (MailTemplates.Send_Tmp_ActivationCompany(MailTemplates.ActivationCompany, ActivationCode, SaveCompanyID, txtContactName.Text, txtContactLastName.Text, Email))
                        { //**
                            //**this.LoginControl(txtEMail.Text, txtPassword.Text, String.Empty);
                            this.GoToFeedback(PIKCV.COM.EnumDB.ErrorTypes.SaveCompany);
                        } //**
                        else
                        { //**
                            pnlError.Visible   = true;
                            ltlError.Text      = "Üyelik iþlemi sýrasýnda bir hata oluþtu. Lütfen tekrar deneyin.";
                            pnlSuccess.Visible = false;
                        } //**
                    }

                    //pnlSuccess.Visible = true;

                    //ltlSuccess.Text = "Üyelik isteðiniz bize ulaþmýþtýr. Üyeliðiniz incelenip en yakýn zamanda kullanýcý adý ve þifreniz e-posta adresinize gönderilecektir.";
                    //pnlError.Visible = false;
                }
                else
                {
                    pnlError.Visible   = true;
                    ltlError.Text      = "Üyelik iþlemi sýrasýnda bir hata oluþtu. Lütfen tekrar deneyin.";
                    pnlSuccess.Visible = false;
                }
            }
            else if (CompanyUserExistance > 0)
            {
                pnlError.Visible   = true;
                ltlError.Text      = "Bu email adresiyle daha önceden kayýt yapýlmýþtýr. Bir email adresiyle sadece bir kayýt yapýlabilir.";
                pnlSuccess.Visible = false;
            }
            else if (CompanyUserExistance == -1)
            {
                pnlError.Visible   = true;
                ltlError.Text      = "Üyelik iþlemi sýrasýnda bir hata oluþtu. Lütfen tekrar deneyin.";
                pnlSuccess.Visible = false;
            }
        }
    }