Exemple #1
0
        protected override void ReadProperties(DbDataReader reader)
        {
            try
            {
                System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString("---> HH:mm:ss.fff"));

                Creator    = new User((int)reader["creator"], (string)reader["creatorName"]);
                CreateDate = (DateTime)reader["createDate"];

                System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff"));

                period      = (int)reader["period"];
                docNumber   = (int)reader["docNumber"];
                permitState = new EnumerationItem((int)reader["permitState"], (string)reader["permitStateName"]);

                System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff"));

                dateFrom = (DateTime)reader["dateFrom"];
                dateTo   = (DateTime)reader["dateTo"];

                System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff"));

                cargo      = new Cargo((int)reader["cargo"], (string)reader["cargoName"]);
                vehicle    = new Vehicle((int)reader["vehicle"], (string)reader["vehicleName"]);
                driverName = (string)reader["driverName"];
                contact    = (string)reader["contact"];

                System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff"));

                if (DBNull.Value.Equals(reader["entryPointName"]))
                {
                    EntryPoint = EntryPoint.Empty;
                }
                else
                {
                    EntryPoint = new Classes.EntryPoint((int)reader["entryPoint"], (string)reader["entryPointName"]);
                }
                multiEntry = (short)reader["multiEntry"];

                System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff"));

                comment = "";
                //if (DBNull.Value.Equals(reader["comment"]))
                //    comment = "";
                //else
                //    comment = (string)reader["comment"];
                System.Diagnostics.Debug.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 private void LoadClosedPermitState(Connection connection)
 {
     try
     {
         int id = int.Parse(LoadConstant(connection, "closedPermitState"));
         ClosedPermitState = new EnumerationItem(id, "Закрытый");
     }
     catch (Exception)
     {
         throw new NotImplementedException("ClosedPermitState value");
     }
 }
        public static List <Contractor> LoadList(Database database, EnumerationItem group)
        {
            List <Contractor> contractorList = new List <Contractor>();
            QueryParameters   parameters     = new QueryParameters("contractorGroup", group.Id);

            using (DbDataReader reader = database.ExecuteReader(LoadListQuery, parameters))
            {
                while (reader.Read())
                {
                    contractorList.Add(new Contractor(reader));
                }
                reader.Close();
            }

            return(contractorList);
        }
Exemple #4
0
        public static int GetCount(Database database, DateTime dateStart, DateTime dateFinish,
                                   EntryPoint entryPoint, EnumerationItem defaultState)
        {
            string query = EntryControl.Resources.Doc.Permit.GetCount;

            QueryParameters parameters = new QueryParameters("dateStart", dateStart);

            parameters.Add("dateFinish", dateFinish);
            parameters.Add("entryPoint", entryPoint.Id);
            parameters.Add("defaultState", defaultState.Id);

            object result = database.ExecuteScalar(query, parameters);

            if (result != null && !DBNull.Value.Equals(result))
            {
                return((int)result);
            }

            return(0);
        }
Exemple #5
0
        public static List <Permit> LoadList(Database database, DateTime dateStart, DateTime dateFinish,
                                             EntryPoint entryPoint, EnumerationItem defaultState, int page)
        {
            QueryParameters parameters = new QueryParameters("dateStart", dateStart);

            parameters.Add("dateFinish", dateFinish);
            parameters.Add("entryPoint", (entryPoint != null ? entryPoint.Id : 0));
            parameters.Add("defaultState", defaultState.Id);
            parameters.Add("page", page);

            List <Permit> permitList = new List <Permit>();

            using (DbDataReader reader = database.ExecuteReader(LoadListQuery, parameters))
            {
                while (reader.Read())
                {
                    permitList.Add(new Permit(reader));
                }
                reader.Close();
            }

            return(permitList);
        }
Exemple #6
0
        protected override void InitializeProperties()
        {
            Creator    = User.Empty;
            CreateDate = DateTime.Now;

            period = DateTime.Today.Year;

            // permitState = EntryControlDatabase.ConstantPermitState;
            permitState = EntryControlDatabase.TemporaryPermitState;

            dateFrom = DateTime.Today;
            dateTo   = new DateTime(dateFrom.Year, 12, 31);

            cargo      = Cargo.Empty;
            vehicle    = Vehicle.Empty;
            driverName = "ФИО водителя";
            contact    = "Контактная информация";

            EntryPoint = EntryPoint.Empty;
            multiEntry = 1;

            comment = "";
        }
Exemple #7
0
 public static List <Permit> LoadList(Database database, DateTime dateStart, DateTime dateFinish,
                                      EntryPoint entryPoint, EnumerationItem defaultState)
 {
     return(LoadList(database, dateStart, dateFinish, entryPoint, defaultState, 1));
 }
        public void LoadCloseMovingType(Connection connection)
        {
            int id = int.Parse(LoadConstant(connection, "closeMoving"));

            closeMovingType = new EnumerationItem(id, EntryControl.Resources.Doc.Permit.CloseMoving);
        }
        private void LoadExitMovingType(Connection connection)
        {
            int id = int.Parse(LoadConstant(connection, "exitMoving"));

            exitMovingType = new EnumerationItem(id, EntryControl.Resources.Doc.Permit.ExitMoving);
        }
        private void LoadTemporaryPermitState(Connection connection)
        {
            int id = int.Parse(LoadConstant(connection, "temporaryPermitState"));

            temporaryPermitState = new Classes.EnumerationItem(id, "Временный");
        }
        private void LoadConstantPermitState(Connection connection)
        {
            int id = int.Parse(LoadConstant(connection, "constantPermitState"));

            constantPermitState = new EnumerationItem(id, "Постоянный");
        }
        private void LoadOneTimePermitState(Connection connection)
        {
            int id = int.Parse(LoadConstant(connection, "oneTimePermitState"));

            oneTimePermitState = new EnumerationItem(id, "Разовый");
        }
        private void LoadVehicleOwnerGroup(Connection connection)
        {
            int id = int.Parse(LoadConstant(connection, "vehicleOwnerGroup"));

            vehicleOwnerGroup = new EnumerationItem(id, "Перевозчик");
        }