protected void Page_Load(object sender, EventArgs e)
        {
            _userObj = Common.GetUserSession();

            if (_userObj == null)
                Common.RedirectToLoginPage();

            if (_userObj != null)
            {
                if (_userObj.ParkingLocation != null)
                {
                    if (_userObj.ParkingLocation.Latitude != "")
                        hiddLatitude.Value = _userObj.ParkingLocation.Latitude;

                    if (_userObj.ParkingLocation.Longitude != "")
                        hiddLongitude.Value = _userObj.ParkingLocation.Longitude;

                    ltrlParkingLocationInfo.Text = "";
                }
                else
                {
                    ltrlParkingLocationInfo.Text = "Parking Location is not set. you need to set your parking location before you can find your car.";
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _userObj = Common.GetUserSession();

            if (_userObj == null)
                Common.RedirectToLoginPage();
        }
示例#3
0
 public static void SetSession(User userObj)
 {
     if (userObj != null)
     {
         userObj.isAdmin = false;
         HttpContext.Current.Session["UserSession"] = userObj;
     }
 }
示例#4
0
        public User ValidateUser(string userName, string password)
        {
            User validUser = null;

            try
            {
                using (SqlCommand cmd = new SqlCommand(StoredProcedures.SPR_VALIDATE_USER, _connection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@UserName", SqlDbType.VarChar).Value = userName;
                    cmd.Parameters.Add("@Password", SqlDbType.VarChar).Value = password;

                    SqlDataReader dr = cmd.ExecuteReader();

                    if (dr != null)
                    {
                        if (dr.HasRows)
                        {
                            if (dr.Read())
                            {
                                validUser = new User();
                                validUser.UserName = dr["UserName"].ToString();
                                validUser.EmailAddress = dr["EmailAddress"].ToString();
                                validUser.UserId = dr["UserId"].ToString();

                                ParkingLocation parkingLocation = new ParkingLocation();
                                parkingLocation.UserId = dr["UserId"].ToString();
                                parkingLocation.LocationId = dr["LocationId"].ToString();
                                parkingLocation.Latitude = dr["Latitude"].ToString();
                                parkingLocation.Longitude = dr["Longitude"].ToString();

                                validUser.ParkingLocation = parkingLocation;

                                validUser.ModelId = Convert.ToInt32(dr["ModelId"]);
                                validUser.MakeId = Convert.ToInt32(dr["MakeId"]);
                                validUser.Year = Convert.ToInt32(dr["Year"]);

                                validUser.isAdmin = false;
                            }
                        }
                    }

                }
            }
            catch (Exception ex)
            {

            }

            return validUser;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _userObj = Common.GetUserSession();

            if (_userObj == null)
                Common.RedirectToLoginPage();

            Session["ViewMap"] = "";

            if (!Page.IsPostBack)
            {
                viewMap.Attributes.Add("onclick", "return calcRoute();");
            }
        }
 protected void RegisterUser_CreatedUser(object sender, EventArgs e)
 {
     var userObj = new User();
     userObj.UserName = UserName.Text;
     userObj.Password = Password.Text;
     userObj.EmailAddress = Email.Text;
     var obj = new UserBLL();
     var status = obj.Registeruser(userObj);
     if (status)
     {
         lblStatus.Text = "User Was Registered successfully.";
     }
     else
     {
         lblStatus.Text = "Registration was not successfull. Please try again later.";
     }
 }
示例#7
0
 public bool RegisterUser(User userObj)
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand(StoredProcedures.SPR_REGISTER_USER, _connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add("@UserName", SqlDbType.VarChar).Value = userObj.UserName;
             cmd.Parameters.Add("@UserPassword", SqlDbType.VarChar).Value = userObj.Password;
             cmd.Parameters.Add("@EmailAddress", SqlDbType.VarChar).Value = userObj.EmailAddress;
             cmd.ExecuteNonQuery();
             return true;
         }
     }
     catch (Exception ex)
     {
         return false;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            _userObj = Common.GetUserSession();

            if (_userObj == null)
                Common.RedirectToLoginPage();
            else
            {
                loadUserFuels();
            }
            if (!Page.IsPostBack)
            {
                LoadVehicleMakes();
                BindUserFuelDetails();
               // LoadUserFuelChart();
            }

            if (_userObj != null)
            {
                if (_userObj.MakeId != 0)
                {

                    lstMake.SelectedValue = _userObj.MakeId.ToString();
                    LoadVehicleModels();
                    lstModel.SelectedValue = _userObj.ModelId.ToString();
                    txtYear.Text = _userObj.Year.ToString();
                    LoadCarDetails();

                    btnSaveCar.Visible = false;
                }
            }
            LoadUserFuelChart();
        }
示例#9
0
 public bool Registeruser(User userObj)
 {
     return new UserDAL().RegisterUser(userObj);
 }
示例#10
0
 public void UpdateUserVehicleDetails(User userObj)
 {
     new VehicleDAL().UpdateUserVehicleDetails(userObj);
 }
示例#11
0
        public void UpdateUserVehicleDetails(User userObj)
        {
            try
            {
                using (SqlCommand cmd = new SqlCommand(StoredProcedures.SPR_UPDATE_USER_VEHICLE_DTLS, _connection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@MakeId", SqlDbType.Int).Value = userObj.MakeId;
                    cmd.Parameters.Add("@ModelId", SqlDbType.Int).Value = userObj.ModelId;
                    cmd.Parameters.Add("@UserId", SqlDbType.VarChar).Value = userObj.UserId;
                    cmd.Parameters.Add("@Year", SqlDbType.Int).Value = userObj.Year;

                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {

            }
        }