protected void ctlDeleteApproverEditor_Click(object sender, ImageClickEventArgs e)
 {
     foreach (GridViewRow row in ctlApproverEditorGrid.Rows)
     {
         if ((row.RowType == DataControlRowType.DataRow) && (((CheckBox)row.FindControl("ctlSelect")).Checked))
         {
             try
             {
                 long userId = UIHelper.ParseLong(ctlApproverEditorGrid.DataKeys[row.RowIndex].Value.ToString());
                 SuUserFavoriteActor ApproverEditor = QueryProvider.SuUserFavoriteActorQuery.FindUserFavoriteByFavoriteId(userId);
                 SuUserFavoriteActorService.DeleteFavorite(ApproverEditor);
                 //SuUserFavoriteActor user = SuUserFavoriteActor.FindProxyByIdentity(organizationId);
                 //SuOrganizationService.Delete(organization);
             }
             catch (Exception ex)
             {
                 string exMessage = ex.Message;
                 Spring.Validation.ValidationErrors errors = new Spring.Validation.ValidationErrors();
                 errors.AddError("DeleteApproverEditor.Error", new Spring.Validation.ErrorMessage("CannotDelete"));
                 ValidationErrors.MergeErrors(errors);
             }
         }
     }
     ctlApproverEditorGrid.DataCountAndBind();
     ctlApprroverUpdatePanel.Update();
 }
        protected void ctlInitiatorLookup_OnObjectLookUpReturn(object sender, ObjectLookUpReturnArgs e)
        {
            ShowAdd.Text    = null;
            ShowAdd.Visible = false;
            IList <SuUser> userList     = (List <SuUser>)e.ObjectReturn;
            ArrayList      groupArrList = new ArrayList();

            //Add Approver to SuUserFavorite
            //.....
            foreach (GridViewRow row in ctlInitiatorGrid.Rows)
            {
                Label ctlInitiator = (Label)ctlInitiatorGrid.Rows[row.RowIndex].FindControl("ctlUserID");

                groupArrList.Add(ctlInitiator.Text);
            }

            SuUser user = GetUser();

            foreach (SuUser u in userList)
            {
                if (!groupArrList.Contains(u.UserName))
                {
                    SuUserFavoriteActor initiator = new SuUserFavoriteActor();
                    initiator.Active    = true;
                    initiator.User      = user;
                    initiator.ActorType = "2"; //2 = initiator
                    initiator.CreBy     = UserAccount.UserID;
                    initiator.CreDate   = DateTime.Now;
                    //approver.RowVersion = u.RowVersion;
                    initiator.UpdBy       = UserAccount.UserID;
                    initiator.UpdDate     = DateTime.Now;
                    initiator.UpdPgm      = UserAccount.CurrentProgramCode;
                    initiator.ActorUserID = u;
                    SuUserFavoriteActorService.AddFavoriteInitiator(initiator);
                }
                else
                {
                    ShowAdd.Text   += "INITIATOR   '" + u.UserName + "'  HAS BEEN ADDED <br>";
                    ShowAdd.Visible = true;
                }
            }

            ctlInitiatorGrid.DataCountAndBind();
            ctlUpdatePanelInitiator.Update();
        }
        protected void ctlApproverEditorLookup_OnObjectLookUpReturn(object sender, ObjectLookUpReturnArgs e)
        {
            IList <SuUser> userList    = (List <SuUser>)e.ObjectReturn;
            ArrayList      userArrList = new ArrayList();

            foreach (GridViewRow row in ctlApproverEditorGrid.Rows)
            {
                Label ctlUserID = (Label)ctlApproverEditorGrid.Rows[row.RowIndex].FindControl("ctlUserID");

                userArrList.Add(ctlUserID.Text);
            }

            SuUser user = GetUser();

            foreach (SuUser u in userList)
            {
                if (!userArrList.Contains(u.UserName))
                {
                    SuUserFavoriteActor ApproverEditor = new SuUserFavoriteActor();
                    ApproverEditor.Active    = true;
                    ApproverEditor.User      = user;
                    ApproverEditor.ActorType = "1"; //1 = ApproverEditor
                    ApproverEditor.CreBy     = UserAccount.UserID;
                    ApproverEditor.CreDate   = DateTime.Now;
                    //ApproverEditor.RowVersion = u.RowVersion;
                    ApproverEditor.UpdBy       = UserAccount.UserID;
                    ApproverEditor.UpdDate     = DateTime.Now;
                    ApproverEditor.UpdPgm      = UserAccount.CurrentProgramCode;
                    ApproverEditor.ActorUserID = u;

                    SuUserFavoriteActorService.AddFavoriteApprover(ApproverEditor);
                }
            }

            ctlApproverEditorGrid.DataCountAndBind();
            ctlApprroverUpdatePanel.Update();
        }