protected void gridRoles_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("DeleteRow"))
     {
         string roleName = e.CommandArgument.ToString();
         try
         {
             if (Roles.GetUsersInRole(roleName).Length > 0)
             {
                 lblStatus.Text = String.Format("Cannot delete role name {0} since it already has users associated with it", roleName);
             }
             else
             {
                 try
                 {
                     UserManagement.DeleteRole(roleName);
                 }
                 catch (Exception ex)
                 {
                     ApplicationLogger.Write(ex);
                     DynamicControlBinding.SetLabelTextWithCssClass(lblStatus, ex.Message, LabelStyleNames.ErrorMessage);
                 }
             }
         }
         catch (Exception ex)
         {
             ApplicationLogger.Write(ex);
             DynamicControlBinding.SetLabelTextWithCssClass(lblStatus, ex.Message, LabelStyleNames.ErrorMessage);
         }
     }
     BindToGrid(null);
 }
Beispiel #2
0
 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();
     }
 }
Beispiel #3
0
 void IBasicCommand.AddNew()
 {
     mvwForm.SetActiveView(viwAddEdit);
     RowID = 0;
     CalendarPopup1.SelectedValue = DateTime.Today;
     CalendarPopup2.SelectedValue = DateTime.Today.AddDays(7);
     chkActive.Checked            = true;
     chkInfinite.Checked          = false;
     DynamicControlBinding.ClearTextBox(txtDescription);
     txtDescription.Focus();
 }
Beispiel #4
0
    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);
        }
    }
Beispiel #5
0
 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;
            }
        }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.ApplyUserSecurity(lnbAddNew, lnbDelete, btnSave, gvwMaster);

        if (!this.IsPostBack)
        {
            mvwForm.SetActiveView(viwRead);
            ddlFilter.SelectedIndex = 0;
            DynamicControlBinding.SetUpControls(pgrMaster, gvwMaster);
            ((IBasicCommand)this).Refresh();
        }

        WebFormHelper.InjectSubmitScript(this, "Save this data ?", "Saving, please wait...", btnSave, true);
    }
 private void DoResetPassword()
 {
     try
     {
         string userName = ViewState["_UserName"].ToString();
         UserManagement.UnlockUser(userName);
         string newPassword = UserManagement.ResetPassword(userName);
         lblNewPassword.Text = String.Format("New Password for <strong>{0}</strong> is <strong style='color:green;'>{1}</strong>", userName, newPassword);
         btnDoReset.Enabled  = false;
     }
     catch (Exception ex)
     {
         DynamicControlBinding.SetLabelTextWithCssClass(lblNewPassword, String.Format("<b>Error:</b> {0}", ex.Message), LabelStyleNames.ErrorMessage);
     }
 }
 protected void btnDoReset_Click(object sender, EventArgs e)
 {
     try
     {
         string userName = ViewState["_UserName"].ToString();
         //UserManagement.UnlockUser(userName);
         string newPassword = SecurityService.ResetPassword(userName);
         lblNewPassword.Text = String.Format("New Password for <strong>{0}</strong> is <strong style='color:green;'>{1}</strong>", userName, newPassword);
         btnDoReset.Enabled  = false;
     }
     catch (Exception ex)
     {
         DynamicControlBinding.SetLabelTextWithCssClass(lblNewPassword, String.Format("<b>Error:</b> {0}", ex.Message), LabelStyleNames.ErrorMessage);
         LogService.ErrorException(GetType().FullName, ex);
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtCreditCardNo.Text.Trim().Length == 16 &&
                    ValidationHelper.IsValidCreditCardNumber(txtCreditCardNo.Text.Trim()))
                {
                    CustomerService.UpdateCreditCardInfo(
                        Request["barcode"],
                        Convert.ToInt32(ddlCreditCardType.SelectedValue),
                        Convert.ToInt32(ddlBank.SelectedValue),
                        txtCardHolderName.Text,
                        txtCardHolderIDNo.Text,
                        txtCreditCardNo.Text,
                        calExpireDate.SelectedDate.GetValueOrDefault(DateTime.Today),
                        txtReason.Text);

                    ClientScript.RegisterStartupScript(GetType(),
                                                       "_alert",
                                                       String.Format("alert('Credit card information for {0} has been updated.')", Request["barcode"]),
                                                       true);

                    DynamicControlBinding.ClearTextBox(txtCardHolderIDNo, txtCardHolderName, txtCreditCardNo);
                    txtReason.Text = String.Empty;
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(),
                                                       "_alert",
                                                       String.Format("alert('Credit card number is invalid')"),
                                                       true);
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(GetType(),
                                                   "_alert",
                                                   String.Format("alert('{0}')", ex.Message),
                                                   true);
                LogService.ErrorException(GetType().FullName, ex);
            }
            finally
            {
                gvwMaster.DataBind();
            }
        }
Beispiel #11
0
        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;
            }
        }
Beispiel #12
0
    void IBasicCommand.Delete()
    {
        int[] arrayOfID = DynamicControlBinding.GetRowIdForDeletion(gvwMaster);

        try
        {
            using (var ctx = new FitnessDataContext())
            {
                ctx.Alerts.DeleteAllOnSubmit(ctx.Alerts.Where(row => arrayOfID.Contains(row.ID)));
                ctx.SubmitChanges();
            }
        }
        catch (Exception ex)
        {
            DynamicControlBinding.SetLabelTextWithCssClass(lblStatus, ex.Message, LabelStyleNames.ErrorMessage);
            ApplicationLogger.Write(ex);
        }
        ((IBasicCommand)this).Refresh();
    }
    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();
        }
    }
Beispiel #14
0
    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);
        }
    }
Beispiel #15
0
    void IBasicCommand.Save()
    {
        if (this.IsValid)
        {
            try
            {
                using (var ctx = new FitnessDataContext())
                {
                    Alert entity = RowID == 0 ? new Alert() : ctx.Alerts.Single(row => row.ID == RowID);
                    entity.Description = txtDescription.Text;
                    entity.StartDate   = CalendarPopup1.SelectedValue.Value;
                    entity.EndDate     = chkInfinite.Checked ? null : CalendarPopup2.SelectedValue;
                    entity.Active      = chkActive.Checked;
                    if (RowID == 0)
                    {
                        EntityHelper.SetAuditFieldForInsert(entity, User.Identity.Name);
                        ctx.Alerts.InsertOnSubmit(entity);
                    }
                    else
                    {
                        EntityHelper.SetAuditFieldForUpdate(entity, User.Identity.Name);
                    }

                    ctx.SubmitChanges();
                }

                DynamicControlBinding.SetLabelTextWithCssClass(lblStatus, "Data has been saved.", LabelStyleNames.InfoMessage);
            }
            catch (Exception ex)
            {
                DynamicControlBinding.SetLabelTextWithCssClass(lblStatus, ex.Message, LabelStyleNames.ErrorMessage);
                ApplicationLogger.Write(ex);
            }
            finally
            {
                ((IBasicCommand)this).Refresh();
            }
        }
    }
 protected void gvwMaster_RowCreated(object sender, GridViewRowEventArgs e)
 {
     DynamicControlBinding.ChangeBackgroundColorRowOnHover(e);
 }
Beispiel #17
0
 protected void gvwSchedule_RowCreated(object sender, GridViewRowEventArgs e)
 {
     DynamicControlBinding.HideGridViewRowId(0, e);
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Validate("AddEdit");
                if (IsValid)
                {
                    if (calDateOfBirth.SelectedDate > DateTime.Today)
                    {
                        DynamicControlBinding.SetLabelTextWithCssClass(
                            lblMessageAddEdit,
                            "Invalid date of birth",
                            LabelStyleNames.ErrorMessage);
                        return;
                    }

                    if (ddlBillingType.SelectedItem.Text.ToUpper() == "AUTO PAYMENT")
                    {
                        cuvCreditCardNo.Validate();
                        if (cuvCreditCardNo.IsValid)
                        {
                            if (ddlBillingCardType.SelectedIndex == 0 ||
                                ddlBillingBank.SelectedIndex == 0 ||
                                String.IsNullOrEmpty(txtBillingCardHolderID.Text) ||
                                String.IsNullOrEmpty(txtBillingCardHolderName.Text) ||
                                String.IsNullOrEmpty(txtBillingCardNo.Text))
                            {
                                DynamicControlBinding.SetLabelTextWithCssClass(
                                    lblMessageAddEdit,
                                    "Auto payment information is incomplete",
                                    LabelStyleNames.ErrorMessage);
                                return;
                            }
                        }

                        if (txtDuesAmount.Text.ToDefaultNumber <decimal>() == 0 ||
                            ddlMonthlyDuesItem.SelectedValue.ToDefaultNumber <int>() == 0)
                        {
                            DynamicControlBinding.SetLabelTextWithCssClass(
                                lblMessageAddEdit,
                                "Both <b>Dues Amount</b> and <b>Monthly Dues Item</b> fields must be specified if billing type is manual payment",
                                LabelStyleNames.ErrorMessage);
                            return;
                        }
                    }

                    if (chkGenerateNewBarcodeCustomer.Checked)
                    {
                        if (chkFather.Checked && (
                                String.IsNullOrEmpty(txtFatherName.Text)))
                        {
                            DynamicControlBinding.SetLabelTextWithCssClass(
                                lblStatusParent,
                                "Parent Information (Father) is incomplete", cssClass: LabelStyleNames.ErrorMessage);
                            return;
                        }

                        if (chkMother.Checked && (
                                String.IsNullOrEmpty(txtMotherName.Text)))
                        {
                            DynamicControlBinding.SetLabelTextWithCssClass(
                                lblStatusParent,
                                "Parent Information (Mother) is incomplete",
                                LabelStyleNames.ErrorMessage);
                            return;
                        }
                    }

                    switch (RowID)
                    {
                    case 0:
                        ContractService.Add(
                            calDate.SelectedDate.GetValueOrDefault(),
                            !chkGenerateNewBarcodeCustomer.Checked,
                            txtCustomerBarcode.Text,
                            chkIsTransfer.Checked,
                            txtCustomerFirstName.Text,
                            txtCustomerLastName.Text,
                            calDateOfBirth.SelectedDate.GetValueOrDefault(),
                            txtIDCardNo.Text,
                            ddlOccupation.SelectedIndex == 0 ? (int?)null :Convert.ToInt32(ddlOccupation.SelectedValue),
                            Convert.ToInt32(ddlFindBranch.SelectedValue),
                            Convert.ToInt32(ddlPackage.SelectedValue),
                            null,
                            calEffectiveDate.SelectedDate.GetValueOrDefault(),
                            Convert.ToInt32(ddlBillingType.SelectedValue),
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToInt32(ddlBillingCardType.SelectedValue),
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToInt32(ddlBillingBank.SelectedValue),
                            txtBillingCardNo.Text,
                            txtBillingCardHolderName.Text,
                            txtBillingCardHolderID.Text,
                            new DateTime(Convert.ToInt32(ddlCardExpiredYear.SelectedValue),
                                         Convert.ToInt32(ddlCardExpiredMonth.SelectedValue),
                                         DateTime.DaysInMonth(Convert.ToInt32(ddlCardExpiredYear.SelectedValue),
                                                              Convert.ToInt32(ddlCardExpiredMonth.SelectedValue))),
                            'P',
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToInt32(ddlMonthlyDuesItem.SelectedValue),
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToDecimal(txtDuesAmount.Value),
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToDecimal(txtAdditionalDuesAmount.Value),
                            calNextDuesDate.SelectedDate.GetValueOrDefault(),
                            calExpiredDate.SelectedDate.GetValueOrDefault(),
                            txtHomePhone.Text,
                            txtCellPhone.Text,
                            txtWorkPhone.Text,
                            txtMailingAddress.Text,
                            txtMailingZipCode.Text,
                            txtAddress.Text,
                            txtZipCode.Text,
                            Convert.ToInt32(ddlArea.SelectedValue),
                            chkFather.Checked,
                            txtFatherName.Text,
                            txtIDCardNoFather.Text,
                            chkFatherBirthDateUnknown.Checked ? (DateTime?)null : calBirthDateFather.SelectedDate,
                            txtFatherPhone.Text,
                            txtFatherEmail.Text,
                            chkMother.Checked,
                            txtMotherName.Text,
                            txtIDCardNoMother.Text,
                            chkMotherBirthDateUnknown.Checked ? (DateTime?)null : calBirthDateMother.SelectedDate,
                            txtMotherPhone.Text,
                            txtMotherEmail.Text,
                            txtNotes.Text,
                            ddlRenewalOrUpgrade.SelectedValue
                            );
                        break;

                    default:
                        ContractService.Update(
                            RowID,
                            Convert.ToInt32(ddlPackage.SelectedValue),
                            calDate.SelectedDate.GetValueOrDefault(),
                            calEffectiveDate.SelectedDate.GetValueOrDefault(),
                            txtIDCardNo.Text,
                            ddlOccupation.SelectedIndex == 0 ? (int?)null : Convert.ToInt32(ddlOccupation.SelectedValue),
                            Convert.ToInt32(ddlBillingType.SelectedValue),
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToInt32(ddlBillingCardType.SelectedValue),
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToInt32(ddlBillingBank.SelectedValue),
                            txtBillingCardNo.Text,
                            txtBillingCardHolderName.Text,
                            txtBillingCardHolderID.Text,
                            new DateTime(Convert.ToInt32(ddlCardExpiredYear.SelectedValue),
                                         Convert.ToInt32(ddlCardExpiredMonth.SelectedValue),
                                         DateTime.DaysInMonth(Convert.ToInt32(ddlCardExpiredYear.SelectedValue),
                                                              Convert.ToInt32(ddlCardExpiredMonth.SelectedValue))),
                            txtHomePhone.Text,
                            txtCellPhone.Text,
                            txtWorkPhone.Text,
                            txtMailingAddress.Text,
                            txtMailingZipCode.Text,
                            txtAddress.Text,
                            txtZipCode.Text,
                            Convert.ToInt32(ddlArea.SelectedValue),
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToInt32(ddlMonthlyDuesItem.SelectedValue),
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToDecimal(txtDuesAmount.Value.GetValueOrDefault()),
                            Convert.ToInt32(ddlBillingType.SelectedValue) == 1 ? 0 : Convert.ToDecimal(txtAdditionalDuesAmount.Value.GetValueOrDefault()),
                            calNextDuesDate.SelectedDate.GetValueOrDefault(),
                            calExpiredDate.SelectedDate.GetValueOrDefault(),
                            chkFather.Checked,
                            txtFatherName.Text,
                            txtIDCardNoFather.Text,
                            chkFatherBirthDateUnknown.Checked ? (DateTime?)null : calBirthDateFather.SelectedDate,
                            txtFatherPhone.Text,
                            txtFatherEmail.Text,
                            chkMother.Checked,
                            txtMotherName.Text,
                            txtIDCardNoMother.Text,
                            chkMotherBirthDateUnknown.Checked ? (DateTime?)null : calBirthDateMother.SelectedDate,
                            txtMotherPhone.Text,
                            txtMotherEmail.Text,
                            txtNotes.Text
                            );
                        break;
                    }
                    Refresh();
                }
            }
            catch (Exception ex)
            {
                WebFormHelper.SetLabelTextWithCssClass(lblMessage, ex.Message, LabelStyleNames.ErrorMessage);
                LogService.ErrorException(GetType().FullName, ex);
            }
        }
    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();
            }
        }
    }
        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();
                }
            }
        }