Пример #1
0
        public override void Click(float X, float Y)
        {
            if (!CanGrab && !CanPut) //nothing to do here
            {
                return;
            }
            IActionIcon mouseItem   = WM.MouseGrab;
            IActionIcon currentItem = this.Item;

            if (mouseItem == null)
            {
                if (currentItem == null) //nothing to do here
                {
                    return;
                }
                else // take the item
                {
                    WM.MouseGrab = currentItem;
                    this.Item    = null;
                    ItemOut?.Invoke(this, new ItemEventArgs(currentItem));
                }
            }
            else //if mouse has something
            {
                if (!CanPut) //can't grab item: mouse full
                {
                    return;
                }
                ItemEventArgs iargs = new ItemEventArgs(mouseItem);
                BeforeItemChanged?.Invoke(this, iargs);
                if (iargs.Cancel) //custom function declined the item or no custom function
                {
                    return;
                }
                if (currentItem == null) //put in item
                {
                    iargs = new ItemEventArgs(mouseItem);
                    ItemIn?.Invoke(this, iargs);
                    this.Item    = mouseItem;
                    WM.MouseGrab = null;
                }
                else //swap items
                {
                    iargs = new ItemEventArgs(mouseItem);
                    ItemIn?.Invoke(this, iargs);
                    if (iargs.Cancel)
                    {
                        return;
                    }
                    this.Item    = mouseItem;
                    WM.MouseGrab = currentItem;
                    iargs        = new ItemEventArgs(mouseItem);
                    ItemOut?.Invoke(this, iargs);
                }
            }
            base.Click(X, Y);
        }
Пример #2
0
        public int StockOutCondition(ItemOut itemOut)
        {
            SqlConnection sqlConnection = new SqlConnection(conString);
            string        query         = "Insert into StockOutTable values('" + itemOut.ItemName + "','" + itemOut.CompanyName + "','" + itemOut.Quantity + "','" + itemOut.Condition + "','" + itemOut.TimeStamp + "')";
            SqlCommand    command       = new SqlCommand(query, sqlConnection);

            sqlConnection.Open();
            int rowAffected = command.ExecuteNonQuery();

            sqlConnection.Close();
            return(rowAffected);
        }
        public string StockOutCondition(ItemOut itemOut)
        {
            StockManageGateway stockManageGateway = new StockManageGateway();
            int row = stockManageGateway.StockOutCondition(itemOut);

            if (row > 0)
            {
                return("Updated");
            }
            else
            {
                return("Failure");
            }
        }
 private void lostbutton_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem listViewItem in stockOutlistView.Items)
     {
         ItemOut itemOut = new ItemOut();
         itemOut.ItemName    = listViewItem.SubItems[1].Text;
         itemOut.CompanyName = listViewItem.SubItems[2].Text;
         itemOut.Quantity    = Convert.ToInt32(listViewItem.SubItems[3].Text);
         itemOut.Condition   = "Lost";
         itemOut.TimeStamp   = GetTimestamp(DateTime.Now);
         StockManageManager stockManageManager = new StockManageManager();
         stockManageManager.StockOut(itemOut.Quantity, itemOut.ItemName, itemOut.CompanyName);
         stockManageManager.StockOutCondition(itemOut);
     }
     stockOutlistView.Items.Clear();
     quantitytextBox.Clear();
     GetUpdateData();
     int sr = 1;
 }
Пример #5
0
        private static CXML MapCXMLData(Root data)
        {
            var cxml = new CXML();

            // Header
            cxml.Header.To.Credential.Identity     = GetFieldValue(data, "VEND_ID");
            cxml.Header.Sender.Credential.Identity = GetFieldValue(data, "BUYER_ID");
            cxml.Header.Sender.UserAgent           = GetFieldValue(data, "VEND_NAME");

            // OrderRequestHeader - Request\OrderRequest\OrderRequestHeader
            cxml.Request.OrderRequest.OrderRequestHeader.OrderID   = GetFieldValue(data, "PO_ID");
            cxml.Request.OrderRequest.OrderRequestHeader.OrderDate = GetFieldValue(data, "ORD_DT");
            if (string.IsNullOrWhiteSpace(cxml.Request.OrderRequest.OrderRequestHeader.OrderDate))
            {
                cxml.Request.OrderRequest.OrderRequestHeader.OrderDate = GetFieldValue(data, "INVC_DT");
            }
            cxml.Request.OrderRequest.OrderRequestHeader.Total.Money.Text     = GetFieldValue(data, "TRN_PO_LN_TOT_AMT");
            cxml.Request.OrderRequest.OrderRequestHeader.Total.Money.Currency = GetFieldValue(data, "TRNS___CRNCY___CD");

            // Ship To
            cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.AddressID = GetFieldValue(data, "SHIP_TO_LOC_ID");
            cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.Name.Text = GetFieldValue(data, "DEL_TO_FLD");
            cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.PostalAddress.PostalCode             = GetFieldValue(data, "SHIP_TO_POSTAL_CD");
            cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.PostalAddress.State                  = GetFieldValue(data, "SHIP_TO_MAIL_STATE_DC");
            cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.PostalAddress.Country.IsoCountryCode = GetFieldValue(data, "SHIP_TO_COUNTRY_CD");
            cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.PostalAddress.Country.Text           = GetFieldValue(data, "SHIP_TO_COUNTRY_CD");
            cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.PostalAddress.City = GetFieldValue(data, "SHIP_TO_CITY_NAME");
            if (!string.IsNullOrWhiteSpace(GetFieldValue(data, "SHIP_TO_LN_1_ADDR")))
            {
                cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.PostalAddress.Street.Add(GetFieldValue(data, "SHIP_TO_LN_1_ADDR"));
            }

            if (!string.IsNullOrWhiteSpace(GetFieldValue(data, "SHIP_TO_LN_2_ADDR")))
            {
                cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.PostalAddress.Street.Add(GetFieldValue(data, "SHIP_TO_LN_2_ADDR"));
            }
            if (!string.IsNullOrWhiteSpace(GetFieldValue(data, "SHIP_TO_LN_3_ADDR")))
            {
                cxml.Request.OrderRequest.OrderRequestHeader.ShipTo.Address.PostalAddress.Street.Add(GetFieldValue(data, "SHIP_TO_LN_3_ADDR"));
            }


            // Bill To
            cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.AddressID = GetFieldValue(data, "BILL_TO_LOC_ID");
            cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.Name.Text = GetFieldValue(data, "BILL_TO_LOC_ID_NAME");
            cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.PostalAddress.PostalCode             = GetFieldValue(data, "SUBK_BILL_POSTAL_ADDR");
            cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.PostalAddress.State                  = GetFieldValue(data, "SUBK_BILL_STATE_ADDR");
            cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.PostalAddress.Country.IsoCountryCode = GetFieldValue(data, "SUBK_BILL_COUNTRY_ADDR");
            cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.PostalAddress.Country.Text           = GetFieldValue(data, "SUBK_BILL_COUNTRY_ADDR");
            cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.PostalAddress.City = GetFieldValue(data, "SUBK_BILL_CITY_ADDR");
            if (!string.IsNullOrWhiteSpace(GetFieldValue(data, "SUBK_BILL_LINE1_ADDR")))
            {
                cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.PostalAddress.Street.Add(GetFieldValue(data, "SUBK_BILL_LINE1_ADDR"));
            }

            if (!string.IsNullOrWhiteSpace(GetFieldValue(data, "SUBK_BILL_LINE2_ADDR")))
            {
                cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.PostalAddress.Street.Add(GetFieldValue(data, "SUBK_BILL_LINE2_ADDR"));
            }
            if (!string.IsNullOrWhiteSpace(GetFieldValue(data, "SUBK_BILL_LINE3_ADDR")))
            {
                cxml.Request.OrderRequest.OrderRequestHeader.BillTo.Address.PostalAddress.Street.Add(GetFieldValue(data, "SUBK_BILL_LINE3_ADDR"));
            }

            // ItemOut - Request\OrderRequest\ItemOut

            if (data.document.rows != null && data.document.rows.Count > 0 &&
                data.document.rows[0].row.children != null && data.document.rows[0].row.children.Count > 0)
            {
                foreach (var child in data.document.rows[0].row.children)
                {
                    if (GetFieldValue(child, "PO_LN_NO") == null)
                    {
                        continue;
                    }
                    var itemOut = new ItemOut
                    {
                        LineNumber = GetFieldValue(child, "PO_LN_NO")
                    };
                    itemOut.ItemDetail.Description.Text = GetFieldValue(child, "PO_LN_DESC");
                    if (string.IsNullOrWhiteSpace(itemOut.ItemDetail.Description.Text))
                    {
                        itemOut.ItemDetail.Description.Text = GetFieldValue(child, "VCHR_LN_DESC");
                    }

                    itemOut.ItemDetail.UnitOfMeasure = GetFieldValue(child, "PO_LN_UM_CD");
                    if (string.IsNullOrWhiteSpace(itemOut.ItemDetail.UnitOfMeasure))
                    {
                        itemOut.ItemDetail.UnitOfMeasure = GetFieldValue(child, "UM_CD");
                    }

                    itemOut.Quantity = GetFieldValue(child, "ORD_QTY");

                    itemOut.ItemDetail.UnitPrice.Money.Text     = GetFieldValue(child, "TRN_NET_UN_CST_AMT");
                    itemOut.ItemDetail.UnitPrice.Money.Currency = GetFieldValue(data, "PAY_CRNCY_CD");
                    itemOut.ItemDetail.Classification.Text      = GetFieldValue(child, "COMM_CD");

                    itemOut.ItemID.SupplierPartID = GetFieldValue(child, "VEND_PART_ID");
                    if (string.IsNullOrWhiteSpace(itemOut.ItemID.SupplierPartID))
                    {
                        itemOut.ItemID.SupplierPartID = GetFieldValue(child, "ITEM_ID");
                    }

                    itemOut.Distribution.Accounting.Project      = GetFieldValue(child, "POMPOVCH_VCHRLNACCT_PROJ_ID");
                    itemOut.Distribution.Accounting.Department   = GetFieldValue(child, "POMPOVCH_VCHRLNACCT_ACCT_ID");
                    itemOut.Distribution.Accounting.Organization = GetFieldValue(child, "POMPOVCH_VCHRLNACCT_ORG_ID");

                    itemOut.Distribution.Charge.Money.Text = GetFieldValue(child, "POMPOVCH_POLN_TRN_LN_CHG_CST_AMT");

                    cxml.Request.OrderRequest.ItemOut.Add(itemOut);
                }
            }


            return(cxml);
        }