private void businessTypeToolStripMenuItem_Click(object sender, EventArgs e) { if (this.busityp_wind == null) { this.busityp_wind = new IstabWindow(this, Istab.TABTYP.BUSITYP); this.busityp_wind.MdiParent = this; this.busityp_wind.Show(); } else { this.busityp_wind.Activate(); } }
private void serviceCaseToolStripMenuItem_Click(object sender, EventArgs e) { if (this.servicecase_wind == null) { this.servicecase_wind = new IstabWindow(this, Istab.TABTYP.SERVICE_CASE); this.servicecase_wind.MdiParent = this; this.servicecase_wind.Show(); } else { this.servicecase_wind.Activate(); } }
private void versionExtensionToolStripMenuItem_Click(object sender, EventArgs e) { if (this.verext_wind == null) { this.verext_wind = new IstabWindow(this, Istab.TABTYP.VEREXT); this.verext_wind.MdiParent = this; this.verext_wind.Show(); } else { this.verext_wind.Activate(); } }
private void salesAreaToolStripMenuItem_Click(object sender, EventArgs e) { if (this.area_wind == null) { this.area_wind = new IstabWindow(this, Istab.TABTYP.AREA); this.area_wind.MdiParent = this; this.area_wind.Show(); } else { this.area_wind.Activate(); } }
private void problemCodeToolStripMenuItem_Click(object sender, EventArgs e) { if (this.probcode_wind == null) { this.probcode_wind = new IstabWindow(this, Istab.TABTYP.PROBLEM_CODE); this.probcode_wind.MdiParent = this; this.probcode_wind.Show(); } else { this.probcode_wind.Activate(); } }
private void leaveCauseToolStripMenuItem_Click(object sender, EventArgs e) { if (this.leavecause_wind == null) { this.leavecause_wind = new IstabWindow(this, Istab.TABTYP.ABSENT_CAUSE); this.leavecause_wind.MdiParent = this; this.leavecause_wind.Show(); } else { this.leavecause_wind.Activate(); } }
private void howToKnowToolStripMenuItem_Click(object sender, EventArgs e) { if (this.howknown_wind == null) { this.howknown_wind = new IstabWindow(this, Istab.TABTYP.HOWKNOWN); this.howknown_wind.MdiParent = this; this.howknown_wind.Show(); } else { this.howknown_wind.Activate(); } }
private void btnGo_Click(object sender, EventArgs e) { this.tableLayoutPanel1.Visible = false; DateTime first_date = DateTime.Parse(this.year.ToString() + "-" + this.month.ToString() + "-1", CultureInfo.GetCultureInfo("th-TH")); int days_in_month = DateTime.DaysInMonth((this.year - 543), this.month); DateTime last_date = first_date.AddDays(days_in_month - 1); int first_day_of_week = first_date.GetDayIntOfWeek(); string from_date = DateTime.Parse(this.year.ToString() + "/" + this.month.ToString() + "/1", CultureInfo.GetCultureInfo("th-TH"), DateTimeStyles.None).ToMysqlDate(); string to_date = DateTime.Parse(this.year.ToString() + "/" + this.month.ToString() + "/" + days_in_month.ToString(), CultureInfo.GetCultureInfo("th-TH"), DateTimeStyles.None).ToMysqlDate(); List <EventCalendar> event_cal; List <TrainingCalendar> training_cal; List <NoteCalendar> note_cal; CRUDResult get = ApiActions.GET(PreferenceForm.API_MAIN_URL() + "eventcalendar/get_event&from_date=" + from_date + "&to_date=" + to_date); ServerResult sr = JsonConvert.DeserializeObject <ServerResult>(get.data); if (sr.result == ServerResult.SERVER_RESULT_SUCCESS) { event_cal = sr.event_calendar; training_cal = sr.training_calendar; note_cal = sr.note_calendar; } else { event_cal = new List <EventCalendar>(); training_cal = new List <TrainingCalendar>(); note_cal = new List <NoteCalendar>(); } List <Istab> absent_cause = IstabWindow.GetIstab(Istab.getTabtypString(Istab.TABTYP.ABSENT_CAUSE)); List <Users> users_list = UsersList.GetUsers(); int increase_date = 0 + ((first_day_of_week - 1) * -1); for (int i = 1; i < this.tableLayoutPanel1.RowCount; i++) { for (int j = 0; j < this.tableLayoutPanel1.ColumnCount; j++) { // remove existing control if (this.tableLayoutPanel1.GetControlFromPosition(j, i) != null) { this.tableLayoutPanel1.Controls.Remove(this.tableLayoutPanel1.GetControlFromPosition(j, i)); } // create new control NoteCalendar note = note_cal.Where(n => n.date == first_date.AddDays(increase_date).ToString("yyyy-MM-dd", CultureInfo.GetCultureInfo("en-US"))).FirstOrDefault(); int max_leave = note != null ? note.max_leave : -1; List <AbsentVM> absent_list = event_cal.Where(ev => ev.date == first_date.AddDays(increase_date).ToString("yyyy-MM-dd", CultureInfo.GetCultureInfo("en-US"))).ToAbsentViewModel(absent_cause, users_list, max_leave); var trainer = training_cal.Where(t => t.date == first_date.AddDays(increase_date).ToString("yyyy-MM-dd", CultureInfo.GetCultureInfo("en-US"))).ToList(); //var note = note_cal; CustomDateEvent2 de = new CustomDateEvent2(this.main_form, this, first_date.AddDays(increase_date), this.month, absent_list, absent_cause, trainer, note, users_list, max_leave); this.tableLayoutPanel1.Controls.Add(de, j, i); increase_date++; } } this.tableLayoutPanel1.Visible = true; }