Beispiel #1
0
        private async void Btn_print_Click(object sender, RoutedEventArgs e)
        {//print
            try
            {
                HelpClass.StartAwait(grid_main);
                #region

                if (packuser.packageUserId <= 0)
                {
                    //no book saved
                    Toaster.ShowWarning(Window.GetWindow(this), message: "You have to book first", animation: ToasterAnimation.FadeIn);
                }
                else
                {
                    result = await BuildReport();

                    if (result == "0")
                    {
                        // not payed yet
                        Toaster.ShowWarning(Window.GetWindow(this), message: "The customer must pay first", animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        LocalReportExtensions.PrintToPrinterbyNameAndCopy(rep, FillCombo.getdefaultPrinters(), FillCombo.rep_print_count == null ? short.Parse("1") : short.Parse(FillCombo.rep_print_count));
                    }
                }
                #endregion
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);
                requiredControlList = new List <string> {
                    "name", "email", "port", "smtpClient", "side", "password",
                };
                if (MainWindow.lang.Equals("en"))
                {
                    //MainWindow.resourcemanager = new ResourceManager("Restaurant.en_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection = FlowDirection.LeftToRight;
                }
                else
                {
                    //MainWindow.resourcemanager = new ResourceManager("Restaurant.ar_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection = FlowDirection.RightToLeft;
                }
                translate();
                FillCombo.FillSideCombo(cb_side);
                Keyboard.Focus(tb_name);
                await Search();

                Clear();
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private void Btn_unSelectedAll_Click(object sender, RoutedEventArgs e)
        {//unselect all
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }

                int x = selectedUsers.Count;
                for (int i = 0; i < x; i++)
                {
                    lst_selectedUsers.SelectedIndex = 0;
                    Btn_unSelectedUser_Click(null, null);
                }
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #4
0
        private void Btn_emailsSetting_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }

                uc_emailsSetting uc = new uc_emailsSetting();
                sc_main.Visibility = Visibility.Collapsed;
                main.Children.Add(uc);

                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private void Btn_preview_Click(object sender, RoutedEventArgs e)
        {//preview
            try
            {
                HelpClass.StartAwait(grid_main);

                #region
                Window.GetWindow(this).Opacity = 0.2;

                string pdfpath = "";
                //
                pdfpath = @"\Thumb\report\temp.pdf";
                pdfpath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, pdfpath);

                BuildReport();

                LocalReportExtensions.ExportToPDF(rep, pdfpath);
                wd_previewPdf w = new wd_previewPdf();
                w.pdfPath = pdfpath;
                if (!string.IsNullOrEmpty(w.pdfPath))
                {
                    w.ShowDialog();
                    w.wb_pdfWebViewer.Dispose();
                }
                Window.GetWindow(this).Opacity = 1;
                #endregion

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private void Btn_saleNote_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }

                Window.GetWindow(this).Opacity = 0.2;
                wd_saleNote w = new wd_saleNote();
                w.ShowDialog();
                Window.GetWindow(this).Opacity = 1;

                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #7
0
        private void HandleKeyPress(object sender, KeyEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }

                if (e.Key == Key.Return)
                {
                    Btn_save_Click(null, null);
                }
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #8
0
 private void Btn_systmSetting_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (sender != null)
         {
             HelpClass.StartAwait(grid_main);
         }
         //if (MainWindow.groupObject.HasPermissionAction(companySettingsPermission, MainWindow.groupObjects, "one") || SectionData.isAdminPermision())
         //{
         Window.GetWindow(this).Opacity = 0.2;
         wd_reportSystmSetting w = new wd_reportSystmSetting();
         w.windowType = "e";
         w.ShowDialog();
         Window.GetWindow(this).Opacity = 1;
         //}
         //else
         //    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
         if (sender != null)
         {
             HelpClass.EndAwait(grid_main);
         }
     }
     catch (Exception ex)
     {
         if (sender != null)
         {
             HelpClass.EndAwait(grid_main);
         }
         HelpClass.ExceptionMessage(ex, this);
     }
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_mainGrid);

                menuList = new List <string> {
                    "users", "agents", "customers"
                };

                #region translate
                if (MainWindow.lang.Equals("en"))
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.en_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.LeftToRight;
                }
                else
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.ar_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.RightToLeft;
                }
                translate();
                #endregion

                Btn_users_Click(btn_users, null);

                HelpClass.EndAwait(grid_mainGrid);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_mainGrid);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #10
0
        private void Btn_pdf_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                HelpClass.StartAwait(grid_main);

                #region
                BuildReport();

                saveFileDialog.Filter = "PDF|*.pdf;";

                if (saveFileDialog2.ShowDialog() == true)
                {
                    string filepath = saveFileDialog.FileName;
                    LocalReportExtensions.ExportToPDF(rep, filepath);
                }
                #endregion

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #11
0
 private void Btn_image_Click(object sender, RoutedEventArgs e)
 {
     //select image
     try
     {
         HelpClass.StartAwait(grid_main);
         isImgPressed          = true;
         openFileDialog.Filter = "Images|*.png;*.jpg;*.bmp;*.jpeg;*.jfif";
         if (openFileDialog.ShowDialog() == true)
         {
             HelpClass.imageBrush.ImageSource = new BitmapImage(new Uri(openFileDialog.FileName, UriKind.Relative));
             btn_image.Background             = HelpClass.imageBrush;
             imgFileName = openFileDialog.FileName;
         }
         else
         {
         }
         HelpClass.EndAwait(grid_main);
     }
     catch (Exception ex)
     {
         HelpClass.EndAwait(grid_main);
         HelpClass.ExceptionMessage(ex, this);
     }
 }
Beispiel #12
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_branchList);
                }
                translate();
                wb_pdfWebViewer.Navigate(new Uri(pdfPath));

                if (sender != null)
                {
                    HelpClass.EndAwait(grid_branchList);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_branchList);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void Tb_search_TextChanged(object sender, TextChangedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }

                Search();

                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #14
0
        private async void Dg_packageUser_SelectionChanged(object sender, SelectionChangedEventArgs e)
        { //selection
            try
            {
                HelpClass.StartAwait(grid_main);

                if (dg_packageUser.SelectedIndex != -1)
                {
                    packageUser      = dg_packageUser.SelectedItem as PackageUser;
                    this.DataContext = packageUser;

                    if (packageUser != null)
                    {
                        Packages packageModel = new Packages();
                        Packages package      = await packageModel.GetByID(packageUser.packageId.Value);
                    }
                }

                clearValidate();
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #15
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);
                //  sale_note
                requiredControlList = new List <string> {
                    ""
                };

                #region translate
                if (MainWindow.lang.Equals("en"))
                {
                    grid_main.FlowDirection = FlowDirection.LeftToRight;
                }
                else
                {
                    grid_main.FlowDirection = FlowDirection.RightToLeft;
                }
                translat();
                #endregion

                // List<SettingCls> settingsCls = await setModel.GetAll();
                List <SetValues> settingsValues = await valueModel.GetBySetName("sale_note");

                setVNote      = settingsValues.FirstOrDefault();
                tb_notes.Text = setVNote.value;
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #16
0
        private void Btn_lastPage_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }

                //posSerialsQuery = items.Where(x => x.isActive == tglCategoryState);
                pageIndex = ((posSerialsQuery.Count() - 1) / itemsPerPage) + 1;
                #region
                posSerialsQuery = posSerialsQuery.Where(s => s.serial.Contains(txtSearch) ||
                                                        (s.posName != null ? s.posName.Contains(txtSearch) : false) ||
                                                        (s.branchName != null ? s.branchName.Contains(txtSearch) : false));
                txt_count.Text = posSerialsQuery.Count().ToString();
                refreshGrid();
                #endregion
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #17
0
        private void Btn_nextPage_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }

                pageIndex = int.Parse(btn_nextPage.Content.ToString());
                #region
                posSerialsQuery = posSerialsQuery.Where(s => s.serial.Contains(txtSearch) ||
                                                        (s.posName != null ? s.posName.Contains(txtSearch) : false) ||
                                                        (s.branchName != null ? s.branchName.Contains(txtSearch) : false));
                txt_count.Text = posSerialsQuery.Count().ToString();
                refreshGrid();
                #endregion
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private void Btn_companyInfo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }

                Window.GetWindow(this).Opacity = 0.2;
                wd_companyInfo w = new wd_companyInfo();
                w.isFirstTime = false;
                w.ShowDialog();
                Window.GetWindow(this).Opacity = 1;

                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);
                requiredControlList = new List <string> {
                    "name"
                };
                if (MainWindow.lang.Equals("en"))
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.en_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.LeftToRight;
                }
                else
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.ar_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.RightToLeft;
                }
                translate();
                Keyboard.Focus(tb_code);

                await RefreshProgramsList();
                await Search();

                Clear();

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void Btn_refresh_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }

                RefreshSettingsList();
                // RefreshSetttingsView();

                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void Btn_save_Click(object sender, RoutedEventArgs e)
        {//save
            try
            {
                HelpClass.StartAwait(grid_customers);

                foreach (var p in selectedCustomersSource)
                {
                    AgentCustomer ac = new AgentCustomer();
                    ac.agentCustomerId = 0;
                    ac.agentId         = agentID;
                    ac.customerId      = p.custId;
                    ac.createUserId    = MainWindow.userID;
                    selectedCustomers.Add(ac);
                }

                int s = await agentCustomerModel.saveNewList(selectedCustomers, agentID);

                //isActive = true;
                this.Close();

                HelpClass.EndAwait(grid_customers);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_customers);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void Btn_save_Click(object sender, RoutedEventArgs e)
        {//save
            try
            {
                if (sender != null)
                {
                    HelpClass.StartAwait(grid_main);
                }
                //get selcted ids
                List <int> userIds = new List <int>();
                foreach (var u in selectedUsers)
                {
                    userIds.Add(u.userId);
                }

                await groupModel.UpdateGroupIdInUsers(groupId, userIds, MainWindow.userID);

                isActive = true;
                this.Close();
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    HelpClass.EndAwait(grid_main);
                }
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #23
0
        private void Btn_exportToExcel_Click_1(object sender, RoutedEventArgs e)
        {
            //excel
            try
            {
                HelpClass.StartAwait(grid_main);

                #region
                //Thread t1 = new Thread(() =>
                //{
                BuildReport();
                this.Dispatcher.Invoke(() =>
                {
                    saveFileDialog2.Filter = "EXCEL|*.xls;";
                    if (saveFileDialog.ShowDialog() == true)
                    {
                        string filepath = saveFileDialog.FileName;
                        LocalReportExtensions.ExportToExcel(rep, filepath);
                    }
                });


                //});
                //t1.Start();
                #endregion

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #24
0
        private void Dg_posSerial_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {//selection
            try
            {
                HelpClass.StartAwait(grid_main);

                if (dg_posSerial.SelectedIndex != -1)
                {
                    posSerial        = dg_posSerial.SelectedItem as PosSerials;
                    this.DataContext = posSerial;

                    if (posSerial != null)
                    {
                    }
                }

                clearValidate();
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #25
0
        private async void Btn_download_Click(object sender, RoutedEventArgs e)
        {//download
            try
            {
                HelpClass.StartAwait(grid_main);

                HelpClass.validateWindow(requiredControlList, this);
                if (cb_type.SelectedIndex != -1)
                {
                    //string activeState = "rn";//rn OR up  from buton
                    string activeState = cb_type.SelectedValue.ToString();

                    PackageUser pumodel = new PackageUser();
                    ReportCls   rc      = new ReportCls();
                    SendDetail  sd      = new SendDetail();
                    sd = await pumodel.ActivateServerOffline(packageUser.packageUserId, activeState);

                    packagesSend packtemp = new packagesSend();
                    if (sd.packageSend.result > 0)
                    {
                        //encode
                        string myContent = JsonConvert.SerializeObject(sd);

                        saveFileDialog.Filter = "File|*.ac;";
                        if (saveFileDialog.ShowDialog() == true)
                        {
                            string DestPath = saveFileDialog.FileName;

                            bool res = false;

                            res = rc.encodestring(myContent, DestPath);
                            // rc.DelFile(pdfpath);
                            //  rc.decodefile(DestPath,@"D:\stringlist.txt");
                            if (res)
                            {
                                //done
                                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                            }
                            else
                            {
                                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                            }
                        }
                    }
                    else
                    {
                        //error
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }

                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void Btn_add_Click(object sender, RoutedEventArgs e)
        { //add
            try
            {
                HelpClass.StartAwait(grid_main);
                //if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "add"))
                //{

                //      if (HelpClass.validate(requiredControlList, this) && HelpClass.IsValidEmail(this))
                {
                    sysEmail.emailId = 0;
                    sysEmail.name    = tb_name.Text;
                    sysEmail.email   = tb_email.Text;
                    // sysEmail.password = pb_password.Password;
                    sysEmail.password = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(pb_password.Password));

                    sysEmail.port  = int.Parse(tb_port.Text);
                    sysEmail.isSSL = tgl_isSSL.IsChecked.Value;
                    //  sysEmail.isMajor = tgl_isMajor.IsChecked.Value;
                    sysEmail.smtpClient = tb_smtpClient.Text;
                    sysEmail.side       = cb_side.SelectedValue.ToString();
                    // sysEmail.branchId = (int)cb_branchId.SelectedValue;
                    sysEmail.notes        = tb_notes.Text;
                    sysEmail.createUserId = MainWindow.userLogin.userId;
                    sysEmail.updateUserId = MainWindow.userLogin.userId;
                    sysEmail.isActive     = 1;

                    int s = await sysEmail.Save(sysEmail);

                    if (s.Equals(-4))
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trMajorEmaillAlreadyExists"), animation: ToasterAnimation.FadeIn);
                    }
                    else if (!s.Equals(0))
                    {
                        Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopAdd"), animation: ToasterAnimation.FadeIn);

                        Clear();
                        await RefreshUsersList();
                        await Search();
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }
                }
                //}
                //else
                //    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);

                #region translate
                if (MainWindow.lang.Equals("en"))
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.en_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.LeftToRight;
                }
                else
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.ar_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.RightToLeft;
                }
                translate();
                #endregion

                if (!MainWindow.userLogin.type.Equals("ag"))
                {
                    dpnl_country.Visibility = Visibility.Visible;
                    bdr_country.Visibility  = Visibility.Collapsed;
                    await FillCombo.fillCountriesNames(cb_countries);

                    bdr_agent.Visibility = Visibility.Collapsed;
                }
                else
                {
                    dpnl_country.Visibility = Visibility.Collapsed;
                    bdr_country.Visibility  = Visibility.Visible;
                    tb_country.Text         = await HelpClass.getCountry(MainWindow.userLogin.countryId.Value);

                    dpnl_agent.Visibility = Visibility.Collapsed;
                    bdr_agent.Visibility  = Visibility.Visible;
                    tb_agent.Text         = MainWindow.userLogin.accountName;

                    var typelist = new[] {
                        new { Text  = MainWindow.userLogin.name + " " + MainWindow.userLogin.lastName,
                              Value = MainWindow.userLogin.userId }
                    };
                    cb_agents.DisplayMemberPath = "Text";
                    cb_agents.SelectedValuePath = "Value";
                    cb_agents.ItemsSource       = typelist;
                    cb_agents.SelectedIndex     = 0;
                }

                await Search();

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void Btn_update_Click(object sender, RoutedEventArgs e)
        {//update
            try
            {
                HelpClass.StartAwait(grid_main);
                if (sysEmail.emailId > 0)
                {
                    if (HelpClass.validate(requiredControlList, this) && HelpClass.IsValidEmail(this))
                    {
                        sysEmail.email = tb_email.Text;
                        //   sysEmail.password = pb_password.Password;
                        sysEmail.password     = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(pb_password.Password));
                        sysEmail.name         = tb_name.Text;
                        sysEmail.port         = int.Parse(tb_port.Text);
                        sysEmail.isSSL        = tgl_isSSL.IsChecked.Value;
                        sysEmail.isMajor      = true;
                        sysEmail.smtpClient   = tb_smtpClient.Text;
                        sysEmail.side         = cb_side.SelectedValue.ToString();
                        sysEmail.branchId     = 1;
                        sysEmail.notes        = tb_notes.Text;
                        sysEmail.createUserId = MainWindow.userLogin.userId;
                        sysEmail.updateUserId = MainWindow.userLogin.userId;
                        //sysEmail.isActive = 1;
                        //  string s = await sysEmail.Save(sysEmail);
                        int s = await sysEmail.Save(sysEmail);

                        if (s.Equals(-4))
                        {
                            Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trMajorEmaillAlreadyExists"), animation: ToasterAnimation.FadeIn);
                        }
                        else if (!s.Equals(0))
                        {
                            Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopUpdate"), animation: ToasterAnimation.FadeIn);
                            await RefreshUsersList();
                            await Search();
                        }
                        else
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                        }
                    }
                }
                else
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trSelectItemFirst"), animation: ToasterAnimation.FadeIn);
                }



                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #29
0
        private async void Btn_save_Click(object sender, RoutedEventArgs e)
        {//save
            try
            {
                HelpClass.StartAwait(grid_main);

                countryPackageDate = new CountryPackageDate();

                if (!chkIfExist())
                {
                    if (HelpClass.validateWindow(requiredControlList, this))
                    {
                        countryPackageDate.countryId  = Convert.ToInt32(cb_country.SelectedValue);
                        countryPackageDate.packageId  = packageID;
                        countryPackageDate.monthCount = Convert.ToInt32(cb_month.SelectedValue);
                        countryPackageDate.price      = decimal.Parse(tb_price.Text);
                        if (Convert.ToInt32(cb_month.SelectedValue) == 0)
                        {
                            countryPackageDate.islimitDate = false;
                        }
                        else
                        {
                            countryPackageDate.islimitDate = true;
                        }
                        countryPackageDate.notes        = tb_notes.Text;
                        countryPackageDate.isActive     = 1;
                        countryPackageDate.createUserId = MainWindow.userLogin.userId;
                        countryPackageDate.updateUserId = MainWindow.userLogin.userId;

                        int s = await countryPackageDateModel.Save(countryPackageDate);

                        if (s <= 0)
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                        }
                        else
                        {
                            Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopAdd"), animation: ToasterAnimation.FadeIn);

                            Clear();
                            await RefreshCountryPackageDateList();
                            await Search();
                        }
                    }
                }
                else
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopAlreadyExist"), animation: ToasterAnimation.FadeIn);
                }
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Beispiel #30
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);
                requiredControlList = new List <string> {
                    "name", "lastName", "accountName", "mobile", "country"
                };

                #region translate
                if (MainWindow.lang.Equals("en"))
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.en_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.LeftToRight;
                }
                else
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.ar_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.RightToLeft;
                }
                translate();
                #endregion

                if ((MainWindow.userLogin.type.Equals("ad")) || (MainWindow.userLogin.type.Equals("us")))
                {
                    btn_packages.Visibility = Visibility.Visible; btn_customers.Visibility = Visibility.Visible;
                }
                else
                {
                    btn_packages.Visibility = Visibility.Collapsed; btn_customers.Visibility = Visibility.Collapsed;
                }

                await FillCombo.fillCountries(cb_areaMobile);

                await FillCombo.fillCountries(cb_areaPhone);

                await FillCombo.fillCountries(cb_areaFax);

                await FillCombo.fillCountriesNames(cb_country);

                FillCombo.fillAgentLevel(cb_agentLevel);

                Keyboard.Focus(tb_code);

                await Search();

                Clear();

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }