コード例 #1
0
        public Response<RespLogin> Login(UserModel objUserModel)
        {
            List<RespLogin> objResp = new List<RespLogin>();
            Response<RespLogin> response = new Response<RespLogin>();
            try
            {
                objDBMethod = new DBMethod();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    objResp.Add(objDBMethod.Login(objUserModel));
                    switch (objResp[0].restKey)
                    {

                        case "0":
                            response.Create(false, Messages.WebError, Messages.AppVersion, objResp);
                            break;
                        case "1":
                            response.Create(true, Messages.FormatMessage(Messages.Success, "Logged in "), Messages.AppVersion, objResp);
                            break;
                        case "2":
                            response.Create(false, Messages.NotAllowedUser, Messages.AppVersion, objResp);
                            break;
                        case "3":
                            response.Create(false, Messages.InvalidPassword, Messages.AppVersion, objResp);
                            break;
                        case "4":
                            response.Create(false, Messages.EmailVerify, Messages.AppVersion, objResp);
                            break;
                        case "5":
                            response.Create(true, Messages.AccountCreated, Messages.AppVersion, objResp);
                            break;
                        case "6":
                            response.Create(false, "Sorry!!! we were unable to fetch your email please change your Facebook settings for email.", Messages.AppVersion, objResp);
                            break;
                        default:
                            response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);
                            break;
                    }
                }
                else
                {
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                }

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objUserModel);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            finally
            {
            }
            return response;
        }
コード例 #2
0
        /// <summary>
        /// Link for reset password
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult ResetPassword(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {

                DBMethod objDBMethod = new DBMethod();
                //id = objDBMethod.ReplacedSpecialCharacter(id, "");
                ViewBag.id = id;
                ViewBag.userName = objDBMethod.CheckReset(id);
                //ViewBag.isPasswordChanged = objDBMethod.CheckReset(id);
            }
            return View();

        }
コード例 #3
0
 public ActionResult VerifyEmail(string id)
 {
     if (!string.IsNullOrEmpty(id) && id != "Update")
     {
         var encrypted = id.Replace("_", "/").Replace("-", "+");
         string decrypted = Encryption.DecryptURL(encrypted);
         string[] objArray = decrypted.Split(',');
         string uid = objArray[0];
         string type = objArray[1];
         DBMethod objDBMethod = new DBMethod();
         var result = objDBMethod.VerifyEmail(Convert.ToInt64(uid), type);
         ViewBag.Result = result.ToString().ToLower();
     }
     if (id == "Update")
     {
         ViewBag.expire = "Update";
     }
     return View();
 }
コード例 #4
0
        public Response<string> ForgetPassword(ReqEmail objReq)
        {
            List<string> objResp = new List<string>();
            Response<string> response = new Response<string>();
            try
            {
                objDBMethod = new DBMethod();
                if (CheckRequestIsvalidornot(this.Request))
                {
                    switch (objDBMethod.ForgetPassword(objReq))
                    {
                        case 1:
                            response.Create(true, Messages.MailSent, Messages.AppVersion, objResp);
                            break;
                        case 0:
                            response.Create(false, Messages.NoEmailExist, Messages.AppVersion, objResp);
                            break;
                        default:
                            break;
                    }

                }
            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);

            }

            return response;
        }
コード例 #5
0
        public Response<string> UpdateBadgeCounter(ReqBadgeCounter objReq)
        {

            Response<string> response = new Response<string>();
            List<string> objResp = new List<string>();
            if (objReq != null)
            {
                try
                {
                    bool var = CheckRequestIsvalidornot(this.Request);
                    if (var == false)
                    {
                        response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);
                    }
                    else
                    {
                        objDBMethod = new DBMethod();
                        string rst = objDBMethod.UpdateBadgeCounter(objReq);
                        if (rst == "1")
                        {
                            response.Create(true, Messages.FormatMessage(Messages.Success, ""), Messages.AppVersion, objResp);
                        }
                        else
                        {
                            response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);
                        }
                    }


                }
                catch (Exception ex)
                {

                    response.Create(false, Messages.FormatMessage(Messages.ErrorOccure, ""), Messages.AppVersion, objResp);
                }

            }
            else
            {
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure, ""), Messages.AppVersion, objResp);
            }


            return response;
        }
コード例 #6
0
        public Response<RespLogin> GetProfile(Entity objReq)
        {
            List<RespLogin> objResp = new List<RespLogin>();
            Response<RespLogin> response = new Response<RespLogin>();
            try
            {
                objDBMethod = new DBMethod();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    objResp.Add(objDBMethod.GetUser(objReq));
                    response.Create(true, "User Data", Messages.AppVersion, objResp);

                }
                else
                {
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                }

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            return response;
        }
コード例 #7
0
        public Response<string> UpdateUser()
        {
            UserModel objReq = new UserModel();
            Response<string> response = new Response<string>();
            List<string> objResp = new List<string>();

            string resp = "";

            try
            {
                objDBMethod = new DBMethod();

                if (CheckRequestIsvalidornot(this.Request))
                {
                    // //HttpContextWrapper objwrapper = GetHttpContext(this.Request);
                    //   HttpFileCollectionBase collection = objwrapper.Request.Files;

                    // string jsonvalue = objwrapper.Request.Form["json"];
                    HttpContextWrapper objwrapper = GetHttpContext(this.Request);
                    HttpFileCollectionBase collection = objwrapper.Request.Files;

                    //var s = HttpContext.Current.Request;
                    //string jsonVlaue = s.Form["json"];
                    //HttpFileCollectionBase o = s.Files;


                    string jsonvalue = objwrapper.Request.Form["json"];
                    if (!string.IsNullOrEmpty(jsonvalue))
                    {
                        objReq = JsonConvert.DeserializeObject<UserModel>(jsonvalue);
                        objReq.profilePic = SaveImage(collection, objReq.profilePic);

                        resp = objDBMethod.UpdateUser(objReq);
                        switch (Convert.ToInt32(resp))
                        {
                            case 0:
                                response.Create(false, "No user found", Messages.AppVersion, objResp);
                                break;
                            case 1:
                                response.Create(true, "Profile updated successfully", Messages.AppVersion, objResp);
                                break;
                            case 2:
                                response.Create(true, "You are blocked from admin", Messages.AppVersion, objResp);
                                break;

                            default:
                                break;
                        }
                    }
                    else
                    {
                        response.Create(false, Messages.InvalidReq, Messages.AppVersion, objResp);
                    }
                }
                else
                {
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                }

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error(ex.Message, ex, session, ex.Message);
                response.Create(false, "Error occured while Processing Webservice request", Messages.AppVersion, objResp);
            }
            finally
            {
            }
            return response;
        }
コード例 #8
0
 public Response<string> UpdateLatLong(ReqLatLong objReq)
 {
     Response<string> response = new Response<string>();
     List<string> objResp = new List<string>();
     try
     {
         objDBMethod = new DBMethod();
         int retValue = objDBMethod.UpdateLatLong(objReq);
         response.Create(true, "done", Messages.AppVersion, objResp);
     }
     catch (Exception ex)
     {
         object session = new JavaScriptSerializer().Serialize(objReq);
         LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
         response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
     }
     finally
     {
     }
     return response;
 }
コード例 #9
0
        public Response<string> AvailableEmail(ReqEmail objUserModel)
        {
            Response<string> response = new Response<string>();
            List<string> objResp = new List<string>();


            try
            {
                objDBMethod = new DBMethod();

                if (CheckRequestIsvalidornot(this.Request))
                {

                    if (!objDBMethod.EmailAvailable(objUserModel))
                    {
                        response.Create(true, Messages.EmailAvailable, Messages.AppVersion, objResp);
                    }
                    else
                    {
                        response.Create(false, Messages.EmailExist, Messages.AppVersion, objResp);
                    }

                }
                else
                {
                    response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);

                }

            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objUserModel);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);


            }
            finally
            {
            }
            return response;
        }
コード例 #10
0
 public int ResetPassword(ReqResetPassword objResetPassword)
 {
     objDBMethod = new DBMethod();
     int retValue = objDBMethod.ResetPassword(objResetPassword);
     return retValue;
 }