/// <summary> /// Deserialise FileZilla binary data into object /// </summary> /// <param name="reader">Binary reader to read data from</param> /// <param name="protocolVersion">Current FileZilla protocol version</param> /// <param name="index">The 0 based index of this item in relation to any parent list</param> public void Deserialize(BinaryReader reader, int protocolVersion, int index) { SpeedLimit = reader.ReadBigEndianInt32(); Date = reader.ReadDate(); FromTime = reader.ReadTime(); ToTime = reader.ReadTime(); Days = (Days)reader.ReadByte(); }
public Player(string nick, string real, Jobs job, int level, Days day) { NickName = nick; RealName = real; Job = job; Level = level; AvailableDays = day; }
public Cluster(Point centerPoint, List<Order> ordersInCluster, Days daysPlannedFor) { this.CenterPoint = centerPoint; this.AvailableOrdersInCluster = ordersInCluster; foreach (Order order in ordersInCluster) order.PutInCluster(this); }
private static Forecast Get(ForecastResponce fr, Days day) { return new Forecast { Humidity = fr.list[(int)(day)].Main.humidity, Temperature = Math.Round(fr.list[(int)(day)].Main.temp - 273) }; }
public Route(Days Day) { this.Orders = new List<Order>(); this.TravelTime = 1800.0d; this.Weight = 0; this.Day = Day; this.Orders.Add(Data.GetOrder0()); }
public bool CheckDay(Days shedule, Days dayToCheck) { if ((shedule & dayToCheck) == dayToCheck) { return true; } return false; }
public bool ArrangeDay(ref Days shedule, Days dayToAdd) { if ((shedule & dayToAdd)==dayToAdd) { return false; } shedule |= dayToAdd; return true; }
public void AddNewItemToPlanning(Days day, int truckID, List<Route> routes) { TruckPlanning.Add(new Tuple<Days, int, List<Route>>(day, truckID, routes)); foreach (Route route in routes) { foreach (Order order in route.Orders) this.AddPlannedOccurrence(order.OrderNumber, route); AvailableRoutes.Remove(route); TravelTimeScore += route.TravelTime; } }
public bool CanAddOrder(Days day) { if (OrderDayOccurrences.HasFlag(day)) return false; // Already occurred on specified day foreach (Days restrictions in OrderDayRestrictions) if (restrictions.HasFlag(day)) return true; // Order has yet to occur on specified day and can be added accorrding to the restrictions return false; // restrictions is either empty or does not have the specified day in its restriction }
void AdvanceDay() { if (curDay == Days.Heswir) { curDay = Days.Vydir; AdvanceWeek(); } else { curDay++; } morningTick = false; dinnerTick = false; FamilyResources.instance.DayTick (); }
public override Solution executeStrategy(Solution toStartFrom) { if (toStartFrom.AvailableRoutes.Count == 0) return toStartFrom; int routeIndex = random.Next(toStartFrom.AvailableRoutes.Count); Route routeToDestroy = toStartFrom.AvailableRoutes[routeIndex]; toStartFrom.RemoveRoute(routeToDestroy); ordersDestroyed = routeToDestroy.Orders; dayDestroyed = routeToDestroy.Day; routeToDestroy.Destroy(); strategyHasExecuted = true; return toStartFrom; }
public override Solution executeStrategy(Solution toStartFrom) { Planning = toStartFrom.GetRandomPlanning(); if (Planning.Item3.Count == 0) return toStartFrom; Route routeToDestroy = Planning.Item3[random.Next(Planning.Item3.Count)]; ordersDestroyed = routeToDestroy.Orders; dayDestroyed = routeToDestroy.Day; toStartFrom.RemoveRouteFromPlanning(Planning.Item1, Planning.Item2, routeToDestroy); toStartFrom.RemoveRoute(routeToDestroy); routeToDestroy.Destroy(); strategyHasExecuted = true; return toStartFrom; }
public void ResetDay(ref Days shedule, Days dayToRemove) { shedule &= ~dayToRemove; }
private void bAcceptar_Click(object sender, EventArgs e) { string message; string caption = "Ha habido un error"; MessageBoxButtons buttons; DialogResult result; double price; int minimAl, maxAl; if (dateini.Value > datefi.Value) { message = "La fecha de inicio no puede ser posterior a la fin"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } else if (comboSelectPicina.SelectedIndex == -1) { message = "Tienes de seleccionar una picina"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } else if (txtdescripcio.Text == "") { message = "Tienes de escribir una descripción"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } else if (combohores.SelectedIndex == -1) { message = "Tienes de seleccionar una hora"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } else if (!Double.TryParse(txtPreu.Text, out price) || price < 0) { message = "Tienes de incluir un precio"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } else if (!Int32.TryParse(txtMinimAl.Text, out minimAl) || minimAl < 0) { message = "Numero de alumnos mínimo erroneo"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } else if (!Int32.TryParse(txtMaxA.Text, out maxAl) || maxAl < 0) { message = "Numero de alumnos máximo erroneo"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } else if (minimAl > maxAl) { message = "No puede ser menor el máximo que el mínimo número de alumnos"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } else { Pool pSelected = service.FindPoolByZipCode(Convert.ToInt32(comboSelectPicina.SelectedItem.ToString())); DateTime dStart = dateini.Value; DateTime dfi = datefi.Value; String valhora = combohores.SelectedItem.ToString(); Char delimiter = ':'; String[] substrings = valhora.Split(delimiter); Days daysCurs = new Days(); int cont = 0; // Days daysCurs = Days.Wednesday | Days.Friday; if (cbdilluns.Checked) { cont = 1; daysCurs = Days.Monday; } if (cbcdimarts.Checked) { cont = 1; daysCurs = daysCurs | Days.Tuesday; } if (cbdimecres.Checked) { cont = 1; daysCurs = daysCurs | Days.Wednesday; } if (cbdijous.Checked) { cont = 1; daysCurs = daysCurs | Days.Thursday; } if (cbdivendres.Checked) { cont = 1; daysCurs = daysCurs | Days.Friday; } if (cbdisapte.Checked) { cont = 1; daysCurs = daysCurs | Days.Saturday; } if (cont == 1) { List <int> lan = new List <int>(); foreach (int l in chekedLanes.CheckedItems.Cast <int>()) { lan.Add(l); } if (lan.Count > 0) { bool inser = service.AddCourse(pSelected, txtdescripcio.Text, dStart, dfi, createTime(Int32.Parse(substrings[0]), Int32.Parse(substrings[1]), 0), new TimeSpan(0, 45, 0), daysCurs, minimAl, maxAl, price, lan); if (!inser) { message = "No se ha insertado el curso"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } else { message = "Se ha insertado el curso correctamente"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); this.Close(); } } else { message = "Tienes que seleccionar alguna linia"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } } else { message = "Tienes que seleccionar al menos un día"; buttons = MessageBoxButtons.OK; result = MessageBox.Show(message, caption, buttons); } } }
public static string PrepareRequestByAutoIP(MethodType methodType, string key, Days ofDays) { return(string.Concat(methodType.GetParameters(), "?key=", key, "&", ReqestFor.AutoIP(), "&", ofDays.PrepareDays())); }
public TestClass() { // initialize demo vars. fieldDay = Days.Tue; fieldClassInstance = new Child(5); fieldClassInstance.fctChild1(new int[3] { 1, 2, 3 }); // accept only arrays fieldClassInstance.fctChild3(1, 2, 3); // parameters are converted to array fieldClassInstance.fctChild3(new int[3] { 1, 2, 3 }); // also accept array fieldHash = new Hashtable(); fieldHash.Add("Tuesday", fieldDay); fieldArrayList = new ArrayList(); fieldArrayList.Add(fieldDay); // init bound array int[] myLengthsArray = new int[3] { 1, 2, 5 }; // 1 by 2 by 5 int[] myBoundsArray = new int[3] { 2, 3, 8 }; // 2..4 , 3..4 , 8..12 fieldArray = Array.CreateInstance(typeof(Object), myLengthsArray, myBoundsArray); // sub array int[] myIndArray = new int[3]; myIndArray[0] = 2; myIndArray[1] = 4; myIndArray[2] = 6; fieldArray.SetValue(238, new int[3] { 2, 3, 8 }); fieldArray.SetValue("239", new int[3] { 2, 3, 9 }); fieldArray.SetValue(DateTime.Now, new int[3] { 2, 4, 8 }); fieldArray.SetValue(fieldClassInstance, new int[3] { 2, 4, 9 }); fieldArray.SetValue(myIndArray, new int[3] { 2, 4, 10 }); }
private void WriteAttributes(XmlWriter w, bool newGuids = false) { if (newGuids) { w.WriteAttributeString("Id", Guid.NewGuid().ToString()); } else { w.WriteAttributeString("Id", Id.ToString()); } w.WriteAttributeString("Order", Order.ToString()); w.WriteAttributeString("Field", ConditionName); w.WriteAttributeString("Comparison", Comparison); if (Description.HasValue()) { w.WriteAttributeString("Description", Description); } if (PreviousName.HasValue()) { w.WriteAttributeString("PreviousName", Description); } if (TextValue.HasValue()) { w.WriteAttributeString("TextValue", TextValue); } if (DateValue.HasValue) { w.WriteAttributeString("DateValue", DateValue.ToString()); } if (CodeIdValue.HasValue()) { w.WriteAttributeString("CodeIdValue", CodeIdValue); } if (StartDate.HasValue) { w.WriteAttributeString("StartDate", StartDate.ToString()); } if (EndDate.HasValue) { w.WriteAttributeString("EndDate", EndDate.ToString()); } if (Program > 0) { w.WriteAttributeString("Program", Program.ToString()); } if (Division > 0) { w.WriteAttributeString("Division", Division.ToString()); } if (Organization > 0) { w.WriteAttributeString("Organization", Organization.ToString()); } if (OrgType > 0) { w.WriteAttributeString("OrgType", OrgType.ToString()); } if (Days > 0) { w.WriteAttributeString("Days", Days.ToString()); } if (Quarters.HasValue()) { w.WriteAttributeString("Quarters", Quarters); } if (Tags.HasValue()) { w.WriteAttributeString("Tags", Tags); } if (Schedule != 0) { w.WriteAttributeString("Schedule", Schedule.ToString()); } if (Campus > 0) { w.WriteAttributeString("Campus", Campus.ToString()); } if (ConditionName != "FamilyHasChildrenAged") { Age = null; } if (Age.HasValue) { w.WriteAttributeString("Age", Age.ToString()); } if (SavedQuery.HasValue()) { w.WriteAttributeString("SavedQueryIdDesc", SavedQuery); } if (OnlineReg.HasValue) { w.WriteAttributeString("OnlineReg", OnlineReg.ToString()); } if (OrgStatus.HasValue) { w.WriteAttributeString("OrgStatus", OrgStatus.ToString()); } if (OrgType2.HasValue) { w.WriteAttributeString("OrgType2", OrgType2.ToString()); } if (OrgName.HasValue()) { w.WriteAttributeString("OrgName", OrgName); } }
internal void ValidateDaysAndTime() { try { IList <string> DaysList = GlobalDefinitions.ExcelLib.ReadData(2, "Selectday").Split('/'); //Getting count for all days //Check the checkbox is selected for days mentioned in excel and validate time for same int DaysRows = Days.FindElements(By.Name("Available")).Count; foreach (string AvailableDays in DaysList) { for (int i = 1; i <= DaysRows; i++) { string DayValue = Days.FindElements(By.ClassName("fields"))[i].Text; if (AvailableDays.ToLower() == DayValue.ToLower()) { Console.WriteLine("Selected {0}", Days.FindElements(By.Name("Available"))[i - 1].Selected); Console.WriteLine("First Start date check {0} {1}", Days.FindElements(By.Name("StartTime"))[i - 1].GetAttribute("value"), DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("HH:mm")); if (Days.FindElements(By.Name("Available"))[i - 1].Selected && Days.FindElements(By.Name("StartTime"))[i - 1].GetAttribute("value") == DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("HH:mm") && Days.FindElements(By.Name("EndTime"))[i - 1].GetAttribute("value") == DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("HH:mm")) { Base.test.Log(LogStatus.Pass, DayValue + " is selected and Time is Entered Successfully"); Assert.IsTrue(true); } else { Base.test.Log(LogStatus.Fail, DayValue + " is not selected or Time Entered Failed, Image - " + SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Report")); } } } } } catch (Exception e) { Base.test.Log(LogStatus.Fail, "Caught Exception For Day and Time", e.Message); } }
//TODO: Rename rate to Base Rate //finds the adjustment rate of the A5 table for the corresponsing baserate, //arm, and days. public static String getA5AdjustmentRate(string rate, Arm arm, Days days) { pstrl("getA5AdjustmentRate() called"); const int RATES_ROW_START = 2;//row where base rates and rate adjustments are displayed from top to bottom //the adj_rate_col is the one column that contains the adjustment rate. //The column that the adjustment rate lies in is dependent on the Arm //enum type, and the Days enum type. int adj_rate_col; //the base_rate_col is the one column that contains the base rate that's dependent //on the Arm enum type. int base_rate_col; //first set the adj_rate_col to where one of the ARM types adjustment rate column starts. if (arm == Arm.Arm5) { base_rate_col = FIVE_ONE_ARM_BASE_RATE_COL; } else if (arm == Arm.Arm7) { base_rate_col = SEVEN_ONE_ARM_BASE_RATE_COL; } else { base_rate_col = THIRTY_YEAR_BASE_RATE_COL; } //now that the adjustment rate col's base location is known, we just offset it depending on the Days //enum type to find the column we want. if (days == Days.Day15) { adj_rate_col = (base_rate_col + 1); } else if (days == Days.Day30) { adj_rate_col = base_rate_col + 2; } else if (days == Days.Day45) { adj_rate_col = base_rate_col + 3; } else { throw new Exception("Days enum type is invalid"); } String adjustmentRate = null; for (int i = RATES_ROW_START; i < A5_TABLE_ROWS; i++) { if (a5Table[i, base_rate_col] != rate) { Console.WriteLine(String.Format("a5Table[{0}, {1}] != {2}", i, base_rate_col, rate)); continue; } else { Console.WriteLine("Adjustment rate found!"); adjustmentRate = a5Table[i, adj_rate_col]; } } pstrl("[adj_rate_col:" + adj_rate_col.ToString() + ",base_rate_col:" + base_rate_col + "]"); //If no adjustment rate was found, then the input parameters to this function were incorrect. if (adjustmentRate == null) { throw new Exception("There exists no adjustment rate for the rate, ARM, and Days parameters"); } else { return(adjustmentRate); } }
public WeatherModel GetWeatherDataByAutoIP( string key, Days ForecastOfDays) { return GetData(APIURL + RequestBuilder.PrepareRequestByAutoIP(MethodType.Forecast, key, ForecastOfDays)); }
public WeatherModel GetWeatherData( string key, GetBy getBy, string value, Days ForecastOfDays) { return GetData(APIURL +RequestBuilder.PrepareRequest(MethodType.Forecast, key, getBy, value, ForecastOfDays)); }
private IEnumerable<TimeTable> Parse(List<List<string>> rows, City city) { string busNumber; string stopName; string finalStop; Days days = new Days(); IEnumerable<Shedule> stops; List<TimeTable> Result = new List<TimeTable>(); foreach (List<string> row in rows) { if (!String.IsNullOrEmpty(row[0] as string) && !String.IsNullOrEmpty(row[1] as string) && !String.IsNullOrEmpty(row[2] as string) && !String.IsNullOrEmpty(row[3] as string)) { busNumber = row[busNumberOffset].Remove(0, 1); stopName = row[stopNameOffset].Trim(' '); finalStop = row[finalStopOffset].Trim(' '); var daysList = row[daysOffset].Split(','); days = new Days(); foreach (var item in daysList) { switch (item.Trim(' ')) { case "ПН": { days |= Days.Monday; break; } case "ВТ": { days |= Days.Tuesday; break; } case "СР": { days |= Days.Wednesday; break; } case "ЧТ": { days |= Days.Thursday; break; } case "ПТ": { days |= Days.Friday; break; } case "СБ": { days |= Days.Saturday; break; } case "ВС": { days |= Days.Sunday; break; } case "Р": { days |= Days.Working; break; } case "В": { days |= Days.Weekend; break; } } } stops = Convert(row.Skip(sheduleStartOffset).Take(row.Count() - endOffset), days); if (!Result.Where(x => x.Stop.Name == stopName && x.Bus.Number == busNumber && x.FinalStop.Name == finalStop).Any()) { Result.Add(new TimeTable { Bus = new Bus { Number = busNumber, CityId = city.Id }, Stop = new Stop { Name = stopName, CityId = city.Id }, FinalStop = new Stop { Name = finalStop, CityId = city.Id }, Shedules = stops.ToList() }); } else { var shedules = Result.Where(x => x.Stop.Name == stopName && x.Bus.Number == busNumber && x.FinalStop.Name == finalStop).First().Shedules; foreach (var temp in stops) { shedules.Add(temp); } } } } return Result; }
//======================================================// private IEnumerable<Shedule> Convert(IEnumerable<string> values, Days days) { return values.Where(x => !String.IsNullOrEmpty(x)).Select(x => new Shedule { Days = days, Time = Helper(x) }); }
/// <summary> /// Default constructor (sets defaults as in FileZilla server interface) /// </summary> public SpeedLimitRule() { SpeedLimit = 8; Days = Days.All; }
public TestClass() { // initialize demo vars. fieldDay = Days.Tue; fieldClassInstance = new Child(5); fieldClassInstance.fctChild1(new int[3] { 1, 2, 3 }); // accept only arrays fieldClassInstance.fctChild3(1, 2, 3); // parameters are converted to array fieldClassInstance.fctChild3(new int[3] { 1, 2, 3 }); // also accept array // init array int[] myLengthsArray = new int[3] { 1, 2, 5 }; // 1 by 2 by 5 // sub array int[] myIndArray = new int[3]; myIndArray[0] = 2; myIndArray[1] = 4; myIndArray[2] = 6; fieldArray = Array.CreateInstance(typeof(Object), myLengthsArray); // Silerlight 2 support only 0 based array index fieldArray.SetValue(238, new int[3] { 0, 1, 3 }); fieldArray.SetValue("239", new int[3] { 0, 1, 2 }); fieldArray.SetValue(DateTime.Now, new int[3] { 0, 0, 3 }); fieldArray.SetValue(fieldClassInstance, new int[3] { 0, 0, 4 }); fieldArray.SetValue(myIndArray, new int[3] { 0, 1, 4 }); }
public void AddDay(Day day) => Days.Add(day);
public void Silly(Days s) { Contract.Assert(((int)s) >= 0); // true as we assume that enums can only take their initial values }
public WeatherModel GetWeatherDataByLatLong( string key, string latitude, string longitude, Days ForecastOfDays) { return GetData(APIURL + RequestBuilder.PrepareRequestByLatLong(MethodType.Forecast, key,latitude,longitude, ForecastOfDays)); }
private void addDay(int day, CalendarMonth month, bool isCurrentMonth) { Days.Add(new ReportsCalendarDayViewModel(day, month, isCurrentMonth, today)); }
public static string PrepareRequest( MethodType methodType,string key, GetBy getBy, string value, Days ofDays) { return string.Concat(methodType.GetParameters(),"?key=",key,"&", getBy.PrepareQueryParameter(value),"&", ofDays.PrepareDays()); }
public override bool DoValidation(Kid kid, Days day) { return(Days.Sun != day && kid.Height > 65); }
public static string PrepareRequestByAutoIP(MethodType methodType, string key, Days ofDays ) { return string.Concat(methodType.GetParameters(), "?key=", key, "&", ReqestFor.AutoIP(), "&", ofDays.PrepareDays()); }
// Start is called before the first frame update void Start() { currentDay = Days.sun; }
public static string PrepareRequestByLatLong(MethodType methodType, string key, string latitude, string longitude, Days ofDays) { return string.Concat(methodType.GetParameters(), "?key=", key, "&", ReqestFor.LatLong(latitude,longitude) , "&", ofDays.PrepareDays()); }
public static string PrepareRequestByLatLong(MethodType methodType, string key, string latitude, string longitude, Days ofDays) { return(string.Concat(methodType.GetParameters(), "?key=", key, "&", ReqestFor.LatLong(latitude, longitude), "&", ofDays.PrepareDays())); }
public string Translate(Days d) { switch (d) { case Days.Sun: // 0 case Days.Tue: // 2 case Days.Thu: // 4 case Days.Fri: // 5 return "Even"; case Days.Mon: // 1 case Days.Sat: // 6 return "Odd"; default: Contract.Assert(false); // we forgot one case! return null; } }
public static string PrepareRequest(MethodType methodType, string key, GetBy getBy, string value, Days ofDays) { return(string.Concat(methodType.GetParameters(), "?key=", key, "&", getBy.PrepareQueryParameter(value), "&", ofDays.PrepareDays())); }
public Account(Days days) { _days = days; }
public void DateChecking(Days day) { int next = ((int)day + 7) % 7; Assert.AreEqual(day, (Days)next); }
public ActionResult AddShedule(AddSheduleViewModel model) { int cityId = (int)Session["City"]; if (ModelState.IsValid) { try { var busId = int.Parse(model.Bus); var stop = stopsRepository.Get(x => x.CityId == cityId && x.Name == model.Stop).First(); var endStop = stopsRepository.Get(x => x.CityId == cityId && x.Name == model.EndStop).First(); var timeTable = timeTablesRepository.Get(x => x.BusId == busId && x.Stop.Id == stop.Id && x.FinalStop.Id == endStop.Id).First(); Days days = new Days(); foreach (var day in model.SelectedDays) { days |= ((Days[])Enum.GetValues(typeof(Days))).Where(x => x.ToDescription() == day).First(); } List<Shedule> sheduleRange = new List<Shedule>(); foreach (var time in model.Shedule) { sheduleRange.Add(new Shedule { Days = days, TimeTableId = timeTable.Id, Time = time }); } shedulesRepository.InsertRange(sheduleRange); model.Shedule = null; model.Bus = null; model.SelectedDays = null; TempData["Success"] = "Запись добавлена"; } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error(ex); ModelState.AddModelError("", "Ошибка при добавлении записи. Повторите попытку позже"); } } model.Buses = timeTablesRepository.Get(x => x.Bus.CityId == cityId && x.Shedules.Count == 0) .Select(x => x.Bus) .Distinct() .Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Number }); model.Days = ((Days[])Enum.GetValues(typeof(Days))).Select(x => x.ToDescription()); return View(model); }
internal void EditShareSkill() { GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\Rammy\Desktop\marsframework\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); GlobalDefinitions.wait(30); //Click on ShareSkill button ShareSkillButton.Click(); //Wait GlobalDefinitions.wait(30); //Enter data in Title textbox Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Title")); string TitleTextbox = Title.GetAttribute("Value"); if (TitleTextbox.Length == 0) { Assert.IsEmpty("Title"); } //Enter data in Description textbox Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Description")); Assert.That(Description.Text, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(3, "Description"))); CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Category")); CategoryDropDown.Click(); SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "SubCategory")); SubCategoryDropDown.Click(); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Tags")); Tags.SendKeys(Keys.Enter); //Click on Hourly basis service or One-off service if (GlobalDefinitions.ExcelLib.ReadData(3, "Service Type") == "Hourly basis service") { Hourlybasisservice.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "Service Type") == "One-off service") { OneOffservice.Click(); } //Click on On-site or Online if (GlobalDefinitions.ExcelLib.ReadData(3, "Location Type") == "On-site") { OnSite.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "Location Type") == "Online") { Online.Click(); } //Wait GlobalDefinitions.wait(60); //Convert excel dateformat to C# - Enter data in Staredate string dateformat = "dd / MM / yyyy"; string sdate = GlobalDefinitions.ExcelLib.ReadData(3, "Startdate"); string newStartDate = DateTime.Parse(sdate).ToString(dateformat); StartDateDropDown.SendKeys(newStartDate); string StartDate = StartDateDropDown.GetAttribute("Value"); if (StartDate.Length == 0) { Assert.IsEmpty("Startdate"); } //Convert excel dateformat to C# - Enter data in Enddate string edate = GlobalDefinitions.ExcelLib.ReadData(3, "Enddate"); string newEndDate = DateTime.Parse(edate).ToString(dateformat); EndDateDropDown.SendKeys(newEndDate); string EndDate = EndDateDropDown.GetAttribute("Value"); if (EndDate.Length == 0) { Assert.IsEmpty("Enddate"); } //Wait GlobalDefinitions.wait(60); //Click on a day Days.Click(); //Convert excel timeformat to C# - enter data in Starttime string timeformat = "hh:mmtt"; string stime = GlobalDefinitions.ExcelLib.ReadData(3, "Starttime"); string newStartTime = DateTime.Parse(stime).ToString(timeformat); StartTimeDropDown.SendKeys(newStartTime); string Start = StartTimeDropDown.GetAttribute("Value"); if (Start.Length == 0) { Assert.IsEmpty("Starttime"); } //Convert excel timeformat to C# - enter data in Endtime string etime = GlobalDefinitions.ExcelLib.ReadData(3, "Endtime"); string newEndTime = DateTime.Parse(etime).ToString(timeformat); EndTimeDropDown.SendKeys(newEndTime); string End = EndTimeDropDown.GetAttribute("Value"); if (End.Length == 0) { Assert.IsEmpty("Endtime"); } //Click on Skill-exchange or Credit if (GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade") == "Skill-exchange") { SkillExchangeOption.Click(); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade") == "Credit") { CreditOption.Click(); CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } //Click on Active or Hidden ActiveOption.Click(); if (GlobalDefinitions.ExcelLib.ReadData(3, "Active") == "Active") { ActiveOption.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "Active") == "Hidden") { HiddenOption.Click(); } //Upload a file WorkSample.Click(); GlobalDefinitions.wait(20); string path = GlobalDefinitions.ExcelLib.ReadData(3, "WorkSample"); AutoItX.WinActivate("File Upload"); //Wait GlobalDefinitions.wait(60); AutoItX.Send(path); AutoItX.Send("{ENTER}"); Save.Click(); Assert.That(ManageTitle.Text, Is.EqualTo("Voice Actor")); }
public Day() : base() { this.iValue = default(Days); this.iNameOfDay = this.Value.ToString(); }
public void RemoveDay(Day day) => Days.Remove(day);
/// <summary> /// Get the number of commits made on any <see cref="DayOfWeek"/> /// </summary> /// <param name="dayOfWeek">The day of the week</param> /// <returns>The number of commits made</returns> public int GetCommitCountOn(DayOfWeek dayOfWeek) { return(Days.ElementAt((int)dayOfWeek)); }
public RegisterTime_Steps() { projects = new Projects(db); days = new Days(db); }
static void Main(string[] args) { // enums to be declared out of the main scope Level l = Level.High; Console.WriteLine(l); // using enums with switch switch (l) { case Level.Low: Console.WriteLine("low level"); break; case Level.Medium: Console.WriteLine("medium level"); break; case Level.High: Console.WriteLine("high level"); break; default: Console.WriteLine("level out of range"); break; } // --------------------------------------------------------- // exercice vote const int AGE_MARGIN = 18; Console.Write("entrez votre age? "); int userAge = int.Parse(Console.ReadLine()); if (userAge < AGE_MARGIN) { Console.WriteLine("t as pas le droit de voter"); } else { Console.WriteLine("yeeeee VOTE!"); } // ------------------------------------------------------ // exercice nbr plus grand Console.WriteLine("entrez 2 nbr?"); int nbr1 = int.Parse(Console.ReadLine()); int nbr2 = int.Parse(Console.ReadLine()); if (nbr1 > nbr2) { Console.WriteLine("le plus grand est {0}", nbr1); } else { Console.WriteLine("le plus grand est {0}", nbr2); } // ------------------------------------------------------ // exercice etat temperature Console.Write("entrez la temperature? "); double tmp = double.Parse(Console.ReadLine()); if (tmp < 0) { Console.WriteLine("temps glacial"); } else if (tmp < 10) { Console.WriteLine("tres froid"); } else if (tmp < 20) { Console.WriteLine("temperature froide"); } else if (tmp < 30) { Console.WriteLine("temps normal"); } else if (tmp < 40) { Console.WriteLine("c est chaud"); } else { Console.WriteLine("tres chaud, la mort"); } // ------------------------------------------------------ // exercice equation 2eme deg Console.WriteLine("entrez les valeurs de:"); Console.Write("x: "); double x = double.Parse(Console.ReadLine()); Console.Write("y: "); double y = double.Parse(Console.ReadLine()); Console.Write("z: "); double z = double.Parse(Console.ReadLine()); if (x == 0) { Console.WriteLine("equation 1er degre"); if (y == 0) { Console.WriteLine("pas de solution"); } else { Console.WriteLine("{0} est une seul solution pour l equation", -z / y); } } else { double d = Math.Pow(y, 2) - 4 * x * z; if (d == 0) { Console.WriteLine("{0} est une seul solution pour l equation", -z / (2 * x)); } else if (d > 0) { Console.WriteLine("l equation accepte 2 solution dans R"); Console.WriteLine("1er racine est {0}", (-y - Math.Sqrt(d)) / (2 * x)); Console.WriteLine("2eme racine est {0}", (-y + Math.Sqrt(d)) / (2 * x)); } else { Console.WriteLine("l'equation n'as pas de racines reels, mais 2 racines complexe"); } } // -------------------------------------------- // exercice jour de semaine Console.Write("entrez le nbr de jour? "); Days j = (Days)int.Parse(Console.ReadLine()); switch (j) { case Days.Dimanche: Console.Write("Dimanche"); break; case Days.Lundi: Console.Write("Lundi"); break; case Days.Mardi: Console.Write("Mardi"); break; case Days.Mercredi: Console.Write("Mercredi"); break; case Days.Jeudi: Console.Write("Jeudi"); break; case Days.Vendredi: Console.Write("Vendredi"); break; case Days.Samedi: Console.Write("Samedi"); break; default: Console.Write("pas de jour pour toi"); break; } // ------------------------------------------------------ // exercice calculatrice Console.WriteLine("Programe Calculatrice? ..."); Console.WriteLine("Choisissez une des options suivantes"); Console.WriteLine(" - {0}: {1}", 0, Options.Addition); Console.WriteLine(" - {0}: {1}", 1, Options.Soustraction); Console.WriteLine(" - {0}: {1}", 2, Options.Division); Console.WriteLine(" - {0}: {1}", 3, Options.Multiplication); Console.Write("votre choix? : "); Options opt = (Options)int.Parse(Console.ReadLine()); if (opt != Options.Quit) { Console.WriteLine("Entrer 2 nbr"); Console.Write("x: "); double a = double.Parse(Console.ReadLine()); Console.Write("y: "); double b = double.Parse(Console.ReadLine()); Console.WriteLine("Resultat"); switch (opt) { case Options.Addition: Console.WriteLine("Addition, {0} + {1} = {2}", a, b, a + b); break; case Options.Soustraction: Console.WriteLine("Soustraction, {0} - {1} = {2}", a, b, a - b); break; case Options.Division: if (b == 0) { Console.WriteLine("division sur 0 est incorrect"); } else { Console.WriteLine("Division, {0} / {1} = {2}", a, b, a / b); } break; case Options.Multiplication: Console.WriteLine("Multiplication, {0} x {1} = {2}", a, b, a * b); break; default: Console.WriteLine("pas d'operation pour toi!"); break; } } else { Console.WriteLine("bye"); } }
private void Lecture_CheckedChanged(object sender, EventArgs e) { //the function checks if the checkbox that was checked is lecture //if it does, the function will load the lectures info into the listboxes accordingly int Count = 0, val = 0; if (Lecture.Checked && Practice.Checked) { Practice.Checked = false; } if (!Lecture.Checked) { Lecture_Select.Enabled = false; Lecture_Select.Enabled = false; ID.ResetText(); ID.Items.Clear(); Start_Time.ResetText(); Start_Time.Items.Clear(); End_Time.ResetText(); End_Time.Items.Clear(); Courses.ResetText(); Courses.Items.Clear(); Days.ResetText(); Days.Items.Clear(); Day.Text = ""; Teacher_ID.ResetText(); Teacher_ID.Items.Clear(); Lecture_Select.Enabled = true; Lecture_Select.Items.Clear(); Lecture_Select.ResetText(); Search.Enabled = false; StartTime.ResetText(); StartTime.Items.Clear(); EndTime.ResetText(); EndTime.Items.Clear(); Teacher.ResetText(); Teacher.Items.Clear(); ClassCombobox.ResetText(); ClassCombobox.Items.Clear(); ClassCombobox.Enabled = false; Teacher.Enabled = false; StartTime.Enabled = false; EndTime.Enabled = false; Day.Enabled = false; } else { ID.ResetText(); ID.Items.Clear(); Start_Time.ResetText(); Start_Time.Items.Clear(); End_Time.ResetText(); End_Time.Items.Clear(); Courses.ResetText(); Courses.Items.Clear(); Days.ResetText(); Days.Items.Clear(); Day.Text = ""; Teacher_ID.ResetText(); Teacher_ID.Items.Clear(); Lecture_Select.Enabled = true; Lecture_Select.Items.Clear(); Lecture_Select.ResetText(); Search.Enabled = false; StartTime.ResetText(); StartTime.Items.Clear(); EndTime.ResetText(); EndTime.Items.Clear(); Teacher.ResetText(); Teacher.Items.Clear(); ClassCombobox.ResetText(); ClassCombobox.Items.Clear(); ClassCombobox.Enabled = false; Teacher.Enabled = false; StartTime.Enabled = false; EndTime.Enabled = false; Day.Enabled = false; if (StartTime.Items.Count == 0) { for (int i = 8; i < 21; i++) { StartTime.Items.Add(i + ":00"); } } Lesson = "Lecture"; if (!SqlWorker.CheckForInternetConnection()) { MessageBox.Show("There is no internet connection.\nPlease try again later.", "Error" , MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataSet TableShow = SqlWorker.GetDataSet("SELECT CourseName , StartTime , Day ,EndTime , Lecturer, ID From Lecture"); val = TableShow.Tables[0].Rows.Count; while (val > Count) { Lecture_Select.Items.Add(TableShow.Tables[0].Rows[Count]["ID"].ToString()); ID.Items.Add(TableShow.Tables[0].Rows[Count]["ID"].ToString()); Courses.Items.Add(TableShow.Tables[0].Rows[Count]["CourseName"].ToString()); Start_Time.Items.Add(TableShow.Tables[0].Rows[Count]["StartTime"].ToString()); End_Time.Items.Add(TableShow.Tables[0].Rows[Count]["EndTime"].ToString()); Days.Items.Add(TableShow.Tables[0].Rows[Count]["Day"].ToString()); Teacher_ID.Items.Add(TableShow.Tables[0].Rows[Count]["Lecturer"].ToString()); Count++; } } }
private int DayInt(Days day) { switch (day) { case Days.Monday: return 1; case Days.Tuesday: return 2; case Days.Wednesday: return 3; case Days.Thursday: return 4; case Days.Friday: return 5; default: return -1; } }
internal void EnterShareSkillData() { //Enter the Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter the Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Select Category GlobalDefinitions.SelectDropDown(CategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select Sub-Category GlobalDefinitions.SelectDropDown(SubCategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter Tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n"); //Select Service Type GlobalDefinitions.SelectRadioButton(ServiceTypeOptions, GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"), By.Name("serviceType")); //Select Location Type GlobalDefinitions.SelectRadioButton(LocationTypeOption, GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"), By.Name("locationType")); //Add Start Date StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Add End Date EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Getting all the values in Selectday column in a list IList <string> DaysList = GlobalDefinitions.ExcelLib.ReadData(2, "Selectday").Split('/'); //Getting count for all days //Check the checkbox for selectdays mentioned in excel and enter time for same int DaysRows = Days.FindElements(By.Name("Available")).Count; foreach (string AvailableDays in DaysList) { for (int i = 1; i <= DaysRows; i++) { string DayValue = Days.FindElements(By.ClassName("fields"))[i].Text; if (AvailableDays.ToLower() == DayValue.ToLower()) { Days.FindElements(By.Name("Available"))[i - 1].Click(); string StartTime = DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt"); Days.FindElements(By.Name("StartTime"))[i - 1].SendKeys(StartTime); string EndTime = DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt"); Days.FindElements(By.Name("EndTime"))[i - 1].SendKeys(EndTime); break; } } } //Select Skill Trade GlobalDefinitions.SelectRadioButton(SkillTradeOption, GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"), By.Name("skillTrades")); string SkillTradeValue = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade").ToUpper(); //Enter Skill-Exchange or Credit if (SkillTradeValue == "SKILL-EXCHANGE") { SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + "\n"); } else { CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } //upload Work Samples WorkSamples.Click(); AutoItX.WinWait("Open", "File Upload", 1); AutoItX.WinActivate("Open"); AutoItX.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]"); AutoItX.Send(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\ExcelData\\empty.txt")); AutoItX.Send("{Enter}"); //Select Active radio GlobalDefinitions.SelectRadioButton(ActiveOption, GlobalDefinitions.ExcelLib.ReadData(2, "Active"), By.Name("isActive")); }
static void Main(string[] args) { Days readingDays = Days.Monday | Days.Saturday; }
// "Tempalte" of method for all inheritence class. // This method will make validation process for (Kid + Day) and return Bool value. public abstract bool DoValidation(Kid kid, Days day);
public bool AddCourse(Pool p, String des, DateTime dateStar, DateTime dateFin, DateTime startH, TimeSpan dura, Days day, int minim, int max, double preu, IEnumerable <int> lanes) { Course cou = new Course(dateStar, dateFin, startH, dura, minim, max, false, preu, des, day, p); if (service.GetAll <Course>().Where(c => c.Description == des).Count() != 0) { return(false); throw new ServiceException("El curs ja existeix"); } IEnumerable <Course> cursos = service.GetAll <Course>(); bool esta = false; foreach (Course c in cursos) { if (c.StartDate.Date > cou.FinishDate.Date || cou.StartDate > c.FinishDate || (c.CourseDays & cou.CourseDays) == 0 || c.StartHour > cou.StartHour.Add(cou.Duration) || cou.StartHour > c.StartHour.Add(c.Duration)) { continue; } else { IEnumerable <Lane> carrils = c.Lanes; foreach (Lane l in carrils) { foreach (int nl in lanes) { if (l.Number == nl) { esta = true; } } } } } if (esta == true) { throw new ServiceException("Course no"); return(false); } foreach (int nl in lanes) { Lane l = p.FindLaneByNumber(nl); if (l == null) { l = new Lane(nl); service.Insert <Lane>(l); } cou.Lanes.Add(l); } service.Insert <Course>(cou); service.Commit(); return(true); }
protected override void OnConfigLoaded() { if (IsWriteLine) { Console.WriteLine(@"Press ESC to exit..."); Console.WriteLine(); Console.WriteLine(@"StartTime: " + StartTime); Console.WriteLine(@"EndTime: " + EndTime); Console.WriteLine(@"DayOfWeek: " + string.Join(", ", ((DayOfWeek[])Enum.GetValues(typeof(DayOfWeek))).Where(d => Days.Contains((int)d)).Select(d => d.ToString()).ToArray())); Console.WriteLine(@"Interval (d:hh:mm:ss): " + Interval.ToString(@"d\:hh\:mm\:ss")); Console.WriteLine(@" Days: {0,3}", Interval.Days); Console.WriteLine(@" Hours: {0,3}", Interval.Hours); Console.WriteLine(@" Minutes: {0,3}", Interval.Minutes); Console.WriteLine(@" Seconds: {0,3}", Interval.Seconds); Console.WriteLine(); } base.OnConfigLoaded(); }
public Dictionary <DayOfWeek, Dictionary <TimeSpan, int> > GetFreeLanes(Pool pol, DateTime date) { if (date.DayOfWeek != DayOfWeek.Monday) { //Console.WriteLine("Fecha incorrecta."); throw new ServiceException("Fecha incorrecta."); } Dictionary <DayOfWeek, Dictionary <TimeSpan, int> > dicti = new Dictionary <DayOfWeek, Dictionary <TimeSpan, int> >(); TimeSpan obri = new TimeSpan(8, 0, 0); TimeSpan tanca = new TimeSpan(21, 0, 0); TimeSpan increment = new TimeSpan(0, 45, 0); DateTime iniSemana = date; DateTime fiSemana = date; fiSemana.AddDays(7); TimeSpan ini = obri; TimeSpan fi = ini.Add(increment); DayOfWeek diaSemana = DayOfWeek.Monday; for (int i = 0; i < 6; i++) { Dictionary <TimeSpan, int> aux = new Dictionary <TimeSpan, int>(); IEnumerable <Course> cursos = service.GetAll <Course>(); int[] linees = new int[pol.Lanes.Count]; for (int j = 0; j < linees.Length; j++) { linees[j] = 1; } Console.WriteLine(diaSemana.ToString()); while (ini < tanca) { foreach (Course c in cursos) { TimeSpan startHour = new TimeSpan(c.StartHour.Hour, c.StartHour.Minute, c.StartHour.Second); TimeSpan finishHour = startHour.Add(increment); if (c.Cancelled) { continue; } if (c.StartDate.Date.CompareTo(fiSemana.Date) > 0) { continue; } if (c.FinishDate.Date.CompareTo(iniSemana.Date) < 0) { continue; } if (finishHour < ini) { continue; } if (startHour > fi) { continue; } Days diaAux = (Days)Math.Pow(2, i); if ((c.CourseDays & diaAux) == diaAux) { continue; } foreach (Lane l in c.Lanes) { linees[l.Number] = 0; } } int cont = 0; foreach (int j in linees) { if (j == 1) { cont++; } } aux.Add(ini, cont); ini = ini.Add(increment); fi = fi.Add(increment); } dicti.Add(diaSemana, aux); diaSemana++; date.AddDays(1); ini = obri; fi = ini.Add(increment); } return(dicti); }
public void CreateCalendar(DateTime targetDate, String userID) //tworzymy dany miesiac danego roku { this.userLogin = userID; //TODO wyjatek - brak polaczenia z baza factory = DbProviderFactories.GetFactory("System.Data.OracleClient"); connection = factory.CreateConnection(); connection.ConnectionString = "SERVER=" + "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=155.158.112.45)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=oltpstud)));" + "uid=msbd12;" + "pwd=haslo2015;"; connection.Open(); DbCommand command = factory.CreateCommand(); //create a new command DbCommand commandNote = factory.CreateCommand(); Days.Clear(); //we check which day of week is first day of month //and so what date is monday DateTime d = new DateTime(targetDate.Year, targetDate.Month, 1); int dayNumber = ((int)d.DayOfWeek + 6) % 7; if (dayNumber != 0) { d = d.AddDays(-dayNumber); //np. 25.02 w marcu } string availability; string description; command.CommandText = "SELECT notedate, notetext FROM Notes"; //"WHERE notedate LIKE '" + firstDayDate.ToString("yy/MM/dd", CultureInfo.InvariantCulture) + "'"; //TODO - WHERE month command.Connection = connection; DbDataAdapter adapter = factory.CreateDataAdapter(); //create new adapter adapter.SelectCommand = command; DataTable dt = new DataTable(); //create a new table DataSet ds = new DataSet(); //create a new dataset adapter.Fill(ds, "Notes"); //fill the data set with the query result dt = ds.Tables[0]; //copy the table from the dataset to the dataTable command.CommandText = "SELECT notedate, notetext1, notetext2, noteavail FROM User_Notes"; //"WHERE notedate LIKE '" + firstDayDate.ToString("yy/MM/dd", CultureInfo.InvariantCulture) + "'"; //TODO - WHERE month command.Connection = connection; adapter.SelectCommand = command; DataTable dtn = new DataTable(); //create a new table ds = new DataSet(); //create a new dataset adapter.Fill(ds, "User_Notes"); //fill the data set with the query result dtn = ds.Tables[0]; //copy the table from the dataset to the dataTable //6 weeks and 7 days for (int box = 0; box < 42; box++) { description = ""; availability = ""; foreach (DataRow row in dt.Rows) { if (DateTime.ParseExact(row["NoteDate"].ToString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture).ToString("yy/MM/dd", CultureInfo.InvariantCulture).Equals(d.ToString("yy/MM/dd", CultureInfo.InvariantCulture))) { description = row["NoteText"].ToString(); break; } } foreach (DataRow row in dtn.Rows) { if (DateTime.ParseExact(row["NoteDate"].ToString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture).ToString("yy/MM/dd", CultureInfo.InvariantCulture).Equals(d.ToString("yy/MM/dd", CultureInfo.InvariantCulture))) { //description = row["NoteText"].ToString(); availability = row["NoteAvail"].ToString(); break; } } Day day = new Day { Date = d, Enabled = true, IsTargetMonth = targetDate.Month == d.Month, Description = description, Avail = availability }; day.PropertyChanged += Day_Changed; if (availability != "") { day.Avail += " h"; } day.IsToday = d == DateTime.Today; day.IsWeekend = d.DayOfWeek == DayOfWeek.Saturday || d.DayOfWeek == DayOfWeek.Sunday; Days.Add(day); d = d.AddDays(1); } connection.Close(); }
public static void Main() { Days d = (Days)0x13; Console.WriteLine(d); }
internal void EnterShareSkill() { //Explicit wait GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[contains(.,'Share Skill')]")); //click shareskill ShareSkillButton.Click(); // Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); //Enter title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); // Select on Category Dropdown GlobalDefinitions.wait(10); SelectElement catg = new SelectElement(CategoryDropDown); catg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Select on SubCategory Dropdown GlobalDefinitions.wait(10); SelectElement subcatg = new SelectElement(SubCategoryDropDown); subcatg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter Tag names in textbox Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Tags.SendKeys(Keys.Return); //Select the Service type if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis") { Hourly.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off") { Oneoff.Click(); } //Select the Location type if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "On-site") { Onsite.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "Online") { Online.Click(); } //Click on Start Date dropdown StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Click on End Date dropdown EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Select available days Days.Click(); //Select startTime StartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")); //select endtime EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")); if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Skill-Exchange") { //select SkillTradeOption SkillTradeOption.Click(); //Enter SkillExchange SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Return); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Credit") { Credit.Click(); Creditvalue.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); Creditvalue.SendKeys(Keys.Enter); } //Click worksample Worksample.Click(); //Worksample.SendKeys("path"); //upload file using AutoIT AutoItX3 autoit = new AutoItX3(); //Activate so that next action happens on this window autoit.WinActivate("Open"); //autoit.Send(@"D:\Shareskillmars\FileUploadScript.exe"); autoit.Send(@"D:\Shareskillmars\sample.txt"); autoit.Send("{ENTER}"); Thread.Sleep(10000); //Select user option if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active") { StatusActive.Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden") { StatusHidden.Click(); } //click save or cancel if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save") { Save.Click(); } else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel") { Cancel.Click(); } }
/// <summary>Days�I�u�W�F�N�g��ݒ肷��</summary> /// <param name="days">Days�I�u�W�F�N�g</param> public void SetDays(Days days) { //���ݕҏW����Days�I�u�W�F�N�g������ꍇ�̓C�x���g�ʒm���� if (this.days != null) { this.days.NameChangeEvent -= new Days.NameChangeEventHandler(days_NameChangeEvent); this.days.DayChangeEvent -= new Days.DayChangeEventHandler(days_DayChangeEvent); } this.days = days; //�C�x���g�o�^ days.NameChangeEvent += new Days.NameChangeEventHandler(days_NameChangeEvent); days.DayChangeEvent += new Days.DayChangeEventHandler(days_DayChangeEvent); //�R���g���[���j�����ɃC�x���g�ʒm���� this.Disposed += delegate(object sender, EventArgs e) { days.NameChangeEvent -= new Days.NameChangeEventHandler(days_NameChangeEvent); days.DayChangeEvent -= new Days.DayChangeEventHandler(days_DayChangeEvent); }; //������������s�� bool initFlag = initializing; initializing = true; //���̂�ݒ� tbxDaysName.Text = days.Name; //TextBox�ɗj���O���[�v��ݒ� tbxSunday.Text = days.GetTermName(DayOfWeek.Sunday); tbxMonday.Text = days.GetTermName(DayOfWeek.Monday); tbxTuesday.Text = days.GetTermName(DayOfWeek.Tuesday); tbxWednesday.Text = days.GetTermName(DayOfWeek.Wednesday); tbxThursday.Text = days.GetTermName(DayOfWeek.Thursday); tbxFriday.Text = days.GetTermName(DayOfWeek.Friday); tbxSaturday.Text = days.GetTermName(DayOfWeek.Saturday); initializing = initFlag; }
static void Main(string[] args) { Games basketball = Games.Basketball; //'basketball' object is created with 'Basketball' value from 'Games' enum Console.WriteLine(basketball); //print the value of 'basketball' on the console which is 'Basketball' Console.WriteLine((int)basketball); //print the mapped value of 'Basketball' which is 4 Console.WriteLine(); Games games = (Games)3; //create 'games' object with the value that is mapped to integer 3 in 'Games' enum Console.WriteLine(games); //print the value of 'games' on the console which is 'Chess' Console.WriteLine(); //create an array object 'gameNames' with all the values of 'Games' enum string[] gameNames = Enum.GetNames(typeof(Games)); //print all values of the array foreach (var VARIABLE in gameNames) { Console.WriteLine(VARIABLE); } Console.WriteLine("**********"); Console.WriteLine(); //Another example with 'Days' enum Days monday = Days.Monday; Console.WriteLine(monday); Console.WriteLine((int)monday); Days tuesday = Days.Tuesday; Console.WriteLine(tuesday); Console.WriteLine((int)tuesday); Days wednesday = Days.Wednesday; Console.WriteLine(wednesday); Console.WriteLine((int)wednesday); Days thursday = Days.Thursday; Console.WriteLine(thursday); Console.WriteLine((int)thursday); Days friday = Days.Friday; Console.WriteLine(friday); Console.WriteLine((int)friday); Days saturday = Days.Saturday; Console.WriteLine(saturday); Console.WriteLine((int)saturday); Days sunday = Days.Sunday; Console.WriteLine(sunday); Console.WriteLine((int)sunday); Console.WriteLine(); Days days = (Days)4; Console.WriteLine(days); Console.WriteLine(); string[] values = Enum.GetNames(typeof(Days)); foreach (var s in values) { Console.WriteLine(s); } }
public static List <ScheduleView> GetLessons() { var list = Parser.GetDataFromTable <LessonCell>((int)ConstantIndexes.ContentRowIndex, (int)ConstantIndexes.ContentColumnIndex, Days.Last().EndCellIndex.GetNumber()); var resultList = new List <LessonCell>(); foreach (var item in list) { var itemGroups = Groups.Where(g => g.IsInColumnRange(item.StartCellIndex, item.EndCellIndex)).ToList(); if (itemGroups.Count != 0) // will need to be changed { item.Groups = itemGroups.Select(g => g.Group).ToList(); item.Specialities = itemGroups.Select(s => s.Speciality).Distinct().ToList(); item.Day = Days.Where(d => d.IsInRowRange(item.StartCellIndex, item.EndCellIndex)).Select(d => d.Day).FirstOrDefault(); item.LessonNumber = LessonNumbers.Where(l => l.IsInRowRange(item.StartCellIndex, item.EndCellIndex)).Select(s => s.LessonNumber).FirstOrDefault(); if (!item.IsMergedRows) { item.Week = Weeks.Where(w => w.IsInRowRange(item.StartCellIndex, item.EndCellIndex)).Select(w => w.Week).FirstOrDefault(); } resultList.Add(item); } } var _list = new List <ScheduleView>(); foreach (var item in Groups) { var rows = resultList.Where(r => r.Groups.Contains(item.Group)); // 57 rows for 422 group var groupedItems = rows.GroupBy(d => new { d.LessonNumber, item.Group.Name, d.Day }, (key, group) => new GroupedItem { Day = key.Day, NumberOfLesson = key.LessonNumber, GroupNumber = key.Name, Rows = group.ToList() }).ToList(); var groupLessons = ParseRows(groupedItems).ToList(); var scheduleItem = new ScheduleView { GroupName = item.Group.Name, Lessons = groupLessons }; _list.Add(scheduleItem); } //var group422 = _list.Where(u => u.GroupName == "422").FirstOrDefault(); //foreach (var item in group422.Lessons) //{ // Console.WriteLine($"{item.LessonNumber.NumberOfLesson} : {item.Lesson.Name} : {item.Teacher.Name} : {item.Auditory.Name}"); //} //Console.WriteLine($"Count {group422.Lessons.Count}"); return(_list); }