本文整理汇总了C#中Invoice.addParcel方法的典型用法代码示例。如果您正苦于以下问题:C# Invoice.addParcel方法的具体用法?C# Invoice.addParcel怎么用?C# Invoice.addParcel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice.addParcel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: update_stat_breakdown_HE
/*
private void update_stat_breakdown_HE()
{
bool result = false;
string query = String.Format("SELECT count(ps_invoice_info.id) AS manifest_count FROM ps_invoice_info WHERE 1 AND ps_invoice_info.status={0} AND ps_invoice_info.packed=2 AND ps_invoice_info.carrier_id=2 GROUP BY ps_invoice_info.carrier_id", (int)InvoiceStatus.INVOICED);
MySqlDataReader dataReader = connection.getDataReader(query);
while (dataReader.Read())
{
if (dataReader["manifest_count"] + "" != "")
{
txtBox_stat_breakdown_HE.Text = dataReader["manifest_count"] + "";
result = true;
}
}
if (!result)
{
txtBox_stat_breakdown_HE.Text = "0";
}
dataReader.Close();
}
private void update_stat_breakdown_EP() {
bool result = false;
string query = String.Format("SELECT count(ps_invoice_info.id) AS manifest_count FROM ps_invoice_info WHERE 1 AND ps_invoice_info.status={0} AND ps_invoice_info.packed=2 AND ps_invoice_info.carrier_id=4 GROUP BY ps_invoice_info.carrier_id", (int)InvoiceStatus.INVOICED);
MySqlDataReader dataReader = connection.getDataReader(query);
while (dataReader.Read()) {
if (dataReader["manifest_count"] + "" != "") {
txtBox_stat_breakdown_EP.Text = dataReader["manifest_count"] + "";
result = true;
}
}
if (!result) {
txtBox_stat_breakdown_EP.Text = "0";
}
dataReader.Close();
}
*/
private void update_last_inserted()
{
if(last_invoiced == null) {
last_invoiced = new Invoice();
string query = String.Format("SELECT i.time_created, i.invoiceNo, i.title, i.surName, i.firstName, i.middleName, i.postcode, i.parcel_weight, i.carrier_id, i.charge, i.parcel_num, i.packed FROM ps_invoice_info i WHERE i.status={0} ORDER BY i.id DESC LIMIT 1", (int)InvoiceStatus.INVOICED);
IDataReader dataReader = connection.getDataReader(query);
while (dataReader.Read()) {
last_invoiced.InvoiceNo = String.IsNullOrEmpty(dataReader["invoiceNo"].ToString()) ? "" : dataReader["invoiceNo"].ToString();
last_invoiced.InvoiceCustomer.Title = String.IsNullOrEmpty(dataReader["title"].ToString()) ? "" : dataReader["title"].ToString();
last_invoiced.InvoiceCustomer.Firstname = String.IsNullOrEmpty(dataReader["firstName"].ToString()) ? "" : dataReader["firstName"].ToString();
last_invoiced.InvoiceCustomer.Middlename = String.IsNullOrEmpty(dataReader["middleName"].ToString()) ? "" : dataReader["middleName"].ToString();
last_invoiced.InvoiceCustomer.Lastname = String.IsNullOrEmpty(dataReader["surName"].ToString()) ? "" : dataReader["surName"].ToString();
last_invoiced.InvoiceCustomer.Postcode = String.IsNullOrEmpty(dataReader["postcode"].ToString()) ? "" : dataReader["postcode"].ToString();
Parcel p = new Parcel();
p.Weight = (float)(String.IsNullOrEmpty(dataReader["parcel_weight"].ToString()) ? 0 : Convert.ToDouble(dataReader["parcel_weight"]) / 1000);
p.CostEstimate = String.IsNullOrEmpty(dataReader["charge"].ToString()) ? 0 : float.Parse(dataReader["charge"].ToString());
p.ParcelNumber = String.IsNullOrEmpty(dataReader["parcel_num"].ToString()) ? 1 : int.Parse(dataReader["parcel_num"].ToString());
last_invoiced.addParcel(p);
int providerId = String.IsNullOrEmpty(dataReader["carrier_id"].ToString()) ? AP : int.Parse(dataReader["carrier_id"].ToString());
switch (providerId) {
case AP:
last_invoiced.Provider = AustraliaPost;
break;
case EP:
last_invoiced.Provider = EPost;
break;
case HE:
last_invoiced.Provider = HunterExpress;
break;
case TL:
last_invoiced.Provider = Toll;
break;
}
last_invoiced.Packed = String.IsNullOrEmpty(dataReader["packed"].ToString()) ? false : (dataReader["packed"].ToString() == "1" ? true : false);
last_invoiced.InvoiceDate = String.IsNullOrEmpty(dataReader["time_created"].ToString()) ? DateTime.Now : DateTime.Parse(dataReader["time_created"].ToString());
txtBox_last_carrier.Text = GetCarrierNameForID(int.Parse(dataReader["carrier_id"].ToString()));
}
dataReader.Close();
}
Parcel par = last_invoiced.Parcels.Count > 0 ? (Parcel)last_invoiced.Parcels[0] : new Parcel();
//txtBox_last_carrier.Text = String.Format("{0}", last_invoiced.Provider);
txtBox_last_cost.Text = String.Format("{0:C}", par.CostEstimate);
txtBox_last_invoiceNo.Text = last_invoiced.InvoiceNo;
txtBox_last_packpick.Text = last_invoiced.Packed ? "Yes" : "No";
txtBox_last_parcelnum.Text = par.ParcelNumber.ToString();
txtBox_last_postcode.Text = last_invoiced.InvoiceCustomer.Postcode;
txtBox_last_receiptient.Text = last_invoiced.InvoiceCustomer.FullName;
txtBox_last_weight.Text = par.Weight.ToString();
txtBox_last_time.Text = last_invoiced.InvoiceDate.ToString("dd/MM/yyyy");
}