public DataSet ValidateUser(string UserName, string Password)
        {
            try
            {
                string EncryptionKey = getEncryptdata(UserName);
                //string EncryptionKey = getEncryptdata1(UserName);
                string Encrypted = pwdEnDecrypt_obj.Encrypt(Password, EncryptionKey);

                sqlhelper_obj = new SqlHelper();
                using (SqlConnection sqlconn_obj = new SqlConnection())
                {
                    sqlconn_obj.ConnectionString = sqlhelper_obj.GetConnectionSrting();
                    using (SqlCommand sqlcmd_login_obj = new SqlCommand("PARK_PROC_LoginUser", sqlconn_obj))
                    {
                        sqlcmd_login_obj.CommandType    = CommandType.StoredProcedure;
                        sqlcmd_login_obj.CommandTimeout = 0;
                        sqlcmd_login_obj.Parameters.AddWithValue("@UserName", UserName);
                        sqlcmd_login_obj.Parameters.AddWithValue("@Password", Encrypted);

                        DataSet ds;
                        using (SqlDataAdapter da = new SqlDataAdapter(sqlcmd_login_obj))
                        {
                            ds = new DataSet();
                            da.Fill(ds);
                        }
                        DataTable dt = ds.Tables[0];
                        return(ds);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        public string UpateLoginUserPassword(User objUpdateUser)
        {
            string resultmsg = string.Empty;

            objencrypt    = new DataEncryptDecrypt();
            objpwdencrypt = new PasswordEncryptDecrypt();
            string resultMsg  = string.Empty;
            string encryptKey = string.Empty;

            try
            {
                string resultkey = getEncryptdata(objUpdateUser.UserCode);
                string pwd       = objpwdencrypt.Encrypt(objUpdateUser.Password, resultkey); //objUpdateUser.Password;//
                using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString()))
                {
                    using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_UpateLoginUserPassword", sqlconn_obj))
                    {
                        sqlcmd_obj.CommandType = CommandType.StoredProcedure;
                        sqlcmd_obj.Parameters.AddWithValue("@UserID", objUpdateUser.UserID);
                        sqlcmd_obj.Parameters.AddWithValue("@PASSWORD", pwd);
                        sqlcmd_obj.Parameters.AddWithValue("@UpdatedBy", objUpdateUser.UserID);
                        sqlconn_obj.Open();
                        int resultcount = sqlcmd_obj.ExecuteNonQuery();
                        if (resultcount > 0)
                        {
                            resultmsg = "Success";
                        }
                        else
                        {
                            resultmsg = "Fail";
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                objExceptionlog.InsertException("WebAPI", ex.Message, "DALUserLoginVerification", "Proc: " + "OPAPP_PROC_UpateLoginUserPassword", "UpateLoginUserPassword");
                throw;
            }
            return(resultmsg);
        }
Exemple #3
0
        public string GetUserDeviceLoginStatus(UserLogin objUser)
        {
            string resultmsg = string.Empty;

            objencrypt    = new DataEncryptDecrypt();
            objpwdencrypt = new PasswordEncryptDecrypt();
            string resultMsg  = string.Empty;
            string encryptKey = string.Empty;

            try
            {
                string resultkey = getEncryptdata(objUser.UserName);
                string pwd       = objpwdencrypt.Encrypt(objUser.Password, resultkey);
                using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString()))
                {
                    using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_GetUserDeviceLoginStatus", sqlconn_obj))
                    {
                        sqlcmd_obj.CommandType = CommandType.StoredProcedure;
                        sqlcmd_obj.Parameters.AddWithValue("@UserName", objUser.UserName);
                        sqlcmd_obj.Parameters.AddWithValue("@Password", pwd);
                        sqlcmd_obj.Parameters.AddWithValue("@LoginDeviceID", objUser.LoginDeviceID);
                        sqlconn_obj.Open();
                        SqlDataAdapter sqldap   = new SqlDataAdapter(sqlcmd_obj);
                        DataTable      resultdt = new DataTable();
                        sqldap.Fill(resultdt);
                        if (resultdt.Rows.Count > 0)
                        {
                            resultmsg = "Please check user already logged in another device";
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                objExceptionlog.InsertException("WebAPI", ex.Message, "DALUserLoginVerification", "Proc: " + "OPAPP_PROC_GetUserDeviceLoginStatus", "GetUserDeviceLoginStatus");
                throw;
            }
            return(resultmsg);
        }
Exemple #4
0
        public User GetLoginUserDetails(UserLogin objUser)
        {
            User objOutPutuser = new User();

            objencrypt    = new DataEncryptDecrypt();
            objpwdencrypt = new PasswordEncryptDecrypt();
            string resultMsg  = string.Empty;
            string encryptKey = string.Empty;

            try
            {
                string resultkey = getEncryptdata(objUser.UserName);
                string pwd       = objpwdencrypt.Encrypt(objUser.Password, resultkey);
                using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString()))
                {
                    using (SqlCommand sqlcmd_obj = new SqlCommand("OPAPP_PROC_LoginVerification", sqlconn_obj))
                    {
                        sqlcmd_obj.CommandType = CommandType.StoredProcedure;
                        sqlcmd_obj.Parameters.AddWithValue("@USERNAME", objUser.UserName);
                        sqlcmd_obj.Parameters.AddWithValue("@PASSWORD", pwd);
                        sqlcmd_obj.Parameters.AddWithValue("@Lattitude", objUser.Latitude);
                        sqlcmd_obj.Parameters.AddWithValue("@Longitude", objUser.Longitude);
                        sqlconn_obj.Open();
                        SqlDataAdapter sqldap   = new SqlDataAdapter(sqlcmd_obj);
                        DataTable      resultdt = new DataTable();
                        sqldap.Fill(resultdt);
                        if (resultdt.Rows.Count > 0)
                        {
                            objOutPutuser.UserName = Convert.ToString(resultdt.Rows[0]["USERNAME"]);
                            objOutPutuser.UserCode = Convert.ToString(resultdt.Rows[0]["UserCode"]);
                            objOutPutuser.UserID   = resultdt.Rows[0]["UserID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["UserID"]);
                            objOutPutuser.UserTypeID.UserTypeID = resultdt.Rows[0]["UserTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["UserTypeID"]);
                            objOutPutuser.LocationParkingLotID.LocationParkingLotID    = resultdt.Rows[0]["LocationParkingLotID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["LocationParkingLotID"]);
                            objOutPutuser.LocationParkingLotID.LocationParkingLotName  = Convert.ToString(resultdt.Rows[0]["LocationParkingLotName"]);
                            objOutPutuser.LocationParkingLotID.LocationParkingLotCode  = Convert.ToString(resultdt.Rows[0]["LocationParkingLotCode"]);
                            objOutPutuser.LocationParkingLotID.LocationID.LocationID   = resultdt.Rows[0]["LocationID"] == DBNull.Value ? 0 : Convert.ToInt32(resultdt.Rows[0]["LocationID"]);
                            objOutPutuser.LocationParkingLotID.LocationID.LocationName = Convert.ToString(resultdt.Rows[0]["LocationName"]);
                            objOutPutuser.UserTypeID.UserTypeName        = Convert.ToString(resultdt.Rows[0]["UserTypeName"]);
                            objOutPutuser.LocationParkingLotID.Lattitude = Convert.ToDecimal(objUser.Latitude);
                            objOutPutuser.LocationParkingLotID.Longitude = Convert.ToDecimal(objUser.Longitude);
                            objOutPutuser.PhoneNumber   = Convert.ToString(resultdt.Rows[0]["PhoneNumber"]);
                            objOutPutuser.LoginTime     = DateTime.Now;
                            objOutPutuser.LoginDeviceID = objUser.LoginDeviceID;
                            objOutPutuser.Photo         = resultdt.Rows[0]["Photo"] == DBNull.Value ? null : (byte[])resultdt.Rows[0]["Photo"];
                            List <LocationParkingLot> lstLocationParkingLots = GetLoginUserAllocatedLocationLots(objOutPutuser);
                            if (lstLocationParkingLots.Count > 0)
                            {
                                LocationParkingLot userlot = lstLocationParkingLots[0];
                                objOutPutuser.LocationParkingLotID.LotCloseTime = userlot.LotCloseTime;
                                objOutPutuser.LocationParkingLotID.LotOpenTime  = userlot.LotOpenTime;
                                if (resultdt.Rows[0]["LocationParkingLotID"] == DBNull.Value)
                                {
                                    objOutPutuser.LocationParkingLotID.LocationParkingLotID    = userlot.LocationParkingLotID;
                                    objOutPutuser.LocationParkingLotID.LocationParkingLotName  = userlot.LocationParkingLotName;
                                    objOutPutuser.LocationParkingLotID.LocationID.LocationID   = userlot.LocationID.LocationID;
                                    objOutPutuser.LocationParkingLotID.LocationID.LocationName = userlot.LocationID.LocationName;
                                }
                                DALLocationLot dalLocation    = new DALLocationLot();
                                var            lotavilability = dalLocation.GetLocationLotVehicleAvailabilityDetails(userlot.LocationID.LocationID, userlot.LocationParkingLotID);
                                objOutPutuser.LocationParkingLotID.LotVehicleAvailabilityName = lotavilability.LotVehicleAvailabilityName;
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                objExceptionlog.InsertException("WebAPI", ex.Message, "DALUserLoginVerification", "Proc: " + "OPAPP_PROC_LoginVerification", "GetLoginUserDetails");
                throw;
            }
            return(objOutPutuser);
        }