コード例 #1
0
ファイル: Float.cs プロジェクト: ideaztech/ideaz
        private void readCashDenominations()
        {
            dataGridViewFloat.Rows.Clear();

            ClearForm();

            Sol_CashDenomination        sol_CashDenomination     = new Sol_CashDenomination();
            Sol_CashDenomination_Sp     sol_CashDenomination_Sp  = new Sol_CashDenomination_Sp(Properties.Settings.Default.WsirDbConnectionString);
            List <Sol_CashDenomination> sol_CashDenominationList = new List <Sol_CashDenomination>();


            sol_CashDenominationList = sol_CashDenomination_Sp.SelectAll();

            if (sol_CashDenominationList == null ||
                sol_CashDenominationList.Count < 1)
            {
                MessageBox.Show("There are no Cash Denominations defined! Please go to Tools -> Cash Denomination option to add them.");
                return;
            }



            string[] str = new string[dataGridViewFloat.ColumnCount];
            foreach (Sol_CashDenomination cd in sol_CashDenominationList)
            {
                if (Main.cashDenominationsType[cd.CashType].Description.ToLower() == "rolls")
                {
                    str[0] = cd.Description;
                }
                else
                {
                    str[0] = String.Format("{0:#,##0.00}", cd.CashValue);
                }
                str[1] = Main.cashDenominationsType[cd.CashType].Description;
                str[2] = "0";     // String.Format("{0,3:##,##0}", dozen);
                str[3] = "$0.00"; // container;
                str[4] = cd.CashID.ToString();
                str[5] = cd.CashValue.ToString();
                str[6] = cd.CashItemValue.ToString();
                str[7] = cd.Quantity.ToString();
                str[8] = cd.MoneyID.ToString();

                if (cd.CashType == 2 && cd.CashItemValue <= 0)   //"Rolls"
                {
                    MessageBox.Show("Please, all CashDenomination Rolls types should have the Item Value set, goto Tools -> Cash Denomination option.");
                    this.Close();
                    return;
                }


                dataGridViewFloat.Rows.Add(str);
            }
            dataGridViewFloat.Focus();
            dataGridViewFloat[0, 0].Selected = false;
            dataGridViewFloat[2, 0].Selected = true;
            dataGridViewFloat.CurrentCell    = this.dataGridViewFloat[2, 0];
        }
コード例 #2
0
        /// <summary>
        /// Selects all records from the sol_CashDenominations table.
        /// </summary>
        public virtual List <Sol_CashDenomination> SelectAll()
        {
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "sol_CashDenominations_SelectAll"))
            {
                List <Sol_CashDenomination> sol_CashDenominationList = new List <Sol_CashDenomination>();
                while (dataReader.Read())
                {
                    Sol_CashDenomination sol_CashDenomination = MakeSol_CashDenomination(dataReader);
                    sol_CashDenominationList.Add(sol_CashDenomination);
                }

                return(sol_CashDenominationList);
            }
        }
コード例 #3
0
        /// <summary>
        /// Creates a new instance of the sol_CashDenominations class and populates it with data from the specified SqlDataReader.
        /// </summary>
        protected virtual Sol_CashDenomination MakeSol_CashDenomination(SqlDataReader dataReader)
        {
            Sol_CashDenomination sol_CashDenomination = new Sol_CashDenomination();

            sol_CashDenomination.CashID        = SqlClientUtility.GetInt32(dataReader, "CashID", 0);
            sol_CashDenomination.CashType      = SqlClientUtility.GetByte(dataReader, "CashType", 0x00);
            sol_CashDenomination.CashValue     = SqlClientUtility.GetDecimal(dataReader, "CashValue", Decimal.Zero);
            sol_CashDenomination.Description   = SqlClientUtility.GetString(dataReader, "Description", String.Empty);
            sol_CashDenomination.OrderValue    = SqlClientUtility.GetInt16(dataReader, "OrderValue", 0);
            sol_CashDenomination.CashItemValue = SqlClientUtility.GetDecimal(dataReader, "CashItemValue", Decimal.Zero);
            sol_CashDenomination.Quantity      = SqlClientUtility.GetInt32(dataReader, "Quantity", 0);
            sol_CashDenomination.MoneyID       = SqlClientUtility.GetInt32(dataReader, "MoneyID", 0);

            return(sol_CashDenomination);
        }
コード例 #4
0
        /// <summary>
        /// Saves a record to the sol_CashDenominations table.
        /// </summary>
        public virtual void Insert(Sol_CashDenomination sol_CashDenomination)
        {
            ValidationUtility.ValidateArgument("sol_CashDenomination", sol_CashDenomination);

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@CashType", sol_CashDenomination.CashType),
                new SqlParameter("@CashValue", sol_CashDenomination.CashValue),
                new SqlParameter("@Description", sol_CashDenomination.Description),
                new SqlParameter("@OrderValue", sol_CashDenomination.OrderValue),
                new SqlParameter("@CashItemValue", sol_CashDenomination.CashItemValue),
                new SqlParameter("@Quantity", sol_CashDenomination.Quantity),
                new SqlParameter("@MoneyID", sol_CashDenomination.MoneyID)
            };

            sol_CashDenomination.CashID = (int)SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "sol_CashDenominations_Insert", parameters);
        }