public ResponseModel AddRequestForTractorPrice(RequestForTractorPriceModel request)
        {
            IAuthentication         _authrepository = new DataAccess.Authentication.Authentication();
            IMasterTablesDataAccess _repository     = new MasterTablesDataAccess();
            int response = 0;

            response = _repository.AddRequestForQuotation(request);
            string        Status = "0";
            ResponseModel model  = new ResponseModel();

            if (response > 0)
            {
                model.Status  = response.ToString();
                model.Message = "Request For Quotation Raised Successfully.";
                UserModel user = new UserModel();
                user = _authrepository.GetUserDetails(request.UserId);
                var    lfd    = _repository.GetLookingForDetailsById(request.LookingForDetailsId).LookingForDetails;
                var    models = _repository.GetModelById(request.ModelId).Model;
                string msg    = user.FullName + " is Looking for " + lfd + " of " + models;

                Notification.SendNotification(request.UserId, WebConfigurationManager.AppSettings["LKF"], msg);
            }
            else
            {
                model.Status = "0";
            }
            return(model);
        }
Exemple #2
0
        public LoginResponseObject ValidateUser(LoginRequestObject viewmodel)
        {
            LoginResponseObject objentity    = new LoginResponseObject();
            AppResponseView     objApp       = new AppResponseView();
            LoginResponseModel  objLoginResp = new LoginResponseModel();
            IAuthentication     _repository  = new DataAccess.Authentication.Authentication();

            objLoginResp           = _repository.ValidateUser(viewmodel.UserRequest);
            objentity.ResultObject = objLoginResp;
            if (objentity.ResultObject.Status == 1)
            {
                if (objentity.ResultObject.IsOTPverified == false)
                {
                    objentity.ResultObject.Status  = 0;
                    objentity.ResultObject.Message = "OTP Not Verified";
                }
                else
                {
                    objentity.ResultObject.Status  = 1;
                    objentity.ResultObject.Message = "Success";
                    objentity.ResultObject.user    = _repository.GetUserDetails(objentity.ResultObject.UserId);
                }
                //string OTP = GenerateNewOTP();
                //objLoginResp.OTP = OTP;
                //objentity.ResultObject = objLoginResp;
                //SMSService.SendSms(viewmodel.UserRequest.UserName, ("Login OTP " + objentity.ResultObject.OTP));
            }
            else
            {
                objentity.ResultObject.Message = "Invalid Credentials";
            }
            return(objentity);
        }
Exemple #3
0
        public static FCMPushNotification SendNotification(int userId, string notificationId, string message)
        {
            IMasterTablesDataAccess _repository     = new MasterTablesDataAccess();
            IAuthentication         _authrepository = new DataAccess.Authentication.Authentication();
            UserModel user = new UserModel();

            user = _authrepository.GetUserDetails(userId);
            string              DeviceId = user.DeviceId.ToString();
            List <string>       NotificationsSubscribed = GetList(user.NotificationTypeId);
            FCMPushNotification pushNotification        = new FCMPushNotification();

            if (NotificationsSubscribed.Contains(notificationId.ToString()))
            {
                NotificationsModel response          = new NotificationsModel();
                NotificationModel  notificationModel = new NotificationModel();
                response.NotificationMasterList = _repository.GetNotificationMaster();
                var          notification    = response.NotificationMasterList.Where(x => x.NotificationID == Convert.ToInt32(notificationId)).FirstOrDefault();
                Notification objNotification = new Notification();
                if (notification.ToAll)
                {
                    pushNotification = objNotification.SendNotificationToTopic(notification.NotificationCode, notification.NotificationAction, message);
                }
                else
                {
                    pushNotification = objNotification.SendNotificationToRegisteredUser(DeviceId, notification.NotificationAction, message);
                }
                notificationModel.NotificationText = message;
                notificationModel.ToAll            = notification.ToAll;
                notificationModel.ToUserId         = userId;
                notificationModel.CreatedBy        = userId;
                _repository.AddNotification(notificationModel);
            }
            return(pushNotification);
        }
Exemple #4
0
        public objRegisterResponseModel GetUserDetails(objRegisterRequestModel request)
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            objRegisterResponseModel response    = new objRegisterResponseModel();

            response.user = _repository.GetUserDetails(request.objUser.Id);
            return(response);
        }
Exemple #5
0
        public objRegisterResponseModel VerifyOTPNewUser(objRegisterRequestModel Request)
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            int                      result      = _repository.VerifyOTPofNewUser(Request.objUser);
            objRegisterResponseModel response    = new objRegisterResponseModel();

            if (result > 0)
            {
                AppResponseView objresponse = new AppResponseView();
                objresponse.Message = "User Registered Successfully";
                response.user       = _repository.GetUserDetails(result);
                response.Response   = objresponse;
            }
            return(response);
        }
        public ResponseModel AddUpdateFarms()//FarmsModel request, HttpPostedFile farmimage, HttpPostedFile coverimage)
        {
            IAuthentication         _authrepository = new DataAccess.Authentication.Authentication();
            IMasterTablesDataAccess _repository     = new MasterTablesDataAccess();
            int        response      = 0;
            var        httpRequest   = HttpContext.Current.Request;
            FarmsModel objFarmsModel = new FarmsModel();
            FarmsModel request       = new FarmsModel();

            request = JsonConvert.DeserializeObject <FarmsModel>(httpRequest.Form["farmsdetail"]);
            HttpPostedFile farmimage = httpRequest.Files["farmimage"];

            if (farmimage != null)
            {
                AmazonS3Uploader service = new AmazonS3Uploader();
                request.FarmImages = service.UploadFile("FarmImages/" + request.MobileNumber + farmimage.FileName, new HttpPostedFileWrapper(farmimage));
            }
            HttpPostedFile coverimage = httpRequest.Files["coverimage"];

            if (coverimage != null)
            {
                AmazonS3Uploader service = new AmazonS3Uploader();
                request.CoverPhoto = service.UploadFile("FarmCoverPhotos/" + request.MobileNumber + coverimage.FileName, new HttpPostedFileWrapper(coverimage));
            }
            response = _repository.AddUpdateFarms(request);
            string        Status = "0";
            ResponseModel model  = new ResponseModel();

            if (response > 0)
            {
                model.Status  = response.ToString();
                model.Message = "Farm has been added/updated successfully.";
                UserModel user = new UserModel();
                user = _authrepository.GetUserDetails(request.CreatedBy);
                //var lfd = _repository.GetLookingForDetailsById(request.LookingForDetailsId).LookingForDetails;
                //var models = _repository.GetModelById(request.ModelId).Model;
                //string msg = user.FullName + " is Looking for " + lfd + " of " + models;

                //Notification.SendNotification(request.UserId, WebConfigurationManager.AppSettings["LKF"], msg);
            }
            else
            {
                model.Status = "0";
            }
            return(model);
        }