예제 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            LoginCheck login = new LoginCheck();

            if (usertype.Text == "Trainer")
            {
                string log = txtuserid.Text;
                int    h   = login.logincheck(log);
                if (h != 1)
                {
                    long id = trainers();
                    List <TrainerSkill>  dbcheck = new List <TrainerSkill>();
                    RegistrationCheckbox registrationCheckbox = new RegistrationCheckbox();
                    foreach (ListItem item in CheckBoxList1.Items)
                    {
                        long skillId = long.Parse(item.Value);
                        if (item.Selected)
                        {
                            registrationCheckbox.skillInsert(id, skillId);
                        }
                        Label1.Visible      = true;
                        Label1.Text         = "Registered successfully";
                        LinkButton1.Visible = true;
                    }
                }
                else
                {
                    Label1.Visible = true;
                    Label1.Text    = "username already exists";
                }
            }
            else if (usertype.Text == "SME")
            {
                string log = txtuserid.Text;
                int    h   = login.loginsmeusercheck(log);
                if (h != 1)
                {
                    long                 sid                  = sme();
                    List <SmeSkill>      dbsmeskill           = new List <SmeSkill>();
                    RegistrationCheckbox registrationcheckbox = new RegistrationCheckbox();
                    foreach (ListItem item in CheckBoxList1.Items)
                    {
                        long smeskillId = long.Parse(item.Value);
                        if (item.Selected)
                        {
                            registrationcheckbox.smeSkillInsert(sid, smeskillId);
                        }
                        Label1.Visible      = true;
                        Label1.Text         = "Registered successfully";
                        LinkButton1.Visible = true;
                    }
                }
                else
                {
                    Label1.Visible = true;
                    Label1.Text    = "username already exists";
                }
            }
            else
            {
                string log = txtuserid.Text;
                int    h   = login.requestorlogincheck(log);
                if (h != 1)
                {
                    registrationInsertion regis            = new registrationInsertion();
                    Requestor             requestorDetails = new Requestor();
                    requestorDetails.First_name    = txtfirstname.Text;
                    requestorDetails.Last_name     = txtlastname.Text;
                    requestorDetails.Gender        = radiogender.Text;
                    requestorDetails.Age           = long.Parse(txtage.Text);
                    requestorDetails.Contact_no    = long.Parse(txtcontact.Text);
                    requestorDetails.Userid        = txtuserid.Text;
                    requestorDetails.Password_user = txtpassword.Text;
                    requestorDetails.UserType      = usertype.Text;
                    requestorDetails.EmailId       = emailid.Text;
                    requestorDetails.Description   = TextBox1.Text;
                    regis.registrationRequestor(requestorDetails);
                    Label1.Visible      = true;
                    Label1.Text         = "Registered successfully";
                    LinkButton1.Visible = true;
                }
                else
                {
                    Label1.Visible = true;
                    Label1.Text    = "username already exists";
                }
            }

            //else if (usertype.Text == "SME")
            //{
            //    registrationInsertion regis = new registrationInsertion();
            //    Trainer trainerdetails = new Trainer();
            //    trainerdetails.First_name = txtfirstname.Text;
            //    trainerdetails.Last_name = txtlastname.Text;
            //    trainerdetails.Gender = radiogender.Text;
            //    trainerdetails.Age = long.Parse(txtage.Text);
            //    trainerdetails.Contact_no = long.Parse(txtcontact.Text);
            //    trainerdetails.Userid = txtuserid.Text;
            //    trainerdetails.Password_user = txtpassword.Text;
            //    trainerdetails.UserType = usertype.Text;
            //    trainerdetails.EmailId = emailid.Text;
            //    regis.registrationSme(trainerdetails);
            //}
            //else
            //{
            //
            //}
        }