コード例 #1
0
        public ActionResult TaskStartWorking(Guid taskPk)
        {
            try {
                var userPk = new PrivateSession().Current.User.Pk;
                var taskStartWorkingResult = _task.TaskStartWorking(userPk, taskPk);
                if (taskStartWorkingResult.IsSuccess)
                {
                    _notifycations.AddNotification(NotifycationTypes.WorkerStartedTask.ToString(), taskPk, Guid.Parse(taskStartWorkingResult.Data.Customer.Pk), userPk);
                    HubClient.WorkerStartedTask(taskStartWorkingResult.Data.Customer.Pk, new JavaScriptSerializer().
                                                Serialize(new {
                        taskPk     = taskStartWorkingResult.Data.PublicKey,
                        title      = taskStartWorkingResult.Data.Name,
                        workerName = taskStartWorkingResult.Data.Worker.Name
                    }));

                    var listOfLoosers = taskStartWorkingResult.Data.Biders.Select(i4 => i4.PublicKey.ToString()).ToList();
                    HubClient.WorkersIsLateToGetTask(listOfLoosers, new JavaScriptSerializer().Serialize(new { taskPk = taskPk }));
                }
                return(!taskStartWorkingResult.IsSuccess ? Json(new { IsSuccess = false }) : Json(new { IsSuccess = true }));
            }
            catch (Exception ex) {
                _log.AddError("[Task]/[TaskStartWorking]", ex.Message);
                return(Json(new { IsSuccess = false }));
            }
        }
コード例 #2
0
        public LayoutViewModel()
        {
            var user = new PrivateSession().Current.User;

            if (user == null)
            {
                IsAuthanticated = false;
                ImagePath       = null;
                ParlourPath     = null;
            }
            else
            {
                IsAuthanticated = true;
                ImagePath       = !string.IsNullOrEmpty(user.UserLogoPath) ? user.UserLogoPath : "/Storage/Avatars/defaultuser.png";
                if (user.IsAdmin)
                {
                    ParlourPath = "/Addmin/Parlour"; return;
                }
                if (user.IsModerator)
                {
                    ParlourPath = "/Modderator/Parlour"; return;
                }
                ParlourPath = "/MyUser/Parlour";
            }
        }
コード例 #3
0
        private async Task <int> GetParentIdByAlias(PrivateSession session, string alias, Func <PrivateConnection> connectionFactory)
        {
            var request = (GetOptionRequest.Builder().SelectDefault() as GetOptionRequest.IBuilderWithSelect).WhereName(alias);

            return(Convert.ToInt32
                       ((await(new GetOptionWithoutUsingIdHandler()).Handle(session, request.Content, connectionFactory)).OptionData.Keys.Single()));
        }
コード例 #4
0
        public async Task <List <SetOptionResponse> > Handle(PrivateSession session, SetOptionRequest request, Func <PrivateConnection> connectionFactory)
        {
            var requestObject = await ConvertRequestToDataContract(session, request, connectionFactory);

            var responseObject = new List <Json.OptionCreateResponseItem>();

            for (var i = 0; i < requestObject.Count; i += CreateOptionRequestBatchSize)
            {
                var range = Math.Min(CreateOptionRequestBatchSize, requestObject.Count - i);
                using (var connection = connectionFactory().ApiName(ApiName).Method(PrivateConnectionMethod.Create))
                {
                    try
                    {
                        using (var response = await connection.SendAsync(requestObject.Skip(i).Take(range).ToList()))
                        {
                            responseObject.AddRange(await response.ReadAsync <List <Json.OptionCreateResponseItem> >());
                        }
                    }
                    catch (ConnectionResponseException e)
                    {
                        throw e.ToRequestException("Option set request failed", request);
                    }
                }
            }
            return(responseObject.Select(ConvertResponseItem).ToList());
        }
コード例 #5
0
        public ActionResult SetCallBack(Pages.PagesEnum pageName, Guid?publicKey)
        {
            var ps = new PrivateSession().Current;

            ps.PageName  = pageName;
            ps.PublicKey = publicKey;
            return(Json(new { IsSuccess = true }));
        }
コード例 #6
0
        public async Task <bool> Handle(PrivateSession session, List <string> idList, Func <PrivateConnection> connectionFactory)
        {
            using (var connection = connectionFactory().ApiName(CreateFieldHandler.FIELD).Method(PrivateConnectionMethod.Delete))
            {
                IConnectionResponse response = await connection.SendAsync(new DeleteFieldRequestData(idList));

                return(response.Code == 204);
            }
        }
コード例 #7
0
        public ActionResult GetActualData()
        {
            var userPk       = new PrivateSession().Current.User.Pk;
            var rialtoData   = _rialtos.GetCommonData(userPk);
            var chartData    = _rialtos.GetChartData();
            var champion     = _rialtos.GetChampionName();
            var chatMessages = _rialtos.GetChatMessages();

            return(Json(new { IsSuccess = true, RialtoData = rialtoData, ChartData = chartData, Champion = champion, ChatMessage = chatMessages }));
        }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "PrivateSessionID,SessionStart,SessionEnd,InstructorID,Notes")] PrivateSession privateSession)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(privateSession).State = EntityState.Modified;
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(privateSession));
 }
コード例 #9
0
ファイル: Access.cs プロジェクト: cruise-2008/avelango
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (httpContext == null)
            {
                return(false);
            }
            var sessionCurrent = new PrivateSession().Current;

            return(sessionCurrent.User != null && sessionCurrent.User.IsAdmin);
        }
コード例 #10
0
ファイル: TestUserAPI.cs プロジェクト: tranxuannam/bk_data
        public void SetUp()
        {
            string serverUrl = "http://namtest2-web.dynamic.ps.porters.local";
            PrivateServerSettings settings = new PrivateServerSettings();

            settings.ServerUrl = new Uri(serverUrl);
            client             = PrivateClient.CreateClient(settings);
            session            = client.CreateSession(PrivateAuthentication.WithCredentials("TestCompany", "*****@*****.**", "password"));
            Assume.That(session.Authenticate(), Is.True, "Cannot login to the server!");
        }
コード例 #11
0
 public ActionResult GetState()
 {
     try {
         var parlourPath = Settings.UserParlourPath;
         var session     = new PrivateSession().Current;
         _log.AddInfo("GetState", "User: "******"   IsAuthenticated: " + User.Identity.IsAuthenticated);
         if (session.User != null)
         {
             if (session.User.IsAdmin)
             {
                 parlourPath = Settings.AdminParlourPath;
             }
             if (session.User.IsModerator)
             {
                 parlourPath = Settings.ModeratorParlourPath;
             }
             return(Json(new {
                 IsEnabled = true,
                 IsAuthanticated = session.User.IsEnabled,
                 ImagePath = !string.IsNullOrEmpty(session.User.UserLogoPath) ? session.User.UserLogoPath : Settings.DefaulLogoPath,
                 UserName = session.User.Name,
                 ParlourPath = parlourPath,
                 SessionId = session.User.Id,
                 Groups = session.User.SubscribeToGroups
             }));
         }
         if (!User.Identity.IsAuthenticated)
         {
             return(Json(new { IsEnabled = false, IsAuthanticated = false, ImagePath = (string)null, ParlourPath = (string)null }));
         }
         session.User = _user.GetUserInfo(Guid.Parse(User.Identity.Name));
         if (session.User.IsAdmin)
         {
             parlourPath = Settings.AdminParlourPath;
         }
         if (session.User.IsModerator)
         {
             parlourPath = Settings.ModeratorParlourPath;
         }
         return(Json(new {
             IsEnabled = true,
             IsAuthanticated = session.User.IsEnabled,
             ImagePath = !string.IsNullOrEmpty(session.User.UserLogoPath) ? session.User.UserLogoPath : Settings.DefaulLogoPath,
             UserName = session.User.Name,
             ParlourPath = parlourPath,
             SessionId = session.User.Id,
             Groups = session.User.SubscribeToGroups
         }));
     }
     catch (Exception ex) {
         _log.AddError("GetState", ex.Message);
         return(Json(new { IsEnabled = false, IsAuthanticated = false, ImagePath = (string)null, ParlourPath = (string)null }));
     }
 }
コード例 #12
0
        public ActionResult DeleteConfirmed(int id)
        {
            PrivateSession privateSession = _db.PrivateSessions.Find(id);

            if (privateSession != null)
            {
                _db.PrivateSessions.Remove(privateSession);
            }
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #13
0
 public Task <string> StartPrivateSessionAsync(string login)
 {
     return(Task.Run(() =>
     {
         var privateSession = new PrivateSession(login, "waiting...");
         lock (_privateLockObj)
         {
             _privateSessions.Add(privateSession);
         }
         return privateSession.GameKey;
     }));
 }
コード例 #14
0
        public void TestPrivateAuthenticationSuccess()
        {
            PrivateClient client = PrivateClient.CreateClient(new PrivateServerSettings {
                ServerUrl = new Uri("http://arwyntest-web.dynamic.ps.porters.local")
            });

            using (PrivateSession session = client.CreateSession(PrivateAuthentication.WithCredentials("TestCompany", "*****@*****.**", "password")))
            {
                var result = session.Call(MetaDataRequest.LastUpdated(1));
                Assert.That(result.LastUpdateDate, Is.GreaterThan(0));
            }
        }
コード例 #15
0
 public ActionResult SetMyGroups(string groups, bool emailDelivery, bool smsDelivery, bool pushUpDelivery)
 {
     try {
         var session          = new PrivateSession().Current;
         var subscribedResult = _users.SetSubscribedGroups(session.User.Pk, groups, emailDelivery, smsDelivery, pushUpDelivery);
         return(Json(subscribedResult.IsSuccess ? new { IsSuccess = true } : new { IsSuccess = false }));
     }
     catch (Exception ex) {
         _log.AddError("[MyUser]/[SetMyGroups]", ex.Message);
         return(Json(new { IsSuccess = false }));
     }
 }
コード例 #16
0
 public ActionResult GetMyGroups()
 {
     try {
         var session = new PrivateSession().Current;
         var groups  = PageLangManager.GetGroupsContent(session.CurrentLang.ToString());
         return(Json(new { IsSuccess = true, Groups = groups }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex) {
         _log.AddError("GetMyGroups", ex.Message);
         return(Json(new { IsSuccess = false }, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #17
0
ファイル: uWarehouse.ascx.cs プロジェクト: ewin66/dev
 public void ClearForm()
 {
     //clear all fields inside form layout
     ASPxEdit.ClearEditorsInContainer(frmlInfoGeneral);
     this.pagWarehouseEdit.ActiveTabIndex = 0;
     this.cbRowStatus.SelectedIndex       = 0;
     //HtmlEditorDescription.Html = String.Empty;
     txtCode.IsValid = true;
     txtName.IsValid = true;
     txtName.Text    = "";
     PrivateSession.ClearInstance();
 }
コード例 #18
0
        public ActionResult SetMyLogo(string image)
        {
            try {
                if (image == null)
                {
                    return(Json(false));
                }

                // Remove old images
                var user = new PrivateSession().Current.User;
                if (!string.IsNullOrEmpty(user.UserLogoPath))
                {
                    ImgHandler.RemoveImage(Server.MapPath("~") + user.UserLogoPath);
                }
                if (!string.IsNullOrEmpty(user.UserLogoPathMax))
                {
                    ImgHandler.RemoveImage(Server.MapPath("~") + user.UserLogoPathMax);
                }

                // Create new images
                var img     = ImgHandler.Base64ToImage(image);
                var imgMini = ImgHandler.CreateMiniImage(img, 128, 128);

                // Save new images
                var userLogoPath = @"\Storage\Avatars\" + Guid.NewGuid() + ".png";
                var res1         = ImgHandler.SaveImage(imgMini, Server.MapPath("~") + userLogoPath);

                var userLogoPathMax = @"\Storage\Avatars\" + Guid.NewGuid() + ".png";
                var res2            = ImgHandler.SaveImage(img, Server.MapPath("~") + userLogoPathMax);

                var resSet = false;
                if (res1 && res2)
                {
                    resSet = _users.SetImages(user.Pk, userLogoPath, userLogoPathMax).IsSuccess;
                }
                user.UserLogoPath    = userLogoPath;
                user.UserLogoPathMax = userLogoPathMax;

                if (resSet)
                {
                    return(Json(new { IsSuccess = true, UserLogoPath = userLogoPath, UserLogoPathMax = userLogoPathMax }));
                }

                ImgHandler.RemoveImage(Server.MapPath("~") + userLogoPath);
                ImgHandler.RemoveImage(Server.MapPath("~") + userLogoPathMax);
                return(Json(new { IsSuccess = false }));
            }
            catch (Exception ex) {
                _log.AddError("[MyUser]/[SetMyLogo]", ex.Message);
                return(Json(new { IsSuccess = false }));
            }
        }
コード例 #19
0
            /// <summary>
            ///     Check the clicked time slot is available for a private session booking.
            /// </summary>
            /// <remarks>
            ///     Get all lessons on the same date as the clicked time slots.
            ///     Check against all lessons to see if there an overlap for another class.
            ///     If so, refresh the calendar age with a failure notification saying the slot cannot be booked.
            ///     if no overlap exists, create a PrivateSession and redirect the user to the PrivateSession request view.
            /// </remarks>
            /// <param name="e">The dataset of the timeslots selected by the user.</param>
            protected override void OnTimeRangeSelected(TimeRangeSelectedArgs e)
            {
                //Set a LINQ query to get all lessons that take place the same day as the requested session
                //DateTime startDate = e.Start;

                var lessons = _db.Lessons
                              .Where(l => DbFunctions.TruncateTime(l.ClassStartDate) == e.Start.Date)
                              .ToList();


                //If there is are any other classes that day, loop through them to check for a time conflict
                if (lessons.Count != 0)
                {
                    //Set a flag to denote if an overlap exists
                    bool overlapExists = false;

                    //Loop though all the day's classes and check if the start or end overlaps with the request time
                    foreach (var lesson in lessons)
                    {
                        bool startCondition = (e.Start.TimeOfDay > lesson.ClassStartDate.TimeOfDay) &&
                                              (e.Start.TimeOfDay < lesson.ClassEndDate.TimeOfDay);
                        bool endCondition = (e.End.TimeOfDay > lesson.ClassStartDate.TimeOfDay) &&
                                            (e.End.TimeOfDay < lesson.ClassEndDate.TimeOfDay);

                        if (startCondition || endCondition)
                        {
                            //Break out the loop if a match is found
                            overlapExists = true;
                            break;
                        }
                    }

                    //If there's a match, set an error message for the page alert and refresh the page to show it
                    if (overlapExists)
                    {
                        Errormessage = "Overlap";
                        Redirect("/Schedule/Index");
                    }
                }

                //If no overlap occurs or there are no lessons booked on that day:
                //Create new session
                request = new PrivateSession
                {
                    SessionStart = e.Start,
                    SessionEnd   = e.End
                };
                //Set the start and end times
                //Send the model to the request form
                Redirect("/Schedule/RequestPrivate");
            }
コード例 #20
0
        // COMMENTED OUT AS AN ADMIN WOULD NEVER CREATE A SESSION, THESE ARE USER-CREATED ONLY.
        //// GET: PrivateSessions/Create
        //public ActionResult Create()
        //{
        //    return View();
        //}

        //// POST: PrivateSessions/Create
        //// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        //// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Create([Bind(Include = "PrivateSessionID,SessionStart,SessionEnd,InstructorID,Notes")] PrivateSession privateSession)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        _db.PrivateSessions.Add(privateSession);
        //        _db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }

        //    return View(privateSession);
        //}

        /// <summary>
        ///     Load the Form and Model to Edit a Session
        /// </summary>
        /// <remarks>
        ///     Retrieve the session from the database with a matching id
        ///     Load the Edit View
        /// </remarks>
        /// <param name="id">The id of the session entity to be edited</param>
        /// <returns>The edit session form with the session to be edited as the sending model</returns>
        // GET: PrivateSessions/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PrivateSession privateSession = _db.PrivateSessions.Find(id);

            if (privateSession == null)
            {
                return(HttpNotFound());
            }
            return(View(privateSession));
        }
コード例 #21
0
 public ActionResult Index()
 {
     try {
         var session = new PrivateSession().Current;
         if (User.Identity.IsAuthenticated && session.User == null)
         {
             session.User = _user.GetUserInfo(Guid.Parse(User.Identity.Name));
         }
     }
     catch (Exception ex) {
         _log.AddError("[HomeController]/[Index]", ex.Message);
     }
     return(View());
 }
コード例 #22
0
        public ActionResult RequestPrivate([Bind(Include = "StudentName,SessionStart,SessionEnd,InstructorID,Notes")] PrivateSession model)
        {
            model.Status = PrivateSession.RequestStatus.Submitted;
            model.User   = _db.Users.Single(u => u.UserName == User.Identity.Name);
            if (ModelState.IsValid)
            {
                _db.PrivateSessions.Add(model);
                _db.SaveChanges();
                SendEmail(User.Identity.Name, "private");
                Errormessage = "Private";
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
コード例 #23
0
 public ActionResult GetTask(Guid pk)
 {
     try {
         var user        = new PrivateSession().Current.User;
         var tasksResult = _task.GetTaskByPk(user?.Pk ?? Guid.Empty, pk);
         if (!tasksResult.IsSuccess)
         {
             return(Json(new { IsSuccess = false }));
         }
         return(Json(new { IsSuccess = true, Job = new List <ApplicationTask> {
                               tasksResult.Data
                           } }));
     }
     catch (Exception ex) {
         _log.AddError("[Task]/[GetTask]", ex.Message);
         return(Json(new { IsSuccess = false }));
     }
 }
コード例 #24
0
        public ActionResult CheckPhone(string phone)
        {
            try {
                if (string.IsNullOrEmpty(phone) || phone.Length != 13)
                {
                    return(Json(new { IsExist = false, SmsSended = false, LimitExceeded = false }));
                }
                var existResult = _user.CheckPhone(phone);
                if (existResult.IsSuccess && existResult.Data)
                {
                    return(Json(new { IsExist = true, SmsSended = false, LimitExceeded = false }));
                }
                // Send SMS
                var sendingEnable = _user.CheckSmsSendingEnable(phone);
                // var sendingEnable = new OperationResult<bool>(true);

                if (!sendingEnable.Data)
                {
                    return(Json(new { IsExist = false, SmsSended = false, LimitExceeded = true }));
                }

                var password = _user.GetTempPassword();

                var passwordString = string.Join("-", Regex.Split(password.Data.ToString(), @"([0-9]{2})").Where(s => !string.IsNullOrWhiteSpace(s)).ToList());
                var sendResult     = Handlers.Api.TurboSms.TurboSmsManager.Send(phone, "Your temporary password" + Environment.NewLine + passwordString);
                // var sendResult = true;

                var session = new PrivateSession().Current;
                session.TemporyPhoneNumber = phone;
                session.TemporyPassword    = password.Data.ToString();

                if (!sendResult)
                {
                    return(Json(new { IsExist = false, SmsSended = false, LimitExceeded = true }));
                }

                _user.AddSendedSms(Request.UserHostAddress, phone);
                return(Json(new { IsExist = false, SmsSended = true }));
            }
            catch (Exception ex) {
                _log.AddError("[Account]/[CheckPhone]", ex.Message);
            }
            return(Json(new { IsExist = false }));
        }
コード例 #25
0
        //[RequireHttps]
        public ActionResult Login(string phone, string password)
        {
            try {
                if (!string.IsNullOrEmpty(phone) && !string.IsNullOrEmpty(password))
                {
                    var user = _user.GetUserInfo(phone, password);
                    if (user == null)
                    {
                        return(Json(new { IsEnabled = false }));
                    }

                    var session = new PrivateSession();
                    session.Current.User = user;
                    if (session.Current.User.IsAdmin)
                    {
                        session.Current.User.SubscribeToGroups = "[\"aconnect\"]";
                    }
                    if (session.Current.User.IsModerator)
                    {
                        session.Current.User.SubscribeToGroups = "[\"mconnect\"]";
                    }
                    SetAuth(user.Pk);

                    var imagePath = !string.IsNullOrEmpty(user.UserLogoPath) ? user.UserLogoPath : Settings.DefaulLogoPath;

                    if (user.IsAdmin)
                    {
                        return(Json(new { IsEnabled = true, Path = Settings.AdminParlourPath, ImagePath = imagePath }));
                    }
                    if (user.IsModerator)
                    {
                        return(Json(new { IsEnabled = true, Path = Settings.ModeratorParlourPath, ImagePath = imagePath }));
                    }
                    return(user.IsEnabled ? Json(new { IsEnabled = true, ImagePath = imagePath, UserName = user.Name, SessionId = user.Pk, Groups = user.SubscribeToGroups }) : Json(new { IsEnabled = false }));
                }
                return(Json(new { IsEnabled = false }));
            }
            catch (Exception ex) {
                _log.AddError("[Account]/[Login]", ex.Message);
            }
            return(Json(new { IsEnabled = false }));
        }
コード例 #26
0
        public ActionResult Register(string code, string name)
        {
            try {
                var session = new PrivateSession().Current;
                if (session.TemporyPassword != code)
                {
                    return(Json(new { Success = false, IncorrectCode = true, UsesExist = false }));
                }
                var user = new ApplicationUser {
                    PhoneNumber = session.TemporyPhoneNumber, PasswordHash = code, Name = name
                };
                var userCreationResult = _user.Register(user);

                if (!userCreationResult.IsSuccess)
                {
                    _log.AddError("[Account]/[Register]", userCreationResult.Exception.Message);
                    return(Json(new { Success = false, IncorrectCode = false, UsesExist = false }));
                }

                if (userCreationResult.Data == null || !userCreationResult.IsSuccess)
                {
                    return(Json(new { Success = false, IncorrectCode = false, UsesExist = true }));
                }

                session.Current.User = userCreationResult.Data;
                SetAuth(userCreationResult.Data.Pk);
                // Send mail
                //new Task(() => {
                //    new MailSender().Send(name, name, Connection.SenderInfo, "Registration", MailTypes.Confirm,
                //        new PrivateSession().Current.CurrentLang, new Dictionary<string, string> { { "UserKey", user.Id } });
                //    _mail.SaveEmailInfo(name, "Registration");
                //}).Start();

                // Add event
                //Task.Run(() => { _events.Save(Guid.Parse(user.Id), "Registration", "Email: " + user.Email + ", IP: " + Request.UserHostAddress); });
                return(Json(new { Success = true, IsEnabled = true, ImagePath = Settings.DefaulLogoPath, UserName = userCreationResult.Data.Name, SessionId = userCreationResult.Data.Pk, Groups = string.Empty }));
            }
            catch (Exception ex) {
                _log.AddError("[Account]/[Register]", ex.Message);
                return(Json(new { Success = false, Path = "/Account/Register" }));
            }
        }
コード例 #27
0
 public ActionResult RemoveBid(Guid taskPk)
 {
     try {
         var user             = new PrivateSession().Current.User;
         var bidRemovedResult = _taskBids.RemoveBid(taskPk, user.Pk);
         if (bidRemovedResult.IsSuccess)
         {
             HubClient.TaskUnbidded(bidRemovedResult.Data.Customer.Pk, new JavaScriptSerializer().Serialize(new {
                 title      = bidRemovedResult.Data.Name,
                 workerName = user.Name,
                 taskPk     = bidRemovedResult.Data.PublicKey
             }));
         }
         return(Json(bidRemovedResult.IsSuccess ? new { IsSuccess = true } : new { IsSuccess = false }));
     }
     catch (Exception ex) {
         _log.AddError("[Task]/[RemoveBid]", ex.Message);
         return(Json(new { IsSuccess = false }));
     }
 }
コード例 #28
0
 public ActionResult SetOffers(List <Guid> tasksPk, Guid toUser, string message)
 {
     try {
         var user         = new PrivateSession().Current.User;
         var offersSetted = _taskOffers.SetOffers(user.Pk, tasksPk, message);
         _notifycations.AddNotifications(NotifycationTypes.ProposalOfTask.ToString(), tasksPk, toUser, user.Pk);
         foreach (var taskPk in tasksPk)
         {
             HubClient.WorkerHasGotProposition(toUser.ToString(), new JavaScriptSerializer().Serialize(new {
                 taskPk       = taskPk,
                 customerName = user.Name
             }));
         }
         return(!offersSetted.IsSuccess ? Json(new { IsSuccess = false }) : Json(new { IsSuccess = true }));
     }
     catch (Exception ex) {
         _log.AddError("[Task]/[TaskStartWorking]", ex.Message);
         return(Json(new { IsSuccess = false }));
     }
 }
コード例 #29
0
        public void SetLang(string lang)
        {
            var privateSession = new PrivateSession();
            var tn             = lang.ToLower().Trim();

            switch (tn)
            {
            case "ru": { privateSession.Current.CurrentLang = Langs.LangsEnum.Ru; break; }

            case "en": { privateSession.Current.CurrentLang = Langs.LangsEnum.En; break; }

            case "de": { privateSession.Current.CurrentLang = Langs.LangsEnum.De; break; }

            case "es": { privateSession.Current.CurrentLang = Langs.LangsEnum.Es; break; }

            case "ua": { privateSession.Current.CurrentLang = Langs.LangsEnum.Ua; break; }

            case "fr": { privateSession.Current.CurrentLang = Langs.LangsEnum.Fr; break; }
            }
        }
コード例 #30
0
        // POST: Modderator/TaskChecked
        public ActionResult TaskChecked(ApplicationTask task, bool success, List <DeactivationCauses> causes)
        {
            var tasksResult = _task.TaskChecked(task.PublicKey, task.Name, task.Description, task.Group, task.SubGroup, task.Price, success);

            HubClient.TasksInModeration.Remove(task.PublicKey.ToString());
            var moderPk = new PrivateSession().Current.User.Pk;

            if (success)
            {
                _notifycations.AddNotification(NotifycationTypes.TaskConfirmed.ToString(), task.PublicKey, Guid.Parse(task.Customer.Pk), moderPk);
                HubClient.TaskConfirmed(tasksResult.Data.Customer.Pk, new JavaScriptSerializer().Serialize(new { taskPk = task.PublicKey, title = task.Name }));
            }
            else
            {
                _notifycations.AddNotification(NotifycationTypes.TaskDismissed.ToString(), task.PublicKey, Guid.Parse(task.Customer.Pk), moderPk);
                HubClient.TaskDismissed(tasksResult.Data.Customer.Pk, new JavaScriptSerializer().Serialize(new { taskPk = task.PublicKey, title = task.Name }));
                AlertUserToDeactivation(Guid.Parse(tasksResult.Data.Customer.Pk), causes);
            }
            return(tasksResult.IsSuccess ? Json(new { IsSuccess = true }) : Json(new { IsSuccess = false }));
        }