Пример #1
0
        public static List <EmployeeToll> GetEmployeeTollList(int employeeId)
        {
            List <EmployeeToll> list = new List <EmployeeToll>();

            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetEmployeeTollList";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@EmployeeId", DbType.Int32, employeeId);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    EmployeeToll employeeToll = new EmployeeToll();
                    employeeToll.EmployeeTollId    = Convert.ToInt32(dataReader["EmployeeTollId"]);
                    employeeToll.EmployeeVehicleId = Convert.ToInt32(dataReader["EmployeeVehicleId"]);
                    employeeToll.EmployeeId        = Convert.ToInt32(dataReader["EmployeeId"]);
                    employeeToll.DateOfToll        = Convert.ToDateTime(dataReader["DateOfToll"]);
                    employeeToll.PaymentType       = dataReader["PaymentType"].ToString();
                    employeeToll.Value             = Convert.ToDouble(dataReader["Value"]);
                    employeeToll.Description       = dataReader["Description"].ToString();

                    employeeToll.Registration = dataReader["Registration"].ToString();
                    employeeToll.Type         = dataReader["Type"].ToString();
                    employeeToll.VINNumber    = dataReader["VINNumber"].ToString();
                    employeeToll.Model        = dataReader["Model"].ToString();
                    employeeToll.Attachment   = dataReader["Attachment"].ToString();

                    list.Add(employeeToll);
                }
            }
            return(list);
        }
Пример #2
0
        public static EmployeeToll GetEmployeeTollByEmployeeTollId(int employeeTollId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetEmployeeTollByEmployeeTollId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@EmployeeTollId", DbType.Int32, employeeTollId);
            db.AddOutParameter(dbCommand, "@EmployeeId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@EmployeeVehicleId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@VehicleId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@DateOfToll", DbType.DateTime, 8);
            db.AddOutParameter(dbCommand, "@PaymentTypeId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@Value", DbType.Double, 8);
            db.AddOutParameter(dbCommand, "@Description", DbType.String, 1000);
            db.AddOutParameter(dbCommand, "@Attachment", DbType.String, 1000);
            db.ExecuteNonQuery(dbCommand);
            EmployeeToll employeeToll = new EmployeeToll();

            employeeToll.EmployeeTollId    = employeeTollId;
            employeeToll.EmployeeId        = Convert.ToInt32(db.GetParameterValue(dbCommand, "EmployeeId"));
            employeeToll.EmployeeVehicleId = Convert.ToInt32(db.GetParameterValue(dbCommand, "EmployeeVehicleId"));
            employeeToll.VehicleId         = Convert.ToInt32(db.GetParameterValue(dbCommand, "VehicleId"));
            employeeToll.DateOfToll        = Convert.ToDateTime(db.GetParameterValue(dbCommand, "DateOfToll"));
            employeeToll.PaymentTypeId     = Convert.ToInt32(db.GetParameterValue(dbCommand, "PaymentTypeId"));
            employeeToll.Value             = Convert.ToDouble(db.GetParameterValue(dbCommand, "Value"));
            employeeToll.Description       = db.GetParameterValue(dbCommand, "Description").ToString();
            employeeToll.Attachment        = db.GetParameterValue(dbCommand, "Attachment").ToString();

            return(employeeToll);
        }
Пример #3
0
        public static EmployeeToll GetEmployeeTollByVehicleIdEmployeeId(int vehicleId, int employeeId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetEmployeeTollByVehicleIdEmployeeId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@VehicleId", DbType.Int32, vehicleId);
            db.AddInParameter(dbCommand, "@EmployeeId", DbType.Int32, employeeId);
            db.AddOutParameter(dbCommand, "@EmployeeTollId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@EmployeeVehicleId", DbType.Int32, 4);
            db.ExecuteNonQuery(dbCommand);
            EmployeeToll employeeToll = new EmployeeToll();

            employeeToll.EmployeeTollId    = Convert.ToInt32(db.GetParameterValue(dbCommand, "EmployeeTollId"));
            employeeToll.EmployeeVehicleId = Convert.ToInt32(db.GetParameterValue(dbCommand, "EmployeeVehicleId"));
            return(employeeToll);
        }