Пример #1
0
        public WrappedJsonResult EditAjax(tDeal dealData)
        {
            if (ModelState.IsValid)
            {
                ArrangeCityData(dealData);
                ArrangeImages(dealData);

                _dealRepository.InsertOrUpdate(dealData);
                return(new WrappedJsonResult {
                    Data = new {
                        objectAddedName = "",
                        valid = true,
                        Message = CustomMessages.SuccessMessage("tDeal Updated Succesfully")
                    }
                });
            }
            else
            {
                return(new WrappedJsonResult {
                    Data = new {
                        objectAddedName = "",
                        valid = false,
                        Message = CustomMessages.ErrorMessage("Fill All Fields please")
                    }
                });
            }
        }
Пример #2
0
        public async Task <IActionResult> OnPostSave([FromBody] SavePlanCommand command)
        {
            try
            {
                List <SearchedPlan> dbResult = await Mediator.Send(command);

                if (dbResult.Any())
                {
                    int ModuleID  = HttpContext.Session.GetInt32("ModuleID").Value;
                    int ProcessID = HttpContext.Session.GetInt32("ProcessID").Value;
                    await Mediator.Send(new SaveProcessTracksCommand()
                    {
                        ModuleId = ModuleID, ProcessId = ProcessID, RecordId = dbResult.FirstOrDefault().Id
                    });
                }

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = dbResult },
                    Status = UIStatus.Success,
                    Text = "تشکیل موفقانه ثبت سیستم شد",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Пример #3
0
        public async Task <IActionResult> OnPostRemove([FromBody] DeletePositionCommand command)
        {
            try
            {
                List <SearchedPosition> theParentOfDeletedPosition = new List <SearchedPosition>();
                theParentOfDeletedPosition = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = theParentOfDeletedPosition },
                    Status = UIStatus.Success,
                    Text = "بست انتخاب شده موفقانه حذف گردید",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(new UIResult()
                {
                    Data = new { },
                    Status = UIStatus.Failure,
                    Text = CustomMessages.StateExceptionTitle(ex),
                    Description = CustomMessages.DescribeException(ex)
                }));
            }
        }
Пример #4
0
        public async Task <IActionResult> OnPostSave([FromBody] SaveOrgPositionCommand command)
        {
            try
            {
                List <SearchedOrgPositionModel> dbResult = new List <SearchedOrgPositionModel>();
                dbResult = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = dbResult },
                    Status = UIStatus.Success,
                    Text = "معلومات موفقانه ثبت سیستم شد",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(new UIResult()
                {
                    Data = null,
                    Status = UIStatus.Failure,
                    Text = CustomMessages.StateExceptionTitle(ex),
                    Description = CustomMessages.DescribeException(ex)
                }));
            }
        }
Пример #5
0
 private void resetSubjectsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (CustomMessages.YesNoReset(this))
     {
         new SubjectController().DeleteAll();
     }
 }
Пример #6
0
    void Start()
    {
        //Links the gameObject for the label to the current object
        // to be able to easily show and hide it at runtime
        //label = transform.GetChild(0).FindChild("Canvas").gameObject;

        while (customMessages == null)
        {
            Debug.Log("CustomMessages was null");
            customMessages = CustomMessages.Instance;
        }
        customMessages.MessageHandlers[CustomMessages.TestMessageID.ToggleHighLight] = this.ToggleMessageReceived;

        modelNameToTransform = new Dictionary <string, Transform>();
        foreach (Transform child in this.transform)
        {
            try
            {
                string name = child.name;
                Debug.Log("Adding child to dictionary: " + name);
                modelNameToTransform.Add(name, child);
            }
            catch (System.ArgumentException e)
            {
                Debug.Log("The child could not be added because the string was already used as a key for the dictionary");
            }
        }
    }
Пример #7
0
        public async Task <IActionResult> OnPostSave([FromBody] SavePersonAddressCommand command)
        {
            try
            {
                command.CreatedBy  = 10; // UNTILL : applicatio nof identity
                command.CreatedOn  = DateTime.Now;
                command.ModifiedBy = "Test";
                command.ModifiedOn = DateTime.Now;
                List <SearchedPersonAdress> dbResult = new List <SearchedPersonAdress>();
                dbResult = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = dbResult },
                    Status = UIStatus.Success,
                    Text = "آدرس فرد موفقانه ثبت سیستم گردید",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(new UIResult()
                {
                    Data = null,
                    Status = UIStatus.Failure,
                    Text = CustomMessages.StateExceptionTitle(ex),
                    Description = CustomMessages.DescribeException(ex)
                }));
            }
        }
        private void deleteLecturerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CustomMessages.YesNoDelete(this))
            {
                return;
            }

            int index = LecturersGridView.CurrentCell.RowIndex,
                id    = (int)LecturersGridView["Id", index].Value;

            //delete from database
            new LecturerController().Delete(new Lecturer()
            {
                Id   = id,
                Name = LecturersGridView["Name", index].Value.ToString()
            });

            //remove from datatable
            foreach (DataRow row in all_lecturers.Rows)
            {
                if (Convert.ToInt32(row["Id"]) == id)
                {
                    all_lecturers.Rows.Remove(row);
                    break;
                }
            }
        }
Пример #9
0
 private void AcceptButton_Click(object sender, EventArgs e)
 {
     if (New) //creating new subject
     {
         if (controller.Insert(subject) > 0)
         {
             InsertedSubjects.Add(subject);
             if (CustomMessages.YesNoNext(this, "subject"))
             {
                 SetSubject(new Subject());
             }
             else
             {
                 Close();
             }
         }
     }
     else //updating existed subject
     {
         if (controller.Update(subject))
         {
             CustomMessages.Updated(this, "subject");
             SetSubject(subject);
         }
     }
 }
Пример #10
0
 private void AcceptButton_Click(object sender, EventArgs e)
 {
     if (New)
     {
         if (controller.Insert(hall) > 0)
         {
             InsertedHalls.Add(hall);
             if (CustomMessages.YesNoNext(this, "lecture hall"))
             {
                 SetHall(new LectureHall());
             }
             else
             {
                 Close();
             }
         }
     }
     else
     {
         if (controller.Update(hall))
         {
             CustomMessages.Updated(this, "lecture hall");
             SetHall(hall);
         }
     }
 }
Пример #11
0
        public async Task <ActionResult> Edit(ContactVM vm)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    bool IsSuccess = await _contactService.Update(vm);

                    if (IsSuccess)
                    {
                        TempData["SuccessMessage"] = "Record Updated Successfully!!!";
                        CustomMessages msg = new CustomMessages();
                        msg.Message = "Record Updated Successfully!!!";
                        await _publisher.PublishMessage(msg);

                        return(RedirectToAction("Index"));
                    }
                }
            }
            catch
            {
                ViewBag.ErrorMessage = "There was some error while updating the record.";
            }
            return(View(vm));
        }
Пример #12
0
 private void AcceptButton_Click(object sender, EventArgs e)
 {
     if (New)
     {
         if (controller.Insert(lecturer) > 0)
         {
             InsertedLecturers.Add(lecturer);
             if (CustomMessages.YesNoNext(this, "lecturer"))
             {
                 SetLecturer(new Lecturer());
             }
             else
             {
                 Close();
             }
         }
     }
     else
     {
         if (controller.Update(lecturer))
         {
             CustomMessages.Updated(this, "lecturer");
             SetLecturer(lecturer);
         }
     }
 }
Пример #13
0
        public JsonResult DeleteMultiple(int[] array)
        {
            if (array == null)
            {
                return(Json(new {
                    valid = false,
                    Message = CustomMessages.ErrorMessage("Please provide coupons to be deleted"),
                    redirect = "none"
                }));
            }
            if (array.Length == 0)
            {
                return(Json(new {
                    valid = false,
                    Message = CustomMessages.ErrorMessage("Please provide coupons to be deleted"),
                    redirect = "none"
                }));
            }
            int deleted = _couponRepository.Delete(array);

            if (deleted == 0)
            {
                return(Json(new {
                    valid = false,
                    Message = CustomMessages.ErrorMessage("Coupons couldn't be deleted"),
                    redirect = "none"
                }));
            }
            return(Json(new {
                valid = true,
                Message = CustomMessages.SuccessMessage(array.Length + " coupons were deleted succesfully"),
                redirect = "/Coupon/AdminIndex"
            }));
        }
Пример #14
0
        public async Task <IActionResult> OnPostSave([FromBody] SavePersonPublicationCommand command)
        {
            try
            {
                command.CreatedBy  = 10;
                command.ModifiedBy = "Test";
                command.CreatedOn  = DateTime.Now;
                command.ModifiedOn = DateTime.Now;

                List <SearchedPersonPublication> result = new List <SearchedPersonPublication>();
                result = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = result },
                    Status = UIStatus.Success,
                    Text = "انتشار کارمند موفقانه ثبت سیستم شد",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(new UIResult()
                {
                    Data = null,
                    Status = UIStatus.Failure,
                    Text = CustomMessages.StateExceptionTitle(ex),
                    Description = CustomMessages.DescribeException(ex)
                }));
            }
        }
Пример #15
0
        private void SelectionDeclineButton_Click(object sender, EventArgs e)
        {
            if (New) //reset
            {
                //reset
                SetSelection(new SubjectSelection());

                //reset all lecturers
                for (int i = 0; i < LecturersGridView.Rows.Count; ++i)
                {
                    if (LecturersGridView["Select", i].Value != null &&
                        (bool)LecturersGridView["Select", i].Value)
                    {
                        LecturersGridView["Select", i].Value = false;
                    }
                }
                checked_lecturers_id.Clear();

                TimetableControl.ResetLectureTimes();
            }
            else if (CustomMessages.YesNoDelete(this))
            {
                Deleted = controller.Delete(selection);
                Close();
            }
        }
Пример #16
0
        public async Task <IActionResult> OnPostSave([FromBody] CreatePersonCommand command)
        {
            try
            {
                // Untill application of Identity
                command.ModifiedBy = "TEST USER";
                command.CreatedBy  = 10;
                command.CreatedOn  = DateTime.Now;

                command.ModuleID       = HttpContext.Session.GetInt32("ModuleID").Value;
                command.ProcessID      = HttpContext.Session.GetInt32("ProcessID").Value;
                command.OrganizationId = await _currentUser.GetUserOrganizationID();

                List <SearchedPersonModel> SaveResult = new List <SearchedPersonModel>();

                SaveResult = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = SaveResult },
                    Status = UIStatus.Success,
                    Text = "اطلاعات مستخدم موفقانه ثبت سیستم شد",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Пример #17
0
        private async Task PageHasCertificate(string url)
        {
            // if site has certificate than it will load by https://
            url = url.Replace("http://", "https://");
            try
            {
                if (WebRequest.Create(url) is HttpWebRequest request)
                {
                    request.Method = "HEAD";
                    HttpWebResponse response = await request.GetResponseAsync() as HttpWebResponse;

                    response?.Close();
                }

                siteAddress.Text  = url;
                pageHasCerificate = true;
            }
            catch (NullReferenceException exception)
            {
                CustomMessages.DisplayCustomErrorMsg("NullReferenceException", exception.Message);
                pageHasCerificate = false;
            }
            catch (Exception exception)
            {
                CustomMessages.DisplayCustomErrorMsg("UnrecognizedException", exception.Message);
                pageHasCerificate = false;
            }

            // TODO: Obsługa poszczególnych wyjątków, tak aby poinformować użytkownika nie tylko o tym, że nie udało się nawiązać połączenia, ale również czemu to się nie udało
        }
Пример #18
0
    void Start()
    {
        customMessages = CustomMessages.Instance;
        stateAccessor  = StateAccessor.Instance;
        if (customMessages != null)
        {
            customMessages.MessageHandlers[CustomMessages.TestMessageID.InitiateIsolateMessage]       = InitiateIsolateMessageReceived;
            customMessages.MessageHandlers[CustomMessages.TestMessageID.TryToIsolateStructure]        = TryToIsolateStructureMessageReceived;
            customMessages.MessageHandlers[CustomMessages.TestMessageID.TryToReturnIsolatedStructure] = TryToReturnIsolatedStructureMessageReceived;
            customMessages.MessageHandlers[CustomMessages.TestMessageID.ConcludeIsolate] = ConcludeIsolateMessageReceived;
        }

        structuresList = new List <Transform>();
        foreach (GameObject current in GameObject.FindGameObjectsWithTag("Structure"))
        {
            structuresList.Add(current.GetComponent <Transform>());
        }

        isolatedStructures = new List <Transform>();
        movingStructures   = new List <MovingStructureWithDirection>();

        CalculateDefaultAndFinalPositionsScalesAndRotations();
        currentlyInIsolatedMode = false;
        //cortexBoxCollider = GameObject.Find(CORTEX_OBJECT_NAME).GetComponentInChildren<BoxCollider>();
        brain      = GameObject.Find(BRAIN_PARTS_GAMEOBJECT_NAME);
        ventricles = GameObject.Find(VENTRICLE_OBJECT_NAME);
        cortex     = GameObject.Find(CORTEX_OBJECT_NAME);
    }
Пример #19
0
 public JsonResult CreateAjax(tCoupon user, int Count)
 {
     if (ModelState.IsValid)
     {
         user.DateAdded = DateTime.Now;
         if (user.DateBegin < DateTime.Now)
         {
             return(Json(new {
                 objectAddedName = user.Code,
                 valid = false,
                 Message = CustomMessages.ErrorMessage("Beginning date must be greater than now...")
             }));
         }
         if (user.DateEnd < DateTime.Now)
         {
             return(Json(new {
                 objectAddedName = user.Code,
                 valid = false,
                 Message = CustomMessages.ErrorMessage("Expiration date must be greater than now...")
             }));
         }
         if (user.DateEnd <= user.DateBegin)
         {
             return(Json(new {
                 objectAddedName = user.Code,
                 valid = false,
                 Message = CustomMessages.ErrorMessage("Expiration date must follow Beginning Date")
             }));
         }
         if (Count <= 0)
         {
             return(Json(new {
                 objectAddedName = user.Code,
                 valid = false,
                 Message = CustomMessages.ErrorMessage("Count Must be greater than 0")
             }));
         }
         if (Count > 200)
         {
             return(Json(new {
                 objectAddedName = user.Code,
                 valid = false,
                 Message = CustomMessages.ErrorMessage("Count must be less than 200")
             }));
         }
         List <tCoupon> res = CreateCouponsMultiple(user, Count);
         _couponRepository.Insert(res);
         return(Json(new {
             objectAddedName = user.Code,
             valid = true,
             Message = CustomMessages.SuccessMessage("Coupons were added Succesfully")
         }));
     }
     return(Json(new {
         objectAddedName = "",
         valid = false,
         Message = CustomMessages.ErrorMessage("Fill All Fields please")
     }));
 }
Пример #20
0
    void Start()
    {
        customMessages = CustomMessages.Instance;

        customMessages.MessageHandlers[CustomMessages.TestMessageID.HeadTransform] = this.UpdateHeadTransform;
        customMessages.MessageHandlers[CustomMessages.TestMessageID.UserAvatar]    = this.UpdateUserAvatar;
        customMessages.MessageHandlers[CustomMessages.TestMessageID.UserHit]       = this.ProcessUserHit;
    }
Пример #21
0
    void Start()
    {
        customMessages = CustomMessages.Instance;

        customMessages.MessageHandlers[CustomMessages.TestMessageID.HeadTransform] = this.UpdateHeadTransform;
        SharingSessionTracker.Instance.SessionJoined += Instance_SessionJoined;
        SharingSessionTracker.Instance.SessionLeft   += Instance_SessionLeft;
    }
Пример #22
0
 public WrappedJsonResult CreateAjax(tDeal dealData)
 {
     if (ModelState.IsValid)
     {
         ArrangeCityData(dealData);
         ArrangeImages(dealData);
         dealData.DateAdded = DateTime.Now;
         if (dealData.DateStarting < DateTime.Now)
         {
             return new WrappedJsonResult {
                        Data = new {
                            objectAddedName = dealData.DealTitle,
                            valid           = false,
                            Message         = CustomMessages.ErrorMessage("DateStarting must be greater than now...")
                        }
             }
         }
         ;
         if (dealData.DateEnding < DateTime.Now)
         {
             return new  WrappedJsonResult {
                        Data = new {
                            objectAddedName = dealData.DealTitle,
                            valid           = false,
                            Message         = CustomMessages.ErrorMessage("DateEnding must be greater than now...")
                        }
             }
         }
         ;
         if (dealData.DateEnding <= dealData.DateStarting)
         {
             return new WrappedJsonResult {
                        Data = new {
                            objectAddedName = dealData.DealTitle,
                            valid           = false,
                            Message         = CustomMessages.ErrorMessage("DateEnding must follow Beginning Date")
                        }
             }
         }
         ;
         _dealRepository.InsertOrUpdate(dealData);
         return(new WrappedJsonResult {
             Data = new {
                 objectAddedName = dealData.DealTitle,
                 valid = true,
                 Message = CustomMessages.SuccessMessage("Deal was added Succesfully")
             }
         });
     }
     return(new WrappedJsonResult {
         Data = new {
             objectAddedName = "",
             valid = false,
             Message = CustomMessages.ErrorMessage("Fill All Fields please")
         }
     });
 }
Пример #23
0
        static void SubscriberActionMethod(CustomMessages msg)
        {
            var Clients = GlobalHost.ConnectionManager.GetHubContext <ContactHub>().Clients;

            Clients.All.broadcastMessage(msg.Message);

            //ContactHub hub = new ContactHub();
            //hub.GenerateNotification(msg);
        }
Пример #24
0
        private async Task AskChoice(IDialogContext context, string name)
        {
            _profile.Name = name;
            context.UserData.SetValue("profile", _profile);
            string[]       options = { Constants.ConstantStrings.YesGoToMuse, Constants.ConstantStrings.AlreadyWentThere };
            CustomMessages cm      = WebApiApplication.BotStrings["welcome.message"];

            cm.text = String.Format(cm.text, _profile.Name);
            await context.PostAsync(cm.getActivityFromMessage(context));
        }
Пример #25
0
    void Start()
    {
        customMessages = CustomMessages.Instance;

        customMessages.MessageHandlers[CustomMessages.GameMessageID.UserHeadTransform] = this.UpdateHeadTransform;
        customMessages.MessageHandlers[CustomMessages.GameMessageID.UserAvatar]        = this.UpdateUserAvatar;
        customMessages.MessageHandlers[CustomMessages.GameMessageID.UserHealthUpdated] = this.ProcessUserHit;
        SharingSessionTracker.Instance.SessionJoined += Instance_SessionJoined;
        SharingSessionTracker.Instance.SessionLeft   += Instance_SessionLeft;
    }
Пример #26
0
 private void OkayButton_Click(object sender, EventArgs e)
 {
     preferred_times = TimetableControl.GetLectureTimes(TimetableControl.IsPreferredCell);
     denied_times    = TimetableControl.GetLectureTimes(TimetableControl.IsDeniedCell);
     if (preferred_times.Count > 0 || denied_times.Count > 0)
     {
         CustomMessages.OptionsSaved(this);
     }
     Hide();
 }
Пример #27
0
        private void DeclineButton_Click(object sender, EventArgs e)
        {
            if (New)
            {
                NameTextbox.Text = "";
            }
            else if (CustomMessages.YesNoDelete(this))
            {
                Deleted = controller.Delete(lecturer);

                Close();
            }
        }
Пример #28
0
    // Use this for initialization
    void Start()
    {
        customMessages = CustomMessages.Instance;
        // Assign the ToggleZoomMessageReceived() function to be a message handler for ToggleZoom messages
        // MessageHandlers is a dictionary with TestMessageID's as keys and MessageCalback's as values
        customMessages.MessageHandlers[CustomMessages.TestMessageID.scaleChange] = this.ToggleZoomMessageReceived;

        brain        = GameObject.Find("BrainParts");
        defaultScale = brain.transform.localScale;
        currentZoom  = Scale.Default;

        soundFX = gameObject.GetComponent <AudioSource>();
    }
Пример #29
0
        private void GenerateButton_Click(object sender, EventArgs e)
        {
            if (checked_subjects_id.Count == 0)
            {
                CustomMessages.SelectFail(this);
                return;
            }

            manipulator.AllSelections = new SubjectSelectionController().GetAll();

            manipulator.Halls_Height_Preference
                = floorsHeightPreferenceToolStripMenuItem.Checked;

            manipulator.Preferred_Lecturers.Clear();
            manipulator.Denied_Lecturers.Clear();

            foreach (int id in lecturers_option_form.preferred_lecturers_id)
            {
                manipulator.Preferred_Lecturers.Add(lecturer_controller.Get(id));
            }
            foreach (int id in lecturers_option_form.denied_lecturers_id)
            {
                manipulator.Denied_Lecturers.Add(lecturer_controller.Get(id));
            }

            if (times_option_form.preferred_times != null)
            {
                manipulator.Preferred_Lecture_Times = times_option_form.preferred_times;
            }
            if (times_option_form.denied_times != null)
            {
                manipulator.Denied_Lecture_Times = times_option_form.denied_times;
            }

            manipulator.Selected_Subjects.Clear();

            foreach (int id in checked_subjects_id)
            {
                manipulator.Selected_Subjects.Add(subject_controller.Get(id));
            }
            optimized_selections = manipulator.GetOptimizedSelections();

            if (optimized_selections.Count == 0 || optimized_selections[0].Count == 0)
            {
                CustomMessages.NoSelectionAvailable(this);
            }
            else
            {
                CurrentSelection = 0;
            }
        }
Пример #30
0
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            if (SelectionsGridView.Rows.Count == 0)
            {
                CustomMessages.ChooseBeforeCarryOn(this, "a selection");
                return;
            }


            int index = SelectionsGridView.CurrentCell.RowIndex,
                id    = Int32.Parse(SelectionsGridView["Id", index].Value.ToString());

            SelectionFormPopup(controller.Get(id));
        }