public BaseResponse DateCreate(DateRequest dateRequest) { BaseResponse baseResponse = new BaseResponse(); StreamWriter sw = File.AppendText(@"wwwroot\Files\Log\Log.txt"); try { sw.WriteLine("GET İsteğinde Bulunuldu. Tarih : " + DateTime.Now.ToString("dd.MM.yyyy HH:mm")); if (_dateRepository.List(x => x.RequestDate >= DateTime.Now.AddMinutes(-1)).Count() > 10) { sw.WriteLine("Fazla İstek Hatası"); baseResponse.isOkey = false; baseResponse.message = "1 Dk İçerisinde En Fazla 10 Kez İstekte Bulunabilirsiniz."; } else { TimeSpan Sonuc = dateRequest.endDate - dateRequest.startDate; if (Sonuc.Days < 0) { sw.WriteLine("Yanlış Aralıklı Tarih Hatası"); baseResponse.isOkey = false; baseResponse.message = "Bitiş Tarihi Başlangıç Tarihinden Büyük Olmalıdır."; } else { int count = 0; for (DateTime startDate = dateRequest.startDate; startDate <= dateRequest.endDate; startDate = startDate.AddDays(1)) { if (startDate.DayOfWeek == DayOfWeek.Sunday && startDate.Day == 1) { count++; } } Date date = new Date(); date.EndDate = dateRequest.endDate; date.StartDate = dateRequest.startDate; date.Result = count; date.RequestDate = DateTime.Now; _dateRepository.Insert(date); baseResponse.isOkey = true; baseResponse.message = "Girilen Tarihler Arasında Ayın İlk Günü " + count + " Kez Pazar Gününe Denk Gelmiştir."; } } } catch (Exception) { sw.WriteLine("Veri Tabanı Bağlatı Hatası"); baseResponse.isOkey = false; baseResponse.message = "Lütfen Veri Tabanı Bağlantınızı Kontrol Edin."; } sw.Flush(); sw.Close(); return(baseResponse); }
public override Task <ZodiacResponse> GetZodiacSign(DateRequest request, ServerCallContext context) { string startDate; string endDate; string ZodiacSign; var path = File.ReadAllLines("ZodiacDates.txt"); DateTime requested; DateTime start; DateTime end; for (var i = 0; i < path.Length; i += 3) { startDate = path.ElementAt(i).ToString(); endDate = path.ElementAt(i + 1).ToString(); ZodiacSign = path.ElementAt(i + 2).ToString(); if (DateTime.TryParseExact(startDate, "MM/dd/yyyy", null, DateTimeStyles.None, out start) && DateTime.TryParseExact(endDate, "MM/dd/yyyy", null, DateTimeStyles.None, out end) && DateTime.TryParseExact(request.Date, "MM/dd/yyyy", null, DateTimeStyles.None, out requested)) { if (((start.Month < requested.Month) || (start.Month == requested.Month && start.Day <= requested.Day)) && ((end.Month > requested.Month) || (end.Month == requested.Month) && end.Day >= requested.Day)) { return(Task.FromResult(new ZodiacResponse { Sign = ZodiacSign })); } } } return(Task.FromResult(new ZodiacResponse { Sign = "Invalid input" })); }
static async Task Main(string[] args) { string date; var channel = GrpcChannel.ForAddress("https://localhost:5001"); var client = new Zodiac.ZodiacClient(channel); while (true) { Console.WriteLine("Introduceti data de nastere:"); date = Console.ReadLine(); if (ValidateDate(date)) { var clientDate = new DateRequest { Date = date }; var reply = await client.GetZodiacSignAsync(clientDate); Console.WriteLine("Zodia este: " + reply.Sign); break; } else { Console.WriteLine("Data introdusa nu este valida."); } } Console.WriteLine("Apasati orice tasta pentru a inchide consola."); System.Console.ReadKey(); }
public bool updateDateRequestStatus(string APIKey, [FromBody] DateRequest dateRequest) { if (APIKey == this.APIKey) { DBConnect objDB = new DBConnect(); SqlCommand objCmd = new SqlCommand(); objCmd.CommandType = CommandType.StoredProcedure; objCmd.CommandText = "TP_UpdateDateRequestStatus"; objCmd.Parameters.AddWithValue("@status", dateRequest.Status); objCmd.Parameters.AddWithValue("@requestFrom", dateRequest.UserIDFrom); objCmd.Parameters.AddWithValue("@requestTo", dateRequest.UserIDTo); int result = objDB.DoUpdateUsingCmdObj(objCmd); if (result == 1) { return(true); } else { return(false); } } else { return(false); } }
public override Task <DateResponse> GetZodiacSign(DateRequest request, ServerCallContext context) { string reply = GetSign(request.Date); return(Task.FromResult(new DateResponse { Sign = reply })); }
public ActionResult <List <Event> > GetFromDate(string id, [FromBody] DateRequest dateRequest) { Event ev = _eventService.GetByDate(id, dateRequest.Date); if (ev == null) { return(NotFound()); } return(Ok(ev)); }
public async Task <ActionResult <List <JobsDto> > > GetTodaysJobs([FromBody] DateRequest dateRequest) { if (!ModelState.IsValid) { return(BadRequest()); } var result = await _jobService.DailyJobs(dateRequest.DateRequested); return(Ok(result)); }
public void ImportExpenditure(DateRequest dateRequest) { try { uow.CreateUnitOfWork(); uow.ExpenditureRepository.ImportExpenditure(dateRequest); uow.Commit(); } catch (Exception e) { throw; } }
public IList <Transaction> GetTransactionsByDate(DateRequest request) { try { uow.CreateUnitOfWork(); var res = uow.TransactionRepository.GetTransactionsByDateRequest(request); uow.Commit(); return(res); } catch (Exception e) { throw; } }
public IList <ExpenditureOverview> GetExpenditureRuleOverview(DateRequest dateRequest) { try { uow.CreateUnitOfWork(); var res = uow.ExpenditureRepository.GetExpenditureRuleOverview(dateRequest); uow.Commit(); return(res); } catch (Exception e) { throw; } }
public override Task <ZodiacReply> GetZodiacSign(DateRequest request, ServerCallContext context) { var birthday = request.Birthday; var year = GetYears(birthday); var dateTime = DateTime.Parse(birthday); var path = "intervale-zodii.txt"; var file = File.ReadAllLines(path); string sign = GetSign(file, year, dateTime); Console.WriteLine("Your sign is : " + sign); return(Task.FromResult(new ZodiacReply() { Sign = sign })); }
static void Main(string[] args) { var channel = GrpcChannel.ForAddress("https://localhost:5001"); var client = new Zodiac.ZodiacClient(channel); var request = new DateRequest(); request.Birthday = ValidateInput(); var response = client.GetZodiacSign(request); Console.WriteLine($"Zodia este {response.Sign}"); channel.ShutdownAsync().Wait(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
public List <DateRequest> loadSentDateRequests(string APIKey, string usernameFrom) { if (APIKey == this.APIKey) { User tempUser = new User(); int userIDFrom = tempUser.getUserID(usernameFrom); DateRequest tempRequest = new DateRequest(); List <DateRequest> sentRequestList = tempRequest.getSentRequests(userIDFrom); return(sentRequestList); } else { return(new List <DateRequest>()); } }
public List <DateRequest> loadReceivedDateRequests(string APIKey, string usernameTo) { if (APIKey == this.APIKey) { User tempUser = new User(); int userIDTo = tempUser.getUserID(usernameTo); DateRequest tempRequest = new DateRequest(); List <DateRequest> receivedRequestList = tempRequest.getReceivedRequests(userIDTo); return(receivedRequestList); } else { return(new List <DateRequest>()); } }
public IActionResult GetDateCreate(string startDate, string endDate) { DateTime _startDate, _endDate; if (DateTime.TryParse(startDate, out _startDate) && DateTime.TryParse(endDate, out _endDate)) { DateRequest dateRequest = new DateRequest(); dateRequest.startDate = _startDate; dateRequest.endDate = _endDate; var baseResponse = _dateAppService.DateCreate(dateRequest); return(Ok(baseResponse)); } else { BaseResponse baseResponse = new BaseResponse(); baseResponse.isOkey = false; baseResponse.message = "Girdiğiniz Değerler Tarih Değildir"; return(Ok(baseResponse)); } }
public async Task <DateRequest> aExperiencia(int candidato) { DateRequest fecha = new DateRequest(); var resultado = ""; var mes = 0; var dia = 0; var fechas = db.CandidatoTrayectoriaLaboral.Where(s => s.IdCandidato == candidato).ToList(); if (fechas.Count != 0) { foreach (var item in fechas) { DateDiff periodo = new DateDiff ( item.FechaInicio, item.FechaFin ); if (periodo.Months > 12) { mes = periodo.Months / 12; } else { mes = periodo.Months; } if (periodo.Days > 365) { dia = periodo.Days / 365; } else { dia = periodo.Days; } resultado = "Años: " + periodo.Years + " Mes: " + mes + " Dia: " + dia; fecha.dia = periodo.Days; fecha.Experiencia = resultado; } } return(fecha); }
public async Task <IEnumerable <Room> > Get(DateRequest req) { var rooms = await roomDac.Gets(x => true); var roomActLst = await roomActivatedDac.Gets(x => true); var qryRoomActLst = roomActLst.Where(r => !((r.ArrivalDate - req.CheckOutDate).TotalHours >= 18 || (req.CheckInDate - r.Departure).TotalHours >= 18)); if (qryRoomActLst.Any()) { rooms.ToList().ForEach(room => { var roomAct = qryRoomActLst.FirstOrDefault(r => r.RoomNo == room._id); if (roomAct != null) { room.Status = roomAct.Status; } }); } return(rooms); }
/// <inheritdoc /> public async Task <DateResponse> StandartizationQueryDate(DateRequest queries) => await StandartizationQueryDate(queries.Queries);
public async Task <IEnumerable <Schedule> > GetSchedulesByDateAsync(DateRequest dateRequest) { return(await client.GetFromJsonAsync <IEnumerable <Schedule> >($"/api/calender/GetSchedulesByDate?year={dateRequest.Year}&month={dateRequest.Month}&day={dateRequest.Day}")); }
public IList <Expenditure> GetExpenditureByDateRequest(DateRequest request) { var res = DapperRepository.ExecuteStoredProc <Expenditure>(DatabaseConnection.connection, SQLStoredProcedures.getExpendituresByDate, request, _connection, _transaction); return(res); }
public IList <Transaction> GetTransactionsByDateRequest(DateRequest request) { var res = GetWithParamater <Transaction>(DatabaseConnection.connection, SQLStoredProcedures.getGetTransactionByDate, request, _connection, _transaction); return(res); }
public void ImportExpenditure(DateRequest request) { Save(DatabaseConnection.connection, SQLStoredProcedures.saveExpenditure, request, _connection, _transaction); }
public IList <AnalysisByDay> GetAnalyticsByDayRequest(DateRequest request) { var res = GetWithParamater <AnalysisByDay>(DatabaseConnection.connection, SQLStoredProcedures.getAnalyticsByDay, request, _connection, _transaction); return(res); }
public IList <Statistic> GetAnalyticsStatistics(DateRequest request) { var res = GetWithParamater <Statistic>(DatabaseConnection.connection, SQLStoredProcedures.getAnalyticsStatistics, request, _connection, _transaction); return(res); }
public HtmlTag DatePartial(DateRequest request) { return new HtmlTag("h1").Text(Guid.NewGuid().ToString()); }
public IList <ExpenditureOverview> GetExpenditureRuleOverview(DateRequest request) { var res = GetWithParamater <ExpenditureOverview>(DatabaseConnection.connection, SQLStoredProcedures.getExpenditureRuleOverview, request, _connection, _transaction); return(res); }
public HtmlTag DatePartial(DateRequest request) { return(new HtmlTag("h1").Text(Guid.NewGuid().ToString())); }
public string RequestTours([FromBody] DateRequest request) { return(request.Date); }