private void Process(int Receipt)
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("dtuser.Register_Update");
            SqlDataReader dr;
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.Parameters.Add("@pInvoiceID", SqlDbType.Int).Value = Receipt;

                dr = cmd.ExecuteReader();
            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(),"Receipt Zero");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message.ToString(),"Receipt Zero");
            }
            finally
            {
                if (cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
            MessageBox.Show("Receipt has been zeroed");
            this.Close();
        }
Example #2
0
        /// <summary>
        /// Records a sale in the old sales register
        /// </summary>
        /// <param name="ItemID"></param>
        /// <param name="Price"></param>
        /// <returns></returns>
        public bool RecordOldSale(int ItemID, double Price)
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("dtuser.ItemSold_Insert");
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.Parameters.Add("@pItemID", SqlDbType.Int).Value = ItemID;
                cmd.Parameters.Add("@pSalePrice", SqlDbType.Money).Value = Price;
                cmd.ExecuteNonQuery();
                return true;
            }
            catch (SqlException)
            {
                return false;
            }
            catch (Exception)
            {
                return false;
            }
            finally
            {
                if (cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #3
0
        /// <summary>
        /// load up the bar code for printing
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdReprintBarCode_Click(object sender, EventArgs e)
        {
            if (txtItemID.Text != string.Empty)
            {
                var d = new Decode();
                SqlConnection cn = new SqlConnection(d.ConnectionString);
                SqlCommand cmd = new SqlCommand("DTUSER.WaitingToPrint_Insert");
                cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.Parameters.Add("@pItemNumber", SqlDbType.Int).Value = txtItemID.Text;

                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("There was an error: {0}", ex.Message), Properties.Settings.Default.MessageBoxTitle, MessageBoxButtons.OK);
            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
            MessageBox.Show("BarCode Added to Bar Code Print Queue!", "Manual Update", MessageBoxButtons.OK);
            }
        }
 private void Report_ShopSales_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'DoubletakeDataSet.ShopInventory_Select' table. You can move, or remove it, as needed.
     var d = new Decode();
     System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(d.ConnectionString);
     this.ShopInventory_SelectTableAdapter.Connection = con;
     this.ShopInventory_SelectTableAdapter.Fill(this.DoubletakeDataSet.ShopInventory_Select, GlobalClass.RegisterStart, GlobalClass.RegisterEnd);
     this.reportViewer1.RefreshReport();
 }
 private void Report_PaymentsDue_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'DoubletakeDataSet.PaymentsDue_Select' table. You can move, or remove it, as needed.
     var d = new Decode();
     System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(d.ConnectionString);
     this.PaymentsDue_SelectTableAdapter.Connection = con;
     this.PaymentsDue_SelectTableAdapter.Fill(this.DoubletakeDataSet.PaymentsDue_Select, System.DateTime.Parse(GlobalClass.ClothesReport_Date.ToString()));
     this.reportViewer1.RefreshReport();
 }
Example #6
0
 private void Report_Global_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'DoubletakeDataSet.ConsignorGlobalReport' table. You can move, or remove it, as needed.
     var constrg = new Decode();
     System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(constrg.ConnectionString);
     this.ConsignorGlobalReportTableAdapter.Connection = con;
     this.ConsignorGlobalReportTableAdapter.Fill(this.DoubletakeDataSet.ConsignorGlobalReport, GlobalClass.ConsignerID);
     this.reportViewer1.RefreshReport();
 }
Example #7
0
 private void BarCodePrinting_Load(object sender, EventArgs e)
 {
     var constrg = new Decode();
     System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(constrg.ConnectionString);
     this.BarCodePrint_SelectTableAdapter.Connection = con;
     this.BarCodePrint_SelectTableAdapter.Fill(this.DoubletakeDataSet.BarCodePrint_Select,0);
     this.reportViewer1.RefreshReport();
     BarCode_Print();
 }
 private void button1_Click(object sender, EventArgs e)
 {
     DateTime startDate = dateTimePicker1.Value;
     DateTime endDate = dateTimePicker2.Value;
     var constrg = new Decode();
     System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(constrg.ConnectionString);
     this.inventory_SelectTableAdapter.Connection = con;
     this.inventory_SelectTableAdapter.Fill(this.doubletakeDataSet.Inventory_Select, SoldOnly, startDate, endDate);
     dataGridView1.Refresh();
 }
 private void InventorySelect_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'DoubletakeDataSet.Inventory_Select' table. You can move, or remove it, as needed.
     DateTime startDate = GlobalClass.RegisterStart;
     DateTime endDate = GlobalClass.RegisterEnd;
     var constrg = new Decode();
     System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(constrg.ConnectionString);
     this.Inventory_SelectTableAdapter.Connection = con;
     this.Inventory_SelectTableAdapter.Fill(this.DoubletakeDataSet.Inventory_Select, 0, startDate, endDate);
     this.reportViewer1.RefreshReport();
 }
Example #10
0
        private void LoadGrid()
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.ReturnItems_Select");
            SqlDataReader dr;
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                dr = cmd.ExecuteReader();

                if (dr.HasRows == true)
                {
                    while (dr.Read())
                    {
                        cmdDonated.Rows.Add(0,
                            dr.GetValue(0).ToString(),
                            dr.GetValue(1).ToString(),
                            dr.GetValue(2).ToString(),
                            dr.GetValue(3).ToString()
                            );
                    }
                }
                else
                {
                    MessageBox.Show("No Inventory Found With that Search", "Search", MessageBoxButtons.OK);
                }
            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #11
0
        private bool GetConsignor()
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.Consignor_Info");
            SqlDataReader dr;
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.Parameters.Add("@pConsignorID", SqlDbType.VarChar).Value = int.Parse(textBox1.Text);

                dr = cmd.ExecuteReader();
                if (dr.HasRows == true)
                {

                    while (dr.Read())
                    {
                        lblConsignor.Text = dr.GetValue(1).ToString() + ", " + dr.GetValue(2).ToString();
                    }
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);
                return false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
                return false;
            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #12
0
        private void BarCode_Print()
        {
            UPCLabel.UpcLabel mylabel = new UPCLabel.UpcLabel();
            string sprice;
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.BarCodePrint_Select");
            SqlDataReader dr ;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@pItemNumber", SqlDbType.Int).Value = 0;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                dr = cmd.ExecuteReader();
                string PrinterName = GlobalClass.LabelPrinter;
                while (dr.Read())
                {
                    mylabel.setupc(dr.GetSqlValue(0).ToString());
                    mylabel.setupc_description(dr.GetSqlValue(2).ToString());
                    mylabel.setupc_lastline(dr.GetSqlValue(1).ToString() + " | " + dr.GetDateTime(3).ToShortDateString().ToString() + " | " );
                    sprice = "$" + decimal.Round(dr.GetSqlMoney(4).Value,2).ToString();
                    mylabel.setprice(sprice);
                    mylabel.Print(PrinterName);
                }
            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
            }
            finally
            {
                if (cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #13
0
        public MDIParent1()
        {
            InitializeComponent();

            // set the global connection string here
            Decode d = new Decode();
            if (Properties.Settings.Default.DebugMode)
            {
                d.ConnectionString = "DoubleTakeTest";
            }
            else
            {
                d.ConnectionString = "DoubleTake";
            }

            dbPOS POSdb = new dbPOS();
            GlobalClass.SalesTax = POSdb.SalesTaxRate();
            if (GlobalClass.SalesTax == -100)
            {
                //failure to connect and get tax rate
                MessageBox.Show("Unable to reach SQL Database connection - please insure network connectivity exists.  System will now exit.", "NETWORK CONNECTION ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                System.Environment.Exit(0);
            }
            string strFilename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DoubleTakePrinterAssignments.xml");
            if (File.Exists(strFilename) == true)
            {
                GoReader(strFilename);
            }

            string strPictureFilename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DoubleTakePictureAssignments.xml");
            if (File.Exists(strPictureFilename) == true)
            {
                if (System.IO.File.ReadAllLines(strPictureFilename).Length != 0)
                {
                    string[] lines = System.IO.File.ReadAllLines(strPictureFilename);
                    {
                        Image q = Image.FromFile(lines[0].ToString());
                        this.BackgroundImage = q;
                    }
                }
            }
        }
Example #14
0
        public double SalesTaxRate()
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUser.SalesTaxRate_Select");
            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter returnValue = new SqlParameter("@Return_Value", DbType.Decimal);
            returnValue.Direction = ParameterDirection.ReturnValue;
            cmd.Parameters.Add(returnValue);
            SqlDataReader dr;

            try
            {
                double iReturn = -100;
                cn.Open();
                cmd.Connection = cn;

                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    iReturn = (double)dr.GetSqlDecimal(0).Value;
                }
                return iReturn;
            }
            catch (SqlException)
            {
                throw;

            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #15
0
        private void SaveDaysSales()
        {
            int count;
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.OtherDaysSales_Insert");
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@pSaleDate", SqlDbType.DateTime).Value = calMonth.SelectionStart.ToString();
            cmd.Parameters.Add("@pSaleAmount", SqlDbType.Money).Value = decimal.Parse(txtDaysSales.Text.ToString());
            SqlParameter returnValue = new SqlParameter("@Return_Value", DbType.Int32);
            returnValue.Direction = ParameterDirection.ReturnValue;
            cmd.Parameters.Add(returnValue);

            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.ExecuteNonQuery();
                count = Int32.Parse(cmd.Parameters["@Return_Value"].Value.ToString());
                MessageBox.Show("Record #: " + count.ToString() + " Entered!","Days Sales",MessageBoxButtons.OK);

            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #16
0
        private bool BulkArchive(int MonthValue)
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.BulkArchive");
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@pMonthValue", SqlDbType.Int).Value = MonthValue;
            SqlParameter returnValue = new SqlParameter("@Return_Value", DbType.Int32);
            returnValue.Direction = ParameterDirection.ReturnValue;
            cmd.Parameters.Add(returnValue);

            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.ExecuteNonQuery();
                int iReturn = Int32.Parse(cmd.Parameters["@Return_Value"].Value.ToString());
                if (iReturn == 0)
                {
                    return true;
                }
            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString());
                return false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                return false;
            }
            finally
            {
                cn.Close();
            }
            return true;
        }
Example #17
0
        private void BarCodePrinting_FormClosing(Object sender, FormClosingEventArgs e)
        {
            DialogResult DR = MessageBox.Show("Did BarCodes Print OK?", "Bar Code Printing", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (DR == DialogResult.Yes)
            {
                var d = new Decode();
                SqlConnection cn = new SqlConnection(d.ConnectionString);
                SqlCommand cmd = new SqlCommand("DTUSER.WaitingToPrint_Clear");

                try
                {
                    cn.Open();
                    cmd.Connection = cn;
                    cmd.ExecuteNonQuery();

                }
                catch (SqlException sx)
                {
                    MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
                }
                finally
                {
                    if ( cn.State != ConnectionState.Closed)
                    {
                        cn.Close();
                    }
                }

            }
        }
Example #18
0
        private void DonateItem(string ItemId)
        {
            //call the donateitem sproc for the itemnumber
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.DonateItem_Insert");
            cmd.CommandType = CommandType.StoredProcedure;
            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.Parameters.Add("@pItemID", SqlDbType.Int).Value = ItemId;
                cmd.ExecuteNonQuery();

            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
            }
            finally
            {
                if (cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #19
0
 private void txtScanBox_TextChanged(object sender, EventArgs e)
 {
     if (txtScanBox.TextLength == 9)
     {
         if (PreviousEnterCheck(txtScanBox.Text) == true)
         {
             var d = new Decode();
             SqlConnection cn = new SqlConnection(d.ConnectionString);
             SqlCommand cmd = new SqlCommand("DTUSER.UnSoldItemID_Select");
             SqlDataReader dr;
             cmd.CommandType = CommandType.StoredProcedure;
             try
             {
                 cn.Open();
                 cmd.Connection = cn;
                 cmd.Parameters.Add("@pItemID", SqlDbType.Int).Value = txtScanBox.Text.ToString();
                 dr = cmd.ExecuteReader();
                 if (dr.HasRows == true)
                 {
                     while (dr.Read())
                     {
                         col1 = dr.GetValue(0).ToString();
                         col2 = dr.GetValue(1).ToString();
                         col3 = dr.GetSqlMoney(2).ToString();
                         col4 = dr.GetValue(3).ToString();
                     }
                     CheckRowInsert(col1, col2, col3, col4);
                 }
                 else
                 {
                     MessageBox.Show("No Inventory Found With that Search", "Search", MessageBoxButtons.OK);
                 }
             }
             catch (SqlException sx)
             {
                 MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
             }
             finally
             {
                 if ( cn.State != ConnectionState.Closed)
                 {
                     cn.Close();
                 }
             }
         }
         txtScanBox.Text = string.Empty;
     }
 }
Example #20
0
 /// <summary>
 /// load the combo box for the sold status states
 /// </summary>
 private void LoadComboBox()
 {
     var d = new Decode();
     SqlConnection cn = new SqlConnection(d.ConnectionString);
     SqlCommand cmd = new SqlCommand("DTUSER.SoldStatusComboBox");
     SqlDataReader dr;
     try
     {
         cn.Open();
         cmd.Connection = cn;
         dr = cmd.ExecuteReader();
         while (dr.Read())
         {
             cboSoldStatus.Items.Add(dr.GetValue(0).ToString());
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(string.Format("There was an error: {0}", e.Message), Properties.Settings.Default.MessageBoxTitle, MessageBoxButtons.OK);
     }
     finally
     {
         if ( cn.State != ConnectionState.Closed)
         {
             cn.Close();
         }
     }
 }
Example #21
0
        public bool RecordSaleDetails(int InvoiceId, int LineItem, int ItemID, string Description, double Price, int Quantity, double Extended)
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("dtuser.SalesDetails_Insert");
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.Parameters.Add("@pInvoiceID", SqlDbType.Int).Value = InvoiceId;
                cmd.Parameters.Add("@pLineItem", SqlDbType.Int).Value = LineItem;
                cmd.Parameters.Add("@pItemID", SqlDbType.Int).Value = ItemID;
                cmd.Parameters.Add("@pItemDescription", SqlDbType.NVarChar).Value = Description;
                cmd.Parameters.Add("@pPrice", SqlDbType.Money).Value = Price;
                cmd.Parameters.Add("@pQuantity", SqlDbType.Int).Value = Quantity;
                cmd.Parameters.Add("@pExtended", SqlDbType.Money).Value = Extended;

                cmd.ExecuteNonQuery();
                cmd.Parameters.Clear();
                return true;
            }
            catch (SqlException)
            {
                return false;

            }
            catch (Exception)
            {
                return false;
            }
            finally
            {
                if (cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #22
0
        /// <summary>
        /// records hte sale and returns the invoice id
        /// </summary>
        /// <param name="Saletype"></param>
        /// <param name="SubTotal"></param>
        /// <param name="Discount"></param>
        /// <param name="Taxes"></param>
        /// <param name="Total"></param>
        /// <param name="dDateTime"></param>
        /// <returns>Invoice ID</returns>
        public int RecordSale(int Saletype, double SubTotal, double Discount, double Taxes, double Total, DateTime dDateTime)
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("dtuser.SalesRegister_Insert");
            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter returnValue = new SqlParameter("@Return_Value", DbType.Int32);
            returnValue.Direction = ParameterDirection.ReturnValue;
            cmd.Parameters.Add(returnValue);

            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.Parameters.Add("@pMethod", SqlDbType.Int).Value = Saletype;
                cmd.Parameters.Add("@pSubTotal", SqlDbType.Money).Value = SubTotal;
                cmd.Parameters.Add("@pDiscount", SqlDbType.Money).Value = Discount;
                cmd.Parameters.Add("@pTax", SqlDbType.Money).Value = Taxes;
                cmd.Parameters.Add("@pTotal", SqlDbType.Money).Value = Total;
                cmd.Parameters.Add("@pSaleDate", SqlDbType.DateTime).Value = dDateTime;
                cmd.ExecuteNonQuery();

                int iReturn = Int32.Parse(cmd.Parameters["@Return_Value"].Value.ToString());
                if (iReturn == -1)
                {
                    return -1;
                }
                else
                {
                    return iReturn;
                }
            }
            catch (SqlException)
            {
                return -1;
            }
            catch (Exception)
            {
                return -1;
            }
            finally
            {
                if (cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
 private void LoadReport(int consignorID, string soldStatus)
 {
     // TODO: This line of code loads data into the 'DoubletakeDataSet.PaymentsDue_Select' table. You can move, or remove it, as needed.
     var constrg = new Decode();
     try
     {
         System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(constrg.ConnectionString);
         this.ConsignorGlobalReport2_SelectedTableAdapter.Connection = con;
         this.ConsignorGlobalReport2_SelectedTableAdapter.Fill(this.doubletakeDataSet.ConsignorGlobalReport2_Selected, consignorID, soldStatus);
         this.reportViewer1.RefreshReport();
     }
     catch (System.Data.SqlClient.SqlException sx)
     {
         string serror = string.Format("SQL Error: {0}", sx.Message);
         MessageBox.Show(serror, Properties.Settings.Default.MessageBoxTitle, MessageBoxButtons.OK);
     }
     catch (Exception ex)
     {
         string xerror = string.Format("Windows C# Error: {0}", ex.Message);
         MessageBox.Show(xerror, Properties.Settings.Default.MessageBoxTitle, MessageBoxButtons.OK);
     }
 }
Example #24
0
        private bool SaveWaitingToPrint()
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.WaitingToPrint_Clear");
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                cmd.ExecuteNonQuery();

                cmd.CommandText = "DTUSER.WaitingToPrint_Insert";

                for (int iCount = 0; iCount <= dgPrices.Rows.Count - 1; iCount++)
                {

                    cmd.Parameters.Add("@pItemNumber", SqlDbType.Int).Value = int.Parse(dgPrices["Col4", iCount].Value.ToString());
                    cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();

                }
                return true;

            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);
                return false;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
                return false;
            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();

                }

            }
        }
Example #25
0
        private void GetUnpricedItems()
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.UnPricedItem_Select");
            SqlDataReader dr;
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                dr = cmd.ExecuteReader();

                if (dr.HasRows == true)
                {

                    while (dr.Read())
                    {

                        dgPrices.Rows.Add(
                                            dr.GetSqlValue(0).ToString(),
                                            dr.GetSqlValue(1).ToString(),
                                            dr.GetSqlValue(2).ToString(),
                                            dr.GetSqlValue(3).ToString(),
                                            dr.GetSqlValue(4).ToString(),
                                            dr.GetSqlDateTime(6).Value.ToShortDateString().ToString(),
                                            dr.GetSqlMoney(5).ToString() );

                    }
                }
                else
                {
                    MessageBox.Show("No Unpriced Inventory Found ", "Search", MessageBoxButtons.OK);
                    cn.Close();

                }

            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #26
0
 private bool SaveRows()
 {
     var d = new Decode();
     SqlConnection cn = new SqlConnection(d.ConnectionString);
     SqlCommand cmd = new SqlCommand("DTUSER.ReturnItems_Insert");
     cmd.CommandType = CommandType.StoredProcedure;
     try
     {
         cn.Open();
         cmd.Connection = cn;
         for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
         {
             cmd.Parameters.Add("@pItemNumber", SqlDbType.Int).Value = dataGridView1[0, i].Value.ToString();
             cmd.ExecuteNonQuery();
             cmd.Parameters.Clear();
         }
     }
     catch (SqlException sx)
     {
         MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);
         return false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
         return false;
     }
     finally
     {
         if ( cn.State != ConnectionState.Closed)
         {
             cn.Close();
         }
     }
     return true;
 }
Example #27
0
        private void GetPayRate()
        {
            //sql code to load consignor
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.PayRate_Select");
            SqlDataReader dr;
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    PayRate = (double.Parse(dr.GetSqlInt32(0).Value.ToString())) / 100;
                }
            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);

            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #28
0
        private void LoadConsignor(int ConsignorID)
        {
            string sSaleDate;
            double sSaleAmount;
            //sql code to load consignor
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.ConsignorSales_Select");
            SqlDataReader dr;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@pConsignorID", SqlDbType.Int).Value = ConsignorID;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                dr = cmd.ExecuteReader();

                if (ConsignorID == 0)
                {
                    while (dr.Read())
                    {
                        if (dr.IsDBNull(3) == true)
                        {
                            sSaleAmount = 0;
                        }
                        else
                        {
                            sSaleAmount = dr.GetSqlMoney(3).ToDouble();
                        }
                        dgPayments.Rows.Add(
                                                dr.GetSqlInt32(0).Value.ToString(),
                                                dr.GetSqlValue(1).ToString(),
                                                dr.GetSqlValue(2).ToString(),
                                                sSaleAmount.ToString("c")
                                       );
                    }
                }
                else
                {
                    while (dr.Read())
                    {
                        if (dr.IsDBNull(6) == true)
                        {
                            sSaleDate = "00/00/00";
                        }
                        else
                        {
                            sSaleDate = dr.GetDateTime(6).ToShortDateString().ToString();
                        }

                        if (dr.IsDBNull(7) == true)
                        {
                            sSaleAmount = 0;
                        }
                        else
                        {
                            sSaleAmount = dr.GetSqlMoney(7).ToDouble();
                        }

                        // BEGIN THE ROW ADD...............
                        dgPayments.Rows.Add(
                                                dr.GetSqlInt32(0).Value.ToString(),
                                                dr.GetSqlValue(1).ToString(),
                                                dr.GetSqlValue(2).ToString(),
                                                dr.GetInt32(3).ToString(),
                                                dr.GetSqlValue(4).ToString(),
                                                dr.GetSqlMoney(5).Value.ToString("c"),
                                                sSaleDate.ToString(),
                                                sSaleAmount.ToString("c"),
                                                dr.GetSqlValue(8).ToString());
                    }
                }

            }

            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
        }
Example #29
0
        private bool SavePayments()
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.Payment_Insert");
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;
                for (int icount = 0; icount < dgThePayment.Rows.Count - 1; icount++)
                {
                    cmd.Parameters.Add("@pItemNumber", SqlDbType.Int).Value = int.Parse(dgThePayment[3, icount].Value.ToString());
                    cmd.Parameters.Add("@pAmountPaid", SqlDbType.Money).Value = decimal.Parse(dgThePayment[9, icount].Value.ToString());
                    cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                }

            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);
                return false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
                return false;
            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }

            return true;
        }
Example #30
0
        private bool SaveRows(int SaveAction)
        {
            var d = new Decode();
            SqlConnection cn = new SqlConnection(d.ConnectionString);
            SqlCommand cmd = new SqlCommand("DTUSER.PickedUpItems_Insert");
            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                cn.Open();
                cmd.Connection = cn;

               foreach (DataGridViewRow dr in cmdDonated.Rows)
               {
                    if (dr.Cells[1].Value != null)
                    {
                        if (dr.Cells[0].Value.ToString() == "1")
                        {
                            cmd.Parameters.Add("@pSaveAction", SqlDbType.Int).Value = SaveAction;
                            cmd.Parameters.Add("@pItemID", SqlDbType.Int).Value = dr.Cells[3].Value.ToString();
                            cmd.ExecuteNonQuery();
                            cmd.Parameters.Clear();
                        }
                    }
                    else
                    {
                        return true;
                    }
               }
            }
            catch (SqlException sx)
            {
                MessageBox.Show(sx.Message.ToString(), "SQL Data Error", MessageBoxButtons.OK);
                return false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "C# Error", MessageBoxButtons.OK);
                return false;
            }
            finally
            {
                if ( cn.State != ConnectionState.Closed)
                {
                    cn.Close();
                }
            }
            return true;
        }