Beispiel #1
0
        protected void Add_Click(object sender, EventArgs e)
        {
            SuRoleService suRoleService = new SuRoleService();

            suRoleService.RoleID        = new SuRole();
            suRoleService.ServiceTeamID = new DbServiceTeam();
            suRoleService.ServiceTeamID.ServiceTeamID = Convert.ToInt64(ctlServiceTeam1.SelectedValue);
            suRoleService.RoleID.RoleID = RoleID;
            suRoleService.Active        = true;
            suRoleService.CreBy         = UserAccount.UserID;
            suRoleService.UpdBy         = UserAccount.UserID;
            suRoleService.UpdPgm        = ProgramCode;
            try
            {
                SuRoleServiceService.AddRoleService(suRoleService);
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
            finally
            {
                RefreshGridData();
            }
            ctlServiceTeam1.ServiceTeamDataBind(RoleID);
        }
Beispiel #2
0
        public Object RequestProgramRoleData(int startRow, int pageSize, string sortExpression)
        {
            object returnValue = null;

            if (ctlRoleGrid.SelectedIndex > -1)
            {
                SuProgramRole suProgramRole = new SuProgramRole();
                suProgramRole.Role = SuRoleService.FindByIdentity(UIHelper.ParseShort(ctlRoleGrid.SelectedDataKey["Roleid"].ToString()));
                returnValue        = QueryProvider.SuProgramRoleQuery.FindBySuProgramRole(suProgramRole, UserAccount.CurrentLanguageID, startRow, pageSize, sortExpression);
            }
            return(returnValue);
        }
Beispiel #3
0
        public int RequestProgramRoleCount()
        {
            int count = 0;

            if (ctlRoleGrid.SelectedIndex > -1)
            {
                SuProgramRole suProgramRole = new SuProgramRole();
                suProgramRole.Role = SuRoleService.FindByIdentity(UIHelper.ParseShort(ctlRoleGrid.SelectedDataKey["Roleid"].ToString()));
                count = QueryProvider.SuProgramRoleQuery.CountBySuProgramRoleCriteria(suProgramRole, UserAccount.CurrentLanguageID);
            }

            return(count);
        }
Beispiel #4
0
        protected void ctlRoleSearchLookupPopupCaller_NotifyPopupResult(object sender, string action, string value)
        {
            if (action != "ok")
            {
                return;
            }

            object returnValue = new object();

            string[]       listID   = value.Split('|');
            IList <SuRole> roleList = new List <SuRole>();

            foreach (string id in listID)
            {
                SuRole role = SuRoleService.FindByIdentity(UIHelper.ParseShort(id));
                if (role != null)
                {
                    roleList.Add(role);
                }
            }
            returnValue = roleList;
            CallOnObjectLookUpReturn(returnValue);
        }
Beispiel #5
0
        protected void ProgramSearch1_OnObjectLookUpReturn(object sender, ObjectLookUpReturnArgs e)
        {
            IList <SuProgramRole> list            = new List <SuProgramRole>();
            IList <SuProgramLang> programLangList = e.ObjectReturn as IList <SuProgramLang>;
            short roleId = UIHelper.ParseShort(ctlRoleGrid.SelectedValue.ToString());

            try
            {
                foreach (SuProgramLang SuProgramLang in programLangList)
                {
                    SuProgramRole suProgramRole = new SuProgramRole();
                    suProgramRole.Role         = SuRoleService.FindProxyByIdentity(roleId);
                    suProgramRole.Program      = SuProgramLang.Program;
                    suProgramRole.AddState     = false;
                    suProgramRole.EditState    = false;
                    suProgramRole.DeleteState  = false;
                    suProgramRole.DisplayState = false;
                    suProgramRole.Comment      = "";
                    suProgramRole.Active       = true;
                    suProgramRole.CreBy        = UserAccount.UserID;
                    suProgramRole.CreDate      = DateTime.Now.Date;
                    suProgramRole.UpdBy        = UserAccount.UserID;
                    suProgramRole.UpdDate      = DateTime.Now.Date;
                    suProgramRole.UpdPgm       = ProgramCode;
                    list.Add(suProgramRole);
                }
                SuProgramRoleService.UpdateProgramRole(list);

                ctlProgramRoleGrid.DataCountAndBind();
                ctlUpdatePanelProgramRoleGridView.Update();
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
        }
Beispiel #6
0
 protected void Delete_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in ctlService.Rows)
     {
         //traversal in a row
         if (((CheckBox)(row.Cells[0].Controls[1])).Checked)
         {
             int           rowIndex      = row.RowIndex;
             short         roleServiceID = short.Parse(ctlService.DataKeys[rowIndex].Value.ToString());
             SuRoleService roleService   = new SuRoleService();
             roleService.RoleServiceID = roleServiceID;
             try
             {
                 SuRoleServiceService.DeleteRoleService(roleService);
             }
             catch (ServiceValidationException ex)
             {
                 ValidationErrors.MergeErrors(ex.ValidationErrors);
             }
         }
     }
     RefreshGridData();
     ctlServiceTeam1.ServiceTeamDataBind(RoleID);
 }