/// <summary> /// Gets the time at a certain index /// </summary> /// <param name="index"></param> /// <returns></returns> public DateTime GetTime(int index) { switch (TimeStepSize) { case TimeStepUnit.Year: return(StartTime.AddYears(TimeStepMultiplier * index)); case TimeStepUnit.Month: return(StartTime.AddMonths(TimeStepMultiplier * index)); case TimeStepUnit.Day: return(StartTime.AddDays(TimeStepMultiplier * index)); case TimeStepUnit.Hour: return(StartTime.AddHours(TimeStepMultiplier * index)); case TimeStepUnit.Minute: return(StartTime.AddMinutes(TimeStepMultiplier * index)); case TimeStepUnit.Second: return(StartTime.AddSeconds(TimeStepMultiplier * index)); case TimeStepUnit.None: default: return(DateTime.MinValue); } }
public RoastingLog() { this.createdAt = DateTime.UtcNow; this.RoastingDate = DateTime.Today; this.StartTime = DateTime.UtcNow; this.EndTime = StartTime.AddMinutes(12); }
public Timer( XElement xTimer) { try { Id = xTimer.Element("ID").Value; Name = xTimer.Element("Descr").Value; PrePad = xTimer.Attribute("PreEPG") == null ? TimeSpan.Zero : TimeSpan.FromMinutes(int.Parse(xTimer.Attribute("PreEPG").Value)); PostPad = xTimer.Attribute("PostEPG") == null ? TimeSpan.Zero : TimeSpan.FromMinutes(int.Parse(xTimer.Attribute("PostEPG").Value)); Channel = AllChannels.FirstOrDefault(c => c.Name == xTimer.Element("Channel").Attribute("ID").Value.Split('|')[1]); StartTime = DateTime.ParseExact( xTimer.Attribute("Date").Value + " " + xTimer.Attribute("Start").Value, new[] { "dd.MM.yyyy HH:mm:ss" }, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal) + PrePad; StopTime = StartTime.AddMinutes(int.Parse(xTimer.Attribute("Dur").Value)) - PrePad - PostPad; EventId = xTimer.Attribute("EPGEventID") == null ? "" : xTimer.Attribute("EPGEventID").Value; IsRecording = xTimer.Element("Recording").Value != "0"; InError = false; } catch (System.Exception ex) { logger.Error(ex, "Error parsing Timer XML"); InError = true; } }
public DateTime NextStartTime() { var currentTime = DateTime.UtcNow; // Grab the current StartTime + duration var nextTime = StartTime.AddMinutes(DurationInMinutes); // Continue to increment it until it's greater than or equal to the current time while (currentTime >= nextTime) { switch (RepeatFrequency) { case RepeatFrequencyType.Days: nextTime = nextTime.AddDays(1); break; case RepeatFrequencyType.Months: nextTime = nextTime.AddMonths(1); break; case RepeatFrequencyType.Years: nextTime = nextTime.AddYears(1); break; default: throw new Exception("Unknown value for RepeatFrequency specified."); } } // Remove the added duration from the final value return(nextTime.AddMinutes(-DurationInMinutes)); }
public TimeSlotViewModel(TimeSlot timeSlot, DateTime rosterStartTime, Guid?currentUserProfileId = null) { _currentUserProfileId = currentUserProfileId; Players = new List <PlayerViewModel>(); Reserves = new List <PlayerViewModel>(); TimeSlotId = timeSlot.TimeSlotId; RosterId = timeSlot.RosterId; GameName = timeSlot.GameName; IsSteamGame = timeSlot.IsSteamGame; StartTime = rosterStartTime.AddMinutes(timeSlot.Offset); EndTime = StartTime.AddMinutes(timeSlot.Length); NumberOfPlayers = timeSlot.NumberOfPlayers; foreach (var player in timeSlot.Players) { Players.Add(new PlayerViewModel(player, IsSteamGame, currentUserProfileId)); } foreach (var reserve in timeSlot.Reserves) { Reserves.Add(new PlayerViewModel(reserve, IsSteamGame, currentUserProfileId)); } BookPlayerCheck(); BookReserveCheck(); CancelPlayerCheck(); }
private async Task SendData() { var senderClient = new MetricsSenderClient( _testEnvironment.Location, _testEnvironment.MetricsIngestionEndpoint, _testEnvironment.MetricsResource, _testEnvironment.Credential, new SenderClientOptions() { Diagnostics = { IsLoggingContentEnabled = true } }); var names = new[] { Name1, Name2 }; foreach (var name in names) { for (int i = 0; i < Duration.Minutes; i++) { await senderClient.SendAsync(new MetricDataDocument(StartTime.AddMinutes(i), new(new( MetricName, MetricNamespace, new[] { "Name" }, new SeriesValue[] { new(new[] { name }, 5 * i, 20 * i, 30 * i, 1 + i) }))));
protected void HandleDeviceStatusChange(CommunicationEventArgs e) { var deviceId = e.DeviceId; var type = e.DeviceStatus; var feedback = e.Data; var delta = CalcVolume(e.Description); var ftime = PumpCultivation.Schedules.FirstOrDefault(); var ltime = PumpCultivation.Schedules.LastOrDefault(); var stime = StartTime; var etime = Flowrate <= 0 ? DateTime.MinValue : StartTime.AddMinutes((PreUnfinishedVolume > 0 ? PreUnfinishedVolume : Volume) / Flowrate); var ntime = PumpCultivation.Schedules.FirstOrDefault(each => each > DateTime.Now); switch (type) { case DeviceStatusEnum.Startting: CurrentContext.SysCache.SystemRealTimeStatus.Update(deviceId, true, Volume, 0, this.AlreadyRunTimes, PumpCultivation.Schedules.Count, ftime, ltime, stime, etime, ntime); break; case DeviceStatusEnum.Running: var data = feedback as PumpDirectiveData; if (data != null) { CurrentContext.SysCache.SystemRealTimeStatus.Update(deviceId, true, Volume, data.FlowRate, AlreadyRunTimes); } break; //case DeviceStatusEnum.Pausing: case DeviceStatusEnum.Idle: if (CurrentContext.SysCache.SystemRealTimeStatus.In.DeviceId == deviceId) { CurrentContext.SysCache.SystemRealTimeStatus.CurrVolume += Convert.ToInt32(delta); } else { CurrentContext.SysCache.SystemRealTimeStatus.CurrVolume -= Convert.ToInt32(delta); } HandleSystemStatusChange(e); CurrentContext.SysCache.SystemRealTimeStatus.Update(deviceId, false, Volume, 0, AlreadyRunTimes); break; default: break; } //涉及到动画, starting Running都会启动动画 只需要触发一次 if (type == DeviceStatusEnum.Running || type == DeviceStatusEnum.Idle) { Center.OnDeviceStatusChange(new IoStatusChangeEventArgs() { DeviceId = e.DeviceId, DeviceType = e.DeviceType, IoStatus = e.DeviceStatus, Delta = delta, Feedback = e.Data }); } }
/// <summary> /// Adds the specified number of minutes to the schedule start time. /// </summary> /// <param name="minutes">The number of minutes to add.</param> public void AddStartTime(int minutes) { DateTime newStartTime = StartTime.AddMinutes(minutes); StartTime = newStartTime; if (newStartTime >= EndTime) { EndTime = newStartTime.AddMinutes(1); } }
/// <summary> /// Gets an estimated end time for the match or tournament based on the start time and a typical duration /// </summary> /// <returns></returns> public DateTimeOffset EstimatedEndTime() { if (StartTimeIsKnown) { return((MatchType == null) ? StartTime.AddHours(7) : StartTime.AddMinutes(90)); } else { return(StartTime.AddDays(1)); } }
private void InitRadChart() { MemberChart.Chart.Series.Clear(); MemberChart.PlotArea.XAxis.AutoScale = false; for (int i = 0; i < 48; i++) { DateTime dt = StartTime.AddMinutes(30 * i); MemberChart.PlotArea.XAxis.AddItem(string.Format("{0}", dt.Hour)); } }
private void ReloadLabels() { for (int i = 0; i < LabelsCount; i++) { Label label = labels[i]; label.Text = StartTime.AddMinutes(i * MinutesInterval).ToShortTimeString(); label.Font = LabelsFont; label.ForeColor = LabelFontColor; label.AutoSize = true; int x = LabelsOffset + i * (pnlLabels.Size.Width - label.Size.Width - 2 * LabelsOffset) / (LabelsCount - 1); label.Location = new Point(x, pnlLabels.Size.Height / 2 - label.Size.Height / 2); } }
//Creates a normally distrubted list of Spawn Times private List <DateTime> NormalDistributedSpawns() { var random = new Random(); var temp = new List <double>(); for (var i = 0; i < MaxDrones; i++) { temp.Add(i + random.NextDouble() * StandardDistribution); } return(temp .Select(d => StartTime.AddMinutes(d * (60 / ArrivalsPerHour))) .Select(date => date.AddTicks(-(date.Ticks % TimeSpan.TicksPerSecond))).ToList()); }
private void SetNextWarParametrs() { var nextStartTimeEntry = Asda2BattlegroundMgr.GetNextStartTime(Town); if (nextStartTimeEntry == null) { World.BroadcastMsg("ÍÑÈ ÇáÝÑÞ", "ÍÏË ÎØà Ýí äÙÇã ÇáÍÑÈ, ÇáÑÌÇÁ ÅÚÇÏÉ ÊÔÛíá ÇáÓíÑÝÑ.", Color.Red); return; } WarType = nextStartTimeEntry.Type; StartTime = nextStartTimeEntry.Time; EndTime = StartTime.AddMinutes(Asda2BattlegroundMgr.WarLengthMinutes); }
public void SendCurrentProgress(Character character) { if (DateTime.Now < StartTime.AddMinutes(2)) { Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(this, BattleGroundInfoMessageType.WarStartsInNumMins, (short)(StartTime.AddMinutes(2) - DateTime.Now).TotalMinutes, character); } else { Asda2BattlegroundHandler.SendWarCurrentActionInfoResponse(this, BattleGroundInfoMessageType.WarStarted, 0, character); } }
private async Task SendData(MetricsSenderClient senderClient) { var names = new[] { Name1, Name2 }; foreach (var name in names) { for (int i = 0; i < Duration.Minutes; i++) { await senderClient.SendAsync(new MetricDataDocument(StartTime.AddMinutes(i), new(new( MetricName, MetricNamespace, new[] { "Name" }, new SeriesValue[] { new(new[] { name }, 5 * i, 20 * i, 30 * i, 1 + i) }))));
public DateTime NextStartTime() { var currentTime = DateTime.UtcNow; // Grab the StartTime and add the duration var nextTime = StartTime.AddMinutes(DurationInMinutes); // Continue to increment it until it's greater than the current time while (currentTime >= nextTime) { switch (RepeatFrequencyType) { case RepeatFrequencyType.Minutes: nextTime = nextTime.AddMinutes(RepeatFrequency); break; case RepeatFrequencyType.Hours: nextTime = nextTime.AddHours(RepeatFrequency); break; case RepeatFrequencyType.Days: nextTime = nextTime.AddDays(RepeatFrequency); break; case RepeatFrequencyType.Weeks: nextTime = nextTime.AddDays(RepeatFrequency * 7); break; case RepeatFrequencyType.Months: nextTime = nextTime.AddMonths(RepeatFrequency); break; case RepeatFrequencyType.Years: nextTime = nextTime.AddYears(RepeatFrequency); break; case RepeatFrequencyType.FirstWeekdayOfMonth: nextTime = GetNextFirstWeekdayOfMonth(nextTime.AddMonths(RepeatFrequency)); break; default: throw new Exception("Unknown value for RepeatFrequency specified."); } } // Remove the added duration from the return value return(nextTime.AddMinutes(-DurationInMinutes)); }
protected override void OnPaint(PaintEventArgs e) { //base.OnPaint(e); using (SolidBrush enabledBrush = new SolidBrush(Color.FromArgb(101, 31, 156))) using (SolidBrush disabledBrush = new SolidBrush(Color.FromArgb(80, 80, 80))) { for (int i = 0; i < 10; i++) { Rectangle rect = new Rectangle(i * 7, 0, 7, 27); if (StartTime.AddMinutes(i).Minute < 55) { e.Graphics.FillRectangle(enabledBrush, rect); } else { e.Graphics.FillRectangle(disabledBrush, rect); } } } base.OnPaint(e); }
public void UpdateEndTimeSilent(int minutes) { _endTime = StartTime.AddMinutes(minutes); NotifyPropertyChanged("EndTime"); }
public void GetData() { DB2Helper dB2 = new DB2Helper(); //获取PD信息,为Inline的Step赋值 dB2.GetSomeData("select distinct mainpd_id,pd_id,ope_no from istrpt.fvace_wip_pdhis "); foreach (DataRow dr in dB2.dt.Rows) { try { PDModel model = new PDModel(); model.MainPD_ID = dr["MainPD_ID"].ToString(); model.PD_ID = dr["PD_ID"].ToString(); model.OPE_NO = dr["OPE_NO"].ToString(); PDModels.Add(model); } catch (Exception) { } } dB2.GetSomeData(sql); double d = 0; if (dB2.dt.Rows.Count == 0) { throw new NoQueryDataException("没有新的Inline数据"); } //DB2中获取的DateTable转换为类 foreach (DataRow dr in dB2.dt.Rows) { try { InlineDBEntity entity = new InlineDBEntity(); if (double.TryParse(dr["DCITEM_VALUE"].ToString(), out d)) { entity.DCItemValue = d; } else { continue; } entity.ClaimTime = (DateTime)dr["Claim_Time"]; entity.Lot = dr["Lot"].ToString(); entity.SourceLot = dr["SourceLot"].ToString(); entity.Technology = dr["Technology"].ToString(); entity.Product = dr["Product"].ToString(); entity.LotType = dr["Lotype"].ToString(); entity.Owner = dr["Owner"].ToString(); entity.MeasRoute = dr["MeasRoute"].ToString(); entity.MeasRouteVer = dr["MeasRouteVer"].ToString(); entity.MeasItem = dr["MeasItem"].ToString(); entity.MeasTime = (DateTime)dr["MeasTime"]; entity.MeasOperator = dr["MeasOperator"].ToString(); entity.MeasEquipment = dr["MeasEquipment"].ToString(); entity.MeasRecipe = dr["MeasRecipe"].ToString(); entity.ProcRoute = dr["ProcRoute"].ToString(); entity.ProcRouteVer = dr["ProcRouteVer"].ToString(); //entity.ProcStep = dr["ProcStep"].ToString(); var temp = PDModels.Where(w => w.Route == entity.MeasRoute && w.OPE_NO == dr["MeasStep"].ToString()).FirstOrDefault(); entity.MeasStep = temp == null ? dr["MeasStep"].ToString() : temp.Step; temp = PDModels.Where(w => w.Route == entity.ProcRoute && w.OPE_NO == dr["ProcStep"].ToString()).FirstOrDefault(); entity.ProcStep = temp == null ? dr["ProcStep"].ToString() : temp.Step; if (dr["ProcTime"] == DBNull.Value) { entity.ProcTime = null; } else { entity.ProcTime = (DateTime)dr["ProcTime"]; } entity.ProcOperatorUser = dr["PROCOPERATORUSER"].ToString(); entity.ProcEquipment = dr["PROCEQUIPMENT"].ToString(); entity.ProcRecipe = dr["ProcRecipe"].ToString(); entity.ProcReticle = dr["ProcReticle"].ToString(); entity.MeasType = dr["Meas_Type"].ToString(); entity.WaferSeq = dr["Wafer_Seq"].ToString().Trim(); entity.WaferPosition = dr["WAFER_POSITION"].ToString(); entity.SitePosition = dr["Site_Position"].ToString(); entity.Target = dr["Target"].ToString(); entity.SpecLow = dr["SpecLow"].ToString(); entity.SpecHigh = dr["SpecHigh"].ToString(); entity.CtrlLow = dr["CtrlLow"].ToString(); entity.CtrlHigh = dr["CtrlHigh"].ToString(); entity.ProcStepDesc = dr["PROCSTEPDESC"].ToString().Replace("\n", ""); entity.MeasDcdefID = dr["Meas_Dcdef_ID"].ToString(); entity.ItemType = dr["Item_Type"].ToString(); inlineDBEntities.Add(entity); } catch (Exception e) { LogHelper.ErrorLog(string.Format("InlineError InlineEntityGroup.GetData() ClaimTime:{0},Lot:{1}。", dr["Claim_Time"].ToString(), dr["Lot"].ToString()), e); } } //对wafer_seq为空或者为*号的数据去取相似案例的数据 foreach (InlineDBEntity entity in inlineDBEntities) { try { if (string.IsNullOrEmpty(entity.WaferSeq)) { InlineDBEntity likelyEntity = GetLikelyEntity(entity); entity.WaferSeq = likelyEntity.WaferSeq; entity.SourceLot = likelyEntity.SourceLot; entity.Technology = likelyEntity.Technology; entity.Product = likelyEntity.Product; entity.LotType = likelyEntity.LotType; entity.Owner = likelyEntity.Owner; entity.MeasOperator = likelyEntity.MeasOperator; entity.MeasRecipe = likelyEntity.MeasRecipe; entity.ProcRoute = likelyEntity.ProcRoute; entity.ProcRouteVer = likelyEntity.ProcRouteVer; entity.ProcStep = likelyEntity.ProcStep; entity.ProcTime = likelyEntity.ProcTime; entity.ProcOperatorUser = likelyEntity.ProcOperatorUser; entity.ProcEquipment = likelyEntity.ProcEquipment; entity.ProcRecipe = likelyEntity.ProcRecipe; } else if (string.IsNullOrEmpty(entity.Product) && entity.ItemType == "Derived") { InlineDBEntity likelyEntity = GetLikelyEntity(entity); entity.SourceLot = likelyEntity.SourceLot; entity.Technology = likelyEntity.Technology; entity.Product = likelyEntity.Product; entity.LotType = likelyEntity.LotType; entity.Owner = likelyEntity.Owner; entity.MeasOperator = likelyEntity.MeasOperator; entity.MeasRecipe = likelyEntity.MeasRecipe; entity.ProcRoute = likelyEntity.ProcRoute; entity.ProcRouteVer = likelyEntity.ProcRouteVer; entity.ProcStep = likelyEntity.ProcStep; entity.ProcTime = likelyEntity.ProcTime; entity.ProcOperatorUser = likelyEntity.ProcOperatorUser; entity.ProcEquipment = likelyEntity.ProcEquipment; entity.ProcRecipe = likelyEntity.ProcRecipe; } else if (entity.WaferSeq == "*") { InlineDBEntity likelyEntity = GetLikelyEntity(entity); entity.WaferSeq = likelyEntity.WaferSeq; } } catch (Exception e) { LogHelper.ErrorLog(string.Format("InlineError InlineEntityGroup.GetData()从DB2中获取相似InlineEntity失败 ClaimTime:{0},LotID:{1}", entity.ClaimTime.ToString(), entity.Lot), e); } } //获取DCM坐标信息 string dcmSql = string.Format("select lotid,eqpid,measuredatacount,recipe,coordinate,newdate from istrpt.fvace_inline_dcm where newdate between '{0}' and '{1}'", StartTime.AddMinutes(-2).ToString("yyyy-MM-dd-HH.mm.ss.ffffff"), endTimeStamp); dB2.GetSomeData(dcmSql); foreach (DataRow dr in dB2.dt.Rows) { try { InlineDCMEntity dcm = new InlineDCMEntity(); dcm.LotID = dr["LotID"].ToString(); dcm.EQPID = dr["EQPID"].ToString(); dcm.MeasureDataCount = Convert.ToInt16(dr["MeasureDataCount"].ToString()); dcm.Recipe = dr["Recipe"].ToString(); dcm.Coordinate = dr["Coordinate"].ToString(); dcm.NewDate = (DateTime)dr["NewDate"]; DCMEntities.Add(dcm); } catch (Exception ex) { LogHelper.ErrorLog(string.Format("InlineError InlineEntityGroup.GetData()从DCM中获取坐标错误 NewDate:{0},LotID:{1}", dr["NewDate"].ToString(), dr["LotID"].ToString()), ex); } } }
public DateTime GetEndTime(int duration) { DateTime endTimeCalc = StartTime.AddMinutes(duration); return(endTimeCalc); }
private void cmdOK_Click(object sender, EventArgs e) { try { string neworold = "0"; DataTable dtpSearch = new DataTable(); DataTable dtb = this.cntrl.patient_details(txt_p_name.Text); Appointment_for_newPAtient(dtb); if (cmbStartTime.SelectedIndex <= cmbEndTime.SelectedIndex) { if (patient_id != "0") { string dr_id = combodoctor.GetItemText(combodoctor.SelectedValue); string dr_color = "0"; long app_id = 0; DateTime Dateonly = DateTime.Now.Date; string dr_mobile = "0"; string dr_email = ""; DataTable dt_d = this.cntrl.Get_calenderColor(dr_id); if (dt_d.Rows.Count > 0) { dr_color = dt_d.Rows[0][0].ToString(); dr_mobile = dt_d.Rows[0][1].ToString(); dr_email = dt_d.Rows[0][2].ToString(); } string diff1 = "0"; DateTime StartTime1 = DateTime.Now.Date; // string Stime; if (EditingEvent.RecurrenceState == CalendarEventRecurrenceState.xtpCalendarRecurrenceNotRecurring || EditingEvent.RecurrenceState == CalendarEventRecurrenceState.xtpCalendarRecurrenceException) { DateTime StartTime, EndTime; StartTime = dpStartTimeDate.Value; EndTime = dpStartTimeDate.Value; StartTime = StartTime.AddHours(cmbStartTime.SelectedIndex / 12); EndTime = EndTime.AddHours(cmbEndTime.SelectedIndex / 12); int st_ms = 0; st_ms = cmbStartTime.SelectedIndex % 12; StartTime = StartTime.AddMinutes(st_ms * 5); st_ms = cmbEndTime.SelectedIndex % 12; EndTime = EndTime.AddMinutes(st_ms * 5); EditingEvent.StartTime = StartTime; EditingEvent.EndTime = EndTime; var diff = EndTime.Subtract(StartTime); if (diff.Hours.ToString() != "") { int valh = diff.Hours; valh = valh * 60; int valm = diff.Minutes; diff1 = Convert.ToString(valh + valm); } else { diff1 = Convert.ToString(diff.Minutes); } StartTime1 = StartTime; } DateTime Dateonly1 = DateTime.Now; //if (Dateonly1 > StartTime1) //{ // MessageBox.Show("Appointment Date should be greater than Current Date...", "Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; //} if (IsNewEvent) { DateTime StartT; StartT = dpStartTimeDate.Value; StartT = StartT.AddHours(cmbStartTime.SelectedIndex / 12); int md = cmbStartTime.SelectedIndex % 12; StartT = StartT.AddMinutes(md * 5); //*********Booking Name***********// string Name = ""; DataTable doctor = this.cntrl.get_doctor_login(PappyjoeMVC.Model.Connection.MyGlobals.Doctor_id); if (doctor.Rows.Count > 0) { if (doctor.Rows[0]["login_type"].ToString() == "doctor") { Name = "Dr "; } Name = Name + doctor.Rows[0]["doctor_name"].ToString(); } dtpSearch = this.cntrl.patient_details_byname(txt_p_name.Text); if (dtpSearch.Rows.Count <= 0) { this.cntrl.insappointment(Convert.ToDateTime(Dateonly).ToString("yyyy-MM-dd"), Convert.ToDateTime(StartT).ToString("yyyy-MM-dd HH:mm"), diff1, txtDescription.Text, patient_id, txt_p_name.Text, dr_id, txt_p_mobile.Text, txt_p_email.Text, compoprocedure.Text, Name); this.cntrl.save_log(doctor_id, "Appointment", "logged user adds new appointment", "Add"); } else { this.cntrl.insappointment(Convert.ToDateTime(Dateonly).ToString("yyyy-MM-dd"), Convert.ToDateTime(StartT).ToString("yyyy-MM-dd HH:mm"), diff1, txtDescription.Text, patient_id, patient_name, dr_id, lab_p_ph.Text, lab_p_email.Text, compoprocedure.Text, Name); this.cntrl.save_log(doctor_id, "Appointment", "logged user adds new appointment", "Add"); } DataTable dt_a = this.cntrl.appointmentId(); if (dt_a.Rows.Count > 0) { app_id = Convert.ToInt32(dt_a.Rows[dt_a.Rows.Count - 1][0].ToString()); } EditingEvent.Subject = patient_name; EditingEvent.Location = Convert.ToString(cmbStartTime.GetItemText(cmbStartTime.SelectedItem)) + "-" + Convert.ToString(cmbEndTime.GetItemText(cmbEndTime.SelectedItem)); EditingEvent.Body = Convert.ToString(app_id); EditingEvent.Label = Convert.ToInt32(dr_color); EditingEvent.AllDayEvent = (chkAllDayEvent.Checked ? true : false); EditingEvent.BusyStatus = (CalendarEventBusyStatus)cmbShowTimeAs.SelectedIndex; EditingEvent.PrivateFlag = (chkPrivate.Checked ? true : false); EditingEvent.MeetingFlag = (chkMeeting.Checked ? true : false); EditingEvent.Reminder = chkReminder.Checked; if (EditingEvent.Reminder) { CalReminderMinutes pRmd = (CalReminderMinutes)cmbReminder.SelectedItem; if (pRmd != null) { EditingEvent.ReminderMinutesBeforeStart = pRmd.m_nMinutes; } } Main_Calendar.Instance.wndCalendarControl.DataProvider.AddEvent(EditingEvent); string clinic = "", locality = "", contact_no = ""; System.Data.DataTable clinicname = this.cntrl.clinicdetails(); clinic = clinicname.Rows[0]["name"].ToString(); contact_no = clinicname.Rows[0]["contact_no"].ToString(); if (checkBox1.Checked) { string text = ""; string smsName = "", smsPass = ""; DataTable sms = this.cntrl.smsdetails(); if (sms.Rows.Count > 0) { smsName = sms.Rows[0]["smsName"].ToString(); smsPass = sms.Rows[0]["smsPass"].ToString(); } SMS_model a = new SMS_model(); DataTable pat = this.cntrl.Get_Patient_Details(patient_id); DataTable smsreminder = this.cntrl.Get_reminderSmS(); DataTable smslanguage = this.cntrl.sms_lang(); if (smsreminder.Rows.Count > 0) { send_on_day = smsreminder.Rows[0]["send_on_day"].ToString(); send_before_day = smsreminder.Rows[0]["send_before_day"].ToString(); day_time = smsreminder.Rows[0]["day_time"].ToString(); before_time = smsreminder.Rows[0]["day_time"].ToString(); } if (pat.Rows.Count > 0) { string number = "91" + pat.Rows[0]["primary_mobile_number"].ToString(); string type = "LNG"; if (neworold == "1") { a.SendSMS(smsName, smsPass, number, "Dear " + pat.Rows[0]["pt_name"].ToString() + " welcome to " + clinic + "," + contact_no, type); } if (smslanguage.Rows.Count > 0) { string smslang = smslanguage.Rows[0]["Prescription_lang"].ToString(); DataTable smstemplate = this.cntrl.smstemplate(smslang, pat.Rows[0]["pt_name"].ToString(), compoprocedure.Text, StartT.ToString("dd/MM/yyyy"), cmbStartTime.Text, combodoctor.Text, clinic, contact_no); if (smstemplate.Rows.Count > 0) { text = smstemplate.Rows[0]["Template"].ToString(); a.SendSMS(smsName, smsPass, number, text, type); this.cntrl.save_Pt_SMS(patient_id, pat.Rows[0]["pt_name"].ToString(), compoprocedure.Text, StartT.ToString("dd/MM/yyyy"), cmbStartTime.Text, combodoctor.Text); }// } string sddsds = ""; //text = "Dear " + pat.Rows[0]["pt_name"].ToString() + " " + "Your appointment for " + compoprocedure.Text + " has been confirmed at " + StartT.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " with " + "Dr " + combodoctor.Text + " Regards " + clinic + "," + contact_no; //a.SendSMS(smsName, smsPass, number, text); //this.cntrl.save_Pt_SMS(patient_id, pat.Rows[0]["pt_name"].ToString(), compoprocedure.Text, StartT.ToString("dd/MM/yyyy"), cmbStartTime.Text, combodoctor.Text); ////For Reminder SMS----- if (day_time != null) { if (dpStartTimeDate.Value > DateTime.Now.Date) { text = "Dear " + pat.Rows[0]["pt_name"].ToString() + ", " + "Today you have an appointment at " + clinic + " on " + StartT.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " for " + compoprocedure.Text + " .Regards " + clinic + "," + contact_no; a.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT.ToString("dd/MM/yyyy") + " 09:10:00 am", DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt")); } } if (before_time != null) { if (dpStartTimeDate.Value > DateTime.Now.Date) { text = "Dear " + pat.Rows[0]["pt_name"].ToString() + ", " + "Today you have an appointment at " + clinic + " on " + StartT.ToString("dd/MM/yyyy") + " " + cmbStartTime.Text + " for " + compoprocedure.Text + " .Regards " + clinic + "," + contact_no; a.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT.ToString("dd/MM/yyyy") + before_time, DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt")); } } } } if (checkBox3.Checked) { if (dr_mobile != "0") { string text = ""; string smsName = "", smsPass = ""; SMS_model a = new SMS_model(); string number = "91" + dr_mobile; string type = "LNG"; text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + txt_p_name.Text + " for " + compoprocedure.Text + " at " + clinic + "," + contact_no; a.SendSMS(smsName, smsPass, number, text, type); //For Remainder SMS if (day_time != null) { if (dpStartTimeDate.Value > DateTime.Now.Date) { text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + txt_p_name.Text + " for " + compoprocedure.Text + " at " + clinic + "," + contact_no; // a.SendSMS(smsName, smsPass, number, text); a.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT.ToString("dd/MM/yyyy") + " 09:10:00 am", DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt")); } } if (before_time != null) { if (dpStartTimeDate.Value > DateTime.Now.Date) { text = "You have an appointment on " + dpStartTimeDate.Value.ToShortDateString() + " " + cmbStartTime.Text + " With " + txt_p_name.Text + " for " + compoprocedure.Text + " at " + clinic + "," + contact_no; a.SendSMS(smsName, smsPass, number, text, "DRTOMS", patient_id.ToString(), StartT.ToString("dd/MM/yyyy") + before_time, DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt")); } } } } if (checkBox2.Checked) { string email = "", emailName = "", emailPass = ""; string query = "select email_address,pt_name from tbl_patient where id='" + patient_id + "'"; DataTable sr = this.cntrl.getpatemail(patient_id); if (sr.Rows.Count > 0) { email = sr.Rows[0]["email_address"].ToString(); DataTable sms = this.cntrl.send_email(); if (sms.Rows.Count > 0) { emailName = sms.Rows[0]["emailName"].ToString(); emailPass = sms.Rows[0]["emailPass"].ToString(); try { string sr1 = "<table align='center' style='width:700px;border: 1px solid ;border-collapse: collapse; background: #EAEAEA; height:500px'><tr><td align='left' height='27'><FONT color='#666666' face='Arial' SIZE=2> Appointment Reminder:" + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + " @ " + clinic + "</font></td></tr><tr><td align='left' height='400px'><table height='423' align='center' style='width:600px; background: #FFFFFF; height:400px'><tr><td align='left' height='6px'><FONT color='#000000' face='Arial' SIZE=6>" + clinic + "</font></td></tr><tr><td align='left' height='1px' bgcolor='#666666'></td></tr><tr><td align='left' height='62' valign='bottom'><FONT color='#000000' face='Arial' SIZE=3>Good morning <b>" + sr.Rows[0]["pt_name"].ToString() + "</b></font></td></tr> <tr><td align='left' height='197' valign='top'> Just to remind you about your appointment at " + clinic + ".<table><tbody><tr><td width='188' height='31' valign='bottom' align='right'>WHEN :</td><td width='30' height='31' valign='bottom' align='right'></td><td width='358' valign='bottom'> <strong>" + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + "</strong></td> </tr><tr><td height='76' valign='top' align='right'>WHERE :</td><td width='30' height='31' valign='bottom' align='right'></td><td valign='top'>" + locality + "</td></tr></tbody></table> For any queries, contact us at : " + contact_no + "</td> </tr><tr><td align='left' height='1px' bgcolor='#666666'></td></tr> <tr><td height='25' align='right' valign='bottom'>Powered by </td></tr> <tr><td height='81' align='right' valign='top'><img src='http://pappyjoe.com/assets/images/pappyjoe-logo.PNG' alt='pappyjoe official logo'> </td></tr></table></td></tr></table>"; MailMessage message = new MailMessage(); message.From = new MailAddress(email); message.To.Add(email); message.BodyEncoding = System.Text.Encoding.GetEncoding(1252); //bijeesh message.IsBodyHtml = true; //bijeesh SmtpClient smtp = new SmtpClient("smtp.gmail.com"); message.Subject = "Appointment Reminder: " + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + " @ " + clinic; message.Body = sr1.ToString(); smtp.Port = 587; smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential(emailName, emailPass); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Send(message); } catch (Exception ex) { } } } } if (checkBox4.Checked) // Doctor Email { string emailName = "", emailPass = ""; if (dr_email != "") { DataTable sms = this.cntrl.send_email(); if (sms.Rows.Count > 0) { emailName = sms.Rows[0]["emailName"].ToString(); emailPass = sms.Rows[0]["emailPass"].ToString(); try { string sr1 = "<table align='center' style='width:700px;border: 1px solid ;border-collapse: collapse; background: #EAEAEA; height:500px'><tr><td align='left' height='27'><FONT color='#666666' face='Arial' SIZE=2> Appointment Reminder:" + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + " @ " + clinic + "</font></td></tr><tr><td align='left' height='400px'><table height='423' align='center' style='width:600px; background: #FFFFFF; height:400px'><tr><td align='left' height='6px'><FONT color='#000000' face='Arial' SIZE=6>" + clinic + "</font></td></tr><tr><td align='left' height='1px' bgcolor='#666666'></td></tr><tr><td align='left' height='62' valign='bottom'><FONT color='#000000' face='Arial' SIZE=3>Dear <b>" + combodoctor.Text + "</b></font></td></tr> <tr><td align='left' height='197' valign='top'> Just to remind you about your appointment at " + clinic + ".<table><tbody><tr><td width='188' height='31' valign='bottom' align='right'>WHEN :</td><td width='30' height='31' valign='bottom' align='right'></td><td width='358' valign='bottom'> <strong>" + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + "</strong></td> </tr><tr><td height='31' valign='top' align='right'>PATIENT :</td><td width='30' height='31' valign='bottom' align='right'></td><td valign='top'>" + txt_p_name.Text + "</td></tr><tr><td height='76' valign='top' align='right'>FOR :</td><td width='30' height='31' valign='bottom' align='right'></td><td valign='top'>" + compoprocedure.Text + "</td></tr></tbody></table> For any queries, contact us at : " + contact_no + "</td> </tr><tr><td align='left' height='1px' bgcolor='#666666'></td></tr> <tr><td height='25' align='right' valign='bottom'>Powered by </td></tr> <tr><td height='81' align='right' valign='top'><img src='http://pappyjoe.com/assets/images/pappyjoe-logo.PNG' alt='pappyjoe official logo'> </td></tr></table></td></tr></table>"; MailMessage message = new MailMessage(); message.From = new MailAddress(dr_email); message.To.Add(dr_email); message.BodyEncoding = System.Text.Encoding.GetEncoding(1252); //bijeesh message.IsBodyHtml = true; //bijeesh SmtpClient smtp = new SmtpClient("smtp.gmail.com"); message.Subject = "Appointment(s) scheduled for Today: " + dpStartTimeDate.Value.ToString("ddd, dd MMM yyyy") + ' ' + cmbStartTime.Text + " @ " + clinic; message.Body = sr1.ToString(); smtp.Port = 587; smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential(emailName, emailPass); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Send(message); } catch (Exception ex) { } } } }// Doctor Email end } else { DateTime StartT; StartT = dpStartTimeDate.Value; StartT = StartT.AddHours(cmbStartTime.SelectedIndex / 12); int md = cmbStartTime.SelectedIndex % 12; StartT = StartT.AddMinutes(md * 5); EditingEvent.Subject = patient_name; EditingEvent.Location = Convert.ToString(cmbStartTime.GetItemText(cmbStartTime.SelectedItem)) + "-" + Convert.ToString(cmbEndTime.GetItemText(cmbEndTime.SelectedItem)); EditingEvent.Body = Convert.ToString(gpl_app_id); EditingEvent.Label = Convert.ToInt32(dr_color); if (cmbStartTime.SelectedIndex % 2 > 0) { StartT = StartT.AddMinutes(30); } this.cntrl.update_appointment(Convert.ToDateTime(StartT), diff1, txtDescription.Text, compoprocedure.Text, patient_id, patient_name, dr_id, lab_p_ph.Text, lab_p_email.Text, gpl_app_id); } EditingEvent = null; Main_Calendar.Instance.ContextEvent = null; Main_Calendar.Instance.wndCalendarControl.Populate(); Main_Calendar.Instance.wndCalendarControl.RedrawControl(); if (Convert.ToDateTime(DateTime.Today.ToString("d")) == dpStartTimeDate.Value) { Main_Calendar.Instance.listAppointment("0"); } this.Close(); Main_Calendar.Instance.Activate(); } else { } } else { MessageBox.Show("Appointment Date should be greater than Current Date...", "Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (dtpSearch.Rows.Count <= 0) { status1 = 1; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async Task <IActionResult> OnPostAsync(int roomid, int buildingid, int departmentid, string date) { CurrentUser = await _userManager.GetUserAsync(base.User); if (CurrentUser == null) { return(base.NotFound($"Unable to load user with ID '{_userManager.GetUserId(base.User)}'.")); } BuildingIdRoute = buildingid; DepartmentIdRoute = departmentid; DateTime.TryParse(date, out var ParseDate); Date = ParseDate; AllNumbers = await _context.AppUsers .Select(i => i.Number) .ToListAsync(); RoomId = roomid; Reservations = await _context.Reservations .Where(b => b.Room.BuildingID == buildingid) .Where(d => d.Date == Date) .Where(r => r.RoomID == Reservation.RoomID) .AsNoTracking() .ToListAsync(); Room = await _context.Rooms .Where(i => i.RoomID == roomid) .Include(b => b.Building) .ThenInclude(d => d.Department) .AsNoTracking() .FirstOrDefaultAsync(); AppUsers = await _context.AppUsers .AsNoTracking() .ToListAsync(); if (!ModelState.IsValid) { return(Page()); } Hours = new List <String>(); Hours.Add(new DateTime(2018, 1, 1, 8, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 8, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 9, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 9, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 10, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 10, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 11, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 11, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 12, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 12, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 13, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 13, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 14, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 14, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 15, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 15, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 16, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 16, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 17, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 17, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 18, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 18, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 19, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 19, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 20, 00, 0).ToShortTimeString()); ViewData["StartTime"] = new SelectList(Hours, StartTime.ToShortTimeString()); ViewData["EndTime"] = new SelectList(Hours, StartTime.AddMinutes(30).ToShortTimeString()); if (Reservation.StartTime == Reservation.EndTime) { ErrorString = "Rezerwacja musi trwać co najmniej 30 minut."; } if (Reservation.StartTime > Reservation.EndTime) { ErrorString = "Rezerwacja nie może się zacząć później niż skończyć."; } foreach (var item in Reservations) { if (Reservation.StartTime == item.StartTime || Reservation.EndTime == item.EndTime) { ErrorString = "W tym czasie trwa inna rezerwacja."; } if (Reservation.EndTime < item.EndTime && Reservation.StartTime < item.StartTime && Reservation.EndTime > item.StartTime) { ErrorString = "W tym czasie trwa inna rezerwacja."; } if (Reservation.EndTime > item.EndTime && Reservation.StartTime < item.StartTime) { ErrorString = "W tym czasie trwa inna rezerwacja."; } if (Reservation.EndTime > item.EndTime && Reservation.StartTime > item.StartTime && Reservation.StartTime < item.EndTime) { ErrorString = "W tym czasie trwa inna rezerwacja."; } if (Reservation.EndTime < item.EndTime && Reservation.StartTime > item.StartTime) { ErrorString = "W tym czasie trwa inna rezerwacja."; } } if (ErrorString != null) { return(Page()); } var newReservation = new Reservation(); DateTime.TryParse(DateInputString, out var ParseStringDate); newReservation.Date = ParseStringDate; var currentUserRoles = await _userManager.GetRolesAsync(CurrentUser); if (currentUserRoles.First() == "administrator") { if (!AllNumbers.Contains(Number)) { NumberError = String.Format("Nie ma takiego człeka o numerze: {0}", Number); return(Page()); } newReservation.Id = AppUsers.Where(i => i.Number == Number).Select(i => i.Id).FirstOrDefault(); } if (currentUserRoles.First() == "użytkownik") { newReservation.Id = CurrentUser.Id; } if (await TryUpdateModelAsync <Reservation>( newReservation, "Reservation", s => s.Note, s => s.StartTime, s => s.EndTime, s => s.RoomID)) { _context.Reservations.Add(newReservation); await _context.SaveChangesAsync(); } return(Redirect("./Details" + "?" + "reservationid=" + newReservation.ReservationID.ToString() + "&buildingid=" + BuildingIdRoute.ToString() + "&departmentid=" + DepartmentIdRoute.ToString() + "&date=" + Date.ToShortDateString())); }
public async Task <IActionResult> OnGetAsync(int roomid, int buildingid, int departmentid, string date, string time) { CurrentUser = await _userManager.GetUserAsync(HttpContext.User); if (CurrentUser == null) { return(base.NotFound($"Unable to load user with ID '{_userManager.GetUserId(HttpContext.User)}'.")); } BuildingIdRoute = buildingid; DepartmentIdRoute = departmentid; DateTime.TryParse(date, out var ParseDate); Date = ParseDate; DateTime.TryParse(date + " " + time, out var ParseTime); StartTime = ParseTime; RoomId = roomid; Room = await _context.Rooms .Where(i => i.RoomID == roomid) .Include(b => b.Building) .ThenInclude(d => d.Department) .AsNoTracking() .FirstOrDefaultAsync(); Reservations = await _context.Reservations .Include(r => r.ApplicationUser) .Include(r => r.Room) .ThenInclude(b => b.Building) .Where(b => b.Room.BuildingID == buildingid) .Where(d => d.Date == Date) .AsNoTracking() .ToListAsync(); Hours = new List <String>(); Hours.Add(new DateTime(2018, 1, 1, 8, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 8, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 9, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 9, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 10, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 10, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 11, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 11, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 12, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 12, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 13, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 13, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 14, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 14, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 15, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 15, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 16, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 16, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 17, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 17, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 18, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 18, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 19, 00, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 19, 30, 0).ToShortTimeString()); Hours.Add(new DateTime(2018, 1, 1, 20, 00, 0).ToShortTimeString()); ViewData["StartTime"] = new SelectList(Hours, StartTime.ToShortTimeString()); ViewData["EndTime"] = new SelectList(Hours, StartTime.AddMinutes(30).ToShortTimeString()); return(Page()); }
//Note Add a new event private void cmdOK_Click(object sender, System.EventArgs e) { if (EditingEvent.RecurrenceState == CalendarEventRecurrenceState.xtpCalendarRecurrenceNotRecurring || EditingEvent.RecurrenceState == CalendarEventRecurrenceState.xtpCalendarRecurrenceException) { DateTime StartTime, EndTime; StartTime = dpStartTimeDate.Value; EndTime = dpEndTimeDate.Value; StartTime = StartTime.AddHours(cmbStartTime.SelectedIndex / 2); EndTime = EndTime.AddHours(cmbEndTime.SelectedIndex / 2); if (cmbStartTime.SelectedIndex % 2 > 0) { StartTime = StartTime.AddMinutes(30); } if (cmbEndTime.SelectedIndex % 2 > 0) { EndTime = EndTime.AddMinutes(30); } EditingEvent.StartTime = StartTime; EditingEvent.EndTime = EndTime; } EditingEvent.Subject = txtSubject.Text; EditingEvent.Location = txtLocation.Text; EditingEvent.Body = txtDescription.Text; EditingEvent.AllDayEvent = (chkAllDayEvent.Checked ? true : false); EditingEvent.Label = cmbLabel.SelectedIndex; EditingEvent.BusyStatus = (CalendarEventBusyStatus)cmbShowTimeAs.SelectedIndex; EditingEvent.PrivateFlag = (chkPrivate.Checked ? true : false); EditingEvent.MeetingFlag = (chkMeeting.Checked ? true : false); EditingEvent.Reminder = chkReminder.Checked; if (EditingEvent.Reminder) { CalReminderMinutes pRmd = (CalReminderMinutes)cmbReminder.SelectedItem; if (pRmd != null) { EditingEvent.ReminderMinutesBeforeStart = pRmd.m_nMinutes; } } if (IsNewEvent) { frmMain.Instance.wndCalendarControl.DataProvider.AddEvent(EditingEvent); } else { frmMain.Instance.wndCalendarControl.DataProvider.ChangeEvent(EditingEvent); } EditingEvent = null; frmMain.Instance.ContextEvent = null; frmMain.Instance.wndCalendarControl.Populate(); frmMain.Instance.wndCalendarControl.RedrawControl(); this.Close(); frmMain.Instance.Activate(); }
private bool IsGoldenPeriod(DateTime time) { return(time.TimeOfDay >= StartTime.TimeOfDay && time.TimeOfDay <= StartTime.AddMinutes(Minutes).TimeOfDay); // magic number magic mike picked }
private void btnPlus10Minutes_Click(object sender, EventArgs e) { StartTime = StartTime.AddMinutes(TEN_MINUTES); Redraw(); }