Assign users to jobs C#

I have a user table that contains active and disabled users(tblUsers), I also have a transaction table(tblTransactions) with rows of records and an empty UserId colunm.
I want to select from UserId of active users from tblUsers and distribute those Id's across UserId column of tblTransactions.
Am basically trying to assign jobs from tblTransaction to active users in tblUsers. Am coding a C# and building a windows service to do this task.

1) Create an Entity Framework model for your database.  Head here
https://msdn.microsoft.com/en-us/data/ef to learn how.
2) Then you will be able to write C# like this
using (var db = new MyDbContext())
var activeUsers = db.tblUsers.Where(u => u.IsActive).ToList();
var unassignedTransactions = db.tblTransactions.Where(t => t.UserId == null).ToList();
var numActiveUsers = activeUsers.Count;
for (int i=0;i<unassignedTransactions.Count;i++)
var tran = unassignedTransactions[i];
tran.User = activeUsers[i % numActiveUsers];
db.SaveChanges();
Also if you can, remove the "tbl" prefix from all your tables.  It's not helpful.
David
David http://blogs.msdn.com/b/dbrowne/

Similar Messages

  • About creating 'Job created by'-report for multiple user's jobs [sm37c]

    hi,
    Done some searching for the problem in my SM37C-query  with no luck...
    In SM37c there is a User name-field for filtering query for  "User name"-user's jobs. I'm aware that I can use asterisk '*' here but my need is more generic. I would need to filter my query to certain group of users that interest me.
    Q: Can I define a filter (or group) in SM37c that I could get listed only predefined user's jobs? If not, any other transaction or workaround thjat would work here?
    thanks,
    ari

    Hi,
    This is SAP Business one system administration forum. Please find correct forum and repost your question to get quick assistance.
    Please close this thread by marking helpful answer.
    Thanks & Regards,
    Nagarajan

  • Error assigning users to application Role in Obiee 11.1.1.7.0

    Hello
    I installed Obiee 11.1.1.7.0 both on Windows and Linux platform and after that, I successfully set Active Directory integration. I have a problem assigning users to Application Role in EM. When I'm trying to search a user on Display name, the Principal userName returned is blank and the error is : Java Null Pointer Exception
    After that I install a fresh copy of 11.1.6.0. After AD Integration, I was able to assign users to Application Role. I made 11.1.1.7.0 upgrade and same error has come. I think this is a bug because same AD settings on 11.1.1.6.0 works.
    The error:
    ava.lang.NullPointerException
    #{viewScope.emas_pagemodel_security_EditAppRole.searchPrincipal}: java.lang.NullPointerException
         Hide Additional Trace Information
    javax.faces.FacesException: #{viewScope.emas_pagemodel_security_EditAppRole.searchPrincipal}: java.lang.NullPointerException at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96) at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:103) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361) at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96) at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:97) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1086) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:434) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.emSDK.license.LicenseFilter.doFilter(LicenseFilter.java:101) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446) at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177) at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.help.web.rich.OHWFilter.doFilter(Unknown Source) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.emas.fwk.MASConnectionFilter.doFilter(MASConnectionFilter.java:41) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.eml.app.AuditServletFilter.doFilter(AuditServletFilter.java:179) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.eml.app.EMRepLoginFilter.doFilter(EMRepLoginFilter.java:203) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.core.model.targetauth.EMLangPrefFilter.doFilter(EMLangPrefFilter.java:158) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.core.app.perf.PerfFilter.doFilter(PerfFilter.java:141) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.sysman.eml.app.ContextInitFilter.doFilter(ContextInitFilter.java:542) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119) at java.security.AccessController.doPrivileged(Native Method) at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324) at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460) at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103) at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171) at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:178) Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) ... 67 more Caused by: java.lang.NullPointerException at oracle.sysman.emas.model.security.DialogAdminBean$1.compare(DialogAdminBean.java:567) at java.util.Arrays.mergeSort(Arrays.java:1270) at java.util.Arrays.mergeSort(Arrays.java:1281) at java.util.Arrays.sort(Arrays.java:1210) at java.util.Collections.sort(Collections.java:157) at oracle.sysman.emas.model.security.DialogAdminBean.fetchPrincipals(DialogAdminBean.java:563) at oracle.sysman.emas.pagemodel.security.identity.EditAppRolePageModel.searchPrincipal(EditAppRolePageModel.java:496) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.el.parser.AstValue.invoke(Unknown Source) at com.sun.el.MethodExpressionImpl.invoke(Unknown Source) at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46) ... 68 more
    Any suggestion?
    Thx
    Gabriel
    Edited by: Gabbriel on Apr 23, 2013 10:46 PM

    We received from Oracle a work-around of this problem.
    It seems to be related to the virtualize flag set to true. I f you set it to false the problem disappear (it works for me).
    (rif. http://docs.oracle.com/cd/E28280_01/bi.1111/e10543/privileges.htm#BABDCJBH)
    There's an open BUG on this problem: Bug 16808088 - 11G JAVA.LANG.NULLPOINTEREXCEPTION ADDING USER TO ROLE AFTER UPGRADE TO 11.1.1.7.
    Hope this works.
    S.

  • Error while assigning user for release approval path for payment release

    Hi everyone,
         I am trying to assign user for payment release in SPRO. I have defined upto 'Define relevant document types for release for payment', after that while assigning user in terms of position for release and save it, i am getting error 'Program error: ASSIGN with length 0 in program "MP120800" '.Because of it i can t proceed further.
    The data in details below;
    1. Create Workflow Variant for Release for Payment
       1000     SAP
    2. Assign Company Code Workflow Variant for Release for Payment
      1000     1000     SAP
    3. Define Release Approval Groups for Release for Payment
      0001     Vendor A
    0002     vendor B
    0003     Vendor C
    0004     G/L accounts
    4. Define Release Approval Paths for Release for Payment
      0001     Vendor high
    0002     Vendor middle
    0003     Vendor low
    0004     G/L accounts
    0005     Other
    5. Assign Release Approval Paths for Release for Payment
      1000     KZ     0001     0001
    1000     KZ     0002     0002
    1000     KZ     0003     0003
    6. Assign Release Approval Procedure for Release for Payment
    1000     0001     20,000.00     KES     1     WS10000052     WS00400011
    1000     0002     50,000.00     KES     2     WS10000052     WS00400021
    1000     0003     1,000,000.00     KES     3     WS10000052     WS00400022
    7. Define Relevant Document Types for Release for Payment
         1000     KR
    1000     KZ
    8. Define Users with Authorization to Payment Release
    1000     0001     1     20,000.00     KES
    1000     0001     2     50,000.00     KES
    1000     0001     3     100,000.00     KES
    here i have selected the option and tried to create Orgobject, i am getting following error
    Program error: ASSIGN with length 0 in program "MP120800"
    If any corrections in the definitions, Please let me know.
    Thanks in advance!!

    Hello,
    Please start the report RSWOGIND, set also the checkbox "generate all
    ObjTypes from new". This should solve the problem.
    Best regards, Hana

  • Error while assigning user through users_gen t code

    Dear Experts,
    While assigning user to the org structure,i am getting below error message.Please guide me.
    many thanks

    Hi Ganesh,
    Thank you for the update,i was on leave.I could not update the issue.
    Issue has been resolved,issue is due to the last name is not maintained for the user in SU01 then user trying the assign to org through users_gen t code.
    Then issue raised.
    Thank you.

  • Unable to see assign users or groups option under a groupin Shared services

    I have a bizzare issue related to Shared services.
    In Application 1 (on PROD env), after I select the group, right-click and go to properties, under "group members" and "user members" tabs, I do not see the options to assign access to any of the existings groups (we have about 50+ groups). I can only view the existing users/groups, even though I have been given admin/proviosioning rights, while the other admin can assign access to the same application.
    While for Application 2 (on DEV) I am able to see all these options and I am able to assign users and groups to any of the groups. I do not see them as a browser issue, as I have opened both these links on the same IE window, but on different tabs.
    Unfortunately, I can't test App1 on TEST/DEV, as we do not have its copy on here, it is all on PROD and App2 is only on DEV.
    Any ideas?
    Thanks,
    Paul

    I would of thought it was provision related, can you try setting up another user as a test with the correct provisioning such as provisioning manager of the different product areas and see if the new user works.
    If it does then it points an issue with your account or the way it has been provisioned.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Assign User Profiles and Web Interface Transactions to Users

    Hi EM Gurus,
    Has anyone worked with not standard scenarios in SCEM?
    They are working well but I can't access them on interface web.
    In selection page (search page after logon), where choose tracking scenarios, only standard scenarios appear although I have assigned both scenarios to the user and made same configuration; Assigned and Defined Web Interface Transactions, Configured Fields for User Profiles, Defined User Profiles, Assigned User Profiles and Web Interface Transactions to Users.
    But only Standard Scenarios appear as choice of tracking scenarios that are displayed to the user as a dropdown box on the selection screen after logging on to the Web interface.
    Has anyone accessed not standard scenarios on interface web??
    Help, please!
    Thanks a lot.
    Rodrigo Freitas

    Hello Rodrigo,
    if you have assigned the scenarios to your user in transaction /SAPTRX/UCUSER you must go to the admin page and reload the profile manager.
    /admin in the URL of the WCL instead /ehsearch.
    Afterwards you should see them also in the drop-down box.
    Best regards,
    Steffen

  • Assign users to virtual organisations?

    Hi,
    I'm new to IDM and trying to work out how to use it effectively.
    I have an LDAP directory with I've made a directory junction to to create virtual organisations mirroring the directory structure.
    However, when I import users from resource they all go into the Top organization and do not appear under the virtual organization.
    how can I fix this? I read somewhere that the Identity Template is used to assign users to organizations? Assuming I have mapped attributes to mail, ou and ouid is the following Identity template correct?
    mail=${mail},ou=${ou},ouid=${ouid},dc=example,dc=comOr am I missing something entirely?
    thanks for your help,
    Toby.

    You need to create a form and assign it to the reconciliation process. In the form, you need waveset.organization set to where you want the user objects placed. By default, waveset.organization is set to just "Top". You can get the DN, parse it into a list and write the xml code to use the list to place each in a different virtual organization.
    Start off simple, say create a container called Top:newusers. Take a copy of Empty Form and save it as orgEmpty Form or something. Define a field waveset.organization and just set its value to "Top:newusers". Then in the resource, set the reconciliation form to your new form.
    Try this, once you see new ids show up in Top:newusers, you then can enhance the logic to be more sophisticated in placing objects. That is, parse the DN into a list and walk the list for a IDM waveset.organization value.
    BTW, a good question to ask prospective IDM so called experts. Of 8 or so, I only met one that new how to do this efficiently.

  • How to create groups and assign users thru program

    Hi,
    I am planning to create groups by program and assign users to them based on some condition.Once users are assigned to those groups we need to change the Language value for those users in User profile
    We are using Central User Administration.
    Please let me know the solution
    Thanks
    Bala Duvvuri

    probably you can use this code to create a group
    IGroupFactory groupFact = UMFactory.getGroupFactory();  
    IGroup group = groupFact.newGroup(wdContext.currentContextElement().getGroup()); 
       group.commit();
    for this required com.sap.security.api.jar

  • Problem while extracting using RSCRM_BAPI in user defined job

    Hi all,
    Of late I have trying to executing Bex query extract thru RSCRM_BAPI and needed a way to be able to schedule an user defined job so for that so that I have control in terms of when I execute the job.
    I went thru SDN and found this Function module RSCRMBW_REPORT which is supposed to do the part however I am getting a error since my BEx query has a variable screen and I dont know how I can take care of that. I am currently getting the error from the function module:
    "The entry type of variable ZPM_MEDT requires you to enter values"
    Where ZPM_MEDT is a date variable on my Bex report.
    So the question is how do I get my variables to my Bex report while using Fn module RSCRMBW_REPORT. I tried Bex personalization it didnt work.
    For more information on RSCRMBW_REPORT module please refer.
    Providing job names in trx RSCRM_BAPI
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3ba5e590-0201-0010-59b1-cab51fd245b7

    Sorry for the delay in reponse.  I have changed the all variables either to populater by user exit or hard code it to a filter (constant).  But I am having problem executing the function RSCRMBW_REPORT
    I am using the following parameters and getting the subsequent error message.
    I_MODE:  OPEN/START
    I_REPORTUID: YC_OO/ZYM_OO_Q0002_2
    I_REPNAME: ZYM_OO_Q0002_2
    I_PACKSIZE: 0000010000
    I_EXECMODE: TABLE
    I_EXTRACT: ZOCARRY
    I_USER: R2067Z
    I_LANGU: EN
    I_SEPARATOR: ;
    I_BATCH_TIME: 00:00:00
    I_CLEAREXTRACT: X
    I_CHECK_MEMBERS: X
    Rest all fields blank.
    Now I am getting short dump in the GET_CUBETYPE() method in the CL_RSCRMBW_BAPI class.  For some reason the cube name is not being parsed from the report ID name "YC_OO/ZYM_OO_Q0002_2".  Am I missing something?
    Also is there any other way SAP provides to schedule RSCRM_BAPI queries to a table externally without using standard job scheduliing from within the RSCRM_BAPI transaction.
    Thanks

  • How to assign Users to process roles?

    Hi All,
    I have designed a process and I have consolidated all the roles,
    when I intiate the process from the runtime workset it asks to assign users to these roles(I have consolidated all the roles to three mail roles). The problem that I am facing is that the user should not see this screen, depending upon the user login id the approvers should be automatically assigned to the respective roles.
    Is this possible...
    Kindly guide me
    Thanks in Advance
    Sivaprasath

    Hi Sivaprasath,
    assuming that I've got you wright you could try to model the following using the callable object "business logic" and the callable object "assign user to process role".
    With the help of the first CO you can implement the logic to assign the respective approvers to the users (initiator) and let the processflow go on directing it to the appropriate step where the above mentioned second CO assigns the user to the process role (using the result states of the bussiness logic CO)
    At least you are supposed to need an appropriate Parameter that you can consolidate with the User ID.
    Just a quick idea, hope this will work with you.
    Greetings
    Berndt

  • CUPS - Shortcut to assigning users with lines?

    Is there any bulk way to assign users to the line apperances of the user's phone in CallManager?  I need to do this for Presence, but it's a very manual task.  I've tried exporting the phones, but I don't see anywhere in the export where it shows the user/dn assocation.  To be clear, I'm not talking about device association in the end user account, I'm speaking of the end user associated with the DN on the phone (all the way at the bottom of the DN configuration page).

    Hi
    See this previous post:
    https://supportforums.cisco.com/message/3043177#3043177
    Please rate helpful posts...
    Aaron

  • Webpart button that assigns user to list item

    I need a button event that when clicked assigns the user to the list item that is selected from a checkbox. All from a webpart. Unfortunately for me corporate will not let us use Visual Studio (security access to critical info and what not).
    I have access to InfoPath and SharePoint designer content editor and such. I tried circumventing it all together and built a button in the form that only shows when in edit mode from the webpart. The button simply assigns user to the people picker, which shows
    in InfoPath preview. But when I try to do the same in the live edit able list item the people picker just blinks and nothing fills the text field. I even tried using a simple text box which worked but only for userid()  not display name. Anybody know
    why people picker field appears blank in the live version? Or can someone point me to where I can build an outright webpart button that fills my assignto field? I don't quite understand how to do it. What I have seen has been done with visual studio. Any help
    would be great.

    Hi Jack,
    First of all, you can not create a coded web part using SPD.
    What you can do is create custom page (aspx) and do inline coading. (http://social.technet.microsoft.com/Forums/sharepoint/en-US/211d3c10-ab83-473f-95b4-83b0174f9dd7/how-to-add-custom-web-part-to-sharepoint-page-by-using-sharepoint-designer?forum=sharepointgeneralprevious)
    Custom page allows you to add c# code with enable page compiling with
    <PageParserPaths>
    <PageParserPath VirtualPath="/PageLibrary/MyCustomPage.aspx" CompilationMode="Always" AllowServerSideScript="true" />
    </PageParserPaths>
    OR
    Write all into Content editor web part on that page.(http://social.technet.microsoft.com/Forums/sharepoint/en-US/f6d8c243-71af-4a98-bdb6-750d4dd9dc27/check-box-and-button-in-content-editor-web-part?forum=sharepointgeneralprevious)
    Here you can use Javascript only and not "c#" due to security issue.(http://social.msdn.microsoft.com/Forums/sharepoint/en-US/74b676f0-3509-4b11-8725-b9f2626371e9/content-editor-web-part-and-c?forum=sharepointdevelopmentlegacy)

  • Shared Services 11.1.2 Unable to remove assigned user from a security group

    In Shared Services 11.1.2 - trying to remove a user from the assigned users list of a security group. Initially, I am able to remove the user and the assigned users total decreases by one - but when I relaunch the group properties - this user is still in there? The change does not hold. Any suggestions would be appreciated - thanks,
    Paul

    Hello Paul,
    Not sure if this is related to yours, but it might be worth having a look at the following articles on Oracle support --
    External users in EPM Shared Services (e.g. MSAD users) cannot be removed from Native groups if they have multiple IDs in the external user directory. [ID 1526569.1]
    Users from External User Directories Cannot be Removed from Native Groups [ID 1272309.1]
    Thanks,
    hyperionEPM
    Please mark answers as correct or helpful for others to find them easily.

  • User Comparison - Job showing output deleted users in Sol.man

    Hi All,
    I scheduled the User Comparison job for every 4 hrs with respective of the program RHAUTUPD_NEW. In the output it is showing me the list of deleted users as well. like "User EAMANITR does not exist" in Sol.man.
    I am sure it is not a problem, but want to knwo what the job output showing this list as well.
    let me know if any one come up with this issue.
    SV

    Hi,
    Have you checked OSS note 1280891?
    Cheers

Maybe you are looking for