コード例 #1
0
        public bool Delete(Room value)
        {
            bool result = false;

            MachineHibernate machineHibernate = new MachineHibernate();
            result = machineHibernate.DeleteByRoom(value.Guid);

            DatabaseHibernate hibernate = new DatabaseHibernate();
            List<Parameter> parameters = new List<Parameter>();

            if (result)
            {
                string sql = string.Format("delete from e_user_room as t where [t].[room_id] = '{0}'", value.Guid);
                parameters.Clear();

                result = hibernate.Write(Variable.Link, sql, parameters);
            }

            if (result)
            {
                string sql = string.Format("delete from e_room as t where [t].[guid] = '{0}'", value.Guid);
                parameters.Clear();

                result = hibernate.Write(Variable.Link, sql, parameters);
            }

            return result;
        }
コード例 #2
0
        public bool Insert(List<Module.Environmental.DataCache> values)
        {
            bool result = false;

            DatabaseHibernate hibernate = new DatabaseHibernate();

            if (values != null)
            {
                string sql = string.Empty;
                List<Parameter> parameters = new List<Parameter>();
                for (int i = 0; i < values.Count; i++)
                {
                    DateTime refreshTime = DateTime.Now;
                    refreshTime = refreshTime.AddDays(-100);

                    sql = string.Format("delete from e_data_cache where [refresh_time] < #{0}#", refreshTime.ToString("yyyy-MM-dd HH:mm:ss"));
                    parameters.Clear();
                    result = hibernate.Write(Variable.Link, sql, parameters);
                    if (!result)
                    {
                        break;
                    }

                    sql = string.Format("update e_data_cache set [newest] = :newest where [detector_id] = '{0}'", values[i].DetectorId);
                    parameters.Clear();
                    parameters.Add(new Parameter("newest", DatabaseHibernate.Parameter(false)));
                    result = hibernate.Write(Variable.Link, sql, parameters);
                    if (!result)
                    {
                        break;
                    }

                    sql = string.Format("insert into e_data_cache ({0}) values (:guid, :insert_user_id, :insert_time, :update_user_id, :update_time, :remark, :validity, :detector_id, :value, :refresh_time, :newest)", this.Asterisk(""));
                    parameters.Clear();

                    parameters.Add(new Parameter("guid", DatabaseHibernate.Parameter(DatabaseHibernate.GUID())));
                    parameters.Add(new Parameter("insert_user_id", DatabaseHibernate.Parameter(values[i].InsertUserId)));
                    parameters.Add(new Parameter("insert_time", DatabaseHibernate.Parameter(values[i].InsertTime)));
                    parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(values[i].UpdateUserId)));
                    parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(values[i].UpdateTime)));
                    parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(values[i].Remark)));
                    parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(values[i].Validity)));

                    parameters.Add(new Parameter("detector_id", DatabaseHibernate.Parameter(values[i].DetectorId)));
                    parameters.Add(new Parameter("value", DatabaseHibernate.Parameter(values[i].Value)));
                    parameters.Add(new Parameter("refresh_time", DatabaseHibernate.Parameter(values[i].RefreshTime)));
                    parameters.Add(new Parameter("newest", DatabaseHibernate.Parameter(values[i].Newest)));

                    result = hibernate.Write(Variable.Link, sql, parameters);
                    if (!result)
                    {
                        break;
                    }
                }
            }

            return result;
        }
コード例 #3
0
        public bool Insert(Detector value)
        {
            bool result = false;

            string sql = string.Format("insert into e_detector ({0}) values (:guid, :insert_user_id, :insert_time, :update_user_id, :update_time, :remark, :validity, :machine_id, :detector_type_id, :serial, minimum_a, maximum_a, minimum_b, maximum_b, null, null)", this.Asterisk(""));
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("guid", DatabaseHibernate.Parameter(DatabaseHibernate.GUID())));
            parameters.Add(new Parameter("insert_user_id", DatabaseHibernate.Parameter(value.InsertUserId)));
            parameters.Add(new Parameter("insert_time", DatabaseHibernate.Parameter(value.InsertTime)));
            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));

            parameters.Add(new Parameter("machine_id", DatabaseHibernate.Parameter(value.MachineId)));
            parameters.Add(new Parameter("detector_type_id", DatabaseHibernate.Parameter(value.DetectorTypeId)));
            parameters.Add(new Parameter("serial", DatabaseHibernate.Parameter(value.Serial)));
            parameters.Add(new Parameter("minimum_a", DatabaseHibernate.Parameter(value.MinimumA)));
            parameters.Add(new Parameter("maximum_a", DatabaseHibernate.Parameter(value.MaximumA)));
            parameters.Add(new Parameter("minimum_b", DatabaseHibernate.Parameter(value.MinimumB)));
            parameters.Add(new Parameter("maximum_b", DatabaseHibernate.Parameter(value.MaximumB)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #4
0
        public bool Delete(User value)
        {
            bool result = false;

            string sql = string.Format("delete from m_user_module as t where [t].[user_id] = '{0}'", value.Guid);
            List<Parameter> parameters = new List<Parameter>();

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            if (result)
            {
                sql = string.Format("delete from e_user_room as t where [t].[user_id] = '{0}'", value.Guid);
                parameters.Clear();
                result = hibernate.Write(Variable.Link, sql, parameters);
            }

            if (result)
            {
                sql = string.Format("delete from m_user as t where [t].[guid] = '{0}'", value.Guid);
                parameters.Clear();
                result = hibernate.Write(Variable.Link, sql, parameters);
            }

            return result;
        }
コード例 #5
0
        public bool Insert(MessageCache value)
        {
            bool result = false;

            DatabaseHibernate hibernate = new DatabaseHibernate();

            if (value != null)
            {
                string sql = string.Empty;
                List<Parameter> parameters = new List<Parameter>();

                DateTime refreshTime = DateTime.Now;
                refreshTime = refreshTime.AddDays(-100);

                sql = string.Format("delete from e_message_cache where [refresh_time] < #{0}#", refreshTime.ToString("yyyy-MM-dd HH:mm:ss"));
                parameters.Clear();
                result = hibernate.Write(Variable.Link, sql, parameters);

                if (result)
                {
                    sql = string.Format("insert into e_message_cache ({0}) values (:guid, :insert_user_id, :insert_time, :update_user_id, :update_time, :remark, :validity, :ip, :machine, :code, :result, :send_time, :refresh_time)", this.Asterisk(""));
                    parameters.Clear();

                    parameters.Add(new Parameter("guid", DatabaseHibernate.Parameter(DatabaseHibernate.GUID())));
                    parameters.Add(new Parameter("insert_user_id", DatabaseHibernate.Parameter(value.InsertUserId)));
                    parameters.Add(new Parameter("insert_time", DatabaseHibernate.Parameter(value.InsertTime)));
                    parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
                    parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
                    parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
                    parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));

                    parameters.Add(new Parameter("ip", DatabaseHibernate.Parameter(value.Ip)));
                    parameters.Add(new Parameter("machine_id", DatabaseHibernate.Parameter(value.MachineId)));
                    parameters.Add(new Parameter("code", DatabaseHibernate.Parameter(value.Code)));
                    parameters.Add(new Parameter("result", DatabaseHibernate.Parameter(value.Result)));
                    parameters.Add(new Parameter("send_time", DatabaseHibernate.Parameter(value.SendTime)));
                    parameters.Add(new Parameter("refresh_time", DatabaseHibernate.Parameter(value.RefreshTime)));

                    result = hibernate.Write(Variable.Link, sql, parameters);
                }
            }

            return result;
        }
コード例 #6
0
        public bool Delete(DetectorType value)
        {
            bool result = false;

            DatabaseHibernate hibernate = new DatabaseHibernate();

            string sql = string.Format("delete from e_detector as t where [t].[detector_type_id] = '{0}'", value.Guid);
            List<Parameter> parameters = new List<Parameter>();

            result = hibernate.Write(Variable.Link, sql, parameters);

            if (result)
            {
                sql = string.Format("delete from e_detector_type as t where [t].[guid] = '{0}'", value.Guid);
                parameters.Clear();
                result = hibernate.Write(Variable.Link, sql, parameters);
            }

            return result;
        }
コード例 #7
0
        public bool DeleteByUser(string userGuid)
        {
            bool result = false;

            string sql = string.Format("delete from e_user_room as t where [t].[user_id] = '{0}'", userGuid);
            List<Parameter> parameters = new List<Parameter>();

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #8
0
        public bool ChangePassword(string guid, string password)
        {
            bool result = false;

            string sql = string.Format("update m_user as t set [t].[update_user_id] = :update_user_id, [t].[update_time] = :update_time, [t].[password] = :password where [t].[guid] = '{0}'", guid);
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(guid)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(DateTime.Now)));

            parameters.Add(new Parameter("password", DatabaseHibernate.Parameter(password)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #9
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>结果</returns>
        public bool Insert(UserRoom value)
        {
            bool result = false;

            string sql = string.Format("insert into e_user_room ({0}) values (:guid, :insert_user_id, :insert_time, :update_user_id, :update_time, :remark, :validity, :user_id, :room_id)", this.Asterisk(""));
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("guid", DatabaseHibernate.Parameter(DatabaseHibernate.GUID())));
            parameters.Add(new Parameter("insert_user_id", DatabaseHibernate.Parameter(value.InsertUserId)));
            parameters.Add(new Parameter("insert_time", DatabaseHibernate.Parameter(value.InsertTime)));
            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));
            parameters.Add(new Parameter("user_id", DatabaseHibernate.Parameter(value.UserId)));
            parameters.Add(new Parameter("room_id", DatabaseHibernate.Parameter(value.RoomId)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #10
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>结果</returns>
        public bool Update(User value)
        {
            bool result = false;

            string sql = string.Format("update m_user as t set [t].[update_user_id] = :update_user_id, [t].[update_time] = :update_time, [t].[remark] = :remark, [t].[validity] = :validity, [t].[name] = :name, [t].[account] = :account, [t].[password] = :password, [t].[prerogative] = :prerogative where [t].[guid] = '{0}'", value.Guid);
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));

            parameters.Add(new Parameter("name", DatabaseHibernate.Parameter(value.Name)));
            parameters.Add(new Parameter("account", DatabaseHibernate.Parameter(value.Account.ToUpper())));
            parameters.Add(new Parameter("password", DatabaseHibernate.Parameter(value.Password)));
            parameters.Add(new Parameter("prerogative", DatabaseHibernate.Parameter(value.Prerogative)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #11
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>结果</returns>
        public bool Insert(User value)
        {
            bool result = false;

            string sql = string.Format("insert into m_user ({0}) values (:guid, :insert_user_id, :insert_time, :update_user_id, :update_time, :remark, :validity, :name, :account, :password, :prerogative)", this.Asterisk(""));
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("guid", DatabaseHibernate.Parameter(DatabaseHibernate.GUID())));
            parameters.Add(new Parameter("insert_user_id", DatabaseHibernate.Parameter(value.InsertUserId)));
            parameters.Add(new Parameter("insert_time", DatabaseHibernate.Parameter(value.InsertTime)));
            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));
            parameters.Add(new Parameter("name", DatabaseHibernate.Parameter(value.Name)));
            parameters.Add(new Parameter("account", DatabaseHibernate.Parameter(value.Account.ToUpper())));
            parameters.Add(new Parameter("password", DatabaseHibernate.Parameter(value.Password)));
            parameters.Add(new Parameter("prerogative", DatabaseHibernate.Parameter(value.Prerogative)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #12
0
        public bool UpdatePosition(List<Detector> detectors)
        {
            bool result = false;

            DatabaseHibernate hibernate = new DatabaseHibernate();

            for (int i = 0; i < detectors.Count; i++)
            {
                string sql = string.Format("update e_detector as t set [t].[update_user_id] = :update_user_id, [t].[update_time] = :update_time, [t].[position_x] = :position_x, [t].[position_y] = :position_y where [t].[guid] = '{0}'", detectors[i].Guid);
                List<Parameter> parameters = new List<Parameter>();

                parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(detectors[i].UpdateUserId)));
                parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(detectors[i].UpdateTime)));

                parameters.Add(new Parameter("machine_id", DatabaseHibernate.Parameter(detectors[i].PositionX)));
                parameters.Add(new Parameter("machine_id", DatabaseHibernate.Parameter(detectors[i].PositionY)));

                result = hibernate.Write(Variable.Link, sql, parameters);

                if (!result)
                {
                    break;
                }
            }

            return result;
        }
コード例 #13
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>结果</returns>
        public bool Insert(Machine value)
        {
            bool result = false;

            string sql = string.Format("insert into e_machine ({0}) values (:guid, :insert_user_id, :insert_time, :update_user_id, :update_time, :remark, :validity, :room_id, :name, :ip, :netmask, :gateway, :mac, :mobile_a, :mobile_b, :mobile_c, :alarm, :interval, :mobile)", this.Asterisk(""));
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("guid", DatabaseHibernate.Parameter(DatabaseHibernate.GUID())));
            parameters.Add(new Parameter("insert_user_id", DatabaseHibernate.Parameter(value.InsertUserId)));
            parameters.Add(new Parameter("insert_time", DatabaseHibernate.Parameter(value.InsertTime)));
            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));

            parameters.Add(new Parameter("room_id", DatabaseHibernate.Parameter(value.RoomId)));
            parameters.Add(new Parameter("name", DatabaseHibernate.Parameter(value.Name)));
            parameters.Add(new Parameter("ip", DatabaseHibernate.Parameter(value.Ip)));
            parameters.Add(new Parameter("netmask", DatabaseHibernate.Parameter(value.Netmask)));
            parameters.Add(new Parameter("gateway", DatabaseHibernate.Parameter(value.Gateway)));
            parameters.Add(new Parameter("mac", DatabaseHibernate.Parameter(value.Mac)));
            parameters.Add(new Parameter("mobile_a", DatabaseHibernate.Parameter(value.MobileA)));
            parameters.Add(new Parameter("mobile_b", DatabaseHibernate.Parameter(value.MobileB)));
            parameters.Add(new Parameter("mobile_c", DatabaseHibernate.Parameter(value.MobileC)));
            parameters.Add(new Parameter("alarm", DatabaseHibernate.Parameter(value.Alarm)));
            parameters.Add(new Parameter("interval", DatabaseHibernate.Parameter(value.Interval)));
            parameters.Add(new Parameter("mobile", DatabaseHibernate.Parameter(value.Mobile)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #14
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>结果</returns>
        public bool Insert(DetectorType value)
        {
            bool result = false;

            string sql = string.Format("insert into e_detector_type ({0}) values (:guid, :insert_user_id, :insert_time, :update_user_id, :update_time, :remark, :validity, :name, :type, :code, :description_a, :description_b, :unit_a, :unit_b)", this.Asterisk(""));
            List<Parameter> parameters = new List<Parameter>();

            if (string.IsNullOrEmpty(value.Guid))
            {
                value.Guid = DatabaseHibernate.GUID();
            }

            parameters.Add(new Parameter("guid", DatabaseHibernate.Parameter(value.Guid)));
            parameters.Add(new Parameter("insert_user_id", DatabaseHibernate.Parameter(value.InsertUserId)));
            parameters.Add(new Parameter("insert_time", DatabaseHibernate.Parameter(value.InsertTime)));
            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));

            parameters.Add(new Parameter("name", DatabaseHibernate.Parameter(value.Name)));
            parameters.Add(new Parameter("type", DatabaseHibernate.Parameter((int)value.Type)));
            parameters.Add(new Parameter("code", DatabaseHibernate.Parameter(value.Code)));
            parameters.Add(new Parameter("description_a", DatabaseHibernate.Parameter(value.DescriptionA)));
            parameters.Add(new Parameter("description_b", DatabaseHibernate.Parameter(value.DescriptionB)));
            parameters.Add(new Parameter("unit_a", DatabaseHibernate.Parameter(value.UnitA)));
            parameters.Add(new Parameter("unit_b", DatabaseHibernate.Parameter(value.UnitB)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #15
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>结果</returns>
        public bool Update(DetectorType value)
        {
            bool result = false;

            string sql = string.Format("update e_detector_type as t set [t].[update_user_id] = :update_user_id, [t].[update_time] = :update_time, [t].[remark] = :remark, [t].[validity] = :validity, [t].[name] = :name, [t].[type] = :type, [t].[code] = :code, [t].[description_a] = :description_a, [t].[description_b] = :description_b, [t].[unit_a] = :unit_a, [t].[unit_b] = :unit_b where [t].[guid] = '{0}'", value.Guid);
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));

            parameters.Add(new Parameter("name", DatabaseHibernate.Parameter(value.Name)));
            parameters.Add(new Parameter("type", DatabaseHibernate.Parameter((int)value.Type)));
            parameters.Add(new Parameter("code", DatabaseHibernate.Parameter(value.Code)));
            parameters.Add(new Parameter("description_a", DatabaseHibernate.Parameter(value.DescriptionA)));
            parameters.Add(new Parameter("description_b", DatabaseHibernate.Parameter(value.DescriptionB)));
            parameters.Add(new Parameter("unit_a", DatabaseHibernate.Parameter(value.UnitA)));
            parameters.Add(new Parameter("unit_b", DatabaseHibernate.Parameter(value.UnitB)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #16
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>结果</returns>
        public bool Update(Room value)
        {
            bool result = false;

            string sql = string.Format("update e_room as t set [t].[update_user_id] = :update_user_id, [t].[update_time] = :update_time, [t].[remark] = :remark, [t].[validity] = :validity, [t].[name] = :name, [t].[address] = :address, [t].[contact] = :contact, [t].[phone] = :phone where [t].[guid] = '{0}'", value.Guid);
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));

            parameters.Add(new Parameter("name", DatabaseHibernate.Parameter(value.Name)));
            parameters.Add(new Parameter("address", DatabaseHibernate.Parameter(value.Address)));
            parameters.Add(new Parameter("contact", DatabaseHibernate.Parameter(value.Contact)));
            parameters.Add(new Parameter("phone", DatabaseHibernate.Parameter(value.Phone)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #17
0
        public bool Update(Detector value)
        {
            bool result = false;

            string sql = string.Format("update e_detector as t set [t].[update_user_id] = :update_user_id, [t].[update_time] = :update_time, [t].[remark] = :remark, [t].[validity] = :validity, [t].[machine_id] = :machine_id, [t].[detector_type_id] = :detector_type_id, [t].[serial] = :serial, [t].[minimum_a] = :minimum_a, [t].[maximum_a] = :maximum_a, [t].[minimum_b] = :minimum_b, [t].[maximum_b] = :maximum_b where [t].[guid] = '{0}'", value.Guid);
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));

            parameters.Add(new Parameter("machine_id", DatabaseHibernate.Parameter(value.MachineId)));
            parameters.Add(new Parameter("detector_type_id", DatabaseHibernate.Parameter(value.DetectorTypeId)));
            parameters.Add(new Parameter("serial", DatabaseHibernate.Parameter(value.Serial)));
            parameters.Add(new Parameter("minimum_a", DatabaseHibernate.Parameter(value.MinimumA)));
            parameters.Add(new Parameter("maximum_a", DatabaseHibernate.Parameter(value.MaximumA)));
            parameters.Add(new Parameter("minimum_b", DatabaseHibernate.Parameter(value.MinimumB)));
            parameters.Add(new Parameter("maximum_b", DatabaseHibernate.Parameter(value.MaximumB)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }
コード例 #18
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>结果</returns>
        public bool Update(Machine value)
        {
            bool result = false;

            string sql = string.Format("update e_machine as t set [t].[update_user_id] = :update_user_id, [t].[update_time] = :update_time, [t].[remark] = :remark, [t].[validity] = :validity, [t].[room_id] = :room_id, [t].[name] = :name, [t].[ip] = :ip, [t].[netmask] = :netmask, [t].[gateway] = :gateway, [t].[mac] = :mac, [t].[mobile_a] = :mobile_a, [t].[mobile_b] = :mobile_b, [t].[mobile_c] = :mobile_c, [t].[alarm] = :alarm, [t].[interval] = :interval, [t].[mobile] = :mobile where [t].[guid] = '{0}'", value.Guid);
            List<Parameter> parameters = new List<Parameter>();

            parameters.Add(new Parameter("update_user_id", DatabaseHibernate.Parameter(value.UpdateUserId)));
            parameters.Add(new Parameter("update_time", DatabaseHibernate.Parameter(value.UpdateTime)));
            parameters.Add(new Parameter("remark", DatabaseHibernate.Parameter(value.Remark)));
            parameters.Add(new Parameter("validity", DatabaseHibernate.Parameter(value.Validity)));

            parameters.Add(new Parameter("room_id", DatabaseHibernate.Parameter(value.RoomId)));
            parameters.Add(new Parameter("name", DatabaseHibernate.Parameter(value.Name)));
            parameters.Add(new Parameter("ip", DatabaseHibernate.Parameter(value.Ip)));
            parameters.Add(new Parameter("netmask", DatabaseHibernate.Parameter(value.Netmask)));
            parameters.Add(new Parameter("gateway", DatabaseHibernate.Parameter(value.Gateway)));
            parameters.Add(new Parameter("mac", DatabaseHibernate.Parameter(value.Mac)));
            parameters.Add(new Parameter("mobile_a", DatabaseHibernate.Parameter(value.MobileA)));
            parameters.Add(new Parameter("mobile_b", DatabaseHibernate.Parameter(value.MobileB)));
            parameters.Add(new Parameter("mobile_c", DatabaseHibernate.Parameter(value.MobileC)));
            parameters.Add(new Parameter("alarm", DatabaseHibernate.Parameter(value.Alarm)));
            parameters.Add(new Parameter("interval", DatabaseHibernate.Parameter(value.Interval)));
            parameters.Add(new Parameter("mobile", DatabaseHibernate.Parameter(value.Mobile)));

            DatabaseHibernate hibernate = new DatabaseHibernate();

            result = hibernate.Write(Variable.Link, sql, parameters);

            return result;
        }