public Container Get_Container_By_Id(int ID)
        {
            Container _Container = new Container();

            DataTable dt = Container_DA.Get_Container_By_Id(ID);

            foreach (DataRow row in dt.Rows)
            {
                _Container.ID = ID;
                _Container.Name = row["Name"].ToString();
                _Container.CBM = row["CBM"].ToString();
            }
            return _Container;
        }
        public string Insert(string Name, string CBM)
        {
            Container _Container = new Container();
            _Container.Name = Name;
            _Container.CBM = CBM;
            _Container.CreatedBy = Session["User"].ToString();

            return Container_DA.Insert(_Container);
        }
        public string Update(int ID, string Name, string CBM)
        {
            Container _Container = new Container();
            _Container.ID = ID;
            _Container.Name = Name;
            _Container.CBM = CBM;
            _Container.UpdatedBy = Session["User"].ToString();

            if (_Container.UpdatedBy.ToString().ToUpper() == ("Mr. Asif").ToString().ToUpper() || _Container.UpdatedBy.ToString().ToUpper() == ("Saud Piracha").ToString().ToUpper())
            {
                return Container_DA.Update(_Container);
            }
            else
            {
                return "-1";
            }
        }
        public static string Insert(Container _Container)
        {
            DbCommand command = Catalog_Access.CreateCommand();
            //Have to wite the stored procedure
            command.CommandText = "sp_insert_Container";

            DbParameter param;

            param = command.CreateParameter();
            param.ParameterName = "@Name";
            param.Value = _Container.Name;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@CBM";
            param.Value = _Container.CBM;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@CreatedBy";
            param.Value = _Container.CreatedBy;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Return";
            param.DbType = DbType.String;
            param.Size = 2;
            param.Direction = ParameterDirection.Output;
            command.Parameters.Add(param);

            Catalog_Access.ExecuteNonQuery(command);

            string Return = command.Parameters["@Return"].Value.ToString();

            return Return;
        }
        public static string Update(Container _Container)
        {
            DbCommand command = Catalog_Access.CreateCommand();
            command.CommandText = "sp_Update_Container";

            DbParameter param;

            param = command.CreateParameter();
            param.ParameterName = "@ID";
            param.Value = _Container.ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Name";
            param.Value = _Container.Name;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@CBM";
            param.Value = _Container.CBM;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@UpdatedBy";
            param.Value = _Container.UpdatedBy;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Return";
            param.DbType = DbType.String;
            param.Size = 2;
            param.Direction = ParameterDirection.Output;
            command.Parameters.Add(param);
            Catalog_Access.ExecuteNonQuery(command);

            string Return = command.Parameters["@Return"].Value.ToString();

            return Return;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of <see cref="TelemetryProvider"/>
        /// </summary>
        /// <param name="container">The IoC container</param>
        public TelemetryProvider(Container container)
        {
            m_Container = container;

            var dueTime = TimeSpan.FromMinutes(60 - DateTime.Now.Minute);
            m_StorageTimer = new Timer(HandleStorageTimer, null, dueTime, TimeSpan.FromHours(2));

            m_Client = container.Resolve<MqttClient>();
            Task.Factory.StartNew(EstablishConnection);
        }