Ejemplo n.º 1
0
        private static int Execute(CommandLineApplication config, IBudgetFilesFactory budgetFilesFactory, ILog log)
        {
            var yearOption     = YearOption.Create(config);
            var monthOption    = MonthOption.Create(config);
            var currencyOption = CurrencyOption.Create(config);

            if (yearOption.NotExists || monthOption.NotExists || currencyOption.NotExists)
            {
                config.ShowHelp();
                return(ErrorCode.Value);
            }

            var(plannedBudgetFile, realBudgetFile) = budgetFilesFactory.Create(yearOption, monthOption, currencyOption);

            if (plannedBudgetFile.NotExists || realBudgetFile.NotExists)
            {
                plannedBudgetFile.Save();
                realBudgetFile.Save();

                log.Write($"Budget {plannedBudgetFile.Budget} has been created.");
                return(OkCode.Value);
            }

            log.Write($"Budget {plannedBudgetFile.Budget} already exists.");
            return(ErrorCode.Value);
        }
Ejemplo n.º 2
0
        public AddCommandBuilder(CommandLineApplication application)
        {
            _application = application;

            _yearOption        = YearOption.Create(application);
            _monthOption       = MonthOption.Create(application);
            _currencyOption    = CurrencyOption.Create(application);
            _amountOption      = AmountOption.Create(application);
            _categoryOption    = CategoryOption.Create(application);
            _descriptionOption = DescriptionOption.Create(application);
        }
        private static string QueryBuilder(int monthIndex)
        {
            string finalQuery = string.Empty;
            string wages      = "WAGE" + monthIndex;
            string pf         = "PF" + monthIndex;
            //converting index value to string for some column to get month in spell
            MonthOption month      = (MonthOption)monthIndex;
            string      monthValue = month.ToString();
            string      eePercent  = monthValue.Substring(0, 3) + "EE";
            string      erPercent  = monthValue.Substring(0, 3) + "ER";

            return(finalQuery = "SELECT EMP_UAN, EMP_NAME, " + wages + "," + wages + "," + wages + "," + wages + "," + eePercent + "," + pf + "," + erPercent + ", PF13 as NCPdays, PF13 as Totaldays");
        }
Ejemplo n.º 4
0
 public void FillRegistrationForm(RegistrationUser user)
 {
     Type(FirstName, user.FirstName);
     Type(LastName, user.LastName);
     FillManyOptionElements(MatrialStatus, user.MatrialStatus);
     FillManyOptionElements(Hobbies, user.Hobbies);
     CountryOption.SelectByText(user.Country);
     MonthOption.SelectByValue(user.Month);
     DayOption.SelectByText(user.Day);
     YearOption.SelectByValue(user.Year);
     Type(Phone, user.Phone);
     Type(UserName, user.UserName);
     Type(Email, user.Email);
     UploadPicButton.Click();
     _driver.SwitchTo().ActiveElement().SendKeys(user.PicturePath);
     Type(Description, user.Description);
     Type(Password, user.Password);
     Type(ConfirmPassword, user.ConfirmPassword);
     SubmitButton.Click();
 }
Ejemplo n.º 5
0
 public void FillRegistrationForm()
 {
     Type(FirstName, "Ventsislav");
     Type(LastName, "Ivanov");
     this.MatrialStatus.Click();
     this.Hobbies[0].Click();
     this.Hobbies[1].Click();
     CountryOption.SelectByText("Bulgaria");
     MonthOption.SelectByValue("3");
     DayOption.SelectByText("3");
     YearOption.SelectByValue("1989");
     Type(Phone, "359999999999");
     Type(UserName, "BatmanForever");
     Type(Email, "*****@*****.**");
     UploadPicButton.Click();
     Driver.SwitchTo().ActiveElement().SendKeys(Path.GetFullPath(@"..\..\..\logo.jpg"));
     Type(Description, "I think I'm Ready with this test!");
     Type(Password, "123456789");
     Type(ConfirmPassword, "123456789");
     SubmitButton.Click();
 }
        public void FillForm(User user)
        {
            FirstName.SendKeys(user.FirstName);
            LastName.SendKeys(user.LastName);

            Password.SendKeys(user.Password);
            Days.Click();
            DayOption.Click();
            Months.Click();
            MonthOption.Click();
            Years.Click();
            YearOption.Click();
            Address.SendKeys(user.Address);
            City.SendKeys(user.City);
            State.Click();
            StateOption.Click();
            Zip.SendKeys(user.ZipCode);

            HomePhone.SendKeys(user.HomePhone);
            Mobile.SendKeys(user.MobilePhone);
            AddressAlias.Clear();
            AddressAlias.SendKeys(user.AddressAlias);
            RegisterButton.Click();
        }
        public static DataTable ReadDBFfile(string filePath, int monthIndex)
        {
            var dbf = new Dbf();

            dbf.Read(filePath);
            var dt = new DataTable();


            //return dt;

            // Cols
            for (int i = 0; i < dbf.Fields.Count; i++)
            {
                dt.Columns.Add(dbf.Fields[i].Name, dbf.Fields[i].GetType().GetProperties()[0].PropertyType);
            }

            // Rows
            foreach (DbfRecord record in dbf.Records)
            {
                var row = dt.NewRow();
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    row[i] = record.Data[i];
                }
                dt.Rows.Add(row);
            }
            // Clean
            dbf = null;

            //var dt2 = new DataTable();

            //converting index value to string for some column to get month in spell
            MonthOption month      = (MonthOption)monthIndex;
            string      pf         = "PF" + monthIndex;
            string      monthValue = month.ToString();
            string      eePercent  = monthValue.Substring(0, 3) + "EE";
            string      erPercent  = monthValue.Substring(0, 3) + "ER";
            //SHOULD  I make a concrete class for this
            var res = from myRow in dt.AsEnumerable()
                      where myRow.Field <string>("WAGE" + monthIndex.ToString()) != null
                      select new Anon
            {
                EMP_UAN    = myRow.Field <string>("EMP_UAN"),
                EMP_NAME   = myRow.Field <string>("EMP_NAME"),
                EMP_WAGE   = Convert.ToInt32(myRow.Field <string>("WAGE" + monthIndex.ToString())),
                EMP_WAGE2  = Convert.ToInt32(myRow.Field <string>("WAGE" + monthIndex.ToString())),
                EMP_WAGE3  = Convert.ToInt32(myRow.Field <string>("WAGE" + monthIndex.ToString())),
                EMP_WAGE4  = Convert.ToInt32(myRow.Field <string>("WAGE" + monthIndex.ToString())),
                EE_Percent = Convert.ToInt32(myRow.Field <string>(eePercent)),
                PF         = Convert.ToInt32(myRow.Field <string>(pf)),
                ER_Percent = Convert.ToInt32(myRow.Field <string>(erPercent))
            };

            dt = new DataTable();
            dt.Columns.Add("EMP_UAN");
            dt.Columns.Add("EMP_NAME");
            dt.Columns.Add("WAGE" + monthIndex.ToString());
            dt.Columns.Add("WAGE" + monthIndex.ToString() + 1);
            dt.Columns.Add("WAGE" + monthIndex.ToString() + 2);
            dt.Columns.Add("WAGE" + monthIndex.ToString() + 3);
            dt.Columns.Add("EEPer" + monthIndex.ToString());
            dt.Columns.Add(pf);
            dt.Columns.Add("ERPer" + monthIndex.ToString());
            dt.Columns.Add("NCPDays");
            dt.Columns.Add("Totaldays");

            foreach (var item in res)
            {
                DataRow row = dt.NewRow();

                foreach (var col in dt.Columns)
                {
                    row[columnName : "EMP_UAN"]  = item.EMP_UAN;
                    row[columnName : "EMP_NAME"] = item.EMP_NAME;
                    row[columnName : "WAGE" + monthIndex.ToString()]     = item.EMP_WAGE;
                    row[columnName : "WAGE" + monthIndex.ToString() + 1] = item.EMP_WAGE2;
                    row[columnName : "WAGE" + monthIndex.ToString() + 2] = item.EMP_WAGE3;
                    row[columnName : "WAGE" + monthIndex.ToString() + 3] = item.EMP_WAGE4;
                    row[columnName : "EEPer" + monthIndex.ToString()]    = item.EE_Percent;
                    row[columnName : pf] = item.PF;
                    row[columnName : "ERPer" + monthIndex.ToString()] = item.ER_Percent;
                    row[columnName : "NCPdays"]   = 0;
                    row[columnName : "Totaldays"] = 0;
                }

                dt.Rows.Add(row);
            }

            return(dt);
        }