Ejemplo n.º 1
0
        public static string PeriodConv(CountryPackageDate CountryPackageDateModel)
        {
            string period      = "";
            int    monthCount  = int.Parse(CountryPackageDateModel.monthCount.ToString());
            bool   islimitDate = bool.Parse(CountryPackageDateModel.islimitDate.ToString());

            if (!islimitDate)
            {
                period = MainWindow.resourcemanager.GetString("trUnLimited");
            }
            else
            {
                switch (monthCount)
                {
                case 1: period = MainWindow.resourcemanagerreport.GetString("trOneMonth"); break;

                case 3: period = MainWindow.resourcemanagerreport.GetString("trThreeMonth"); break;

                case 6: period = MainWindow.resourcemanagerreport.GetString("trSixMonth"); break;

                case 12: period = MainWindow.resourcemanagerreport.GetString("trTwelveMonth"); break;
                }
            }
            return(period);
        }
Ejemplo n.º 2
0
        public async Task <string> getdata()
        {
            PayOpModel = new PayOp();
            PayOpModel = await PayOpModel.getLastPayOp(packUserRep.packageUserId);

            if (PayOpModel.payOpId <= 0)
            {
                return("0");
            }
            else
            {
                agentmodel = await agentmodel.GetByID((int)packUserRep.userId);

                cumstomerModel = await cumstomerModel.GetByID((int)packUserRep.customerId);

                CountryPackageDateModel = await CountryPackageDateModel.GetByID((int)PayOpModel.countryPackageId);

                PackagesModel = await PackagesModel.GetByID((int)PayOpModel.packageId);

                SetValuesList = await terms.GetBySetName("sale_note");

                terms = SetValuesList.FirstOrDefault();
                //  CountryPackageDateModel.monthCount;
                return("1");
            }
        }
Ejemplo n.º 3
0
        private void Dg_package_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {//selection
            try
            {
                if (dg_package.SelectedIndex != -1)
                {
                    countryPackageDate = dg_package.SelectedItem as CountryPackageDate;
                    this.DataContext   = countryPackageDate;
                    if (countryPackageDate != null)
                    {
                        this.DataContext = countryPackageDate;

                        if (!countryPackageDate.islimitDate)
                        {
                            cb_month.SelectedValue = 0;
                        }
                        else
                        {
                            switch (countryPackageDate.monthCount)
                            {
                            case 1: cb_month.SelectedValue = 1;  break;

                            case 3: cb_month.SelectedValue = 3;  break;

                            case 6: cb_month.SelectedValue = 6;  break;

                            case 12: cb_month.SelectedValue = 12; break;
                            }
                        }

                        this.DataContext = countryPackageDate;

                        #region delete
                        if (countryPackageDate.canDelete)
                        {
                            btn_delete.Content = MainWindow.resourcemanager.GetString("trDelete");
                        }
                        else
                        {
                            if (countryPackageDate.isActive == 0)
                            {
                                btn_delete.Content = MainWindow.resourcemanager.GetString("trActive");
                            }
                            else
                            {
                                btn_delete.Content = MainWindow.resourcemanager.GetString("trInActive");
                            }
                        }
                        #endregion
                    }
                }

                HelpClass.clearValidateWindow(requiredControlList, this);
            }
            catch (Exception ex)
            {
                HelpClass.ExceptionMessage(ex, this);
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        public static string getPeriod(CountryPackageDate cpd)
        {
            string period = "";

            if (!cpd.islimitDate)
            {
                period = MainWindow.resourcemanager.GetString("trUnLimited");
            }
            else
            {
                switch (cpd.monthCount)
                {
                case 1: period = MainWindow.resourcemanager.GetString("trOneMonth"); break;

                case 3: period = MainWindow.resourcemanager.GetString("trThreeMonth"); break;

                case 6: period = MainWindow.resourcemanager.GetString("trSixMonth"); break;

                case 12: period = MainWindow.resourcemanager.GetString("trTwelveMonth"); break;
                }
            }
            return(period);
        }
Ejemplo n.º 6
0
 private async void Cb_period_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {//select period
     try
     {
         if (cb_period.SelectedIndex != -1)
         {
             CountryPackageDate cpd = new CountryPackageDate();
             try
             {
                 cpd = await cpdModel.GetByID((int)cb_period.SelectedValue);
             }
             catch { cpd = await cpdModel.GetByID((int)cb_period.SelectedValue); }
             txt_price.Text = cpd.price.ToString() + " " + cpd.currency.ToString();
         }
         else
         {
             txt_price.Text = "";
         }
     }
     catch (Exception ex)
     {
         HelpClass.ExceptionMessage(ex, this);
     }
 }