コード例 #1
0
ファイル: clsPackingList.cs プロジェクト: jworkman119/HTC
        private void writeOrderDetails(ref XmlWriter xmlWrite, string strOrder)
        {
            clsDatabase      objDB   = new clsDatabase(HiTecResources.DB);
            string           strSQL  = "Select sum(Qty)as Qty From OrderDetails Where OrderDetails.Orders_Number ='" + strOrder + "'";
            SQLiteDataReader objData = objDB.returnData(strSQL);
            string           strQty  = objData["Qty"].ToString();

            strSQL = "SELECT PartID, Description, Qty";
            strSQL = strSQL + " FROM OrderDetails";
            strSQL = strSQL + " WHERE Orders_Number ='" + strOrder + "'";

            objData = objDB.returnData(strSQL);
            xmlWrite.WriteStartElement("OrderDetails");
            xmlWrite.WriteAttributeString("TotalQty", strQty);

            while (objData.Read())
            {
                xmlWrite.WriteStartElement("Item");
                xmlWrite.WriteElementString("Number", objData["PartID"].ToString());
                xmlWrite.WriteElementString("Description", objData["Description"].ToString());
                xmlWrite.WriteElementString("Qty", objData["Qty"].ToString());
                xmlWrite.WriteEndElement();
            }

            xmlWrite.WriteEndElement();
        }
コード例 #2
0
ファイル: clsUploadData.cs プロジェクト: jworkman119/HTC
 private void addToDB(Data objData, string strDB, clsDatabase objDB)
 {
     objDB.addToDB(objData);
     if (objDB.Error != null)
     {
         // Add to array, that will be used to create an email that will be sent to Nancy.
     }
 }
コード例 #3
0
        private void LoadGrid(string strType)
        {
            this.Cursor = Cursors.WaitCursor;
            // Todo - move this string, probably should be put in an xml initialization file

            clsDatabase      objDatabase = new clsDatabase(HiTecResources.DB);
            SQLiteDataReader objData     = objDatabase.returnData(strType);
            int Row = 0;

            grdOrders.ColumnCount = objData.FieldCount;
            //for resizing columns
            Graphics objGraphics = this.CreateGraphics();

            int[] colW = new int[objData.FieldCount];

            grdOrders.Rows.Clear();

            //adding data to grid
            while (objData.Read())
            {
                grdOrders.Rows.Add();

                for (int Col = 0; Col < objData.FieldCount; Col++)
                {
                    if (Row == 0)
                    {
                        string strHeader = objData.GetName(Col);
                        grdOrders.Columns[Col].HeaderText = objData.GetName(Col);
                    }

                    SizeF objSize = objGraphics.MeasureString(objData[Col].ToString(), grdOrders.Font);
                    if (objSize.Width > colW[Col])
                    {
                        colW[Col] = (int)objSize.Width + 5;
                    }
                    grdOrders[Col, Row].Value = objData[Col].ToString();
                }
                Row++;
            }

            //Resizing rows
            AdjustGrid(colW, grdOrders.Columns.Count);

            if (strType == "UnShipped" && mnuRightClick.Items.Count == 1)
            {
                mnuRightClick.Items.Add("Void Order");
            }
            else if (strType == "Shipped" && mnuRightClick.Items.Count == 2)
            {
                mnuRightClick.Items.Remove(mnuRightClick.Items[1]);
            }

            this.Cursor = Cursors.Default;
        }
コード例 #4
0
ファイル: clsUploadData.cs プロジェクト: jworkman119/HTC
        private void streamData(string strFile, int Rows)
        {
            FileStream   objStream = new FileStream(strFile, FileMode.Open);
            StreamReader objReader = new StreamReader(objStream);

            System.Collections.ArrayList objErrors = new System.Collections.ArrayList();


            int    CurrentRow = 1;
            string strOrder   = "";
            bool   blStart    = true;

            clsDatabase objDB = new clsDatabase(strDB);

            XmlWriter xmlWrite = XmlWriter.Create(xmlPackingList);

            xmlWrite.WriteStartDocument();
            xmlWrite.WriteStartElement("Orders");
            xmlWrite.WriteStartElement("Header");
            xmlWrite.WriteElementString("Date", DateTime.Today.ToString("M/dd/yyyy"));
            xmlWrite.WriteEndElement();

            while (objReader.EndOfStream != true)
            {
                string strLine = objReader.ReadLine();
                strLine = strLine.Replace("'", "''");
                string[] arLine = strLine.Split('|');


                Data objData = addToStruct(arLine);

                // Creating Packing List, condition placed so I can tell xml we have last order in list.
                if (CurrentRow < Rows)
                {
                    strOrder = createXML(objData, ref xmlWrite, strOrder, ref blStart, false);
                }
                else
                {
                    strOrder = createXML(objData, ref xmlWrite, strOrder, ref blStart, true);
                }

                // TEST
                addToDB(objData, strDB, objDB);
                CurrentRow++;
            }

            xmlWrite.WriteEndElement();
            xmlWrite.Close();
            objReader.Close();
            objReader.Dispose();
            objStream.Dispose();
            // send Nancy a list of orders that didn't process.
            processErrors(objErrors);
        }
コード例 #5
0
ファイル: clsPackingList.cs プロジェクト: jworkman119/HTC
        private void writeShippedInfo(ref XmlWriter xmlWrite, string strOrder)
        {
            clsDatabase      objDB   = new clsDatabase(HiTecResources.DB);
            SQLiteDataReader objData = objDB.returnData("Select * From Tracking where Orders_Number ='" + strOrder + "'");

            xmlWrite.WriteStartElement("SentInfo");
            xmlWrite.WriteElementString("Tracking", objData["Tracking"].ToString());
            xmlWrite.WriteElementString("Carrier", objData["ShipMethod"].ToString());
            DateTime TS = Convert.ToDateTime(objData["TS"]);

            xmlWrite.WriteElementString("ShippedDate", TS.ToString("MM/dd/yyyy hh:mm"));     //DateTime.Today.ToString("M/dd/yyyy")
            xmlWrite.WriteElementString("Weight", objData["Weight"].ToString());
            xmlWrite.WriteElementString("ShipCost", objData["Cost"].ToString());
            xmlWrite.WriteEndElement();
        }
コード例 #6
0
ファイル: clsPackingList.cs プロジェクト: jworkman119/HTC
        private void writeBillTo(ref XmlWriter xmlWrite, string strOrder)
        {
            clsDatabase      objDB   = new clsDatabase(HiTecResources.DB);
            SQLiteDataReader objData = objDB.returnData("Select * From BillTo where Orders_Number ='" + strOrder + "'");

            xmlWrite.WriteStartElement("BillTo");
            xmlWrite.WriteElementString("Contact", objData["Contact"].ToString());
            xmlWrite.WriteElementString("Address1", objData["Address1"].ToString());
            xmlWrite.WriteElementString("Address2", objData["Address2"].ToString());
            xmlWrite.WriteElementString("Address3", objData["Address3"].ToString());
            string strCityStateZip = objData["City"].ToString() + ", " + objData["State"].ToString() + " " + objData["Zip"].ToString();

            xmlWrite.WriteElementString("CityStateZip", strCityStateZip);
            xmlWrite.WriteElementString("Country", objData["Country"].ToString());
            xmlWrite.WriteEndElement();
        }
コード例 #7
0
ファイル: clsPackingList.cs プロジェクト: jworkman119/HTC
        private void writeOrders(ref XmlWriter xmlWrite, string strOrder)
        {
            clsDatabase      objDB   = new clsDatabase(HiTecResources.DB);
            SQLiteDataReader objData = objDB.returnData("Select * From Orders where Number ='" + strOrder + "'");

            xmlWrite.WriteStartElement("Order");
            xmlWrite.WriteElementString("LastOrder", "True");

            xmlWrite.WriteStartElement("ShippingInfo");
            xmlWrite.WriteElementString("Number", objData["Number"].ToString());
            xmlWrite.WriteElementString("Carrier", objData["ShipMethod"].ToString());
            xmlWrite.WriteElementString("Email", objData["Email"].ToString());
            xmlWrite.WriteElementString("Phone", objData["Telephone"].ToString());
            xmlWrite.WriteElementString("ShippingAccount", objData["ShippingAccount"].ToString());
            xmlWrite.WriteElementString("AES", objData["AES"].ToString());
        }
コード例 #8
0
ファイル: clsUploadData.cs プロジェクト: jworkman119/HTC
        private Data addToStruct(string[] arLine)
        {
            Data        objData = new Data();
            clsDatabase objDB   = new clsDatabase(strDB);

            objData.OrderNumber       = arLine[4];
            objData.BillToContact     = arLine[8];
            objData.BillToLine1       = arLine[9];
            objData.BillToLine2       = arLine[10];
            objData.BillToLine3       = arLine[11];
            objData.BillToLine4       = arLine[12];
            objData.BillToCity        = arLine[13];
            objData.BillToState       = arLine[14];
            objData.BillToPostalCode  = arLine[15];
            objData.BillToCountryCode = arLine[16];
            objData.BillToCountry     = objDB.returnCountry(arLine[16]);
            objData.ShipToContact     = arLine[17];
            objData.ShipToLine1       = arLine[18];
            objData.ShipToLine2       = arLine[19];
            objData.ShipToLine3       = arLine[20];
            objData.ShipToLine4       = arLine[21];
            objData.ShipToCity        = arLine[22];
            objData.ShipToState       = arLine[23];
            objData.ShipToPostalCode  = arLine[24];
            objData.ShipToCountryCode = arLine[25];
            // Todo - change the way I'm entering country code, will enter country code into Database
            objData.ShipToCountry     = objDB.returnCountry(arLine[25]);
            objData.ShipMethod        = arLine[31];
            objData.CustEmailAddr     = arLine[54].Trim();
            objData.ShippingAccountNo = arLine[55];
            objData.TelephoneNbr      = arLine[57].Trim();
            objData.ItemNumber        = arLine[42].Trim();
            objData.ItemDescription   = arLine[43].Replace("'", "''");
            objData.Qty              = Convert.ToInt16(arLine[41]);
            objData.Price            = Convert.ToSingle(arLine[46]);
            objData.SubtotalPerLine  = Convert.ToInt16(arLine[41]) * Convert.ToSingle(arLine[46]);
            objData.TotalQtyPerOrder = Convert.ToInt16(arLine[52]);
            if (arLine[53].Length > 0)
            {
                objData.Subtotal = Convert.ToSingle(arLine[53]);
            }
            objData.aesNumber = arLine[62];


            return(objData);
        }
コード例 #9
0
        private void VoidOrder()
        {
            string       strOrder = grdOrders.CurrentRow.Cells[0].Value.ToString();
            DialogResult result   = MessageBox.Show("Are you sure you want to delete Order #: " + strOrder, "Delete Order", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                clsDatabase objDatabase = new clsDatabase(HiTecResources.DB);
                bool        blSuccess   = objDatabase.deleteFromDB(strOrder);
                if (blSuccess == true)
                {
                    MessageBox.Show("Order #" + strOrder + " has been deleted from the sytem.");
                    LoadGrid("UnShipped");
                }
                else
                {
                    MessageBox.Show("Order #" + strOrder + " has been deleted from the sytem.", "Error on Delete", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }