当前位置: 首页>>代码示例>>C#>>正文


C# Invoice.addParcel方法代码示例

本文整理汇总了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");
        }
开发者ID:mikeyq6,项目名称:LabelPrintingSystem_Manifest,代码行数:89,代码来源:Form1.cs


注:本文中的Invoice.addParcel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。