Dynamic GP eConnect - Creating a new PMClassMaster - c#

I am finding my self looking in front of a wall right now. I've started working with eConnect to communicate with Dynamic GP in order to access information.
I've come accross a questions that I have yet to see answered and I'm tired of searching all over the web and all over the bunch of documents I have. In case someone reads this I'll give you a few sources after my question so you can guide your self even if this post doesn't help you.
My question is how can I create a new PMClassMaster through C#? In the end its an XML file that you need to generate but I wonder if there is a method that does that for me? For example, to create a new Vendor you can do the following:
PMVendorMasterType vendorMasterType = new PMVendorMasterType();
vendorMasterType.eConnectProcessInfo = new eConnectProcessInfo();
vendorMasterType.eConnectProcessInfo.ConnectionString = dynamicGPcs;
vendorMasterType.taUpdateCreateVendorRcd = new taUpdateCreateVendorRcd();
vendorMasterType.taUpdateCreateVendorRcd.VENDORID = vendorGP.VENDORID;
vendorMasterType.taUpdateCreateVendorRcd.VENDNAME = vendorGP.VENDNAME;
vendorMasterType.taUpdateCreateVendorRcd.VENDSHNM = vendorGP.VENDSHNM;
//... etc...
PMVendorMasterType[] vendors = { vendorMasterType };
eConnect.PMVendorMasterType = vendors;
This will pretty much create an XML for you, because thats what GP recevies through eConnect's "CreateEntity" and "UpdateEntity" methods.
I can't seem to find the same for PMClassMaster which is the table that has all the Vendor Class IDs. Does anyone know the answer? For reference: https://www.gptablereference.com/2010/Table/PM00100
----- Sources for GP -----
http://mbsguru.blogspot.pt/
http://victoriayudin.com/
http://www.gptablereference.com

There is no eConnect node for the PM Class Master. Not everything that can be done in GP can be done via eConnect.
For this you will have to manually insert records into the relevant SQL table in the desired database.

Related

Anyone know how to call a feature file fromthe middle of the code - Specflow & c#

Good morning / Afternoon
I have a main class that runs a lot of specific items that include calls to DB, etc.
In the middle of the code I want the code to run a list of specific feature files (specflow) but with all the previous parameters included
I have tried everything but I cannot seem to get it to work.
Anyone got some suggestions?
Thanks
Part of code attached
foreach (string element in Features)
{
DriversPage drivers = new DriversPage(mainRun, steps);
mainRun.TestRunNumber = dataBases.getRunNumberFromDB();
steps.TestRunNumber = mainRun.TestRunNumber; steps.InitializeStep();
drivers.InitializeDriver(element); steps.TerminateStep();
steps.UpdateCollections();
//CALL FEATURE FILE HERE!!!!
steps.UpdateCollections();
}

c# using a binding source to add row to an sql table with incremental identity field

I have a program I created in Visual studio. The program is basically a place for everyone to store passwords for company and external accounts. I want to further this application by automatically creating the company accounts when I create a new user. I approached this by using the binding source. I can get the row into the database but it doesn't use the sql supplied auto increment. I will post the code but I am trying to figure out if I went about this the wrong way. I am not 100% familiar with how the connector and classes that visual studio create when you connect the solution to the database. I am not looking for code to help me do this I am looking for explanations and guidance. If responding with code please help me understand by explaining the code.
DataSet.AccountsRow newdomainuserrow = DBDataSet.Accounts.NewAccountsRow();
newdomainuserrow.USer = userIDTextBox.Text.ToString();
newdomainuserrow.UserName = userIDTextBox.Text.ToString();
System.DateTime moment = new DateTime();
newdomainuserrow.Password = moment.Year;
newdomainuserrow.AccountName = "Domain";
drawingNumDBDataSet.Accounts.Rows.Add(newdomainuserrow);
MessageBox.Show("User Saved");
this.Validate();
this.usersBindingSource.EndEdit();
this.accountBindingSource.Endedit();
this.tableAdapterManager.UpdateAll(this.DataSet);
All help is greatly appreciated.
Matt
I found a solution. The id field is not longer an identity autoincrement field. To increment the id field one by one programmatically like I need to I wrote a simply while statement to get all numbers that were not used. This works if there is a deleted row it will insert one where there is one missing. here is the code I used.
Boolean gotnum;
gotnum = false;
int idnum = 1;
while (gotnum != true)
{
DrawingNumDBDataSet.AccountsRow actrw = drawingNumDBDataSet.Accounts.FindById(idnum);
idnum++;
if (actrw==null)
{
gotnum = true;
idnum--;
}
}
I then set the Id field = to idnum. This is probably not the best practice but it is the best I could come up with.

Query for retrieving account associated with ServicePrincipleName(SPN)

We have an internal site which was built on C# and has various tools for various functions to help the company like looking up/modifying/adding service accounts, for example. The tools are just C# code to automate these tasks. /vague
I've been asked to find/create a way to enter an SPN and have it return the service account which it's associated to.
So something like:
Input: HTTP/server1.company.com
Output: SVC_ACCT_AWESOME
The other request I got was for entering a service account name and have it give the KVNO back.
Issue, I have never done anything in C# before. I have Visual Studio 2013 loaded and I want to learn. I've spent hours pouring over the Googles and haven't found anything useful other than this:
https://msdn.microsoft.com/en-us/library/vstudio/system.servicemodel.configuration.identityelement.serviceprincipalname(v=vs.100).aspx
Unfortunately it doesn't mean anything to me.
Any direction that can be given for these specific tasks would be super appreciated!
Thanks.
I believe you can query AD for SPNs with something like this:
using (var root = new DirectoryEntry()) // or pass in something like "LDAP://dc=example,dc=com" to query a different domain
using (var searcher = new DirectorySearcher(root))
{
searcher.Filter = "(servicePrincipalName=HTTP/server1.company.com)";
using (var results = searcher.FindAll())
{
foreach (SearchResult result in results)
Console.WriteLine(result.Properties["samAccountName"][0]); // or whatever you want to do with it
}
}
(this needs a reference to System.DirectoryServices)

How can i open an existing model from external application

I saw "Ole Automation" examples of creating Physical Database Model elements, but there is no examples of opening an existing DB model.
Can someone please help me? My expectations are similar to this pseudo-code:
PdCommon.Application pd;
pd = PdCommon.OpenApplication(%Path%);
...
pascal was right.
PdCommon.Application pdApplication;
PdPDM.Model pdModel;
pdApplication = new PdCommon.Application();
pdModel = (PdPDM.Model)pdApplication.OpenModel(#"C:\SVN\RAS_DB_Control\trunk\Northwind - MS\Model\Northwind.pdm");

Is there any way to create multiple user stories

I want to create multiple User Stories using the .NET REST API, but I only know how to create one-by-one.
I'm also getting a very slow response, average of 2 secs for each creation.
Can anybody help me?
Code that I'm using:
foreach(RCStoryRecord RecStory in ssStoryList)
{
StoryObject = new DynamicJsonObject();
RecStoryResult = new RCStoryResultRecord();
CreateResult creationResult = restApi.Create("HierarchicalRequirement", StoryObject);
}

Categories