protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (txtFirstName.Text == "" || txtLastName.Text == "" || txtUserName.Text == "" || txtPassword.Text == "")
        {
            lblerr.Text = "* Marked fields are Empty.";
        }
        else
        {
            clsTbContact Contact = new clsTbContact();
            Contact.sFST_Name  = txtFirstName.Text.Trim();
            Contact.sLAST_Name = txtLastName.Text.Trim();
            Contact.daDOB      = Convert.ToDateTime(txtDOB.Text.Trim());
            Contact.sSSN       = txtSSN.Text.Trim();
            if (rbtnMale.Checked == true)
            {
                Contact.sGender = "Male";
            }
            else
            {
                Contact.sGender = "Female";
            }
            Contact.sStatus                  = ddlStatus.SelectedValue.ToString();
            Contact.sPrimary_Email           = txtPrimaryEmail.Text.Trim();
            Contact.sSecondary_Email         = txtSecondaryEmail.Text.Trim();
            Contact.sSkypeID                 = txtSkypeID.Text.Trim();
            Contact.sType                    = ddlType.SelectedValue.ToString();
            Contact.sCurrent_Location        = txtCurrentLocation.Text.Trim();
            Contact.sCurrent_Client          = txtCurrentClient.Text.Trim();
            Contact.sAvailable_For_Interview = ddlAvailableForInterview.SelectedValue.ToString();
            Contact.sAvailability_To_Join    = ddlAvailabilityToJoin.SelectedValue.ToString();
            //Contact.iRecruiterID = "";
            //Contact.iSub_Vendor_ID = "";
            Contact.sType2           = ddlType2.SelectedValue.ToString();
            Contact.sPrimary_Skill   = txtPrimarySkill.Text.Trim();
            Contact.sSecondary_Skill = txtSecondarySkill.Text.Trim();
            Contact.sIMMI_Status     = txtIMMIStatus.Text.Trim();
            Contact.sDescription     = txtDescription.Text.Trim();

            if (txtDOB.Text == "")
            {
                txtDOB.Text = "01/01/1900";
            }
            if (txtClientRate.Text == "")
            {
                txtClientRate.Text = "0.0";
            }
            if (txtSynergyRate.Text == "")
            {
                txtSynergyRate.Text = "0.0";
            }
            if (txtHealthInsurance.Text == "")
            {
                txtHealthInsurance.Text = "0.0";
            }
            if (txtH1BExp.Text == "")
            {
                txtH1BExp.Text = "0.0";
            }
            if (txtPTO.Text == "")
            {
                txtPTO.Text = "0";
            }
            if (txtOtherIMMIExp.Text == "")
            {
                txtOtherIMMIExp.Text = "0.0";
            }
            if (txtCOMM.Text == "")
            {
                txtCOMM.Text = "0.0";
            }
            if (txtNumberOfYearsExperience.Text == "")
            {
                txtNumberOfYearsExperience.Text = "0";
            }

            Contact.dcClient_Rate      = Convert.ToDecimal(txtClientRate.Text.Trim());
            Contact.dcSynergy_Rate     = Convert.ToDecimal(txtSynergyRate.Text.Trim());
            Contact.dcHealth_Insurance = Convert.ToDecimal(txtHealthInsurance.Text.Trim());
            Contact.dcH1B_Exp          = Convert.ToDecimal(txtH1BExp.Text.Trim());
            Contact.iPTO             = Convert.ToInt32(txtPTO.Text.Trim());
            Contact.dcOther_IMMI_Exp = Convert.ToDecimal(txtOtherIMMIExp.Text.Trim());
            Contact.dcCOMM           = Convert.ToDecimal(txtCOMM.Text.Trim());
            Contact.iNo_Of_Years_Exp = Convert.ToInt32(txtNumberOfYearsExperience.Text.Trim());
            Contact.sSeniority       = ddlSeniority.SelectedValue.ToString();
            Contact.sComm_Skills     = ddlCommSkills.SelectedValue.ToString();
            Contact.sAddress_Line1   = txtAddressLine1.Text.Trim();
            Contact.sAddress_Line2   = txtAddressLine2.Text.Trim();
            Contact.sCity            = txtCity.Text.Trim();
            Contact.sState           = txtState.Text.Trim();
            Contact.sZip             = txtZip.Text.Trim();
            Contact.sCountry         = txtCountry.Text.Trim();


            clsTbUser User = new clsTbUser();
            User.sStatus     = ddlStatus.SelectedValue.ToString();
            User.sRole       = ddlRole.SelectedItem.Text;
            User.sRole_Level = ddlRole_Level.SelectedItem.Text;
            User.sUser_Name  = txtUserName.Text.Trim();
            User.sPassword   = GetSHA1HashData(txtPassword.Text.Trim()); //txtPassword.Text.Trim();
            //User.sSEC_Q1 = "";
            //User.sSEC_A1 = "";
            //User.sSEC_Q2 = "";
            //User.sSEC_A2 = "";

            if (string.IsNullOrEmpty(Request.QueryString["ID"]))
            {
                if (User.IsUserExists())
                {
                    lblerr.Text = "UserName Already Taken. Please Choose Another UserName";
                    txtUserName.Focus();
                }
                else
                {
                    Contact.daCDate  = Convert.ToDateTime(DateTime.Now);
                    Contact.sCPerson = Session["UserName"].ToString();
                    DataTable dti = Contact.Insert();
                    string    CID = dti.Rows[0][0].ToString();

                    User.daCDate  = Convert.ToDateTime(DateTime.Now);
                    User.sCPerson = Session["UserName"].ToString();
                    DataTable dtiu = User.Insert();
                    string    CUID = dtiu.Rows[0][0].ToString();

                    clsTbContact_User CU = new clsTbContact_User();
                    CU.iContact_ID = Convert.ToInt32(CID);
                    CU.iUser_ID    = Convert.ToInt32(CUID);
                    CU.sStatus     = ddlStatus.SelectedValue.ToString();
                    CU.Insert();

                    lblerr.Text = "Successfully Registered Contact ID: " + CID + "UserID: " + CUID;
                }
            }
            else
            {
                int i = Convert.ToInt32(Request.QueryString["id"].ToString());
                Contact.iID = i;
                Contact.Update();
                lblerr.Text = "Updated Successfully";
                Bind();
            }
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        clsTbUser        User  = new clsTbUser();
        clsTbClient_Team CTeam = new clsTbClient_Team();

        CTeam.iClient_ID       = Convert.ToInt32(ddlClientName.SelectedValue.ToString());
        CTeam.sName            = txtName.Text.Trim();
        CTeam.sState           = ddlStatus.SelectedItem.ToString();
        CTeam.sRole            = ddlClientRole.SelectedItem.ToString();
        CTeam.sEmail           = txtEmail.Text.Trim();
        CTeam.sPrimary_Phone   = txtPrimaryPhone.Text.Trim();
        CTeam.sSecondary_Phone = txtSecondaryPhone.Text.Trim();
        CTeam.sLocation        = txtLocation.Text.Trim();
        CTeam.sAddress_Line1   = txtAddress_Line1.Text.Trim();
        CTeam.sAddress_Line2   = txtAddress_Line2.Text.Trim();
        CTeam.sCity            = txtCity.Text.Trim();
        CTeam.sState           = txtState.Text.Trim();
        CTeam.sZip             = txtZIP.Text.Trim();
        CTeam.sCountry         = txtCountry.Text.Trim();
        CTeam.sStatus          = ddlStatus.SelectedValue.ToString();

        User.sStatus     = ddlStatus.SelectedValue.ToString();
        User.sRole       = ddlUserRole.SelectedItem.Text;
        User.sRole_Level = ddlRole_Level.SelectedItem.Text;
        User.sUser_Name  = txtUserName.Text.Trim();
        User.sPassword   = GetSHA1HashData(txtPassword.Text.Trim());   //txtPassword.Text.Trim();
        //User.sSEC_Q1 = "";
        //User.sSEC_A1 = "";
        //User.sSEC_Q2 = "";
        //User.sSEC_A2 = "";

        if (string.IsNullOrEmpty(Request.QueryString["ID"]))
        {
            if (txtName.Text == "" || txtUserName.Text == "" || txtPassword.Text == "")
            {
                lblerr.Text = "* marked are compulsory";
            }
            else
            {
                if (User.IsUserExists())
                {
                    lblerr.Text = "UserName Already Taken. Please Choose Another UserName";
                    txtUserName.Focus();
                }
                else
                {
                    CTeam.daCDate  = Convert.ToDateTime(DateTime.Now);
                    CTeam.sCPerson = Session["UserName"].ToString();
                    DataTable dti = CTeam.Insert();
                    string    CID = dti.Rows[0][0].ToString();

                    User.daCDate  = Convert.ToDateTime(DateTime.Now);
                    User.sCPerson = Session["UserName"].ToString();
                    DataTable dtiu = User.Insert();
                    string    CUID = dtiu.Rows[0][0].ToString();

                    clsTbClient_User CU = new clsTbClient_User();
                    CU.iClient_ID = Convert.ToInt32(CID);
                    CU.iUser_ID   = Convert.ToInt32(CUID);
                    CU.sStatus    = ddlStatus.SelectedValue.ToString();
                    CU.Insert();

                    lblerr.Text = "Successfully Registered ClientID: " + CID + "UserID: " + CUID;
                }
            }
        }
        else
        {
            if (txtName.Text == "")
            {
                lblerr.Text = "* marked are compulsory";
            }
            else
            {
                int i = Convert.ToInt32(Request.QueryString["id"].ToString());
                CTeam.iID = i;
                CTeam.Update();
                lblerr.Text = "Updated Successfully";
            }
        }
        txtName.Text           = "";
        txtEmail.Text          = "";
        txtPrimaryPhone.Text   = "";
        txtSecondaryPhone.Text = "";
        txtLocation.Text       = "";
        txtAddress_Line1.Text  = "";
        txtAddress_Line2.Text  = "";
        txtCity.Text           = "";
        txtState.Text          = "";
        txtZIP.Text            = "";
        txtCountry.Text        = "";
        Bind();
    }