public static TMSUserLogin Get(System.Int64 ulLoginId)
    {
        DataSet      ds;
        Database     db;
        string       sqlCommand;
        DbCommand    dbCommand;
        TMSUserLogin instance;


        instance = new TMSUserLogin();

        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSUserLogin_SELECT";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, ulLoginId);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSUserLogin ID:" + ulLoginId.ToString()+ " from Database.");
        // Return results.
        {
            return(null);
        }
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    public static TMSUserLogin[] Search(System.Int64?ulLoginId, System.String ulUserName, System.String ulUserPassword, System.String ulEmailId, System.Int32?ulUserType, System.Int64?ulCreatedBy, System.Int64?ulModifiedBy, System.DateTime?ulCreatedDate, System.DateTime?ulModifiedDate, System.DateTime?ulLastLoginDate, System.Int32?ulStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSUserLogin_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, ulLoginId, ulUserName, ulUserPassword, ulEmailId, ulUserType, ulCreatedBy, ulModifiedBy, ulCreatedDate, ulModifiedDate, ulLastLoginDate, ulStatus);

        ds = db.ExecuteDataSet(dbCommand);
        ds.Tables[0].TableName = TABLE_NAME;
        return(TMSUserLogin.MapFrom(ds));
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["UserId"] != null)
            {
                Int64 UserId = Convert.ToInt32(Session["UserId"]);
                DataTable dtUser = new DataTable();
                TMSUserLogin objUser = new TMSUserLogin();
                dtUser = TMSUserLogin.GetSearch(UserId, null, null, null, null, null, null, null, null, null, 1).Tables[0];
                if (dtUser.Rows.Count > 0)
                {
                    string password = dtUser.Rows[0]["UL_UserPassword"].ToString();
                    string decryptPass = decryptPassword(password);
                    if (txtCurrentPassword.Text == decryptPass)
                    {
                        TMSUserLogin objLogin = TMSUserLogin.Get(UserId);
                        string password2 = txtNewPassword.Text;
                        string encryptPass = encrypPassword(password2);
                        objLogin.ULUserPassword = encryptPass;
                        objLogin.Update();
                        dvMsg.Visible = true;
                        lblMessage.Text = "Password Changed Successfully...!";
                        dvMsg.Attributes.Add("class", "warring_msg");
                    }
                    else
                    {
                        dvMsg.Visible = true;
                        lblMessage.Text = "Current Password is Wrong  Please Try Again....!";
                        dvMsg.Attributes.Add("class", "error_msg");

                    }
                }
                else
                {
                    dvMsg.Visible = true;
                    lblMessage.Visible = true;
                    lblMessage.Text = "No Records Found";
                }
            }
        }
        catch (Exception ex) { }
    }
Esempio n. 4
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (Session["UserId"] != null)
         {
             Int64        UserId  = Convert.ToInt32(Session["UserId"]);
             DataTable    dtUser  = new DataTable();
             TMSUserLogin objUser = new TMSUserLogin();
             dtUser = TMSUserLogin.GetSearch(UserId, null, null, null, null, null, null, null, null, null, 1).Tables[0];
             if (dtUser.Rows.Count > 0)
             {
                 string password    = dtUser.Rows[0]["UL_UserPassword"].ToString();
                 string decryptPass = decryptPassword(password);
                 if (txtCurrentPassword.Text == decryptPass)
                 {
                     TMSUserLogin objLogin    = TMSUserLogin.Get(UserId);
                     string       password2   = txtNewPassword.Text;
                     string       encryptPass = encrypPassword(password2);
                     objLogin.ULUserPassword = encryptPass;
                     objLogin.Update();
                     dvMsg.Visible   = true;
                     lblMessage.Text = "Password Changed Successfully...!";
                     dvMsg.Attributes.Add("class", "warring_msg");
                 }
                 else
                 {
                     dvMsg.Visible   = true;
                     lblMessage.Text = "Current Password is Wrong  Please Try Again....!";
                     dvMsg.Attributes.Add("class", "error_msg");
                 }
             }
             else
             {
                 dvMsg.Visible      = true;
                 lblMessage.Visible = true;
                 lblMessage.Text    = "No Records Found";
             }
         }
     }
     catch (Exception ex) { }
 }
    public static TMSUserLogin[] MapFrom(DataSet ds)
    {
        List <TMSUserLogin> objects;


        // Initialise Collection.
        objects = new List <TMSUserLogin>();

        // Validation.
        if (ds == null)
        {
            throw new ApplicationException("Cannot map to dataset null.");
        }
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        {
            return(objects.ToArray());
        }

        if (ds.Tables[TABLE_NAME] == null)
        {
            throw new ApplicationException("Cannot find table [dbo].[TMS_UserLogin] in DataSet.");
        }

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        {
            throw new ApplicationException("Table [dbo].[TMS_UserLogin] is empty.");
        }

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSUserLogin instance = new TMSUserLogin();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return(objects.ToArray());
    }
 public static void Update(TMSUserLogin tMSUserLogin, DbTransaction transaction)
 {
     tMSUserLogin.Update(transaction);
 }
 public static void Update(TMSUserLogin tMSUserLogin)
 {
     tMSUserLogin.Update();
 }
 public static TMSUserLogin[] Search(TMSUserLogin searchObject)
 {
     return Search ( searchObject.ULLoginId, searchObject.ULUserName, searchObject.ULUserPassword, searchObject.ULEmailId, searchObject.ULUserType, searchObject.ULCreatedBy, searchObject.ULModifiedBy, searchObject.ULCreatedDate, searchObject.ULModifiedDate, searchObject.ULLastLoginDate, searchObject.ULStatus);
 }
    public static TMSUserLogin[] MapFrom(DataSet ds)
    {
        List<TMSUserLogin> objects;

        // Initialise Collection.
        objects = new List<TMSUserLogin>();

        // Validation.
        if (ds == null)
        throw new ApplicationException("Cannot map to dataset null.");
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        return objects.ToArray();

        if (ds.Tables[TABLE_NAME] == null)
        throw new ApplicationException("Cannot find table [dbo].[TMS_UserLogin] in DataSet.");

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        throw new ApplicationException("Table [dbo].[TMS_UserLogin] is empty.");

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSUserLogin instance = new TMSUserLogin();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return objects.ToArray();
    }
    public static TMSUserLogin Get(System.Int64 ulLoginId)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSUserLogin instance;

        instance = new TMSUserLogin();

        db = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSUserLogin_SELECT";
        dbCommand = db.GetStoredProcCommand(sqlCommand, ulLoginId);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSUserLogin ID:" + ulLoginId.ToString()+ " from Database.");
            // Return results.
            return null;
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }
 public static TMSUserLogin[] Search(TMSUserLogin searchObject)
 {
     return(Search(searchObject.ULLoginId, searchObject.ULUserName, searchObject.ULUserPassword, searchObject.ULEmailId, searchObject.ULUserType, searchObject.ULCreatedBy, searchObject.ULModifiedBy, searchObject.ULCreatedDate, searchObject.ULModifiedDate, searchObject.ULLastLoginDate, searchObject.ULStatus));
 }
 public static void Update(TMSUserLogin tMSUserLogin, DbTransaction transaction)
 {
     tMSUserLogin.Update(transaction);
 }
 public static void Update(TMSUserLogin tMSUserLogin)
 {
     tMSUserLogin.Update();
 }
Esempio n. 14
0
 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) { }
 }
Esempio n. 15
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (ddlLogintype.SelectedIndex != 0)
        {
            try
            {
              //  DataTable dtLogin = TMSUserLogin.CheckLoginDetails(txtUserName.Text.Trim(), "c3VtaXQx", Convert.ToInt32(ddlLogintype.SelectedValue)).Tables[0];
             DataTable dtLogin = TMSUserLogin.CheckLoginDetails(txtUserName.Text.Trim(), help.encryptPassword(txtPassword.Text.Trim()), Convert.ToInt32(ddlLogintype.SelectedValue)).Tables[0];
                if (dtLogin.Rows.Count > 0)
                {
                    if (Convert.ToInt32(dtLogin.Rows[0]["UL_Status"]) == 0)
                    {
                        dverror.Style.Add("display", "block");
                        lblMessage.InnerHtml = "Your Account has been disabled, Please contact Admin !";
                        txtUserName.Focus();
                    }
                    else
                    {
                        DataTable dtUserName = null;
                        Session["UserId"] = dtLogin.Rows[0]["UL_LoginId"];
                        Session["Username"] = txtUserName.Text.Trim();
                        Session["Password"] = txtPassword.Text.Trim();
                        Session["UserType"] = dtLogin.Rows[0]["UL_UserType"];
                        string Uname = txtUserName.Text;
                        string Psw = txtPassword.Text;
                        if (Convert.ToInt32(Session["UserType"]) == 1)
                        {
                            dtUserName = TMSFacultyDetails.GetCurrentStaffFacultyDetails(null, null, Convert.ToInt64(Session["UserId"]), null, null).Tables[0];
                            if (dtUserName.Rows.Count > 0)
                            {
                                string name = dtUserName.Rows[0]["UserName"].ToString();
                                Session["LoginName"] = name;
                                ILog logger = log4net.LogManager.GetLogger("" + name + "(Principal)");
                                logger.Info("Login Time,This is info message");
                                logger.Debug("Login Time,This is Debug message");
                                logger.Error("Login Time,This is Error message");
                                logger.Warn("Login Time,This is Warn message");
                                logger.Fatal("Login Time,This is Fatal message");
                            }
                            Response.Redirect("Principal/DashboardPrincipal.aspx", false);
                        }
                        else if (Convert.ToInt32(Session["UserType"]) == 2)
                        {
                            dtUserName = TMSFacultyDetails.GetCurrentStaffFacultyDetails(null, null, Convert.ToInt64(Session["UserId"]), null, null).Tables[0];
                            if (dtUserName.Rows.Count > 0)
                            {
                                string name = dtUserName.Rows[0]["UserName"].ToString();
                                Session["LoginName"] = name;
                                ILog logger = log4net.LogManager.GetLogger("" + name + "(Principal)");
                                logger.Info("Login Time,This is info message");
                                logger.Debug("Login Time,This is Debug message");
                                logger.Error("Login Time,This is Error message");
                                logger.Warn("Login Time,This is Warn message");
                                logger.Fatal("Login Time,This is Fatal message");
                            }

                            Response.Redirect("Teacher/DashboardTeacher.aspx", false);
                        }
                        else if (Convert.ToInt32(Session["UserType"]) == 3)
                        {
                            Response.Redirect("Parents/ParentDashboard.aspx", false);
                        }
                        else if (Convert.ToInt32(Session["UserType"]) == 4)
                        {
                            Response.Redirect("Student/Dashboard.aspx", false);
                        }
                        else if (Convert.ToInt32(Session["UserType"]) == 5)
                        {
                            Response.Redirect("Vendor/VendorDashboard.aspx", false);
                        }
                        else if (Convert.ToInt32(Session["UserType"]) == 6)
                        {
                            Response.Redirect("Transpotation/transportdashboard.aspx", false);
                        }
                        else if (Convert.ToInt32(Session["UserType"]) == 7)
                        {
                            Response.Redirect("Librarian/Librariandashboard.aspx", false);
                        }
                        else if (Convert.ToInt32(Session["UserType"]) == 8)
                        {
                            Response.Redirect("AccountManager/AccountManagerDashboard.aspx", false);
                        }
                    }
                }
                else
                {
                    //If password not found in DB, display mesg to user.
                    dverror.Style.Add("display", "block");
                    lblMessage.InnerHtml = "Incorrect Username or Password !";
                    txtUserName.Focus();
                }
            }
            catch (Exception ex)
            {
                //Response.Write(ex);
            }
        }
        else
        {
            dverror.Style.Add("display", "block");
            lblMessage.InnerHtml = "Please Select Login Type !";
            txtUserName.Focus();
        }
    }