本文整理汇总了C#中Supplier.LoadByPrimaryKey方法的典型用法代码示例。如果您正苦于以下问题:C# Supplier.LoadByPrimaryKey方法的具体用法?C# Supplier.LoadByPrimaryKey怎么用?C# Supplier.LoadByPrimaryKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Supplier
的用法示例。
在下文中一共展示了Supplier.LoadByPrimaryKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: gridView1_FocusedRowChanged
private void gridView1_FocusedRowChanged(object sender,
DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
{
DataRow dr = gridView1.GetFocusedDataRow();
int selected = Convert.ToInt32(dr["ID"]);
Supplier sup = new Supplier();
sup.LoadByPrimaryKey(selected);
txtCompanyName.Text = sup.CompanyName;
txtAddress.Text = sup.Address;
txtContactPerson.Text = sup.ContactPerson;
txtMobile.Text = sup.Mobile;
txtTelephone.Text = sup.Telephone;
txtEmail.Text = sup.Email;
ckIsActive.Checked = sup.IsActive;
supplierId = sup.ID;
cboCompanyInfo.EditValue = sup.CompanyInfo;
btnSupplierSave.Text = "Update";
}
示例2: ReorganizeDataViewForSTVPrint_Program
/// <summary>
/// Reorganizes the data view for STV print_ program.
/// </summary>
/// <param name="dv">The dv.</param>
/// <param name="refNo">The ref no.</param>
/// <param name="pickListId">The pick list id.</param>
/// <param name="userID">The user ID.</param>
/// <param name="stvLogID">The STV log ID.</param>
/// <param name="convertDNtoSTV">if set to <c>true</c> [convert D nto STV].</param>
/// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param>
/// <param name="hasInsurance">if set to <c>true</c> [has insurance].</param>
/// <returns></returns>
public static DataTable ReorganizeDataViewForSTVPrint_Program(DataView dv, int orderID, int pickListId, int userID, int? stvLogID, bool convertDNtoSTV, bool generateNewPrintID, bool hasInsurance)
{
BLL.Order order = new Order();
order.LoadByPrimaryKey(orderID);
int? paymentTypeID = null;
if (order.PaymentTypeID == PaymentType.Constants.CASH || order.PaymentTypeID == PaymentType.Constants.CREDIT || order.PaymentTypeID == PaymentType.Constants.STV)
{
paymentTypeID = order.PaymentTypeID;
}
// This is just to make the delivery notes print a separate series of numbers.
// This section completely asks for a re-write.
if (dv.Count > 0 && (dv[0]["Cost"] == DBNull.Value || Convert.ToDecimal(dv[0]["Cost"]) == 0M))
{
paymentTypeID = PaymentType.Constants.DELIVERY_NOTE;
}
else if (stvLogID != null)
{
Issue issue = new Issue();
issue.LoadByPrimaryKey(stvLogID.Value);
if (!issue.IsColumnNull("IsDeliveryNote") && issue.IsDeliveryNote && !convertDNtoSTV)
{
paymentTypeID = PaymentType.Constants.DELIVERY_NOTE;
}
}
// prepare the pick list for printing.
// this method only merges the items that come in different rows but ...
// that have same price same item.
DataTable dtbl = dv.Table.Clone();
if (!dtbl.Columns.Contains("Supplier"))
{
dtbl.Columns.Add("Supplier");
}
if (!dtbl.Columns.Contains("SupplierID"))
{
dtbl.Columns.Add("SupplierID");
}
dtbl.Columns.Add("STVNumber");
dtbl.Columns.Add("StoreName");
dtbl.Columns.Add("ContactPerson");
dtbl.Columns.Add("PhysicalStoreType"); //The virtual store (The grouping for the stores) for the display on the stv
dtbl.Clear();
foreach (DataRowView drv in dv)
{
if (dtbl.Rows.Count == 0)
{
dtbl.ImportRow(drv.Row);
}
else
{
//check if items with same expiry exists in the table
//TOFIX: Add the supplier in this mix
string qItemID = "", qbatchNumberID = "", qUnitPriceID = "", qPhysicalStoreName = "", qStoreID = "";
qItemID = string.Format("ItemID={0} and UnitID={1}", drv["ItemID"].ToString(), drv["UnitID"]);
if (drv["BatchNumber"] != DBNull.Value)
qbatchNumberID = string.Format(" and BatchNumber='{0}'", drv["BatchNumber"].ToString());
if (drv["UnitPrice"] != DBNull.Value)
qUnitPriceID = string.Format(" and UnitPrice = {0} ", drv["UnitPrice"].ToString());
if (drv["PhysicalStoreName"] != DBNull.Value)
qPhysicalStoreName = string.Format(" and PhysicalStoreName= '{0}'",
drv["PhysicalStoreName"].ToString());
if (drv["StoreID"] != DBNull.Value)
qStoreID = string.Format(" and StoreID= '{0}'", drv["StoreID"].ToString());
string query = string.Format("{0}{1}{2}{3}{4}", qItemID, qbatchNumberID, qUnitPriceID,
qPhysicalStoreName, qStoreID);
DataRow[] ar = dtbl.Select(query);
if (ar.Length > 0)
{
//
foreach (var dataRow in ar)
{
dataRow["SKUPICKED"] = Convert.ToInt32(dataRow["SKUPICKED"]) +
Convert.ToInt32(drv["SKUPICKED"]);
dataRow["Cost"] = (dataRow["Cost"] != DBNull.Value ? Convert.ToDouble(dataRow["Cost"]) : 0) +
(drv["Cost"] != DBNull.Value ? Convert.ToDouble(drv["Cost"]) : 0);
dataRow["IssueDocID"] = dataRow["IssueDocID"].ToString() + ',' +
drv["IssueDocID"].ToString();
//.........这里部分代码省略.........
示例3: btnSupplierSave_Click
private void btnSupplierSave_Click(object sender, EventArgs e)
{
if (supplierValidation.Validate())
{
Supplier sup = new Supplier();
if (supplierId != 0)
sup.LoadByPrimaryKey(supplierId);
else
sup.AddNew();
sup.CompanyInfo = cboCompanyInfo.EditValue.ToString();
sup.CompanyName = txtCompanyName.Text;
sup.Address = txtAddress.Text;
sup.ContactPerson = txtContactPerson.Text;
sup.Telephone = txtTelephone.Text;
sup.IsActive = ckIsActive.Checked;
sup.Mobile = txtMobile.Text;
sup.Email = txtEmail.Text;
sup.Save();
sup.LoadAll();
PopulateSupplier(sup);
ResetSupplier();
}
else
{
txtCompanyName.BackColor = Color.FromArgb(251, 214, 214);
}
}