Beispiel #1
0
        /// <summary>
        /// Binds the purchase list.
        /// </summary>
        private void BindPurchaseList()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("OrderHeaderId");
            dt.Columns.Add("Records");
            dt.Columns.Add("PONumber");
            dt.Columns.Add("Type");

            int    iCount      = 1;
            string objPOnumber = (this.txtPONumber.Text.Trim() == "*") ? string.Empty : PurchasingUtils.GenSafeChars(this.txtPONumber.Text.Trim());
            string objType     = (this.txtType.Text.Trim() == "*") ? string.Empty : PurchasingUtils.GenSafeChars(this.txtType.Text.Trim());

            string sql = "Status = 1 AND PostedBy <> '" + System.Guid.Empty + "' AND OrderNumber LIKE '%" + objPOnumber + "%' AND OrderType LIKE '%" + objType + "%'";

            string[] objOrderBy = { "OrderNumber" };
            PurchaseOrderHeaderCollection objHeaders = PurchaseOrderHeader.LoadCollection(sql, objOrderBy, true);

            foreach (PurchaseOrderHeader objHeader in objHeaders)
            {
                string orderType = string.Empty;
                switch (objHeader.OrderType)
                {
                case 0:
                    orderType = DAL.Common.Enums.POType.FPO.ToString();
                    break;

                case 1:
                    orderType = DAL.Common.Enums.POType.LPO.ToString();
                    break;

                case 2:
                    orderType = DAL.Common.Enums.POType.OPO.ToString();
                    break;
                }

                DataRow row = dt.NewRow();
                row["OrderHeaderId"] = objHeader.OrderHeaderId.ToString(); //// OrderHeaderId
                row["Records"]       = iCount.ToString();                  //// Line Number
                row["PONumber"]      = objHeader.OrderNumber;
                row["Type"]          = orderType;

                dt.Rows.Add(row);

                iCount++;
            }

            dgvReceivingFindList.DataSource = dt;
        }
Beispiel #2
0
        /// <summary>
        /// Binds the purchase list.
        /// </summary>
        private void BindPurchaseList()
        {
            this.lisReceivingFindList.Items.Clear();   ////清除lisPurchaseOrderList控件中的数据

            int    iCount      = 1;
            string objPOnumber = (this.txtPONumber.Text.Trim() == "*") ? string.Empty : PurchasingUtils.GenSafeChars(this.txtPONumber.Text.Trim());
            string objType     = (this.txtType.Text.Trim() == "*") ? string.Empty : PurchasingUtils.GenSafeChars(this.txtType.Text.Trim());

            string sql     = "Status = 1 AND PostedBy <> '" + Guid.Empty + "' AND OrderNumber LIKE '%" + objPOnumber + "%' AND OrderType LIKE '%" + objType + "%'";
            string orderBy = "OrderNumber";

            using (var ctx = new EF6.RT2020Entities())
            {
                var objHeaders = ctx.PurchaseOrderHeader.SqlQuery(
                    string.Format("Select * from PurchaseOrderHeader Where {0} Order By {1}", sql, orderBy))
                                 .AsNoTracking()
                                 .ToList();

                foreach (var objHeader in objHeaders)
                {
                    string orderType = string.Empty;
                    switch (objHeader.OrderType)
                    {
                    case 0:
                        orderType = EnumHelper.POType.FPO.ToString();
                        break;

                    case 1:
                        orderType = EnumHelper.POType.LPO.ToString();
                        break;

                    case 2:
                        orderType = EnumHelper.POType.OPO.ToString();
                        break;
                    }

                    ListViewItem objItem = this.lisReceivingFindList.Items.Add(objHeader.OrderHeaderId.ToString()); //// OrderHeaderId
                    objItem.SubItems.Add(iCount.ToString());                                                        //// Line Number
                    objItem.SubItems.Add(objHeader.OrderNumber);
                    objItem.SubItems.Add(orderType);

                    iCount++;
                }
            }
        }