当前位置: 首页>>代码示例>>C#>>正文


C# DBFunctions.AddCandidate方法代码示例

本文整理汇总了C#中DBFunctions.AddCandidate方法的典型用法代码示例。如果您正苦于以下问题:C# DBFunctions.AddCandidate方法的具体用法?C# DBFunctions.AddCandidate怎么用?C# DBFunctions.AddCandidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBFunctions的用法示例。


在下文中一共展示了DBFunctions.AddCandidate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnRegister_Click

    protected void btnRegister_Click(object sender, EventArgs e)
    {
        MembershipCreateStatus createStatus;
        string message = string.Empty;
        Candidate_tbl candidate = new Candidate_tbl { Name = Nametxt.Text, Username = Usernametxt.Text, Email = Emailtxt.Text, Password = Passwordtxt.Text, Phone = Phonetxt.Text,  Status = 0, AdmissionYear = DateTime.Now.Year.ToString() };
        MembershipUser newUser = System.Web.Security.Membership.CreateUser(Usernametxt.Text, Passwordtxt.Text, Emailtxt.Text, null, null, true, out createStatus);
        switch (createStatus)
        {
            case MembershipCreateStatus.Success: message = "The user account was successfully created!";
                FormsAuthentication.SetAuthCookie(Usernametxt.Text, true);
                DatabaseFunctions db = new DatabaseFunctions();
                DBFunctions d = new DBFunctions();
                int i=db.insertUserOtherInfo(Usernametxt.Text, Phonetxt.Text, newUser.ProviderUserKey.ToString(),0);
                int CandidateID=d.AddCandidate(candidate);
                if(i!=-1)
                {
                    db.InsertMappindIDs(newUser.ProviderUserKey.ToString(),CandidateID);
                    Response.Redirect("ProfilePage.aspx");
                }
                break;

            case MembershipCreateStatus.DuplicateUserName: message = "There already exists a user with this username.";

                break;
            case MembershipCreateStatus.DuplicateEmail: message = "There already exists a user with this email address.";

                break;
            case MembershipCreateStatus.InvalidEmail: message = "There email address you provided in invalid.";

                break;
            case MembershipCreateStatus.InvalidAnswer: message = "There security answer was invalid.";

                break;
            case MembershipCreateStatus.InvalidPassword: message = "The password you provided is invalid. It must be atleast 4 characters long.";

                break;
            default: message = "There was an unknown error; the user account was NOT created.";

                break;
        }
        RegistrationLabel.Visible = true;
        RegistrationLabel.Text = message;
    }
开发者ID:EezeSolutions,项目名称:Higher_Erp,代码行数:43,代码来源:Registration.aspx.cs

示例2: btnRegister_Click

    protected void btnRegister_Click(object sender, EventArgs e)
    {
        if (FileUpload.FileName!="")
        {
            FileUpload.SaveAs(Server.MapPath(UploadFolderPath + FileUpload.FileName));
        }
        double SecondaryPercentage = 0;
        double IntermediatePercentage = 0;
        string message = "";
        if ((Convert.ToInt16(SecondaryObtained.Text) <= Convert.ToInt16(TotalSecondary.Text))&&(Convert.ToInt16(ObtainedIntermediate.Text) <= Convert.ToInt16(TotalIntermediate.Text)))
        {
          
              IntermediatePercentage = (Convert.ToDouble(ObtainedIntermediate.Text) / Convert.ToDouble(TotalIntermediate.Text)) * 100;
              SecondaryPercentage = (Convert.ToDouble(SecondaryObtained.Text) / Convert.ToDouble(TotalSecondary.Text)) * 100;
              double SecondaryWeightage = 0.45;
              double IntermediateWeightage = 0.55;

              double TotalCutOff = (SecondaryWeightage * SecondaryPercentage) + (IntermediateWeightage * IntermediatePercentage);
            DBFunctions db = new DBFunctions();
            Candidate_tbl temp = db.CheckExistingUsers(Usernametxt.Text);
            if (temp == null)
            {
                Candidate_tbl candidate = new Candidate_tbl { Name = Nametxt.Text, Username = Usernametxt.Text, HomeAdress = txtHomeaddress.Text, Stateoforigin = int.Parse(dropdownSto.SelectedValue), LocalGovtArea = int.Parse(dropdownLocalGovtarea.SelectedValue), Email = Emailtxt.Text, DateofBirth = dropdownDay.SelectedItem.Text + "-" + dropdownMonth.SelectedItem.Text + "-" + dropdownyears.SelectedItem.Text, Password = Passwordtxt.Text, Phone = Phonetxt.Text, Image = FileUpload.FileName, Gender = dropdownGender.SelectedValue, ProgrammeID = int.Parse(DropDownprogramme.SelectedValue), CuttoffPoints = TotalCutOff, Status = 0, AdmissionYear = DateTime.Now.Year.ToString() };
                //// candidate is being stored in db here. 
                 MembershipCreateStatus createStatus = new MembershipCreateStatus();
                 MembershipUser newUser = System.Web.Security.Membership.CreateUser(Usernametxt.Text, Passwordtxt.Text, Emailtxt.Text, null, null, true, out createStatus);
                switch (createStatus)
                {
                    case MembershipCreateStatus.Success: message = "The user account was successfully created!";
                        FormsAuthentication.SetAuthCookie(Usernametxt.Text,true);

                        break;

                    case MembershipCreateStatus.DuplicateUserName: message = "There already exists a user with this username.";
                      
                        break;
                    case MembershipCreateStatus.DuplicateEmail: message = "There already exists a user with this email address.";
                       
                        break;
                    case MembershipCreateStatus.InvalidEmail: message = "There email address you provided in invalid.";
                      
                        break;
                    case MembershipCreateStatus.InvalidAnswer: message = "There security answer was invalid.";
                      
                        break;
                    case MembershipCreateStatus.InvalidPassword: message = "The password you provided is invalid. It must be seven characters long and have at least one non-alphanumeric character.";
                      
                        break;
                    default: message = "There was an unknown error; the user account was NOT created.";
                       
                        break;
                }

                db.AddCandidate(candidate);
                Response.Redirect("Login.aspx");
            }
            else
            {
                LabelEmail.Text = "This email already exists, Please Login.";
                LabelEmail.Visible = true;
            }
        }
        else
        {
            CheckMarksSecondary.Text = "Please enter a valid value";
            CheckMarksSecondary.Visible = true;
        }

    }
开发者ID:EezeSolutions,项目名称:Higher_Erp,代码行数:69,代码来源:RegisterCandidate.aspx.cs


注:本文中的DBFunctions.AddCandidate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。