示例#1
0
        public ResponseOut ChangeStatusByUser(int post_id, int status, string message)
        {
            ResponseOut responseOut = new ResponseOut();

            using (PortalEntities _context = new PortalEntities())
            {
                try
                {
                    var data = _context.portal_post_requirement.Where(x => x.pk_requirement_id == post_id).FirstOrDefault();
                    data.approved_status = status;
                    data.client_reason   = message;
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.RequirementPost;
                    }
                }

                catch (Exception ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
                return(responseOut);
            }
        }
示例#2
0
 public ResponseOut UpdateUserProfile(UserViewModel model, int user_id)
 {
     using (PortalEntities _context = new PortalEntities())
     {
         ResponseOut responseOut = new ResponseOut();
         try
         {
             portal_user _user = _context.portal_user.Find(user_id);
             _user.firstname     = model.firstname;
             _user.lastname      = model.lastname;
             _user.updated_date  = DateTime.Now;
             _user.email         = model.email;
             _user.contact       = model.contact;
             _user.fk_country_id = model.fk_country_id;
             _user.fk_city_id    = model.fk_city_id;
             _user.fk_state_id   = model.fk_state_id;
             _user.profile_pic   = model.profile_pic;
             _user.about_us      = model.about_us;
             _user.is_active     = model.is_active;
             _user.is_paid_user  = model.is_paid_user;
             int return_code = _context.SaveChanges();
             if (return_code == 1)
             {
                 responseOut.status  = ActionStatus.Success;
                 responseOut.message = ActionMessage.ProfileUpdatedSuccess;
             }
         }
         catch (Exception ex)
         {
             responseOut.status  = ActionStatus.Fail;
             responseOut.message = ActionMessage.ApplicationException;
         }
         return(responseOut);
     }
 }
示例#3
0
        public async Task <IResponseOut <TranslationResponse> > QueryAsync(TranslationRequest request)
        {
            var cachedLanguageCodes = await this._memoryCache.GetOrInsertCachedItemAsync(
                AppConstants.MemoryCacheTranslationLanguageCodeKey,
                () => this._translationQuery.GetLanguageCodesAsync());

            if (!cachedLanguageCodes.Result.Contains(request.LangCode))
            {
                return(ResponseOut <TranslationResponse> .GenerateFault(new ErrorOut( HttpStatusCode.NotFound,
                                                                                      "Language code does not exist on system",
                                                                                      ResponseErrorType.Application,
                                                                                      nameof(request.LangCode),
                                                                                      AppConstants.InvalidLanguageErrCode )));
            }

            var translationCacheKey      = string.Format(AppConstants.MemoryCacheTranslationItemKey, request.LangCode);
            var errorTranslationCacheKey = string.Format(AppConstants.MemoryCacheErrorTranslationKey, request.LangCode);

            var cachedTranslatedText = await this._memoryCache.GetOrInsertCachedItemAsync(
                translationCacheKey,
                AppConstants.MemoryCacheTranslationSettingsKey,
                () => this._translationQuery.GetTranslationDataAsync(request.LangCode));

            var cachedErrorTranslations = await this._memoryCache.GetOrInsertCachedItemAsync(
                errorTranslationCacheKey,
                AppConstants.MemoryCacheTranslationSettingsKey,
                () => this._translationQuery.GetErrorTranslations(request.LangCode));

            return(ResponseOut <TranslationResponse> .GenerateResult(new TranslationResponse
            {
                Translation = cachedTranslatedText.Result,
                LanguageCodes = request.GetKeys ? cachedLanguageCodes.Result : null,
                ErrorTranslation = cachedErrorTranslations.Result
            }));
        }
示例#4
0
        public ResponseOut ContactUsEmail(EmailContactUsViewModel data)
        {
            ResponseOut responseOut = new ResponseOut();
            string      mailBody    = null;

            mailBody += "Hi Neel,  <br/><br/>";
            mailBody += "you got a new enquiry from website. Details of enquiry is as followed:";
            mailBody += "<br />";
            mailBody += "Name: " + data.name;
            mailBody += "<br/>";
            mailBody += "Contact: " + data.contact_no;
            mailBody += "<br />";
            mailBody += "Email: " + data.email;
            mailBody += "<br />";
            mailBody += "Description: " + data.message;
            mailBody += "<br/><br/>";

            bool status = Utilities.SendEmail(server_email, "*****@*****.**", "Enquiry from Website!", mailBody, 587, true, "smtp.gmail.com", "Welcome@1234", null, null);

            if (status)
            {
                responseOut.status = ActionStatus.Success;
                return(responseOut);
            }
            responseOut.status = ActionStatus.Fail;
            return(responseOut);
        }
示例#5
0
        public ActionResult PostYourRequirement(PostYourRequirement candidateViewModel)
        {
            ResponseOut responseOut = new ResponseOut();

            ICandidateBL candidateBL = new CandidateEngine();

            try
            {
                if (candidateViewModel != null)
                {
                    int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);

                    responseOut = candidateBL.PostRequirement(candidateViewModel, user_id);
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in Home Controller/PostYourRequirement", ex);

                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#6
0
        public ActionResult UpdatePassword(PasswordResetViewModel passwordViewModel)
        {
            ResponseOut responseOut = new ResponseOut();

            IUserBL userBL = new UserEngine();

            try
            {
                if (passwordViewModel != null)
                {
                    int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                    responseOut = userBL.ResetUserPassword(passwordViewModel, user_id);
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#7
0
        public ActionResult AddUserProfile(UserViewModel userViewModel)
        {
            ResponseOut responseOut = new ResponseOut();

            IUserBL userBL = new UserEngine();

            try
            {
                if (userViewModel != null)
                {
                    responseOut = userBL.AddUserProfile(userViewModel);
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#8
0
        public ActionResult RegisterUser(RegisterUserViewModel userViewModel)
        {
            ResponseOut responseOut = new ResponseOut();

            IUserBL  userBL  = new UserEngine();
            IEmailBL emailBL = new EmailEngine();

            try
            {
                if (userViewModel != null)
                {
                    responseOut = userBL.RegisterUser(userViewModel);
                    string body   = this.createEmailBody(responseOut.hash);
                    bool   status = Utilities.SendEmail("", responseOut.email, "Codelate | Verify your Email!", body, 587, true, "smtp.gmail.com", "", null, null);
                    if (status)
                    {
                    }
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#9
0
        public ActionResult AddEditRecruiterProfile(RecruiterViewModel recruiterViewModel)
        {
            ResponseOut responseOut = new ResponseOut();

            IRecruiterBL recruiterBL = new RecruiterEngine();

            try
            {
                if (recruiterViewModel != null)
                {
                    int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                    responseOut = recruiterBL.AddUpdateRecruiter(recruiterViewModel, user_id);
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#10
0
        public ResponseOut UpdatePlans(PlansViewModel model)
        {
            ResponseOut responseOut = new ResponseOut();

            try
            {
                using (PortalEntities _context = new PortalEntities())
                {
                    portal_plan plan = _context.portal_plan.Where(x => x.pk_plan_type_id == model.pk_plan_id).FirstOrDefault();
                    plan.is_active  = model.is_active;
                    plan.is_deleted = false;
                    plan.plan_name  = model.plan_name;
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.PlansCreatedSuccess;
                    }
                }
            }
            catch (Exception ex)
            {
                responseOut.status  = ActionStatus.Fail;
                responseOut.message = ActionMessage.ApplicationException;
            }

            return(responseOut);
        }
示例#11
0
        public ResponseOut UpdatePlanByPlanIDByAdmin(int planId)
        {
            ResponseOut responseOut = new ResponseOut();

            using (PortalEntities _context = new PortalEntities())
            {
                try
                {
                    portal_userplan_mapping portal_Userplan = null;
                    portal_Userplan = _context.portal_userplan_mapping.Where(x => x.userplan_id == planId).FirstOrDefault();
                    if (portal_Userplan != null)
                    {
                        portal_Userplan.is_active = true;
                    }
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.PlansSelectedSuccess;
                    }
                }
                catch (EntityException ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
                catch (Exception ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
            }
            return(responseOut);
        }
示例#12
0
        public ActionResult UpdateUserProfile(UserViewModel userViewModel)
        {
            ResponseOut responseOut = new ResponseOut();

            IUserBL userBL = new UserEngine();

            try
            {
                if (userViewModel != null)
                {
                    int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                    if (userViewModel.pk_user_id != 0)
                    {
                        user_id = userViewModel.pk_user_id;
                    }
                    responseOut = userBL.UpdateUserProfile(userViewModel, user_id);
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in UserController/UpdateUserProfile", ex);
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#13
0
        public ResponseOut AddPlans(PlansViewModel model)
        {
            ResponseOut responseOut = new ResponseOut();

            try
            {
                using (PortalEntities _context = new PortalEntities())
                {
                    portal_plan plan = new portal_plan();
                    plan.is_active  = model.is_active;
                    plan.is_deleted = false;
                    plan.plan_name  = model.plan_name;
                    _context.portal_plan.Add(plan);
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.PlansCreatedSuccess;
                    }
                }
            }
            catch (Exception ex)
            {
                responseOut.status  = ActionStatus.Fail;
                responseOut.message = ActionMessage.ApplicationException;
            }

            return(responseOut);
        }
示例#14
0
        public JsonResult AddUpdatePlanSelectedByVendor(string plan_id)
        {
            int         id          = Convert.ToInt32(plan_id);
            ResponseOut responseOut = new ResponseOut();
            IPlansBL    planBL      = new PlansEngine();

            try
            {
                if (id != 0)
                {
                    int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                    responseOut = planBL.AddUpdateSelectPlanByVendor(id, user_id);
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in VendorController/AddUpdatePlanSelectedByVendor", ex);
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#15
0
        public ActionResult SubmitRequirementStatus(SubmitYourRequirement statusViewModel)
        {
            ResponseOut responseOut = new ResponseOut();

            IAdminBL adminBL = new AdminEngine();

            try
            {
                if (statusViewModel != null)
                {
                    int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                    responseOut = adminBL.SubmitPostStatus(statusViewModel);
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in AdminController/SubmitRequirementStatus", ex);
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#16
0
        public ActionResult WhatClientSays(WhatClientSays feedback)
        {
            ResponseOut responseOut = new ResponseOut();

            IAdminBL adminBL = new AdminEngine();

            try
            {
                if (feedback != null)
                {
                    int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                    responseOut = adminBL.SubmitClientFeedback(feedback);
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in AdminController/WhatClientSays", ex);
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#17
0
        public ActionResult Login(LoginViewModel userViewModel)
        {
            ResponseOut responseOut = new ResponseOut();

            IUserBL userBL = new UserEngine();

            try
            {
                if (userViewModel != null)
                {
                    responseOut = userBL.Authentication(userViewModel.user_name, userViewModel.password);
                    if (responseOut.status == "SUCCESS")
                    {
                        //int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserRoleID]);
                        //return RedirectToAction("Index", "Home");
                        responseOut.message = ActionMessage.SuccessLogin;
                        responseOut.status  = ActionStatus.Success;
                    }
                    //return View("Index");
                }
                else
                {
                    responseOut.message = ActionMessage.ProbleminData;
                    responseOut.status  = ActionStatus.Fail;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in Home Controller/Login", ex);
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#18
0
        public async Task <IResponseOut <HomePageOutput> > QueryAsync(HomePageInput request)
        {
            var cachedLanguageCodes = await this._memoryCache.GetOrInsertCachedItemAsync(
                AppConstants.MemoryCacheTranslationLanguageCodeKey,
                () => this._translationQuery.GetLanguageCodesAsync());

            if (!cachedLanguageCodes.Result.Contains(request.LangCode))
            {
                return(ResponseOut <HomePageOutput> .GenerateFault(new ErrorOut( HttpStatusCode.NotFound,
                                                                                 "Language code does not exist on system",
                                                                                 ResponseErrorType.Application,
                                                                                 nameof(request.LangCode),
                                                                                 AppConstants.InvalidLanguageErrCode )));
            }

            var key          = string.Format(AppConstants.MemoryCacheHomePageItemKey, request.LangCode);
            var cachedhomeDB = await this._memoryCache.GetOrInsertCachedItemAsync(
                key,
                AppConstants.MemoryCacheTranslationSettingsKey,
                () => this._homePageQuery.GetHomePageDataAsync(request.LangCode));

            if (cachedhomeDB.Result == null)
            {
                return(ResponseOut <HomePageOutput> .GenerateFault(new ErrorOut( HttpStatusCode.NotFound, "Could not retrieve requested homepage", ResponseErrorType.Database )));
            }

            return(ResponseOut <HomePageOutput> .GenerateResult(new HomePageOutput
            {
                Title = cachedhomeDB.Result.Title,
                Subtitle = cachedhomeDB.Result.SubTitle,
                Descrption = cachedhomeDB.Result.Description
            }));
        }
示例#19
0
        public ResponseOut PostRequirement(PostYourRequirement model, int id)
        {
            ResponseOut responseOut = new ResponseOut();

            using (PortalEntities _context = new PortalEntities())
            {
                try
                {
                    portal_post_requirement requirement = new portal_post_requirement();
                    if (id != 0)
                    {
                        var data = _context.portal_user.Where(x => x.pk_user_id == id).FirstOrDefault();
                        model.email_id           = data.email;
                        model.fullname           = data.firstname + " " + data.lastname;
                        model.mobile_no          = data.contact;
                        requirement.fk_client_id = id;
                    }

                    requirement.email_id          = model.email_id;
                    requirement.fullname          = model.fullname;
                    requirement.mobile_no         = model.mobile_no;
                    requirement.requirement_title = model.requirement_title;
                    requirement.subject           = model.subject;
                    requirement.message           = model.message;
                    requirement.added_date        = DateTime.Now;
                    requirement.project_type      = model.project_type;
                    _context.portal_post_requirement.Add(requirement);
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.RequirementPost;
                    }
                }
                catch (System.Data.Entity.Validation.DbEntityValidationException e)
                {
                    var outputLines = new List <string>();
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        outputLines.Add(string.Format(
                                            "{0}: Entity of type \"{1}\" in state \"{2}\" has the following validation errors:",
                                            DateTime.Now, eve.Entry.Entity.GetType().Name, eve.Entry.State));
                        foreach (var ve in eve.ValidationErrors)
                        {
                            outputLines.Add(string.Format(
                                                "- Property: \"{0}\", Error: \"{1}\"",
                                                ve.PropertyName, ve.ErrorMessage));
                        }
                    }
                    System.IO.File.AppendAllLines(@"c:\temp\errors.txt", outputLines);
                }
                catch (Exception ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
                return(responseOut);
            }
        }
示例#20
0
        public ResponseOut RegisterUser(RegisterUserViewModel user)
        {
            using (PortalEntities _context = new PortalEntities())
            {
                ResponseOut responseOut = new ResponseOut();
                try
                {
                    var check_user_name = _context.portal_user.Where(x => x.user_name.ToLower() == user.username.ToLower()).Any();
                    var check_email     = _context.portal_user.AsEnumerable().Where(x => (user.email != null && user.email != "" && x.email != null) && x.email.ToLower() == user.email.ToLower()).Any();
                    var hash            = Guid.NewGuid().ToString();

                    if (check_user_name)
                    {
                        responseOut.status  = ActionStatus.Fail;
                        responseOut.message = ActionMessage.UsernameAlreadyExist;
                        return(responseOut);
                    }

                    if (check_email)
                    {
                        responseOut.status  = ActionStatus.Fail;
                        responseOut.message = ActionMessage.EmailAlreadyExist;
                        return(responseOut);
                    }

                    portal_user _user = new portal_user();
                    _user.firstname    = user.fullname;
                    _user.created_date = DateTime.Now;
                    _user.email        = user.email;
                    _user.contact      = user.contact;
                    _user.password     = Utilities.MD5Hash(user.password);
                    _user.user_name    = user.username;
                    _user.is_active    = true;
                    _user.user_hash    = hash;
                    _context.portal_user.Add(_user);
                    int return_code = _context.SaveChanges();
                    if (return_code == 1)
                    {
                        portal_user_role_mapping _role_map = new portal_user_role_mapping();
                        _role_map.fk_role_id = user.user_type;
                        _role_map.fk_user_id = _user.pk_user_id;
                        _context.portal_user_role_mapping.Add(_role_map);
                        _context.SaveChanges();
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.ProfileCreatedSuccess;
                    }
                    responseOut.trnId = _user.pk_user_id;
                    responseOut.hash  = _user.user_hash;
                    responseOut.email = _user.email;
                }
                catch (Exception ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
                return(responseOut);
            }
        }
示例#21
0
        public ResponseOut AddUpdateCandidateProfile(CandidateProfile model)
        {
            ResponseOut responseOut = new ResponseOut();

            using (PortalEntities _context = new PortalEntities())
            {
                try
                {
                    portal_user_candidate_info candidate_Info = new portal_user_candidate_info();
                    var is_Candidate_exist = _context.portal_user_candidate_info.Where(x => x.fk_user_id == model.fk_user_id).Any();
                    if (is_Candidate_exist)
                    {
                        candidate_Info = _context.portal_user_candidate_info.Where(x => x.fk_user_id == model.fk_user_id).FirstOrDefault();
                    }
                    portal_user portal_User = _context.portal_user.Where(x => x.pk_user_id == model.fk_user_id).FirstOrDefault();
                    candidate_Info.availability      = model.availability;
                    candidate_Info.fk_user_id        = model.fk_user_id;
                    candidate_Info.resume            = model.resume;
                    candidate_Info.technologies      = model.selected_technologies_name;
                    candidate_Info.preferred_city    = model.city_listing;
                    candidate_Info.preferred_country = model.country_listing;
                    candidate_Info.preferred_state   = model.state_listing;
                    candidate_Info.head_line         = model.head_line;
                    if (!is_Candidate_exist)
                    {
                        _context.portal_user_candidate_info.Add(candidate_Info);
                    }

                    portal_User.fk_country_id = model.candidate_fk_country_id;
                    portal_User.fk_state_id   = model.candidate_fk_state_id;
                    portal_User.fk_city_id    = model.candidate_fk_city_id;
                    portal_User.profile_pic   = model.profile_pic;
                    portal_User.firstname     = model.first_name;
                    portal_User.lastname      = model.last_name;
                    portal_User.email         = model.email;
                    portal_User.contact       = model.contact;
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.RequirementPost;
                    }
                }
                catch (EntityException ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
                catch (Exception ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
            }

            return(responseOut);
        }
示例#22
0
 public ResponseOut Authentication(string user_name, string password)
 {
     using (PortalEntities _context = new PortalEntities())
     {
         ResponseOut responseOut = new ResponseOut();
         try
         {
             var data = _context.portal_user.AsEnumerable().Where(x => x.user_name == user_name && x.password == Utilities.MD5Hash(password)).Select(x => new
             {
                 x.pk_user_id,
                 x.portal_user_role_mapping.FirstOrDefault().fk_role_id,
                 full_name = x.firstname + " " + x.lastname,
                 x.user_name,
                 x.is_paid_user,
                 x.is_active,
                 x.is_email_verified
             }).FirstOrDefault();
             if (data != null)
             {
                 if (data.is_email_verified)
                 {
                     if (data.is_active)
                     {
                         AppSession.SetSessionValue(SessionKey.CurrentUserID, data.pk_user_id);
                         AppSession.SetSessionValue(SessionKey.CurrentUserName, data.full_name);
                         AppSession.SetSessionValue(SessionKey.CurrentUserRoleID, data.fk_role_id);
                         AppSession.SetSessionValue(SessionKey.CurrentUserPremium, data.is_paid_user);
                         responseOut.message = ActionMessage.SuccessLogin;
                         responseOut.status  = ActionStatus.Success;
                     }
                     else
                     {
                         responseOut.message = ActionMessage.InActiveLogin;
                         responseOut.status  = ActionStatus.Fail;
                     }
                 }
                 else
                 {
                     responseOut.message = ActionMessage.EmailNotVerified;
                     responseOut.status  = ActionStatus.Fail;
                 }
             }
             else
             {
                 responseOut.message = ActionMessage.FailedLogin;
                 responseOut.status  = ActionStatus.Fail;
             }
         }
         catch (Exception ex)
         {
             responseOut.status  = ActionStatus.Fail;
             responseOut.message = ActionMessage.ApplicationException;
         }
         return(responseOut);
     }
 }
示例#23
0
        public ResponseOut SubmitClientFeedback(WhatClientSays status)
        {
            using (PortalEntities _context = new PortalEntities())
            {
                ResponseOut responseOut = new ResponseOut();
                try
                {
                    if (status.id == 0)
                    {
                        portal_what_client_says _client = new portal_what_client_says();
                        _client.title                 = status.title;
                        _client.client_name           = status.client_name;
                        _client.discription           = status.description;
                        _client.added_datetime        = DateTime.Now;
                        _client.is_published_by_admin = status.is_published;
                        _client.image                 = status.client_image;
                        _context.portal_what_client_says.Add(_client);
                        int result = _context.SaveChanges();
                        if (result > 0)
                        {
                            responseOut.status  = ActionStatus.Success;
                            responseOut.message = ActionMessage.FeedbackCreated;
                        }
                    }
                    else
                    {
                        portal_what_client_says _client = _context.portal_what_client_says.Where(x => x.pk_client_what_says_id == status.id).FirstOrDefault();
                        _client.title                 = status.title;
                        _client.client_name           = status.client_name;
                        _client.discription           = status.description;
                        _client.added_datetime        = DateTime.Now;
                        _client.is_published_by_admin = status.is_published;
                        _client.image                 = status.client_image;
                        int result = _context.SaveChanges();
                        if (result > 0)
                        {
                            responseOut.status  = ActionStatus.Success;
                            responseOut.message = ActionMessage.FeedbackUpdated;
                        }
                    }
                }
                catch (Exception ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }

                return(responseOut);
            }
        }
示例#24
0
        public ResponseOut SubmitPostStatus(SubmitYourRequirement status)
        {
            using (PortalEntities _context = new PortalEntities())
            {
                ResponseOut responseOut = new ResponseOut();
                try
                {
                    if (status.status == 1)
                    {
                        foreach (var val in status.vendor_ids)
                        {
                            portal_requirement_vendor_mapping vendor = new portal_requirement_vendor_mapping();
                            vendor.fk_post_id   = status.post_id;
                            vendor.fk_vendor_id = val;
                            vendor.map_date     = DateTime.Now;
                            _context.portal_requirement_vendor_mapping.Add(vendor);
                            _context.SaveChanges();
                        }
                        var data = _context.portal_post_requirement.Where(x => x.pk_requirement_id == status.post_id).FirstOrDefault();
                        data.approved_status = status.status;
                        data.status_reason   = status.reason_status;
                        int result = _context.SaveChanges();
                        if (result > 0)
                        {
                            responseOut.message = ActionMessage.RequirementApprovedStatus;
                            responseOut.status  = ActionStatus.Success;
                        }
                    }
                    else
                    {
                        var data = _context.portal_post_requirement.Where(x => x.pk_requirement_id == status.post_id).FirstOrDefault();
                        data.approved_status = status.status;
                        data.status_reason   = status.reason_status;
                        int result = _context.SaveChanges();
                        if (result > 0)
                        {
                            responseOut.message = ActionMessage.RequirementRejectedStatus;
                            responseOut.status  = ActionStatus.Success;
                        }
                    }
                }
                catch (Exception ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }

                return(responseOut);
            }
        }
示例#25
0
        public JsonResult ContactUs(EmailContactUsViewModel data)
        {
            ResponseOut responseOut = new ResponseOut();
            IEmailBL    emailBL     = new EmailEngine();

            try
            {
                //int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                responseOut = emailBL.ContactUsEmail(data);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#26
0
        public JsonResult SaveInterestedToCandidate(InterestedToCandidateViewModel model)
        {
            ResponseOut  responseOut = new ResponseOut();
            IRecruiterBL recruiterBL = new RecruiterEngine();

            try
            {
                int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                responseOut = recruiterBL.SaveInterestedCandidate(model, user_id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#27
0
        public ResponseOut PostRequirementUpload(PostRequirementImportViewModel data)
        {
            ResponseOut responseOut = new ResponseOut();

            using (PortalEntities _context = new PortalEntities())
            {
                try
                {
                    portal_post_requirement _requirement = new portal_post_requirement();
                    int user_id = 0;
                    if (user_id == 0)
                    {
                        user_id = _context.portal_user.Where(x => !string.IsNullOrEmpty(data.email_id) && x.email.ToLower() == data.email_id.ToLower()).Select(x => x.pk_user_id).FirstOrDefault();
                    }
                    if (user_id == 0)
                    {
                        user_id = _context.portal_user.Where(x => !string.IsNullOrEmpty(data.contact_details) && x.contact == data.contact_details).Select(x => x.pk_user_id).FirstOrDefault();
                    }
                    _requirement.mobile_no       = data.contact_details;
                    _requirement.email_id        = data.email_id;
                    _requirement.fullname        = data.client_name;
                    _requirement.added_date      = DateTime.Now;
                    _requirement.approved_status = 0;
                    if (user_id != 0)
                    {
                        _requirement.fk_client_id = user_id;
                    }
                    _requirement.subject = data.requirement_title;
                    _requirement.message = data.requirement_description;

                    _context.portal_post_requirement.Add(_requirement);
                    int result = _context.SaveChanges();
                    if (result > 0)
                    {
                        responseOut.status  = ActionStatus.Success;
                        responseOut.message = ActionMessage.RequirementPost;
                    }
                }
                catch (Exception ex)
                {
                    responseOut.status  = ActionStatus.Fail;
                    responseOut.message = ActionMessage.ApplicationException;
                }
                return(responseOut);
            }
        }
示例#28
0
        public ActionResult VerifyStatus(string hash)
        {
            ResponseOut responseOut = new ResponseOut();
            IUserBL     userBL      = new UserEngine();

            try
            {
                //int user_id = Convert.ToInt32(HttpContext.Session[SessionKey.CurrentUserID]);
                responseOut    = userBL.VerifyUserEmail(hash);
                ViewBag.Status = responseOut.message;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(View());
        }
        public ActionResult AddUpdateCandidateProfile(CandidateProfile data)
        {
            ICandidateBL candidateBL = new CandidateEngine();
            ResponseOut  responseOut = new ResponseOut();

            try
            {
                responseOut = candidateBL.AddUpdateCandidateProfile(data);
            }
            catch (Exception ex)
            {
                Log.Error("Error in CandidateController/AddUpdateCandidateProfile", ex);
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }
示例#30
0
        public ActionResult ChangeRequirementStatus(int post_id, int status, string message)
        {
            ResponseOut responseOut = new ResponseOut();

            IRequirementBL requirementBL = new RequirementEngine();

            try
            {
                responseOut = requirementBL.ChangeStatusByUser(post_id, status, message);
            }
            catch (Exception ex)
            {
                responseOut.message = ActionMessage.ApplicationException;
                responseOut.status  = ActionStatus.Fail;
            }
            return(Json(responseOut, JsonRequestBehavior.AllowGet));
        }