Exemplo n.º 1
0
 private void PopulateControl()
 {
     try
     {
         txtScheduleCategoryID.Text   = ScheduleCategoryID.ToString();
         txtScheduleCategoryName.Text = ScheduleCategoryName;
         txtLap.Text = Lap.ToString();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        protected void lvMDScheduleCategory_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ScheduleCategoryID;

            Int64.TryParse(e.CommandArgument.ToString(), out ScheduleCategoryID);

            if (ScheduleCategoryID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ScheduleCategoryID = ScheduleCategoryID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDScheduleCategoryEntity.FLD_NAME_ScheduleCategoryID, ScheduleCategoryID.ToString(), SQLMatchType.Equal);

                        MDScheduleCategoryEntity mDScheduleCategoryEntity = new MDScheduleCategoryEntity();


                        result = FCCMDScheduleCategory.GetFacadeCreate().Delete(mDScheduleCategoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ScheduleCategoryID       = 0;
                            _MDScheduleCategoryEntity = new MDScheduleCategoryEntity();
                            PrepareInitialView();
                            BindMDScheduleCategoryList();

                            MiscUtil.ShowMessage(lblMessage, "Schedule Category has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Schedule Category.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }