protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { mvwForm.ActiveViewIndex = 0; DataBindingHelper.PopulateActiveBranches(ddlBranch, User.Identity.Name, false); DynamicControlBinding.BindDropDown(ddlDayOfWeek, CommonHelper.GetDayNames(), "Value", "Key", false); ddlDayOfWeek.SelectedValue = (DateTime.Today.DayOfWeek == DayOfWeek.Sunday ? 7 : (int)DateTime.Today.DayOfWeek).ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { cblCustomerStatus.DataSource = customerStatusProvider.GetAll(); cblCustomerStatus.DataTextField = "Description"; cblCustomerStatus.DataValueField = "ID"; cblCustomerStatus.DataBind(); DynamicControlBinding.BindDropDown(ddlBranch, branchProvider.GetActiveBranches(), "Name", "ID", false); } }
protected void btnRefresh_Click(object sender, EventArgs e) { mvwForm.SetActiveView(viwAddEdit); lblBranch.Text = ddlBranch.SelectedItem.Text; lblPeriod.Text = ddlMonth.SelectedItem.Text + " " + ddlYear.SelectedItem.Text; ddlDayOfWeek.SelectedValue = Convert.ToString((int)DateTime.Today.DayOfWeek == 0 ? 7 : (int)DateTime.Today.DayOfWeek); DynamicControlBinding.BindDropDown(ddlClass, ClassService.GetAllActiveClasses().ToList(), "Name", "ID", false); DynamicControlBinding.BindDropDown(ddlClassRoom, ClassService.GetActiveClassRooms(Convert.ToInt32(ddlBranch.SelectedValue)).ToList(), "Name", "ID", false); ddlTimeStart.DataSource = ClassService.GetTimeSlots(Convert.ToInt32(ddlBranch.SelectedValue), Convert.ToInt32(ddlDayOfWeek.SelectedValue)); ddlTimeStart.DataBind(); gvwDetail.DataBind(); Form.DefaultButton = btnSave.UniqueID; }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { cblCustomerStatus.DataSource = CustomerStatusService.GetAll(); cblCustomerStatus.DataTextField = "Description"; cblCustomerStatus.DataValueField = "ID"; cblCustomerStatus.DataBind(); DynamicControlBinding.BindDropDown(ddlBranch, BranchService.GetActiveBranches(User.Identity.Name), "Name", "ID", false); ddlBranch.Enabled = false; } }
protected void gvwDetail_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteRow") { int id = Convert.ToInt32(e.CommandArgument); if (ClassService.VerifyScheduleDeletion(id)) { ClassService.DeleteSchedule(id); gvwDetail.DataBind(); } else { WebFormHelper.SetLabelTextWithCssClass( lblStatusDelete, "Cannot delete schedule because it has attendees, please clear all of the attendees first to delete this schedule.", LabelStyleNames.ErrorMessage); } } else if (e.CommandName == "EditRow") { int id = Convert.ToInt32(e.CommandArgument); mvwForm.ActiveViewIndex = 2; DynamicControlBinding.BindDropDown(ddlInstructor0, InstructorService.GetActiveInstructors(), "Name", "ID", false); DynamicControlBinding.BindDropDown(ddlClass0, ClassService.GetAllActiveClasses().ToList(), "Name", "ID", false); DynamicControlBinding.BindDropDown(ddlClassRoom0, ClassService.GetActiveClassRooms(Convert.ToInt32(ddlBranch.SelectedValue)).ToList(), "Name", "ID", false); ddlTimeStart0.DataSource = ClassService.GetTimeSlots(Convert.ToInt32(ddlBranch.SelectedValue), Convert.ToInt32(ddlDayOfWeek.SelectedValue)); ddlTimeStart0.DataBind(); ClassScheduleDetail schedule = ClassService.GetSchedule(id); if (schedule != null) { lblBranch0.Text = ddlBranch.SelectedItem.Text; lblPeriod0.Text = ddlMonth.SelectedItem.Text + " " + ddlYear.SelectedItem.Text; lblDayOfWeek0.Text = ddlDayOfWeek.SelectedItem.Text; ddlClass0.SelectedValue = schedule.ClassID.ToString(); ddlClassRoom0.SelectedValue = schedule.ClassRoomID.ToString(); ddlInstructor0.SelectedValue = schedule.InstructorID.ToString(); ddlTimeStart0.FindItemByText(schedule.TimeStart + "-" + schedule.TimeEnd).Selected = true; ddlLevel0.SelectedValue = schedule.Level; ViewState["ScheduleID"] = id; } Form.DefaultButton = btnUpdate.UniqueID; } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { mvwForm.SetActiveView(viwRead1); DataBindingHelper.PopulateActiveBranches(ddlBranch, User.Identity.Name, false); DynamicControlBinding.BindDropDown(ddlMonth, CommonHelper.GetMonthNames(), "Value", "Key", false); DynamicControlBinding.BindDropDown(ddlDayOfWeek, CommonHelper.GetDayNames(), "Value", "Key", false); DynamicControlBinding.BindDropDown(ddlInstructor, instructorProvider.GetActiveInstructors(), "Name", "ID", false); for (int year = DateTime.Today.Year - 1; year <= DateTime.Today.Year; year++) { ddlYear.Items.Add(new ListItem(year.ToString(), year.ToString())); } ddlYear.SelectedValue = DateTime.Today.Year.ToString(); ddlMonth.SelectedValue = DateTime.Today.Month.ToString(); ddlDayOfWeek.SelectedValue = DateTime.Today.DayOfWeek.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { cblMembershipType.DataSource = packageProvider.GetAll(); cblMembershipType.DataTextField = "Name"; cblMembershipType.DataValueField = "ID"; cblMembershipType.DataBind(); cblCustomerStatus.DataSource = customerStatusProvider.GetAll(); cblCustomerStatus.DataTextField = "Description"; cblCustomerStatus.DataValueField = "ID"; cblCustomerStatus.DataBind(); DynamicControlBinding.BindDropDown(ddlBillingType, billingTypeProvider.GetActiveBillingTypes().Where(bt => bt.ID > 1), "Description", "ID", false); DynamicControlBinding.BindDropDown(ddlBranch, branchProvider.GetActiveBranches(), "Name", "ID", false); calFindDateFrom.SelectedDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); calFindDateTo.SelectedDate = DateTime.Today; cblMembershipType.Items.Cast <ListItem>().ToList().ForEach(item => item.Selected = true); } }
protected void gvwSchedule_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandSource is LinkButton) { if (e.CommandName.Equals("StartStop")) { var startStopButton = e.CommandSource as LinkButton; if (startStopButton.Text == "Start") { mvwForm.SetActiveView(View4); ClassRunning classRunning = ClassService.GetClassRunning(Convert.ToInt32(e.CommandArgument)); if (classRunning != null) { lblBranch4.Text = ddlBranch.SelectedItem.Text; lblPeriod4.Text = calDate.SelectedDate.GetValueOrDefault().ToLongDateString(); lblClassName4.Text = classRunning.ClassScheduleDetail.Class.Name; lblInstructor4.Text = classRunning.ClassScheduleDetail.Instructor.Name; ViewState["ClassRunningID"] = Convert.ToInt32(e.CommandArgument); DynamicControlBinding.BindDropDown( ddlRunningInstructor, InstructorService.GetActiveInstructors(), "Name", "ID", true); DynamicControlBinding.BindDropDown( ddlRunningAssistant, InstructorService.GetActiveInstructors(), "Name", "ID", true); ddlRunningInstructor.SelectedValue = classRunning.RunningInstructorID.HasValue ? classRunning.RunningInstructorID.Value.ToString() : classRunning.ClassScheduleDetail.InstructorID.ToString(); ddlRunningAssistant.SelectedValue = classRunning.RunningAssistantID.HasValue ? classRunning.RunningAssistantID.Value.ToString() : String.Empty; txtNotes.Text = Convert.ToString(classRunning.Notes); cblAttendances.DataBind(); LoadAttendancesStatus(); } } else { } } else if (e.CommandName.Equals("Participants")) { mvwForm.ActiveViewIndex = 2; ClassRunning classRunning = ClassService.GetClassRunning(Convert.ToInt32(e.CommandArgument)); if (classRunning != null) { lblBranchName3.Text = ddlBranch.SelectedItem.Text; lblPeriod3.Text = calDate.SelectedDate.GetValueOrDefault().ToLongDateString(); lblClassName3.Text = classRunning.ClassScheduleDetail.Class.Name; lblInstructor3.Text = classRunning.ClassScheduleDetail.Instructor.Name; ViewState["ClassRunningID"] = Convert.ToInt32(e.CommandArgument); if (String.IsNullOrEmpty(hypLookUpCustomer.Attributes["onclick"])) { hypLookUpCustomer.Attributes.Add("onclick", String.Format("showPromptPopUp('PromptCustomer.aspx?', '{0}', 550, 900);", txtBarcode.ClientID)); } } gvwData.DataBind(); CountTotalParticipants(); } } }
protected void gvwSchedule_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandSource is LinkButton) { if (e.CommandName.Equals("StartStop")) { LinkButton startStopButton = e.CommandSource as LinkButton; if (startStopButton != null) { if (startStopButton.Text == "Start") { mvwForm.SetActiveView(View4); ClassRunning classRunning = classProvider.GetClassRunning(Convert.ToInt32(e.CommandArgument)); if (classRunning != null) { lblBranch4.Text = ddlBranch.SelectedItem.Text; lblPeriod4.Text = calDate.SelectedDate.ToLongDateString(); lblClassName4.Text = classRunning.ClassScheduleDetail.Class.Name; lblInstructor4.Text = classRunning.ClassScheduleDetail.Instructor.Name; ViewState["ClassRunningID"] = Convert.ToInt32(e.CommandArgument); DynamicControlBinding.BindDropDown( ddlRunningInstructor, instructorProvider.GetActiveInstructors(), "Name", "ID", true); DynamicControlBinding.BindDropDown( ddlRunningAssistant, instructorProvider.GetActiveInstructors(), "Name", "ID", true); ddlRunningInstructor.SelectedValue = classRunning.RunningInstructorID.HasValue ? classRunning.RunningInstructorID.Value.ToString() : classRunning.ClassScheduleDetail.InstructorID.ToString(); ddlRunningAssistant.SelectedValue = classRunning.RunningAssistantID.HasValue ? classRunning.RunningAssistantID.Value.ToString() : String.Empty; txtNotes.Text = Convert.ToString(classRunning.Notes); cblAttendances.DataBind(); LoadAttendancesStatus(); } } else { } } } else if (e.CommandName.Equals("Participants")) { mvwForm.ActiveViewIndex = 2; ClassRunning classRunning = classProvider.GetClassRunning(Convert.ToInt32(e.CommandArgument)); if (classRunning != null) { lblBranchName3.Text = ddlBranch.SelectedItem.Text; lblPeriod3.Text = calDate.SelectedDate.ToLongDateString(); lblClassName3.Text = classRunning.ClassScheduleDetail.Class.Name; lblInstructor3.Text = classRunning.ClassScheduleDetail.Instructor.Name; ViewState["ClassRunningID"] = Convert.ToInt32(e.CommandArgument); } gvwData.DataBind(); CountTotalParticipants(); } } }