Example #1
0
    protected void imgContinue_Click(object sender, ImageClickEventArgs e)
    {
        string ErrMsg = String.Empty;
        string Email = txtEMail.Text.Trim();
        string Password = txtPassword.Text.Trim();
        string IdentityNo = txtIdentityNo.Text.Trim();

        if (Util.isNeedClearString(Email)) { ErrMsg += PIKCV.COM.Data.GetErrorMessageCache(this.cmbErrors, PIKCV.COM.EnumDB.ErrorTypes.ValidationEmail); }
        if (Util.isNeedClearString(Password)) { ErrMsg += PIKCV.COM.Data.GetErrorMessageCache(this.cmbErrors, PIKCV.COM.EnumDB.ErrorTypes.ValidationPassword); }
        if (Util.isNeedClearString(IdentityNo)) { ErrMsg += PIKCV.COM.Data.GetErrorMessageCache(this.cmbErrors, PIKCV.COM.EnumDB.ErrorTypes.ValidationIdentity); }

        if (ErrMsg == String.Empty)
        {
            PIKCV.BUS.User objUser = new PIKCV.BUS.User();

            if ((this.smIsLogin) || (!objUser.UserExist(Email, IdentityNo)))
            {
                int SavedUserID = objUser.SaveUserInfo(this.smUserID, txtName.Text, txtSurName.Text, Email, IdentityNo, Password, txtPrivateQuestion.Text, txtPrivateAnswer.Text, chIsWantedSMS.Checked);
                this.smFirstName = txtName.Text;
                this.smLastName = txtSurName.Text;
                if (SavedUserID > 0)
                {
                    if (!this.smIsLogin)
                    {
                        string ActivationCode = PIKCV.COM.Util.CreateActivationNumber(SavedUserID);
                        if (objUser.SaveActivation(SavedUserID, ActivationCode))
                        {
                            //Aktivasyon Linkini Mail Yolla 
                            if (MailTemplates.Send_Tmp_Activation(MailTemplates.Activation, ActivationCode, SavedUserID, this.smFirstName, this.smLastName, Email))
                            {
                                this.Redirect("Employee-Membership-CV");    //2.Adýma Yönlendir 
                            }
                            else
                            {
                                ErrMsg += PIKCV.COM.Data.GetErrorMessageCache(this.cmbErrors, PIKCV.COM.EnumDB.ErrorTypes.OkSaveNoSendMail); //**
                            }
                        }
                    }
                    else
                    {
                        this.Redirect("Employee-Membership-CV");
                    }
                }
                else
                {
                    ErrMsg += PIKCV.COM.Data.GetErrorMessageCache(this.cmbErrors, PIKCV.COM.EnumDB.ErrorTypes.NoSave);
                }
            }
            else
            {
                ErrMsg += PIKCV.COM.Data.GetErrorMessageCache(this.cmbErrors, PIKCV.COM.EnumDB.ErrorTypes.UserExist);
            }
        }
        this.ShowError(ErrMsg);
    }