예제 #1
0
        public DelegationsListPage(DelegateViewModel delegateViewModel)
        {
            InitializeComponent();
            BindingContext = delegateViewModel;

            string selectedColorName = "ListViewSelectedBackgroundColor";

            if (Application.Current.RequestedTheme == OSAppTheme.Dark)
            {
                selectedColorName = "ListViewSelectedBackgroundColorDark";
            }

            Application.Current.Resources.TryGetValue(selectedColorName, out var selectedColor);
            selectedItemBackgroundColor = (Color)selectedColor;
        }
예제 #2
0
        public IActionResult Add(DelegateViewModel delegateViewModels)
        {
            if (delegateViewModels.NationalityId == null)
            {
                ModelState.AddModelError("", "الرجاء ادخال جنسية المندوب");
            }
            if (delegateViewModels.DelegateTypeId == null)
            {
                ModelState.AddModelError("", "الرجاء ادخال نوع المندوب");
            }
            ViewBag.AccountTreeId = new SelectList(_Acctree.GetAccountTrees(), "Id", "DescriptionAr");
            if (delegateViewModels.AccountTreeId == null)
            {
                ModelState.AddModelError("", "الرجاء تحدد رقم الحساب في الشجرة");
            }
            if (delegateViewModels.Id == 0)
            {
                ModelState.Remove("Id");
                ModelState.Remove("DelegateTypeId");
                ModelState.Remove("NationalityId");
                ModelState.Remove("AccountTreeId");
                if (ModelState.IsValid)
                {
                    var delegateEmp = _mapper.Map <UserDelegate>(delegateViewModels);
                    _Delegate.AddDelegate(delegateEmp);
                    _toastNotification.AddSuccessToastMessage("تم أضافةالمندوب بنجاح");
                    return(RedirectToAction(nameof(Index)));
                }

                return(View(delegateViewModels));
            }
            else
            {
                ModelState.Remove("DelegateTypeId");
                ModelState.Remove("AccountTreeId");
                ModelState.Remove("NationalityId");
                if (ModelState.IsValid)
                {
                    var Delegate = _mapper.Map <UserDelegate>(delegateViewModels);
                    _Delegate.UpdateDelegate(delegateViewModels.Id, Delegate);
                    _toastNotification.AddSuccessToastMessage("تم تعديل المندوب بنجاح");
                    return(RedirectToAction(nameof(Index)));
                }
                return(View("Add", delegateViewModels));
            }
        }
 public DelegationConfirmationPage(DelegateViewModel delegateViewModel)
 {
     InitializeComponent();
     BindingContext = delegateViewModel;
 }
예제 #4
0
 public BakerListPage(DelegateViewModel delegateViewModel)
 {
     InitializeComponent();
     BindingContext = delegateViewModel;
 }