public void DeleteTask(PrepaymentTask task) { Application.Current.Dispatcher.Invoke(() => { for (var i = 0; i < ViewModel.PaymentCollection.Count; i++) { //get contract windows var contractWindowList = ManageContractViewModel.Instance.EditContractWindowList; EditContractWindow editWindow = null; foreach (var window in contractWindowList) { if (!window.ViewModel.ContractId.Equals(ViewModel.ContractId)) { //not found yet!!! continue; } //found it and add new popup dialog to windows editWindow = window; break; } var level = string.Empty; PersianDatePicker datePicker = LevelOneDatePicker; if (task.Level.Equals("1")) { level = "اول"; } else if (task.Level.Equals("2")) { level = "دوم"; datePicker = LevelTwoDatePicker; } else if (task.Level.Equals("3")) { level = "سوم"; datePicker = LevelThreeDatePicker; } var msg = "آیا مایل به حذف پیش پرداخت مرحله " + level + " با مقدار " + task.Amount + " در تاریخ " + task.Date + " می باشید؟"; var dialog = new DialogUserControl(msg, () => { try { PrepaymentTasksDataAccess.Delete(task.PrepaymentId, task.Level); task.Amount = string.Empty; task.Date = PersianDate.Today; task.IsExistInDatabase = false; datePicker.SelectedDate = PersianDate.Today; var message = "مرحله " + level + " با موفقیت حذف شد."; ViewModel.ShowPrePaymentTaskMessage(message, false); ViewModel.PrepaymentItem.UpdatePrepaymentSum(); } catch (Exception e) { Logger.LogException(e); var message = "خطا در حین حذف مرحله " + level; ViewModel.ShowPrePaymentTaskMessage(message, true); } }, editWindow?.ViewModel.RemovePopupAction); editWindow?.ViewModel.AddPopupAction(dialog); break; } }); }
/// <summary> /// Initializes a new instance of the AutomationPeer for PersianDatePicker control. /// </summary> /// <param name="owner">PersianDatePicker</param> public DatePickerAutomationPeer(PersianDatePicker owner) : base(owner) { }
public static void SetIsEnabled(PersianDatePicker datePicker, bool value) { datePicker.SetValue(IsEnabledProperty, value); }
public ReportForm() { InitializeComponent(); MenuModel.ReportForm = this; var ThisMonthDateString = DateTime.Today.ToShortStringForDate().Substring(0, 7) + "/"; DateTime BDate = (ThisMonthDateString + "01").PersianDateStringToDate(); DateTime EDate = DateTime.Today; var BDateLabel = new Label() { Text = "از تاریخ: ", HorizontalOptions = LayoutOptions.EndAndExpand }; BDatePicker = new PersianDatePicker(PopUpDialog) { Value = BDate, HorizontalOptions = LayoutOptions.EndAndExpand }; var BDateGrid = new MenuModel() { FilterItemGrid = new Grid() { HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = new RowDefinitionCollection() { new RowDefinition() { Height = 40 } }, ColumnDefinitions = new ColumnDefinitionCollection() { new ColumnDefinition() { Width = new GridLength(2, GridUnitType.Star) }, new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) } } } }; BDateGrid.FilterItemGrid.Children.Add(BDatePicker, 0, 0); BDateGrid.FilterItemGrid.Children.Add(BDateLabel, 1, 0); var EDateLabel = new Label() { Text = "تا تاریخ: ", HorizontalOptions = LayoutOptions.EndAndExpand }; EDatePicker = new PersianDatePicker(PopUpDialog) { Value = EDate, HorizontalOptions = LayoutOptions.EndAndExpand }; var EDateGrid = new MenuModel() { FilterItemGrid = new Grid() { HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = new RowDefinitionCollection() { new RowDefinition() { Height = 40 } }, ColumnDefinitions = new ColumnDefinitionCollection() { new ColumnDefinition() { Width = new GridLength(2, GridUnitType.Star) }, new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) } } } }; EDateGrid.FilterItemGrid.Children.Add(EDatePicker, 0, 0); EDateGrid.FilterItemGrid.Children.Add(EDateLabel, 1, 0); var DailyReport = new MenuModel() { Button = new Button() { Text = "روزانه" }, Tag = "Daily" }; var WeeklyReport = new MenuModel() { Button = new Button() { Text = "هفتگی" }, Tag = "Weekly" }; var MonthlyReport = new MenuModel() { Button = new Button() { Text = "ماهانه" }, Tag = "Monthly" }; var StuffGroupsReport = new MenuModel() { Button = new Button() { Text = "گروه کالاها(سطح 1)" }, Tag = "StuffGroups" }; var StuffSubGroupsReport = new MenuModel() { Button = new Button() { Text = "گروه کالاها(سطح 2)" }, Tag = "StuffSubGroups" }; var StuffsReport = new MenuModel() { Button = new Button() { Text = "کالاها" }, Tag = "Stuffs" }; var PartnerGroupsReport = new MenuModel() { Button = new Button() { Text = "گروه مشتریان" }, Tag = "PartnerGroups" }; VerticalAlignmentOfMenus = new MenuModel[][] { new MenuModel[] { BDateGrid, EDateGrid, DailyReport, WeeklyReport, MonthlyReport, StuffGroupsReport, StuffSubGroupsReport, StuffsReport, PartnerGroupsReport } }; HorizontalAlignmentOfMenus = new MenuModel[][] { new MenuModel[] { BDateGrid, DailyReport, WeeklyReport, MonthlyReport, PartnerGroupsReport }, new MenuModel[] { EDateGrid, StuffGroupsReport, StuffSubGroupsReport, StuffsReport, null } }; for (int i = 0; i < VerticalAlignmentOfMenus.Length; i++) { for (int j = 0; j < VerticalAlignmentOfMenus[i].Length; j++) { if (VerticalAlignmentOfMenus[i][j].Button != null) { VerticalAlignmentOfMenus[i][j].Button.BorderColor = Color.FromHex("#1E87D8"); VerticalAlignmentOfMenus[i][j].Button.TextColor = Color.White; VerticalAlignmentOfMenus[i][j].Button.BorderWidth = 1; VerticalAlignmentOfMenus[i][j].Button.BorderRadius = 10; VerticalAlignmentOfMenus[i][j].Button.BackgroundColor = Color.FromHex("#2196F3"); VerticalAlignmentOfMenus[i][j].Button.HorizontalOptions = LayoutOptions.FillAndExpand; VerticalAlignmentOfMenus[i][j].Button.VerticalOptions = LayoutOptions.FillAndExpand; VerticalAlignmentOfMenus[i][j].Button.Clicked += VerticalAlignmentOfMenus[i][j].Button_Clicked; } } } }
public static bool GetIsEnabled(PersianDatePicker datePicker) { return((bool)datePicker.GetValue(IsEnabledProperty)); }