public static void insertRasp(DateTime date, String sotrudnik, String comment) { date = date.AddHours(14); Raspisanie rasp = new Raspisanie(date, sotrudnik, comment, "-"); Form1.collection_raspisanie.InsertOne(rasp); }
//----------------------------------------------------------------------------- private void Open_Click(object sender, EventArgs e) { if (Raspisanie.getStatus(DateTime.Today).Equals("-")) { Raspisanie.updateStatus(DateTime.Today, "O"); } else { Raspisanie.updateStatus(DateTime.Today, "C"); } ReadRaspisanie(); }
private void UpdatePasp_Click(object sender, EventArgs e) { if (commentRasp.Text.Length == 0) { commentRasp.Text = "-"; } if (nameSotr.Text.Length > 0 && idRasp.Length > 0) { if (DateTime.Now < dateRasp.Value) { Raspisanie.updateRasp(idRasp, nameSotr.Text, commentRasp.Text); } refreshRaspisanie(); } }
private void AddRasp_Click(object sender, EventArgs e) { DateTime date = dateRasp.Value; if (commentRasp.Text.Length == 0) { commentRasp.Text = "-"; } if (nameSotr.Text.Length > 0 & date.ToString().Length > 0) { if (DateTime.Now < dateRasp.Value) { Raspisanie.insertRasp(date.Date, nameSotr.Text, commentRasp.Text); } refreshRaspisanie(); } }
/////Расписание public void ReadRaspisanie() { try { list_raspisanie = collection_raspisanie.AsQueryable() .OrderByDescending(c => c.Date) .ToList <Raspisanie>(); list_raspisanie_single = collection_raspisanie.AsQueryable() .OrderByDescending(c => c.Date) .Where(c => c.Date > DateTime.Today) .Where(C => C.Sotrudnik == CurrentSotrudnik.Text) .ToList <Raspisanie>(); if (Raspisanie.getStatus(DateTime.Today).Equals("O")) { Open.Text = "Закрыть смену"; } else if (Raspisanie.getStatus(DateTime.Today).Equals("C")) { Open.Text = "Смена закрыта"; } } catch (Exception e) { String s = e.ToString(); //show } DateTime today = DateTime.Today.Date; currentDate.Text = today.ToString().Substring(0, 10); SummaProdaj.Text = Check.getSum(); addToGridRaspisanie(list_raspisanie); addToGridRaspisanieSingle(list_raspisanie_single); }
private void DeleteRasp_Click(object sender, EventArgs e) { Raspisanie.deleteRasp(idRasp); ReadRaspisanie(); }