protected void BindAccountManagerDetails()
    {
        try
        {
            Int64     UserId    = Convert.ToInt64(Session["UserId"]);
            DataTable dtFaculty = TMSFacultyDetails.GetStaffFacultyDetails(null, 7, UserId).Tables[0];
            if (dtFaculty.Rows.Count > 0)
            {
                Int64     FacultyId = Convert.ToInt64(dtFaculty.Rows[0]["FD_FacultyDetailsId"]);
                DataTable dtAccount = TMSFacultyDetails.GetStaffFacultyDetails(FacultyId, 7, UserId).Tables[0];

                if (dtAccount.Rows.Count > 0)
                {
                    lblFullName.Text        = dtAccount.Rows[0]["FD_FirstName"].ToString() + " " + dtAccount.Rows[0]["FD_MiddleName"].ToString() + " " + dtAccount.Rows[0]["FD_LastName"].ToString();
                    Image1.ImageUrl         = dtAccount.Rows[0]["FD_Image"].ToString();
                    lblDOB.Text             = String.Format("{0:dd MMM yyyy}", dtAccount.Rows[0]["FD_BirthDate"]);// (Convert.ToString(objstudappl.StdaDob))("MM/dd/yyyy");
                    lblNationality.Text     = dtAccount.Rows[0]["FD_Nationality"].ToString();
                    lblGender.Text          = dtAccount.Rows[0]["FD_Gender"].ToString();
                    lblMotherTongue.Text    = dtAccount.Rows[0]["FD_MotherTounge"].ToString();
                    lblMedicalproblems.Text = dtAccount.Rows[0]["FD_MedicalProblem"].ToString();
                    lblBithPlace.Text       = dtAccount.Rows[0]["FD_BirthPlace"].ToString();
                    lblBloodGroup.Text      = dtAccount.Rows[0]["FD_BloodGroup"].ToString();
                    lblCaste.Text           = dtAccount.Rows[0]["FD_Caste"].ToString();
                    lblSubcaste.Text        = dtAccount.Rows[0]["FD_SubCaste"].ToString();
                    lblDOJ.Text             = String.Format("{0:dd MMM yyyy}", dtAccount.Rows[0]["FD_JoiningDate"]);
                    lblHihestDegree.Text    = dtAccount.Rows[0]["FD_HighestDegreeCompletd"].ToString();
                    lblCopleteYear.Text     = dtAccount.Rows[0]["FD_CompletionDate"].ToString();
                    lblUniversity.Text      = dtAccount.Rows[0]["FD_University"].ToString();
                    lblLastSchoolWas.Text   = dtAccount.Rows[0]["FD_LastSchoolwas"].ToString();
                    lblLastSchoolFrom.Text  = dtAccount.Rows[0]["FD_LastSchoolFromDate"].ToString();
                    if (lblLastSchoolFrom.Text != "")
                    {
                        string[] s = lblLastSchoolFrom.Text.Split(' ');
                        lblLastSchoolFrom.Text = String.Format("{0:dd MMM yyyy}", Convert.ToDateTime(s[0]));
                    }
                    lblLastSchoolTo.Text = dtAccount.Rows[0]["FD_LastSchoolToDate"].ToString();
                    if (lblLastSchoolTo.Text != "")
                    {
                        string[] s = lblLastSchoolTo.Text.Split(' ');
                        lblLastSchoolTo.Text = String.Format("{0:dd MMM yyyy}", Convert.ToDateTime(s[0]));
                    }
                    lblTotalExpInMonth.Text = dtAccount.Rows[0]["FD_ExperienceFrom"].ToString();
                    lblTotalExpInYear.Text  = dtAccount.Rows[0]["FD_ExperienceTo"].ToString();
                    lblSpecialization.Text  = dtAccount.Rows[0]["FD_SpecificExpertise"].ToString();
                    //***Mother Details
                    //***Residance Details
                    lblAddress.Text        = dtAccount.Rows[0]["FacultyPerAdd"].ToString();
                    lblmobileNo.Text       = dtAccount.Rows[0]["FacultyMobNo"].ToString();
                    lblResidencePhone.Text = dtAccount.Rows[0]["FacultyResNo"].ToString();
                    lblEmailID.Text        = dtAccount.Rows[0]["FacultyEmailId"].ToString();
                    lblCountry.Text        = dtAccount.Rows[0]["FacultyCountry"].ToString();
                    lblState.Text          = dtAccount.Rows[0]["FacultyState"].ToString();
                    lblCity.Text           = dtAccount.Rows[0]["FacultyCity"].ToString();
                    lblPin.Text            = dtAccount.Rows[0]["FacultyPinCode"].ToString();
                    //***Residance Details
                }
            }
        }
        catch (Exception ex) { }
    }
 protected void BindAcountManagerPhoto()
 {
     try
     {
         Int64     UserId    = Convert.ToInt64(Session["UserId"]);
         DataTable dtFaculty = TMSFacultyDetails.GetStaffFacultyDetails(null, 7, UserId).Tables[0];
         if (dtFaculty.Rows.Count > 0)
         {
             image1.ImageUrl = dtFaculty.Rows[0]["FD_Image"].ToString();
         }
     }
     catch (Exception ex) { }
 }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            Int64 UserId = Convert.ToInt64(Session["UserId"]);

            //DataTable dtFaculty = TMSFacultyDetails.GetSearch(null, UserId, 1, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1).Tables[0];
            DataTable dtFaculty = TMSFacultyDetails.GetStaffFacultyDetails(null, 7, UserId).Tables[0];
            if (dtFaculty.Rows.Count > 0)
            {
                Int64             FacultyId  = Convert.ToInt64(dtFaculty.Rows[0]["FD_FacultyDetailsId"]);
                TMSFacultyDetails objFaculty = TMSFacultyDetails.Get(FacultyId);
                if (objFaculty != null)
                {
                    //objFaculty.FDImage = ImageE;

                    if (FileUpload1.PostedFile.FileName != "")
                    {
                        bool   isExist = false;
                        string strFatherFileNameWithPath = FileUpload1.PostedFile.FileName;
                        string strFatherExtensionName    = System.IO.Path.GetExtension(strFatherFileNameWithPath);
                        string strFatherFileName         = System.IO.Path.GetFileName(strFatherFileNameWithPath).Replace(" ", "_");

                        if (strFatherExtensionName.Equals(".jpg") || strFatherExtensionName.Equals(".gif") || strFatherExtensionName.Equals(".png") || strFatherExtensionName.Equals(".jpeg") || strFatherExtensionName.Equals(".bmp"))
                        {
                            isExist = File.Exists(Server.MapPath(@"~\\UploadImages\\FacultyPhoto\\" + strFatherFileName));

                            string[] Name           = strFatherFileName.Split('.');
                            string   Fname          = Name[0];
                            string   ReplacFileName = Fname + "_" + DateTime.Now.ToString("yyyyMMddhhmmss") + strFatherExtensionName;
                            FileUpload1.PostedFile.SaveAs(Server.MapPath(@"..\\UploadImages\\FacultyPhoto\\" + ReplacFileName));
                            objFaculty.FDImage = "../UploadImages/FacultyPhoto/" + ReplacFileName;
                        }
                        else
                        {
                            dvMsg.Visible   = true;
                            lblMessage.Text = "Please Upload .jpg,.gif,.jpeg,.bmp File Only !";
                            dvMsg.Attributes.Add("class", "error_msg");
                            return;
                        }
                    }

                    objFaculty.Update();
                    Response.Redirect("ChangePhoto.aspx?msg=Photo is updated Successfully");
                }
            }
        }
        catch (Exception ex) { }
    }
    protected void BindTeacherDetails()
    {
        try
        {
            if ((Session["AccountID"] != null) && (Session["FacultyType"] != null))
            {
                Int64     UserId    = Convert.ToInt64(Session["AccountID"]);
                DataTable dtFaculty = TMSFacultyDetails.GetStaffFacultyDetails(null, Convert.ToInt64(Session["FacultyType"]), UserId).Tables[0];
                if (dtFaculty.Rows.Count > 0)
                {
                    if (dtFaculty.Rows[0]["FD_AgeProof"].ToString() != "AGEPROOF")
                    {
                        string[] dd = dtFaculty.Rows[0]["FD_AgeProof"].ToString().Split('/');
                        hyperAge.Text        = dd[2].ToString();
                        hyperAge.NavigateUrl = dtFaculty.Rows[0]["FD_AgeProof"].ToString();
                    }
                    else
                    {
                        hyperAge.Text = dtFaculty.Rows[0]["FD_AgeProof"].ToString();
                    }
                    if (dtFaculty.Rows[0]["FD_Image"] != null)
                    {
                        string[] dd = dtFaculty.Rows[0]["FD_Image"].ToString().Split('/');
                        hyperPassphoto.Text        = dd[3].ToString();
                        hyperPassphoto.NavigateUrl = dtFaculty.Rows[0]["FD_Image"].ToString();
                    }


                    if (dtFaculty.Rows[0]["FD_ReleavingLetter"].ToString() != "ReleavingLetter")
                    {
                        string[] dd = dtFaculty.Rows[0]["FD_ReleavingLetter"].ToString().Split('/');
                        hyperOleavingSchoolSertificate.Text        = dd[2].ToString();
                        hyperOleavingSchoolSertificate.NavigateUrl = dtFaculty.Rows[0]["FD_ReleavingLetter"].ToString();
                    }
                    else
                    {
                        hyperOleavingSchoolSertificate.Text = dtFaculty.Rows[0]["FD_ReleavingLetter"].ToString();
                    }
                }
            }
        }
        catch (Exception ex) { }
    }
    protected void BindPrincipalDetails()
    {
        try
        {
            DataTable dt = null;

            dt = TMSFacultyDetails.GetStaffFacultyDetails(null, 1, null).Tables[0];

            if (dt.Rows.Count > 0)
            {
                ListStaff.DataSource = dt;
                ListStaff.DataBind();
            }
            else
            {
                ListStaff.DataSource = null;
                ListStaff.DataBind();
            }
        }
        catch { }
    }
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        try
        {
            btnSave.Text = "Update";
            SectionEditProfile.Visible = true;
            SectionViewProfile.Visible = false;
            fillCountry();
            BindState();
            BindCity();
            //fillQualification();
            fillCompletedYear();
            Int64     UserId    = Convert.ToInt64(Session["UserId"]);
            DataTable dtFaculty = TMSFacultyDetails.GetStaffFacultyDetails(null, 7, UserId).Tables[0];
            if (dtFaculty.Rows.Count > 0)
            {
                Int64             FacultyId  = Convert.ToInt64(dtFaculty.Rows[0]["FD_FacultyDetailsId"]);
                TMSFacultyDetails objFaculty = TMSFacultyDetails.Get(FacultyId);
                if (objFaculty != null)
                {
                    txtFullName.Text            = objFaculty.FDFirstName;
                    txtMiddleName.Text          = objFaculty.FDMiddleName;
                    txtLatName.Text             = objFaculty.FDLastName;
                    txtBithPlace.Text           = objFaculty.FDBirthPlace;
                    txtDOB.Text                 = String.Format("{0:MM/dd/yyyy}", objFaculty.FDBirthDate);
                    ddlBloddGroup.SelectedValue = Convert.ToString(objFaculty.FDBloodGroup);
                    txtNationality.Text         = objFaculty.FDNationality;
                    txtCaste.Text               = objFaculty.FDCaste;
                    txtSubcaste.Text            = objFaculty.FDSubCaste;
                    ddlGender.SelectedValue     = objFaculty.FDGender;
                    txtMotherTongue.Text        = objFaculty.FDMotherTongue;
                    txtMedicalproblems.Text     = objFaculty.FDMedicalProblem;
                    if (objFaculty.FDJoiningDate != null)
                    {
                        txtDOJ.Text = String.Format("{0:MM/dd/yyyy}", objFaculty.FDJoiningDate);
                    }
                    if (objFaculty.FDHighestDegreeCompletd != null)
                    {
                        //ddlHighestDegree.SelectedValue = objFaculty.FDHighestDegreeCompletd;
                        txtHeighestDegree.Text = objFaculty.FDHighestDegreeCompletd.ToString();;
                    }
                    if (objFaculty.FDSpecificExpertise != "")
                    {
                        ddlSpeciallization.SelectedItem.Text = objFaculty.FDSpecificExpertise;
                    }
                    if (objFaculty.FDCompletionDate != "")
                    {
                        ddlCompletedYear.SelectedValue = objFaculty.FDCompletionDate;
                    }
                    txtUniversity.Text = objFaculty.FDUniversity;

                    txtLastSchoolWas.Text = objFaculty.FDLastSchoolwas;

                    if (objFaculty.FDLastSchoolFromDate != null)
                    {
                        txtLastSchoolFrom.Text = String.Format("{0:MM/dd/yyyy}", objFaculty.FDLastSchoolFromDate);
                    }
                    if (objFaculty.FDLastSchoolToDate != null)
                    {
                        txtLastSchoolTo.Text = String.Format("{0:MM/dd/yyyy}", objFaculty.FDLastSchoolToDate);
                    }
                    txtTotalExpInYear.Text  = objFaculty.FDExperienceTo;
                    txtTotalExpInMonth.Text = objFaculty.FDExperienceFrom;

                    Int64             AddressId  = Convert.ToInt64(objFaculty.FDAddressId);
                    TMSAddressDetails objAddress = TMSAddressDetails.Get(AddressId);
                    if (objAddress != null)
                    {
                        txtAddress.Text          = objAddress.ADPermanentAddress;
                        txtmobileNo.Text         = objAddress.ADMobileNo;
                        txtResidencePhone.Text   = objAddress.ADLandLineNo;
                        txtPin.Text              = objAddress.ADPinCode;
                        txtEmailID.Text          = objAddress.ADEmailId;
                        ddlCountry.SelectedValue = objAddress.ADCountryId.ToString();
                        BindState();
                        ddlState.SelectedValue = objAddress.ADStateId.ToString();
                        BindCity();
                        ddlCity.SelectedValue = objAddress.ADCityId.ToString();
                    }
                    Image2.Visible   = true;
                    Image2.ImageUrl  = objFaculty.FDImage;
                    Session["Image"] = objFaculty.FDImage;
                }
            }
        }
        catch (Exception ex) { }
    }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         string ImageE = EditGetImage();
         if (ImageE == "Ext")
         {
             dvMsg.Visible   = true;
             lblMessage.Text = "InValid File Format";
             dvMsg.Attributes.Add("class", "error_msg");
         }
         else
         {
             Int64     UserId    = Convert.ToInt64(Session["UserId"]);
             DataTable dtFaculty = TMSFacultyDetails.GetStaffFacultyDetails(null, 7, UserId).Tables[0];
             if (dtFaculty.Rows.Count > 0)
             {
                 Int64             FacultyId  = Convert.ToInt64(dtFaculty.Rows[0]["FD_FacultyDetailsId"]);
                 TMSFacultyDetails objFaculty = TMSFacultyDetails.Get(FacultyId);
                 if (objFaculty != null)
                 {
                     objFaculty.FDFirstName      = txtFullName.Text;
                     objFaculty.FDBirthPlace     = txtBithPlace.Text;
                     objFaculty.FDBirthDate      = Convert.ToDateTime(txtDOB.Text);
                     objFaculty.FDBloodGroup     = ddlBloddGroup.SelectedValue;
                     objFaculty.FDNationality    = txtNationality.Text;
                     objFaculty.FDCaste          = txtCaste.Text;
                     objFaculty.FDSubCaste       = txtSubcaste.Text;
                     objFaculty.FDGender         = ddlGender.SelectedValue;
                     objFaculty.FDMotherTongue   = txtMotherTongue.Text;
                     objFaculty.FDMedicalProblem = txtMedicalproblems.Text;
                     if (txtDOJ.Text != "")
                     {
                         objFaculty.FDJoiningDate = Convert.ToDateTime(txtDOJ.Text);
                     }
                     else
                     {
                         objFaculty.FDJoiningDate = null;
                     }
                     //objFaculty.FDHighestDegreeCompletd = ddlHighestDegree.SelectedValue;
                     objFaculty.FDHighestDegreeCompletd = txtHeighestDegree.Text;
                     objFaculty.FDSpecificExpertise     = ddlSpeciallization.SelectedItem.Text;
                     objFaculty.FDCompletionDate        = ddlCompletedYear.SelectedValue;
                     objFaculty.FDUniversity            = txtUniversity.Text;
                     objFaculty.FDLastSchoolwas         = txtLastSchoolWas.Text;
                     if (txtLastSchoolFrom.Text != "")
                     {
                         objFaculty.FDLastSchoolFromDate = Convert.ToDateTime(txtLastSchoolFrom.Text);
                     }
                     if (txtLastSchoolTo.Text != "")
                     {
                         objFaculty.FDLastSchoolToDate = Convert.ToDateTime(txtLastSchoolTo.Text);
                     }
                     objFaculty.FDExperienceTo   = txtTotalExpInYear.Text;
                     objFaculty.FDExperienceFrom = txtTotalExpInMonth.Text;
                     objFaculty.FDImage          = ImageE;
                     objFaculty.Update();
                     Int64             AddressId         = Convert.ToInt64(objFaculty.FDAddressId);
                     TMSAddressDetails objAddressDetails = TMSAddressDetails.Get(AddressId);
                     if (objAddressDetails != null)
                     {
                         objAddressDetails.ADPermanentAddress = txtAddress.Text.Trim();
                         if (!string.IsNullOrEmpty(ddlCity.SelectedValue))
                         {
                             objAddressDetails.ADCityId = Convert.ToInt64(ddlCity.SelectedValue);
                         }
                         if (!string.IsNullOrEmpty(ddlCountry.SelectedValue))
                         {
                             objAddressDetails.ADCountryId = Convert.ToInt64(ddlCountry.SelectedValue);
                         }
                         if (!string.IsNullOrEmpty(ddlState.SelectedValue))
                         {
                             objAddressDetails.ADStateId = Convert.ToInt64(ddlState.SelectedValue);
                         }
                         objAddressDetails.ADEmailId    = txtEmailID.Text.Trim();
                         objAddressDetails.ADMobileNo   = txtmobileNo.Text.Trim();
                         objAddressDetails.ADPinCode    = txtPin.Text.Trim();
                         objAddressDetails.ADLandLineNo = txtResidencePhone.Text;
                         objAddressDetails.Update();
                     }
                     TMSUserLogin objLogin = TMSUserLogin.Get(Convert.ToInt64(Session["UserId"]));
                     if (objLogin != null)
                     {
                         //objLogin.ULUserName = txtEmailID.Text.Trim();
                         objLogin.ULEmailId = txtEmailID.Text.Trim();
                         objLogin.Update();
                     }
                     BindAccountManagerDetails();
                     SectionEditProfile.Visible = false;
                     SectionViewProfile.Visible = true;
                     dvMsg.Visible   = true;
                     lblMessage.Text = "Profile Is Updated Successfully";
                     dvMsg.Attributes.Add("class", "warring_msg");
                 }
             }
         }
     }
     catch (Exception ex) { }
 }
    protected void BindTeacherDetails()
    {
        try
        {
            Int64     UserId    = Convert.ToInt64(Session["AccountID"]);
            DataTable dtFaculty = TMSFacultyDetails.GetStaffFacultyDetails(null, Convert.ToInt64(Session["FacultyType"]), UserId).Tables[0];
            if (dtFaculty.Rows.Count > 0)
            {
                lblFullName.Text = dtFaculty.Rows[0]["FD_FirstName"].ToString() + " " + dtFaculty.Rows[0]["FD_MiddleName"].ToString() + " " + dtFaculty.Rows[0]["FD_LastName"].ToString();
                if (dtFaculty.Rows[0]["FD_Image"] != null)
                {
                    imasdfdsg.ImageUrl = dtFaculty.Rows[0]["FD_Image"].ToString();
                }
                lblEduDetail.Text   = dtFaculty.Rows[0]["FD_HighestDegreeCompletd"].ToString() + "-" + dtFaculty.Rows[0]["FD_SpecificExpertise"].ToString() + " " + dtFaculty.Rows[0]["FD_CompletionDate"].ToString();
                lblAddress.Text     = dtFaculty.Rows[0]["FacultyPerAdd"].ToString();
                lblnationality.Text = dtFaculty.Rows[0]["FD_Nationality"].ToString();
                lblgender.Text      = dtFaculty.Rows[0]["FD_Gender"].ToString();
                lblmotherLong.Text  = dtFaculty.Rows[0]["FD_MotherTounge"].ToString();
                lblmedicolprm.Text  = dtFaculty.Rows[0]["FD_MedicalProblem"].ToString();
                lblbirthPlace.Text  = dtFaculty.Rows[0]["FD_BirthPlace"].ToString();
                lblbloodgroup.Text  = dtFaculty.Rows[0]["FD_BloodGroup"].ToString();
                lblcast.Text        = dtFaculty.Rows[0]["FD_Caste"].ToString();
                lblsubcast.Text     = dtFaculty.Rows[0]["FD_SubCaste"].ToString();
                if (dtFaculty.Rows[0]["FD_HighestDegreeCompletd"].ToString() != "-1")
                {
                    lblhighestDegree.Text = dtFaculty.Rows[0]["FD_HighestDegreeCompletd"].ToString();
                }
                if (dtFaculty.Rows[0]["FD_CompletionDate"].ToString() != "Select")
                {
                    lblcomplicationDateofHigherDegree.Text = dtFaculty.Rows[0]["FD_CompletionDate"].ToString();
                }
                lbluniversity.Text = dtFaculty.Rows[0]["FD_University"].ToString();
                if ((dtFaculty.Rows[0]["FD_ExperienceFrom"] != null) && (dtFaculty.Rows[0]["FD_ExperienceTo"] != null))
                {
                    lblexpyears.Text   = dtFaculty.Rows[0]["FD_ExperienceTo"].ToString() + "  Year";
                    lblexperience.Text = dtFaculty.Rows[0]["FD_ExperienceTo"].ToString() + "  Year" + "  " + dtFaculty.Rows[0]["FD_ExperienceFrom"].ToString() + "   Month";
                }
                else if ((dtFaculty.Rows[0]["FD_ExperienceFrom"] != null) && (dtFaculty.Rows[0]["FD_ExperienceTo"] == null))
                {
                    lblexperience.Text = dtFaculty.Rows[0]["FD_ExperienceFrom"].ToString() + "  Year";
                    lblexpyears.Text   = dtFaculty.Rows[0]["FD_ExperienceFrom"].ToString() + "  Year";
                }
                //  lblspeciolisation.Text = dtFaculty.Rows[0]["FD_SpecificExpertise"].ToString();
                if (dtFaculty.Rows[0]["ClassName"] != null)
                {
                    string Classname = dtFaculty.Rows[0]["ClassName"].ToString();

                    if (Classname != "")
                    {
                        lblstandard.Text = Classname.Remove(Classname.Length - 1, 1);
                    }
                }

                if (dtFaculty.Rows[0]["SubjectName"] != null)
                {
                    string SubjectName = dtFaculty.Rows[0]["SubjectName"].ToString();
                    if (SubjectName != "")
                    {
                        lblsubject.Text = SubjectName.Remove(SubjectName.Length - 1, 1);
                    }
                }
                //   lblusingtransport.Text = dtFaculty.Rows[0]["FD_TransportStatus"].ToString();
            }
        }
        catch (Exception ex) { }
    }