Hello how do I add a new customer with a default contact in my process in code behind.
So far I have this but I need to create a contact object link the two somehow.
PX.Objects.AR.Customer m = new PX.Objects.AR.Customer();
m.AcctCD = "Test1";
m.AcctName = "Joe Bloggs";
m.Type = "CU";
Customers.Insert(m);
Persist();
CustomerMaint graph = PXGraph.CreateInstance<CustomerMaint>();
Customer cust = new Customer();
cust.AcctName = "Company Name";
cust = (Customer)graph.CurrentCustomer.Insert(cust);
Address addr = (Address)graph.Addresses.Current;
addr.AddressLine1 = "Address 1";
addr.AddressLine2 = "Address 2";
addr.City = "City";
addr.State = "State";
addr.PostalCode = "Zip";
addr.CountryID = "Country";
graph.Addresses.Update(addr);
Contact contact = (Contact)graph.DefContact.Current;
contact.ContactType = ContactTypesAttribute.BAccountProperty;
contact.FirstName = "FirstName";
contact.LastName = "Last Name";
contact.EMail = "emaiL#email.com";
contact.WebSite = "www.website.com";
contact.Phone1 = "1234567890";
contact.Fax = "1234567890";
graph.DefContact.Update(contact);
graph.Actions.PressSave();
This what I did seems to work good. Got instance of the customermaint graph. Insert new Customer into currentcustomer and edit current def contact.
PX.Objects.AR.CustomerMaint graph = PXGraph.CreateInstance<PX.Objects.AR.CustomerMaint>();
PX.Objects.AR.Customer m = new PX.Objects.AR.Customer();
m.AcctCD = "Test4";
m.AcctName = "Jo Bloggs";
m.Type = "CU";
graph.CurrentCustomer.Insert(m);
PX.Objects.CR.Contact c = graph.DefContact.Current;
c.ContactType = "AP";
c.FullName = "Joe Bloggs";
c.EMail = "joe#Bloggs.com";
graph.Actions.PressSave();
Related
"Lot/serial nbr ('anyNumber') can not found in the system", why am i getting this when transfer inventory from a location to another?
1) Transferred inventory from SHIPMENT location/warehouse to another location warehouse.
2) then transferring again from above location warehouse to another warehouse/location. then got error.
INTransferEntry transferGraph = PXGraph.CreateInstance<INTransferEntry>();
INRegister reg = new INRegister();
reg.SiteID = lotDetail.WarehouseID;
reg.ToSiteID = distribution.ToWarehouseID;
reg.TransferType = Order.Current.TranType;
reg.DocType = INDocType.Transfer;
reg.TranDate = DateTime.Now;
reg.TotalQty = distribution.Qty;
reg = transferGraph.transfer.Insert(reg);
INTran tran = new INTran();
tran.INTransitQty = distribution.Qty;
tran.InventoryID = Order.Current.InventoryID;
tran.ToLocationID = distribution.ToLocationID;
tran.ToSiteID = distribution.ToWarehouseID;
tran.TranType = INTranType.Transfer;
tran.InvtMult = INTranType.InvtMult(tran.TranType);
tran.Qty = distribution.Qty;
tran.ReasonCode = distribution.ReasonCode;
tran.SiteID = lotDetail.WarehouseID;
tran.LocationID = lotDetail.LocationID;
tran.TranDesc = distribution.Description;
tran.LotSerialNbr = lotDetail.LotSerNumVal;
tran = transferGraph.transactions.Insert(tran);
You need to look at the INTranSplit DAC, it links the Lot Tracking with the INTran DAC to manage the existing Lots linked to the INItem
I am creating an envelope using DocuSign REST API with two recipients. Each recipient has two sets of tags - sign here tag and a full name tag.
When an envelope gets created, the sign here tags are showing up correctly for both recipients but the the full name tags for the second recipient is showing up for the first recipient.
I am passing the correct document id and recipient id for both tags in the API request.
Adding my code here..
Public Function SetSignerProperties(ByVal signer As Recipient) As DocuSign.eSign.Model.Signer
Dim dssigner As New DocuSign.eSign.Model.Signer
If Not signer Is Nothing Then
dssigner.Name = signer.name
dssigner.Email = signer.email
dssigner.AccessCode = signer.accesscode
dssigner.AddAccessCodeToEmail = signer.addAccessCodeToEmail
dssigner.Note = signer.note
dssigner.RoutingOrder = signer.routingOrder
dssigner.RecipientId = signer.recipientrecid
If signer.IsCaptiveRecipient Then
dssigner.ClientUserId = signer.recipientrecid
dssigner.EmbeddedRecipientStartURL = signer.embeddedRecipientStartURL
End If
'set up the signer tabs..
AddRecipientTags(signer, dssigner)
End If
Return dssigner
End Function
Public Function AddRecipientTags(ByVal recp As Recipient, ByVal signer As DocuSign.eSign.Model.Signer)
If Not signer Is Nothing Then
If Not recp.tabs Is Nothing Then
signer.Tabs = New DocuSign.eSign.Model.Tabs
For Each currtab In recp.tabs
Select Case currtab.tabType
Case "Sign Here"
'it is a signer tab..
If signer.Tabs.SignHereTabs Is Nothing Then
signer.Tabs.SignHereTabs = New List(Of DocuSign.eSign.Model.SignHere)
End If
Dim signheretab As New DocuSign.eSign.Model.SignHere
If Not currtab.anchorIgnoreIfNotPresent Is Nothing Then
signheretab.AnchorIgnoreIfNotPresent = currtab.anchorIgnoreIfNotPresent
End If
signheretab.AnchorString = currtab.anchorString
signheretab.AnchorUnits = currtab.anchorUnits
signheretab.AnchorXOffset = currtab.anchorXOffset
signheretab.AnchorYOffset = currtab.anchorYOffset
signheretab.ConditionalParentLabel = currtab.conditionalParentLabel
signheretab.ConditionalParentValue = currtab.conditionalParentValue
signheretab.Name = currtab.name
signheretab.Optional = currtab.toptional
signheretab.PageNumber = currtab.pageNumber
signheretab.RecipientId = currtab.recipientId
signheretab.ScaleValue = currtab.scaleValue
signheretab.TabId = currtab.tabId
signheretab.TabLabel = currtab.tabLabel
signheretab.TabOrder = currtab.tabOrder
signheretab.XPosition = currtab.xPosition
signheretab.YPosition = currtab.yPosition
signheretab.DocumentId = currtab.documentId
signer.Tabs.SignHereTabs.Add(signheretab)
Case "Full Name"
If signer.Tabs.FullNameTabs Is Nothing Then
signer.Tabs.FullNameTabs = New List(Of DocuSign.eSign.Model.FullName)
End If
Dim tab As New DocuSign.eSign.Model.FullName
If Not currtab.anchorIgnoreIfNotPresent Is Nothing Then
tab.AnchorIgnoreIfNotPresent = currtab.anchorIgnoreIfNotPresent
End If
tab.AnchorString = currtab.anchorString
tab.AnchorUnits = currtab.anchorUnits
tab.AnchorXOffset = currtab.anchorXOffset
tab.AnchorYOffset = currtab.anchorYOffset
If Not currtab.bold Is Nothing Then
tab.Bold = currtab.bold
End If
tab.ConditionalParentLabel = currtab.conditionalParentLabel
tab.ConditionalParentValue = currtab.conditionalParentValue
tab.DocumentId = currtab.documentId
tab.Font = currtab.font
tab.FontColor = currtab.fontColor
tab.FontSize = currtab.fontSize
tab.PageNumber = currtab.pageNumber
tab.RecipientId = currtab.recipientId
tab.Name = currtab.name
tab.TabId = currtab.tabId
tab.TabLabel = currtab.tabLabel
tab.TabOrder = currtab.tabOrder
tab.XPosition = currtab.xPosition
tab.YPosition = currtab.yPosition
If Not currtab.underline Is Nothing Then
tab.Underline = currtab.underline
End If
signer.Tabs.FullNameTabs.Add(tab)
End Select
Next
End If
End If
End Function
Please advise,
Thanks,
Minal
I am using 2 datagridview to see the data in a windows form application.
The first DGV show the products according to the ids passed to them.
On click of VIEW as of my one column in DGV1, it passes the product id to and fetch the complete records from database and show the records to the other DGV2.
this is my code:
if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == (Object)"View")
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
int prod_id = Convert.ToInt16(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
dataGridView2.DataSource = null;
dataGridView2.Rows.Clear();
retFindProducts = new MySqlCommand("SELECT DISTINCT tf_history.thefind_id, tf_product.product_id, tf_product.`name`, tf_product.product_url, tf_product.image_tpm, tf_product.image_thefind, tf_product.image_accuracy, (SELECT MIN(tf_h.price) FROM tf_history AS tf_h WHERE tf_h.thefind_id = tf_history.thefind_id) as price, oc_product.price AS priceTPM FROM tf_product LEFT JOIN tf_history ON tf_product.product_id = tf_history.product_id AND tf_product.thefind_id = tf_history.thefind_id LEFT JOIN oc_product ON tf_product.product_id = oc_product.product_id WHERE tf_product.product_id = #product_id", con);
historyData = new MySqlCommand("SELECT price, date from tf_history WHERE thefind_id = #thefind_id", con);
retFindProducts.CommandTimeout = 300;
historyData.CommandTimeout = 300;
retFindProducts.Parameters.AddWithValue("#product_id", prod_id);
dr = retFindProducts.ExecuteReader();
retFindProducts.Parameters.Clear();
while (dr.Read())
{
dataGridView2.Rows.Add();
long fI = Convert.ToInt64(dr["thefind_id"]);
//if (!findId.Exists(p => p.Item1 == fI))
findId.Add(new Tuple<long>(fI));
decimal findPrice = Convert.ToDecimal(dr["price"]);
decimal tpmPrice = Convert.ToDecimal(dr["priceTPM"]);
if (findPrice > tpmPrice)
{
dataGridView2.Rows[cnt].Cells[4].Style.ForeColor = Color.Green;
dataGridView2.Rows[cnt].Cells[4].Style.Font = new Font(dataGridView2.DefaultCellStyle.Font.FontFamily, 9, FontStyle.Regular);
}
else if (findPrice < tpmPrice)
{
dataGridView2.Rows[cnt].Cells[4].Style.ForeColor = Color.Red;
dataGridView2.Rows[cnt].Cells[4].Style.Font = new Font(dataGridView2.DefaultCellStyle.Font.FontFamily, 10, FontStyle.Bold);
}
dataGridView2.Rows[cnt].Cells[0].Value = Image.FromFile(dr["image_tpm"].ToString());
dataGridView2.Rows[cnt].Cells[1].Value = Image.FromFile(dr["image_thefind"].ToString());
dataGridView2.Rows[cnt].Cells[2].Value = dr["name"].ToString();
dataGridView2.Rows[cnt].Cells[3].Value = dr["product_url"].ToString();
dataGridView2.Rows[cnt].Cells[4].Value = dr["price"].ToString();
dataGridView2.Rows[cnt].Cells[5].Value = dr["image_accuracy"].ToString();
cnt++;
}
foreach (DataGridViewRow row in dataGridView2.Rows)
{
row.Height = 60;
}
dr.Close();
}
Now, the outofexception does not comes on first time of the click, but it comes after 5-8 clicks on the VIEW column of DGV1.
How can i clear up the memory?
Try to dispose and create datagridview manually. The Code can be like this:
dgv.Dispose();
dgv = new DataGridView();
DataGridViewColumn col1 = new DataGridViewTextBoxColumn();
DataGridViewColumn col2 = new DataGridViewTextBoxColumn();
DataGridViewColumn col3 = new DataGridViewTextBoxColumn();
DataGridViewColumn col4 = new DataGridViewTextBoxColumn();
DataGridViewColumn col5 = new DataGridViewTextBoxColumn();
col1.HeaderText = "COl1";
col2.HeaderText = "COl2";
col3.HeaderText = "COl3";
col4.HeaderText = "COl4";
col5.HeaderText = "COl5";
dgv = new System.Windows.Forms.DataGridView();
dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgv.Location = new System.Drawing.Point(59, 101);
dgv.Name = "dataGridView1";
dgv.Size = new System.Drawing.Size(240, 150);
dgv.TabIndex = 2;
dgv.Columns.Add(col1);
dgv.Columns.Add(col2);
dgv.Columns.Add(col3);
dgv.Columns.Add(col4);
dgv.Columns.Add(col5);
this.Controls.Add(dgv);
dgv.ColumnCount = 5;
dgv.Visible = true;
I am working in .Net Charts. I am trying to generate a Column chart. I am having two rows in my dataset. Here is my code.
DataTable DT1 = new DataTable();
DT1 = chartViewSummaryList;
DataView DV = DT1.DefaultView;
DV.ToTable(false, new string[] { "REVENUE_TOTAL", "WEEK_END_DATE" });
DataSet ds = new DataSet();
ds.Tables.Add(DT1.Copy());
ds.Tables[0].Rows[0]["MARGIN"] = "0";
ds.Tables[0].Rows[0]["REVENUE_TOTAL"] = "3776169.61";
ds.Tables[0].Rows[0]["MARGIN_PCT"] = "0";
ds.Tables[0].Rows[0]["VISIT_REVENUE_AVG"] = "29.28";
ds.Tables[0].Rows[0]["VISIT_COUNT"] = "614041";
ds.Tables[0].Rows[0]["REVENUE_SALE"] = "1840387.18";
ds.Tables[0].Rows[0]["REVENUE_REGULAR"] = "1935782.43";
ds.Tables[0].Rows[0]["WEEK_END_DATE"] = "1/1/2012 12:00:00 AM";
ds.Tables[0].Rows.Add();
ds.Tables[0].Rows[1]["MARGIN"] = "1";
ds.Tables[0].Rows[1]["REVENUE_TOTAL"] = "5776169.61";
ds.Tables[0].Rows[1]["MARGIN_PCT"] = "0";
ds.Tables[0].Rows[1]["VISIT_REVENUE_AVG"] = "49.28";
ds.Tables[0].Rows[1]["VISIT_COUNT"] = "814041";
ds.Tables[0].Rows[1]["REVENUE_SALE"] = "3840387.18";
ds.Tables[0].Rows[1]["REVENUE_REGULAR"] = "3935782.43";
ds.Tables[0].Rows[1]["WEEK_END_DATE"] = "1/1/2012 12:00:00 AM";
Chart1.DataSource = ds;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Chart1.Titles.Add(storeLevelCaption).Font = new System.Drawing.Font("Verdana", 11, FontStyle.Bold);
Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Weeks";
Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont = new System.Drawing.Font("Verdana", 10, FontStyle.Bold);
Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new Font(new FontFamily("Verdana"), 7.25F, FontStyle.Bold);
string series = "Series" + i;
Chart1.Series.Add(series);
Chart1.Series[series].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column;
Chart1.Series[series].XValueMember = "WEEK_END_DATE";
Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
Color color = System.Drawing.ColorTranslator.FromHtml("#B93B8F");
Chart1.Series[series].Color = color;
Chart1.ChartAreas["ChartArea1"].AxisY.Title = "Total Revenue";
Chart1.ChartAreas["ChartArea1"].AxisY.TitleFont = new System.Drawing.Font("Verdana", 10, FontStyle.Bold);
Chart1.ChartAreas["ChartArea1"].AxisY.LabelStyle.Font = new Font(new FontFamily("Verdana"), 7.25F, FontStyle.Bold);
Chart1.Series[series].YValueMembers = "REVENUE_TOTAL";
Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
Chart1.Series[series].ToolTip = "Total Revenue ($) , " + ds.Tables[0].Rows[i]["WEEK_END_DATE"].ToString() + " , " + ds.Tables[0].Rows[i]["REVENUE_TOTAL"].ToString();
Chart1.Series[series].Font = new Font(new FontFamily("Verdana"), 7.25F, FontStyle.Bold);
//Chart1.Series[series].Name = "Total Revenue";
}
Chart1.ChartAreas[0].AxisY.Interval = 1;
Chart1.DataBind();
I am getting the chart, where two column combined together and displayed as one column. Where i had gone wrong...
I can't reproduce your problem using the WinForm charting assemblies. However you may want to try using distinct dates since they are bound to your X values.
ds.Tables[0].Rows[0]["WEEK_END_DATE"] = "1/1/2012 12:00:00 AM";
ds.Tables[0].Rows[1]["WEEK_END_DATE"] = "8/1/2012 12:00:00 AM"; // a different date
FYI, I changed your code minimaly
// DT1 = chartViewSummaryList;
// replace unknown object with this code
DT1.Columns.Add(new DataColumn("MARGIN"));
DT1.Columns.Add(new DataColumn("REVENUE_TOTAL"));
DT1.Columns.Add(new DataColumn("MARGIN_PCT"));
DT1.Columns.Add(new DataColumn("VISIT_REVENUE_AVG"));
DT1.Columns.Add(new DataColumn("VISIT_COUNT"));
DT1.Columns.Add(new DataColumn("REVENUE_SALE"));
DT1.Columns.Add(new DataColumn("REVENUE_REGULAR"));
DT1.Columns.Add(new DataColumn("WEEK_END_DATE"));
and also added a row manually
ds.Tables.Add(DT1.Copy());
ds.Tables[0].Rows.Add(); // Added this
and got two columns from your plotting code.
Domestic demand,We must let our develop system form copy to the WSS 3.0 Calendar list
Simply put, I know need to use ADO to update [Alluserdata] this table and also know whitch
tp_listId.
However, after updating, has written to the database, it can not appear in Sharepoint page
What am I do some thing wrong...
ps: suspected tp_size field related, but not sure ....
Public Sub Pm_woToSharePoint(ByVal PM_WO_MAIN_VIEWRow As PM_WO_MAIN_VIEW)
Try
Dim cdataobj As New cDataACCESS
Dim dt_Prolist As Data.DataTable
Dim selectString As String
selectString = "select top 1 * from AllUserData where tp_listId='4C0516DB-B090-4740-A0F0-B99E6DC31C0C' order by tp_id desc"
dt_Prolist = cdataobj.sqlDt(selectString, "SharepointConnectionString")
Dim CalenderListRow As Data.DataRow = dt_Prolist.NewRow
Dim CalenderListRow2 As Data.DataRow = dt_Prolist.Rows(0)
With CalenderListRow2
CalenderListRow.Item("tp_ID") = .Item("tp_id") + 1
CalenderListRow.Item("tp_ListId") = .Item("tp_ListId")
CalenderListRow.Item("tp_SiteId") = .Item("tp_SiteId")
' CalenderListRow.Item("tp_RowOrdinal") = 0
CalenderListRow.Item("tp_Version") = 1
CalenderListRow.Item("tp_Author") = 96
CalenderListRow.Item("tp_Editor") = 96
CalenderListRow.Item("tp_Modified") = Now
CalenderListRow.Item("tp_Created") = Now
CalenderListRow.Item("tp_Ordering") = DBNull.Value
CalenderListRow.Item("tp_ThreadIndex") = DBNull.Value
' CalenderListRow.Item("tp_HasAttachment") = 0
'CalenderListRow.Item("tp_ModerationStatus") = 0
CalenderListRow.Item("tp_IsCurrent") = 1
CalenderListRow.Item("tp_ItemOrder") = 100 * CalenderListRow.Item("tp_ID")
CalenderListRow.Item("tp_InstanceID") = DBNull.Value
' CalenderListRow.Item("tp_GUID") = 4
' CalenderListRow.Item("tp_CopySource") = DBNull.Value
'CalenderListRow.Item("tp_HasCopyDestinations") = DBNull.Value
CalenderListRow.Item("tp_AuditFlags") = DBNull.Value
CalenderListRow.Item("tp_InheritAuditFlags") = DBNull.Value
CalenderListRow.Item("tp_Size") = .Item("tp_Size")
CalenderListRow.Item("tp_WorkflowVersion") = 1
CalenderListRow.Item("tp_WorkflowInstanceID") = DBNull.Value
CalenderListRow.Item("tp_DirName") = .Item("tp_DirName")
CalenderListRow.Item("tp_LeafName") = CStr(CalenderListRow.Item("tp_ID")) & "_.000"
CalenderListRow.Item("tp_DeleteTransactionId") = .Item("tp_DeleteTransactionId")
CalenderListRow.Item("tp_ContentType") = .Item("tp_ContentType")
CalenderListRow.Item("tp_ContentTypeId") = .Item("tp_ContentTypeId")
CalenderListRow.Item("nvarchar1") = PM_WO_MAIN_VIEWRow.ITEM_NAME & " " & PM_WO_MAIN_VIEWRow.ITEM_VALUE
CalenderListRow.Item("nvarchar3") = PM_WO_MAIN_VIEWRow.ST_NAME_CHT
CalenderListRow.Item("ntext2") = "機台:" & PM_WO_MAIN_VIEWRow.MS_NAME_CHT & " 生產人員:" & PM_WO_MAIN_VIEWRow.ProductPerson
CalenderListRow.Item("datetime1") = DateAdd(DateInterval.Hour, -8, CType(PM_WO_MAIN_VIEWRow.START_TIME, DateTime))
CalenderListRow.Item("datetime2") = DateAdd(DateInterval.Hour, -8, CType(PM_WO_MAIN_VIEWRow.END_TIME, DateTime))
CalenderListRow.Item("int1") = 0
' CalenderListRow.Item("int2") = .Item("int2")
CalenderListRow.Item("bit1") = 0
CalenderListRow.Item("bit2") = 0
CalenderListRow.Item("bit3") = 0
CalenderListRow.Item("tp_Level") = 1
CalenderListRow.Item("tp_IsCurrentVersion") = 1
CalenderListRow.Item("tp_UIVersion") = 512
CalenderListRow.Item("tp_CalculatedVersion") = 0
CalenderListRow.Item("tp_UIVersionString") = "1.0"
CalenderListRow.Item("tp_DraftOwnerId") = DBNull.Value
CalenderListRow.Item("tp_UIVersionString") = DBNull.Value
CalenderListRow.Item("tp_CheckoutUserId") = DBNull.Value
End With
dt_Prolist.Rows.Add(CalenderListRow)
cdataobj.ExecSQL(dt_Prolist, selectString, "SharepointConnectionString")
Catch ex As System.Exception
Throw
End Try
End Sub
You are on totally the wrong track here accessing the database directly, its dangerous and unsupported.
The correct way to do things like this is the object model or web services (or client object model in 2010) - see here and here to get started.
This is for 2010, but its identical steps 2007 - How to add a event to a SharePoint 2010 Calendar
SPListItem newEvent = yourCalendar.Items.Add();
newEvent["Location"] = "This is location";
newEvent["Start Time"] = DateTime.Now;
newEvent["End Time"] = DateTime.Now.AddHours(1);
newEvent["Description"] = "Going for Meting";
newEvent["Title"] = "New Meting";
newEvent["fAllDayEvent"] = false;
newEvent["Category"] = "Meting";
//Create Event in the sharpoint.
newEvent.Update();