Пример #1
0
        /// <summary>
        /// Creates a new instance of the sol_CashTrays class and populates it with data from the specified SqlDataReader.
        /// </summary>
        protected virtual Sol_CashTray MakeSol_CashTray(SqlDataReader dataReader)
        {
            Sol_CashTray sol_CashTray = new Sol_CashTray();

            sol_CashTray.CashTrayID    = SqlClientUtility.GetInt32(dataReader, "CashTrayID", 0);
            sol_CashTray.Description   = SqlClientUtility.GetString(dataReader, "Description", String.Empty);
            sol_CashTray.WorkStationID = SqlClientUtility.GetInt32(dataReader, "WorkStationID", 0);
            sol_CashTray.UserID        = SqlClientUtility.GetGuid(dataReader, "UserID", Guid.Empty);
            sol_CashTray.UserName      = SqlClientUtility.GetString(dataReader, "UserName", String.Empty);

            return(sol_CashTray);
        }
Пример #2
0
        /// <summary>
        /// Saves a record to the sol_CashTrays table.
        /// </summary>
        public virtual void Insert(Sol_CashTray sol_CashTray)
        {
            ValidationUtility.ValidateArgument("sol_CashTray", sol_CashTray);

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Description", sol_CashTray.Description),
                new SqlParameter("@WorkStationID", sol_CashTray.WorkStationID),
                new SqlParameter("@UserID", sol_CashTray.UserID),
                new SqlParameter("@UserName", sol_CashTray.UserName)
            };

            sol_CashTray.CashTrayID = (int)SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "sol_CashTrays_Insert", parameters);
        }
Пример #3
0
        /// <summary>
        /// Selects all records from the sol_CashTrays table.
        /// </summary>
        public virtual List <Sol_CashTray> SelectAll()
        {
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "sol_CashTrays_SelectAll"))
            {
                List <Sol_CashTray> sol_CashTrayList = new List <Sol_CashTray>();
                while (dataReader.Read())
                {
                    Sol_CashTray sol_CashTray = MakeSol_CashTray(dataReader);
                    sol_CashTrayList.Add(sol_CashTray);
                }

                return(sol_CashTrayList);
            }
        }
Пример #4
0
        private bool addItem(int orderNumber, decimal amount, string station, string employee,
                             /*string openTime,*/
                             string submitDate,
                             bool select, string orderType, decimal fee, string status, int cashTrayID, DateTime datePaid, string reference, DateTime date)
        {
            string[]     str = new string[14];
            ListViewItem itm = new ListViewItem();
            //formatting numbers
            string c = String.Format("{0,8:#,##0.00}", amount);

            if (orderType == "R")
            {
                c = String.Format("{0,8:(#,##0.00)}", amount);
            }

            int index = 0;

            //0
            str[index++] = Funciones.Indent(7) + String.Format("{0,3:##000}", orderNumber);
            //1
            str[index++] = c; //String.Format("{0,8:$#,##0.00;($#,##0.00)}", amount);
            //2
            str[index++] = station;
            //3
            str[index++] = employee;
            //4
            str[index++] = orderType;

            c = String.Format("{0,8:#,##0.00}", fee);
            //5
            str[index++] = c; //String.Format("{0,8:$#,##0.00;($#,##0.00)}", fee);
            //
            //str[index++] = openTime;
            //6
            str[index++] = submitDate;
            //7
            str[index++] = Main.returnOrderStatusType.SingleOrDefault(p => p.Id == status).Description;

            Sol_CashTray sol_CashTray = sol_CashTray_Sp.Select(cashTrayID);

            //8
            if (sol_CashTray == null)
            {
                str[index++] = "";
            }
            else
            {
                str[index++] = sol_CashTray.Description;
            }

            //9
            if (datePaid < date)
            {
                str[index++] = "";
            }
            else
            {
                str[index++] = datePaid.ToShortDateString();
            }
            str[index++] = reference;

            itm = new ListViewItem(str);


            itm.Checked = select;
            if (!String.IsNullOrEmpty(str[9]))    //date paid
            {
                itm.BackColor = System.Drawing.SystemColors.Control;
            }

            listView1.Items.Add(itm);

            return(true);
        }