Пример #1
0
        /// <summary>
        /// Method to gets lsc project
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="connectionString">connectionString</param>
        /// <returns>project object</returns>
        public List <ProjectInfo> GetProjectItem(int lscId, string lscName, string connectionString)
        {
            var projects = new List <ProjectInfo>();

            SqlHelper.TestConnection(connectionString);
            using (var rdr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, SqlText.Sql_Appointment_Get_ProjectItem, null)) {
                while (rdr.Read())
                {
                    var project = new ProjectInfo();
                    project.LscID        = lscId;
                    project.LscName      = lscName;
                    project.ProjectId    = ComUtility.DBNullStringHandler(rdr["ProjectId"]);
                    project.ProjectName  = ComUtility.DBNullStringHandler(rdr["ProjectName"]);
                    project.BeginTime    = ComUtility.DBNullDateTimeHandler(rdr["BeginTime"]);
                    project.EndTime      = ComUtility.DBNullDateTimeHandler(rdr["EndTime"]);
                    project.Responsible  = ComUtility.DBNullStringHandler(rdr["Responsible"]);
                    project.ContactPhone = ComUtility.DBNullStringHandler(rdr["ContactPhone"]);
                    project.Company      = ComUtility.DBNullStringHandler(rdr["Company"]);
                    project.Comment      = ComUtility.DBNullStringHandler(rdr["Comment"]);
                    project.Enabled      = ComUtility.DBNullBooleanHandler(rdr["Enabled"]);
                    projects.Add(project);
                }
            }
            return(projects);
        }
Пример #2
0
        /// <summary>
        /// Method to get user defind groups
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="userId">userId</param>
        public List <UDGroupInfo> GetUDGroups(int lscId, int userId)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID",  SqlDbType.Int),
                                         new SqlParameter("@UserID", SqlDbType.Int) };
                parms[0].Value = lscId;
                parms[1].Value = userId;

                var groups = new List <UDGroupInfo>();
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_GROUP_GETUDGROUPS, parms)) {
                    while (rdr.Read())
                    {
                        var group = new UDGroupInfo();
                        group.LscID        = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                        group.UserID       = ComUtility.DBNullInt32Handler(rdr["UserID"]);
                        group.UDGroupID    = ComUtility.DBNullInt32Handler(rdr["UDGroupID"]);
                        group.UDGroupName  = ComUtility.DBNullStringHandler(rdr["UDGroupName"]);
                        group.UDGroupNodes = null;
                        group.Enabled      = ComUtility.DBNullBooleanHandler(rdr["Enabled"]);
                        groups.Add(group);
                    }
                }
                return(groups);
            } catch { throw; }
        }
Пример #3
0
        /// <summary>
        /// Method to gets lsc project
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="connectionString">connectionString</param>
        /// <returns>project object</returns>
        public ProjectInfo GetProject(int lscId, string lscName, string projectId, string connectionString)
        {
            SqlParameter[] parms = { new SqlParameter("@ProjectId", SqlDbType.VarChar, 50) };
            parms[0].Value = projectId;

            ProjectInfo project = null;

            SqlHelper.TestConnection(connectionString);
            using (var rdr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, SqlText.Sql_Appointment_Get_Project, parms)) {
                if (rdr.Read())
                {
                    project              = new ProjectInfo();
                    project.LscID        = lscId;
                    project.LscName      = lscName;
                    project.ProjectId    = ComUtility.DBNullStringHandler(rdr["ProjectId"]);
                    project.ProjectName  = ComUtility.DBNullStringHandler(rdr["ProjectName"]);
                    project.BeginTime    = ComUtility.DBNullDateTimeHandler(rdr["BeginTime"]);
                    project.EndTime      = ComUtility.DBNullDateTimeHandler(rdr["EndTime"]);
                    project.Responsible  = ComUtility.DBNullStringHandler(rdr["Responsible"]);
                    project.ContactPhone = ComUtility.DBNullStringHandler(rdr["ContactPhone"]);
                    project.Company      = ComUtility.DBNullStringHandler(rdr["Company"]);
                    project.Comment      = ComUtility.DBNullStringHandler(rdr["Comment"]);
                    project.Enabled      = ComUtility.DBNullBooleanHandler(rdr["Enabled"]);
                }
            }
            return(project);
        }
Пример #4
0
        /// <summary>
        /// Method to get nodes combobox information
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="devId">devId</param>
        /// <param name="AI">AI</param>
        /// <param name="AO">AO</param>
        /// <param name="DI">DI</param>
        /// <param name="DO">DO</param>
        public Dictionary <string, string> GetNodes(int lscId, int devId, bool AI, bool AO, bool DI, bool DO)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID", SqlDbType.Int),
                                         new SqlParameter("@DevID", SqlDbType.Int),
                                         new SqlParameter("@AI",    SqlDbType.Bit),
                                         new SqlParameter("@AO",    SqlDbType.Bit),
                                         new SqlParameter("@DI",    SqlDbType.Bit),
                                         new SqlParameter("@DO",    SqlDbType.Bit) };
                parms[0].Value = lscId;
                parms[1].Value = devId;
                parms[2].Value = AI;
                parms[3].Value = AO;
                parms[4].Value = DI;
                parms[5].Value = DO;

                var dict = new Dictionary <string, string>();
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_COMBOBOX_GETNODES, parms)) {
                    while (rdr.Read())
                    {
                        var id   = ComUtility.DBNullInt32Handler(rdr["NodeID"]);
                        var name = ComUtility.DBNullStringHandler(rdr["NodeName"]);
                        dict.Add(id.ToString(), name);
                    }
                }
                return(dict);
            } catch { throw; }
        }
Пример #5
0
        /// <summary>
        /// Gets an appointment
        /// </summary>
        /// <param name="lscId"></param>
        /// <param name="lscName"></param>
        /// <param name="id"></param>
        /// <param name="connectionString"></param>
        /// <returns></returns>
        public AppointmentInfo GetAppointment(int lscId, string lscName, int id, string connectionString)
        {
            SqlParameter[]  parms       = { new SqlParameter("@Id", id) };
            AppointmentInfo appointment = null;

            SqlHelper.TestConnection(connectionString);
            using (var rdr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, SqlText.Sql_Appointment_Get, parms)) {
                if (rdr.Read())
                {
                    appointment              = new AppointmentInfo();
                    appointment.LscID        = lscId;
                    appointment.LscName      = lscName;
                    appointment.Id           = ComUtility.DBNullInt32Handler(rdr["Id"]);
                    appointment.StartTime    = ComUtility.DBNullDateTimeHandler(rdr["StartTime"]);
                    appointment.EndTime      = ComUtility.DBNullDateTimeHandler(rdr["EndTime"]);
                    appointment.LscIncluded  = ComUtility.DBNullInt32Handler(rdr["LscIncluded"]);
                    appointment.StaIncluded  = ComUtility.DBNullStringHandler(rdr["StaIncluded"]);
                    appointment.DevIncluded  = ComUtility.DBNullStringHandler(rdr["DevIncluded"]);
                    appointment.ProjectId    = ComUtility.DBNullStringHandler(rdr["ProjectId"]);
                    appointment.ProjectName  = ComUtility.DBNullStringHandler(rdr["ProjectName"]);
                    appointment.Status       = ComUtility.DBNullProjStatusHandler(rdr["Status"]);
                    appointment.CreaterId    = ComUtility.DBNullInt32Handler(rdr["CreaterId"]);
                    appointment.Creater      = ComUtility.DBNullStringHandler(rdr["Creater"]);
                    appointment.ContactPhone = ComUtility.DBNullStringHandler(rdr["ContactPhone"]);
                    appointment.CreatedTime  = ComUtility.DBNullDateTimeHandler(rdr["CreatedTime"]);
                }
            }
            return(appointment);
        }
Пример #6
0
        /// <summary>
        /// Method to get alarm logics combobox information
        /// </summary>
        /// <param name="alarmDevId">alarmDevId</param>
        public Dictionary <string, string> GetAlarmLogics(int alarmDevId)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@AlarmDeviceTypeID", SqlDbType.Int) };
                if (alarmDevId == ComUtility.DefaultInt32)
                {
                    parms[0].Value = DBNull.Value;
                }
                else
                {
                    parms[0].Value = alarmDevId;
                }

                var dict = new Dictionary <string, string>();
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_COMBOBOX_GETALARMLOGICS, parms)) {
                    while (rdr.Read())
                    {
                        var id   = ComUtility.DBNullInt32Handler(rdr["TypeID"]);
                        var name = ComUtility.DBNullStringHandler(rdr["TypeName"]);
                        dict.Add(id.ToString(), name);
                    }
                }
                return(dict);
            } catch { throw; }
        }
Пример #7
0
        public List <StandardProtocolInfo> GetStandardProtocol()
        {
            var Protocols = new List <StandardProtocolInfo>();

            using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_ALARM_GETALARMDETAILS, null)) {
                while (rdr.Read())
                {
                    var p = new StandardProtocolInfo();
                    p.AlarmID           = ComUtility.DBNullInt32Handler(rdr["AlarmID"]);
                    p.AlarmName         = ComUtility.DBNullStringHandler(rdr["AlarmName"]);
                    p.AlarmInterpret    = ComUtility.DBNullStringHandler(rdr["AlarmInterpret"]);
                    p.AlarmVer          = ComUtility.DBNullInt32Handler(rdr["AlarmVer"]);
                    p.AlarmLevel        = ComUtility.DBNullAlarmLevelHandler(rdr["AlarmLevel"]);
                    p.DevEffect         = ComUtility.DBNullStringHandler(rdr["DevEffect"]);
                    p.OperEffect        = ComUtility.DBNullStringHandler(rdr["OperEffect"]);
                    p.SubAlarmLogTypeID = ComUtility.DBNullInt32Handler(rdr["SubAlarmLogTypeID"]);
                    p.SubAlarmLogType   = ComUtility.DBNullStringHandler(rdr["SubAlarmLogType"]);
                    p.AlarmLogTypeID    = ComUtility.DBNullInt32Handler(rdr["AlarmLogTypeID"]);
                    p.AlarmLogType      = ComUtility.DBNullStringHandler(rdr["AlarmLogType"]);
                    p.AlarmDeviceTypeID = ComUtility.DBNullInt32Handler(rdr["AlarmDeviceTypeID"]);
                    p.AlarmDeviceType   = ComUtility.DBNullStringHandler(rdr["AlarmDeviceType"]);
                    p.NMAlarmID         = ComUtility.DBNullStringHandler(rdr["NMAlarmID"]);
                    p.AlarmClass        = ComUtility.DBNullStringHandler(rdr["AlarmClass"]);
                    Protocols.Add(p);
                }
            }
            return(Protocols);
        }
Пример #8
0
        /// <summary>
        /// Method to get area2 combobox information
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="area1Id">area1Id</param>
        /// <param name="groupId">groupId</param>
        public Dictionary <string, string> GetArea2(int lscId, int area1Id, int groupId)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID",    SqlDbType.Int),
                                         new SqlParameter("@AreaID",   SqlDbType.Int),
                                         new SqlParameter("@GroupID",  SqlDbType.Int),
                                         new SqlParameter("@AreaType", SqlDbType.Int) };

                parms[0].Value = lscId;
                if (area1Id == ComUtility.DefaultInt32)
                {
                    parms[1].Value = DBNull.Value;
                }
                else
                {
                    parms[1].Value = area1Id;
                }
                parms[2].Value = groupId;
                parms[3].Value = (int)EnmNodeType.Area;

                var dict = new Dictionary <string, string>();
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_COMBOBOX_GETAREA2, parms)) {
                    while (rdr.Read())
                    {
                        var id   = ComUtility.DBNullInt32Handler(rdr["AreaID"]);
                        var name = ComUtility.DBNullStringHandler(rdr["AreaName"]);
                        dict.Add(id.ToString(), name);
                    }
                }
                return(dict);
            } catch { throw; }
        }
Пример #9
0
        /// <summary>
        /// Get Device Type
        /// </summary>
        public Dictionary <String, Int32> GetDevType(int lscId, int nodeId)
        {
            SqlParameter[] parms = { new SqlParameter("@LscID", SqlDbType.Int),
                                     new SqlParameter("@DevID", SqlDbType.Int) };

            parms[0].Value = lscId;
            if (nodeId == ComUtility.DefaultInt32)
            {
                parms[1].Value = DBNull.Value;
            }
            else
            {
                parms[1].Value = ComUtility.GetDevID(nodeId);
            }

            var dict = new Dictionary <String, Int32>();

            using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_PREALARM_GETDEVTYPE, parms)) {
                while (rdr.Read())
                {
                    var key   = String.Format("{0}-{1}", ComUtility.DBNullInt32Handler(rdr["LscID"]), ComUtility.DBNullInt32Handler(rdr["DevID"]));
                    var value = ComUtility.DBNullInt32Handler(rdr["DevTypeID"]);
                    dict.Add(key, value);
                }
            }
            return(dict);
        }
Пример #10
0
        /// <summary>
        /// Gets users from the lsc database
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="lscName">lscName</param>
        /// <param name="userId">userId</param>
        /// <param name="connectionString">connectionString</param>
        /// <returns></returns>
        public List <LscUserInfo> GetUsers(int lscId, string lscName, int?userId, string connectionString)
        {
            SqlParameter[] parms = { new SqlParameter("@UserId", SqlDbType.Int) };
            parms[0].Value = DBNull.Value;
            if (userId.HasValue)
            {
                parms[0].Value = userId.Value;
            }

            var lscUsers = new List <LscUserInfo>();

            SqlHelper.TestConnection(connectionString);
            using (var rdr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, SqlText.Sql_Lsc_Get_Users, parms)) {
                while (rdr.Read())
                {
                    var lscUser = new LscUserInfo();
                    lscUser.LscID       = lscId;
                    lscUser.LscName     = lscName;
                    lscUser.UserID      = ComUtility.DBNullInt32Handler(rdr["UserID"]);
                    lscUser.UserName    = ComUtility.DBNullStringHandler(rdr["UserName"]);
                    lscUser.UID         = ComUtility.DBNullStringHandler(rdr["UID"]);
                    lscUser.OpLevel     = ComUtility.DBNullUserLevelHandler(rdr["OpLevel"]);
                    lscUser.LimitTime   = ComUtility.DBNullDateTimeHandler(rdr["LimitTime"]);
                    lscUser.TelePhone   = ComUtility.DBNullStringHandler(rdr["TelePhone"]);
                    lscUser.MobilePhone = ComUtility.DBNullStringHandler(rdr["MobilePhone"]);
                    lscUser.Email       = ComUtility.DBNullStringHandler(rdr["Email"]);
                    lscUser.Address     = ComUtility.DBNullStringHandler(rdr["Address"]);
                    lscUser.PostalCode  = ComUtility.DBNullStringHandler(rdr["PostalCode"]);
                    lscUser.Remark      = ComUtility.DBNullStringHandler(rdr["Remark"]);
                    lscUser.Enabled     = ComUtility.DBNullBooleanHandler(rdr["Enabled"]);
                    lscUsers.Add(lscUser);
                }
            }
            return(lscUsers);
        }
Пример #11
0
        /// <summary>
        /// Method to get system parameters
        /// </summary>
        /// <param name="paraCode">paraCode</param>
        public List <SysParamInfo> GetSysParams(int paraCode)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@ParaCode", SqlDbType.Int) };
                if (paraCode == ComUtility.DefaultInt32)
                {
                    parms[0].Value = DBNull.Value;
                }
                else
                {
                    parms[0].Value = paraCode;
                }

                var sysParms = new List <SysParamInfo>();
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_USER_GETSYSPARAMS, parms)) {
                    while (rdr.Read())
                    {
                        var parm = new SysParamInfo();
                        parm.ID          = ComUtility.DBNullInt32Handler(rdr["ID"]);
                        parm.ParaCode    = ComUtility.DBNullInt32Handler(rdr["ParaCode"]);
                        parm.ParaData    = ComUtility.DBNullInt32Handler(rdr["ParaData"]);
                        parm.ParaDisplay = ComUtility.DBNullStringHandler(rdr["ParaDisplay"]);
                        parm.Note        = ComUtility.DBNullStringHandler(rdr["Note"]);
                        sysParms.Add(parm);
                    }
                }
                return(sysParms);
            } catch { throw; }
        }
Пример #12
0
        /// <summary>
        /// Method to get group tree nodes
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="groupId">groupId</param>
        public List <GroupTreeInfo> GetGroupTreeNodes(int lscId, int groupId)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID",    SqlDbType.Int),
                                         new SqlParameter("@GroupID",  SqlDbType.Int),
                                         new SqlParameter("@AreaType", SqlDbType.Int),
                                         new SqlParameter("@StaType",  SqlDbType.Int),
                                         new SqlParameter("@DevType",  SqlDbType.Int) };
                parms[0].Value = lscId;
                parms[1].Value = groupId;
                parms[2].Value = (int)EnmNodeType.Area;
                parms[3].Value = (int)EnmNodeType.Sta;
                parms[4].Value = (int)EnmNodeType.Dev;

                var gNodes = new List <GroupTreeInfo>();
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_GROUP_GETGROUPTREENODES, parms)) {
                    while (rdr.Read())
                    {
                        var gNode = new GroupTreeInfo();
                        gNode.LscID      = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                        gNode.NodeID     = ComUtility.DBNullInt32Handler(rdr["NodeID"]);
                        gNode.NodeType   = ComUtility.DBNullNodeTypeHandler(rdr["NodeType"]);
                        gNode.NodeName   = ComUtility.DBNullStringHandler(rdr["NodeName"]);
                        gNode.GroupID    = ComUtility.DBNullInt32Handler(rdr["GroupID"]);
                        gNode.LastNodeID = ComUtility.DBNullInt32Handler(rdr["LastNodeID"]);
                        gNode.TreeIndex  = ComUtility.DBNullInt32Handler(rdr["TreeIndex"]);
                        gNode.Status     = EnmAlarmLevel.NoAlarm;
                        gNode.Remark     = ComUtility.DBNullStringHandler(rdr["Remark"]);
                        gNodes.Add(gNode);
                    }
                }
                return(gNodes);
            } catch { throw; }
        }
Пример #13
0
        /// <summary>
        /// Method to get calendar events
        /// </summary>
        /// <param name="uId">uId</param>
        public List <CalendarEventInfo> GetCalendarEvents(string uId)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@UID", SqlDbType.VarChar, 50) };
                parms[0].Value = uId;

                var calEvents = new List <CalendarEventInfo>();
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_CALENDAR_GETCALENDAREVENTS, parms)) {
                    while (rdr.Read())
                    {
                        var calEvent = new CalendarEventInfo();
                        calEvent.EventID    = ComUtility.DBNullInt32Handler(rdr["EventID"]);
                        calEvent.CalendarID = ComUtility.DBNullInt32Handler(rdr["CalendarID"]);
                        calEvent.Title      = ComUtility.DBNullStringHandler(rdr["Title"]);
                        calEvent.StartDate  = ComUtility.DBNullDateTimeHandler(rdr["StartDate"]);
                        calEvent.EndDate    = ComUtility.DBNullDateTimeHandler(rdr["EndDate"]);
                        calEvent.IsAllDay   = ComUtility.DBNullNullableBooleanHandler(rdr["IsAllDay"]);
                        calEvent.Notes      = ComUtility.DBNullStringHandler(rdr["Notes"]);
                        calEvent.Location   = ComUtility.DBNullStringHandler(rdr["Location"]);
                        calEvent.Reminder   = ComUtility.DBNullStringHandler(rdr["Reminder"]);
                        calEvent.Url        = ComUtility.DBNullStringHandler(rdr["Url"]);
                        calEvent.IsNew      = ComUtility.DBNullNullableBooleanHandler(rdr["IsNew"]);
                        calEvent.UID        = ComUtility.DBNullStringHandler(rdr["UID"]);
                        calEvent.UpdateTime = ComUtility.DBNullDateTimeHandler(rdr["UpdateTime"]);
                        calEvents.Add(calEvent);
                    }
                }
                return(calEvents);
            } catch { throw; }
        }
Пример #14
0
        /// <summary>
        /// Method to get frequency alarms
        /// </summary>
        public List <FrequencyAlarmInfo> GetFrequencyAlarms()
        {
            var alarms  = new List <FrequencyAlarmInfo>();
            var sqlText = String.Format(@"
            ;WITH Nodes AS
            (
	            SELECT TA.[LscID],TA.[AicID] AS [NodeID],{0} AS [NodeType],TA.[DevID] FROM [dbo].[TM_AIC] TA
	            UNION ALL
	            SELECT TD.[LscID],TD.[DicID] AS [NodeID],{1} AS [NodeType],TD.[DevID] FROM [dbo].[TM_DIC] TD
            ),
            Alarms AS
            (
                SELECT TF.*,N.[DevID],L.[LscName],DT.[TypeID] AS [DevTypeID],DT.[TypeName] AS [DevTypeName]
                FROM [dbo].[TA_FrequencyAlarm] TF
                INNER JOIN Nodes N ON TF.[LscID] = N.[LscID] AND TF.[NodeType] = N.[NodeType] AND TF.[NodeID] = N.[NodeID]
                INNER JOIN [dbo].[TM_DEV] TD ON N.[LscID] = TD.[LscID] AND N.[DevID] = TD.[DevID]
                INNER JOIN [dbo].[TM_LSC] L ON TD.[LscID] = L.[LscID]
                LEFT OUTER JOIN [dbo].[TC_DeviceType] DT ON TD.[DevTypeID] = DT.[TypeID]
            )
            SELECT [LscID],[LscName],[Area1Name],[Area2Name],[Area3Name],[StaName],[DevID],[DevName],[NodeID],
            [NodeType],[NodeName],[DevTypeID],[DevTypeName],[AlarmLevel],[FreAlarmValue],[FreRightValue],
            [StartTime],[AlarmTime],[ConfirmName],[ConfirmTime],[EndName],[EndTime] FROM Alarms;", (Int32)EnmNodeType.Aic, (Int32)EnmNodeType.Dic);

            using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sqlText, null)) {
                while (rdr.Read())
                {
                    var alarm = new FrequencyAlarmInfo();
                    alarm.LscID         = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                    alarm.LscName       = ComUtility.DBNullStringHandler(rdr["LscName"]);
                    alarm.Area1Name     = ComUtility.DBNullStringHandler(rdr["Area1Name"]);
                    alarm.Area2Name     = ComUtility.DBNullStringHandler(rdr["Area2Name"]);
                    alarm.Area3Name     = ComUtility.DBNullStringHandler(rdr["Area3Name"]);
                    alarm.StaName       = ComUtility.DBNullStringHandler(rdr["StaName"]);
                    alarm.DevID         = ComUtility.DBNullInt32Handler(rdr["DevID"]);
                    alarm.DevName       = ComUtility.DBNullStringHandler(rdr["DevName"]);
                    alarm.NodeID        = ComUtility.DBNullInt32Handler(rdr["NodeID"]);
                    alarm.NodeType      = ComUtility.DBNullNodeTypeHandler(rdr["NodeType"]);
                    alarm.NodeName      = ComUtility.DBNullStringHandler(rdr["NodeName"]);
                    alarm.DevTypeID     = ComUtility.DBNullInt32Handler(rdr["DevTypeID"]);
                    alarm.DevTypeName   = ComUtility.DBNullStringHandler(rdr["DevTypeName"]);
                    alarm.AlarmLevel    = ComUtility.DBNullAlarmLevelHandler(rdr["AlarmLevel"]);
                    alarm.FreAlarmValue = ComUtility.DBNullInt32Handler(rdr["FreAlarmValue"]);
                    alarm.FreRightValue = ComUtility.DBNullInt32Handler(rdr["FreRightValue"]);
                    alarm.StartTime     = ComUtility.DBNullDateTimeHandler(rdr["StartTime"]);
                    alarm.AlarmTime     = ComUtility.DBNullDateTimeHandler(rdr["AlarmTime"]);
                    alarm.ConfirmName   = ComUtility.DBNullStringHandler(rdr["ConfirmName"]);
                    alarm.ConfirmTime   = ComUtility.DBNullDateTimeHandler(rdr["ConfirmTime"]);
                    alarm.EndName       = ComUtility.DBNullStringHandler(rdr["EndName"]);
                    alarm.EndTime       = ComUtility.DBNullDateTimeHandler(rdr["EndTime"]);
                    alarms.Add(alarm);
                }
            }
            return(alarms);
        }
Пример #15
0
        /// <summary>
        /// Method to get CSC alarm filter columns information
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="uId">uId</param>
        public List <ACSFilterInfo> GetCSCAlarmFilterCols(int lscId, string uId)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID", SqlDbType.Int),
                                         new SqlParameter("@UID",   SqlDbType.VarChar, 20) };
                parms[0].Value = lscId;
                parms[1].Value = uId;

                using (var conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction)) {
                    var items = SqlHelper.ExecuteScalar(conn, CommandType.Text, SqlText.SQL_SELECT_SETTING_GETCSCALARMFILTERCOLS, parms);
                    return(ComUtility.DBNullAlarmStaticFiterItemHandler(items));
                }
            } catch { throw; }
        }
Пример #16
0
        /// <summary>
        /// Method to get alarm levels combobox information
        /// </summary>
        public Dictionary <string, string> GetAlarmLevels()
        {
            var dict = new Dictionary <string, string>();

            foreach (EnmAlarmLevel level in Enum.GetValues(typeof(EnmAlarmLevel)))
            {
                if (level == EnmAlarmLevel.NoAlarm)
                {
                    continue;
                }
                dict.Add(((int)level).ToString(), ComUtility.GetAlarmLevelName(level));
            }
            return(dict);
        }
Пример #17
0
        /// <summary>
        /// Method to get trend alarms
        /// </summary>
        public List <TrendAlarmInfo> GetTrendAlarms()
        {
            var alarms  = new List <TrendAlarmInfo>();
            var sqlText = @"
            ;WITH Alarms AS
            (
                SELECT TT.*,TA.[DevID],L.[LscName],DT.[TypeID] AS DevTypeID,DT.[TypeName] AS DevTypeName
                FROM [dbo].[TA_TrendAlarm] TT
                INNER JOIN [dbo].[TM_AIC] TA ON TT.[LscID] = TA.[LscID] AND TT.[NodeID] = TA.[AicID]
                INNER JOIN [dbo].[TM_DEV] TD ON TA.[LscID] = TD.[LscID] AND TA.[DevID] = TD.[DevID]
                INNER JOIN [dbo].[TM_LSC] L ON TD.[LscID] = L.[LscID]
                LEFT OUTER JOIN [dbo].[TC_DeviceType] DT ON TD.[DevTypeID] = DT.[TypeID]
            )
            SELECT [LscID],[LscName],[Area1Name],[Area2Name],[Area3Name],[StaName],[DevID],[DevName],[NodeID],
            [NodeName],[DevTypeID],[DevTypeName],[AlarmType],[AlarmLevel],[StartValue],[AlarmValue],[DiffValue],
            [StartTime],[AlarmTime],[ConfirmName],[ConfirmTime],[EndName],[EndTime] FROM Alarms;";

            using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sqlText, null)) {
                while (rdr.Read())
                {
                    var alarm = new TrendAlarmInfo();
                    alarm.LscID       = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                    alarm.LscName     = ComUtility.DBNullStringHandler(rdr["LscName"]);
                    alarm.Area1Name   = ComUtility.DBNullStringHandler(rdr["Area1Name"]);
                    alarm.Area2Name   = ComUtility.DBNullStringHandler(rdr["Area2Name"]);
                    alarm.Area3Name   = ComUtility.DBNullStringHandler(rdr["Area3Name"]);
                    alarm.StaName     = ComUtility.DBNullStringHandler(rdr["StaName"]);
                    alarm.DevID       = ComUtility.DBNullInt32Handler(rdr["DevID"]);
                    alarm.DevName     = ComUtility.DBNullStringHandler(rdr["DevName"]);
                    alarm.NodeID      = ComUtility.DBNullInt32Handler(rdr["NodeID"]);
                    alarm.NodeName    = ComUtility.DBNullStringHandler(rdr["NodeName"]);
                    alarm.DevTypeID   = ComUtility.DBNullInt32Handler(rdr["DevTypeID"]);
                    alarm.DevTypeName = ComUtility.DBNullStringHandler(rdr["DevTypeName"]);
                    alarm.AlarmType   = ComUtility.DBNullStringHandler(rdr["AlarmType"]);
                    alarm.AlarmLevel  = ComUtility.DBNullAlarmLevelHandler(rdr["AlarmLevel"]);
                    alarm.StartValue  = ComUtility.DBNullFloatHandler(rdr["StartValue"]);
                    alarm.AlarmValue  = ComUtility.DBNullFloatHandler(rdr["AlarmValue"]);
                    alarm.DiffValue   = ComUtility.DBNullFloatHandler(rdr["DiffValue"]);
                    alarm.StartTime   = ComUtility.DBNullDateTimeHandler(rdr["StartTime"]);
                    alarm.AlarmTime   = ComUtility.DBNullDateTimeHandler(rdr["AlarmTime"]);
                    alarm.ConfirmName = ComUtility.DBNullStringHandler(rdr["ConfirmName"]);
                    alarm.ConfirmTime = ComUtility.DBNullDateTimeHandler(rdr["ConfirmTime"]);
                    alarm.EndName     = ComUtility.DBNullStringHandler(rdr["EndName"]);
                    alarm.EndTime     = ComUtility.DBNullDateTimeHandler(rdr["EndTime"]);
                    alarms.Add(alarm);
                }
            }
            return(alarms);
        }
Пример #18
0
 /// <summary>
 /// Method to get alarm log type
 /// </summary>
 public Dictionary <int, string> GetAlarmLogType()
 {
     try {
         var dict = new Dictionary <int, string>();
         using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_SETTING_GETALARMLOGTYPE, null)) {
             while (rdr.Read())
             {
                 var id   = ComUtility.DBNullInt32Handler(rdr["TypeID"]);
                 var name = ComUtility.DBNullStringHandler(rdr["TypeName"]);
                 dict.Add(id, name);
             }
         }
         return(dict);
     } catch { throw; }
 }
Пример #19
0
        public Dictionary <int, string> GetAcMessageType(string connectionString)
        {
            var dict = new Dictionary <int, string>();

            SqlHelper.TestConnection(connectionString);
            using (var rdr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, SqlText.SQL_SELECT_COMBOBOX_GetAcMessageType, null)) {
                while (rdr.Read())
                {
                    var id   = ComUtility.DBNullInt32Handler(rdr["ID"]);
                    var name = ComUtility.DBNullStringHandler(rdr["Name"]);
                    dict.Add(id, name);
                }
            }
            return(dict);
        }
Пример #20
0
 /// <summary>
 /// Method to get alarm names combobox information
 /// </summary>
 public Dictionary <string, string> GetAlarmNames()
 {
     try {
         var dict = new Dictionary <string, string>();
         using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_COMBOBOX_GETALLALARMNAMES, null)) {
             while (rdr.Read())
             {
                 var id   = ComUtility.DBNullInt32Handler(rdr["AlarmID"]);
                 var name = ComUtility.DBNullStringHandler(rdr["AlarmName"]);
                 dict.Add(id.ToString(), name);
             }
         }
         return(dict);
     } catch { throw; }
 }
Пример #21
0
        /// <summary>
        /// Method to get load alarms
        /// </summary>
        public List <LoadAlarmInfo> GetLoadAlarms()
        {
            var alarms  = new List <LoadAlarmInfo>();
            var sqlText = @"
            ;WITH Alarms AS
            (
                SELECT LA.*,L.[LscName],DT.[TypeName] AS [DevTypeName]
                FROM [dbo].[TA_LoadAlarm] LA
                INNER JOIN [dbo].[TM_DEV] TD ON LA.[LscID] = TD.[LscID] AND LA.[DevID] = TD.[DevID]
                INNER JOIN [dbo].[TM_LSC] L ON TD.[LscID] = L.[LscID]
                LEFT OUTER JOIN [dbo].[TC_DeviceType] DT ON TD.[DevTypeID] = DT.[TypeID]
            )
            SELECT [LscID],[LscName],[Area1Name],[Area2Name],[Area3Name],[StaName],[DevID],[DevName],
            [DevTypeID],[DevTypeName],[AlarmLevel],[RateValue],[LoadValue],[LoadPercent],[RightPercent],
            [StartTime],[ConfirmName],[ConfirmTime],[EndName],[EndTime] FROM Alarms;";

            using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sqlText, null)) {
                while (rdr.Read())
                {
                    var alarm = new LoadAlarmInfo();
                    alarm.LscID        = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                    alarm.LscName      = ComUtility.DBNullStringHandler(rdr["LscName"]);
                    alarm.Area1Name    = ComUtility.DBNullStringHandler(rdr["Area1Name"]);
                    alarm.Area2Name    = ComUtility.DBNullStringHandler(rdr["Area2Name"]);
                    alarm.Area3Name    = ComUtility.DBNullStringHandler(rdr["Area3Name"]);
                    alarm.StaName      = ComUtility.DBNullStringHandler(rdr["StaName"]);
                    alarm.DevID        = ComUtility.DBNullInt32Handler(rdr["DevID"]);
                    alarm.DevName      = ComUtility.DBNullStringHandler(rdr["DevName"]);
                    alarm.DevTypeID    = ComUtility.DBNullInt32Handler(rdr["DevTypeID"]);
                    alarm.DevTypeName  = ComUtility.DBNullStringHandler(rdr["DevTypeName"]);
                    alarm.AlarmLevel   = ComUtility.DBNullAlarmLevelHandler(rdr["AlarmLevel"]);
                    alarm.RateValue    = ComUtility.DBNullFloatHandler(rdr["RateValue"]);
                    alarm.LoadValue    = ComUtility.DBNullFloatHandler(rdr["LoadValue"]);
                    alarm.LoadPercent  = ComUtility.DBNullFloatHandler(rdr["LoadPercent"]);
                    alarm.RightPercent = ComUtility.DBNullFloatHandler(rdr["RightPercent"]);
                    alarm.StartTime    = ComUtility.DBNullDateTimeHandler(rdr["StartTime"]);
                    alarm.ConfirmName  = ComUtility.DBNullStringHandler(rdr["ConfirmName"]);
                    alarm.ConfirmTime  = ComUtility.DBNullDateTimeHandler(rdr["ConfirmTime"]);
                    alarm.EndName      = ComUtility.DBNullStringHandler(rdr["EndName"]);
                    alarm.EndTime      = ComUtility.DBNullDateTimeHandler(rdr["EndTime"]);
                    alarms.Add(alarm);
                }
            }
            return(alarms);
        }
Пример #22
0
        /// <summary>
        /// Gets history appointment records.
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="lscName">lscName</param>
        /// <param name="beginTime">beginTime</param>
        /// <param name="endTime">endTime</param>
        /// <param name="queryType">queryType</param>
        /// <param name="queryText">queryText</param>
        /// <returns></returns>
        public List <AppointmentInfo> GetHisAppointments(int lscId, string lscName, DateTime beginTime, DateTime endTime, int queryType, string queryText)
        {
            SqlParameter[] parms = { new SqlParameter("@LscID",     SqlDbType.Int),
                                     new SqlParameter("@BeginTime", SqlDbType.DateTime),
                                     new SqlParameter("@EndTime",   SqlDbType.DateTime),
                                     new SqlParameter("@QueryType", SqlDbType.Int),
                                     new SqlParameter("@QueryText", SqlDbType.NVarChar, 100) };

            parms[0].Value = lscId;
            parms[1].Value = beginTime;
            parms[2].Value = endTime;
            parms[3].Value = queryType;
            parms[4].Value = DBNull.Value;
            if (queryText != null && queryText.Trim() != String.Empty)
            {
                parms[4].Value = queryText.Trim();
            }

            var appointments = new List <AppointmentInfo>();

            using (var rdr = SqlHelper.ExecuteReader(SqlHelper.HisConnectionStringLocalTransaction, CommandType.Text, SqlText.Sql_Appointment_Get_His, parms)) {
                while (rdr.Read())
                {
                    var appointment = new AppointmentInfo();
                    appointment.LscID        = lscId;
                    appointment.LscName      = lscName;
                    appointment.Id           = ComUtility.DBNullInt32Handler(rdr["Id"]);
                    appointment.StartTime    = ComUtility.DBNullDateTimeHandler(rdr["StartTime"]);
                    appointment.EndTime      = ComUtility.DBNullDateTimeHandler(rdr["EndTime"]);
                    appointment.LscIncluded  = ComUtility.DBNullInt32Handler(rdr["LscIncluded"]);
                    appointment.StaIncluded  = ComUtility.DBNullStringHandler(rdr["StaIncluded"]);
                    appointment.DevIncluded  = ComUtility.DBNullStringHandler(rdr["DevIncluded"]);
                    appointment.ProjectId    = ComUtility.DBNullStringHandler(rdr["ProjectId"]);
                    appointment.ProjectName  = ComUtility.DBNullStringHandler(rdr["ProjectName"]);
                    appointment.Status       = ComUtility.DBNullProjStatusHandler(rdr["Status"]);
                    appointment.CreaterId    = ComUtility.DBNullInt32Handler(rdr["CreaterId"]);
                    appointment.Creater      = ComUtility.DBNullStringHandler(rdr["Creater"]);
                    appointment.ContactPhone = ComUtility.DBNullStringHandler(rdr["ContactPhone"]);
                    appointment.CreatedTime  = ComUtility.DBNullDateTimeHandler(rdr["CreatedTime"]);
                    appointment.RecordTime   = ComUtility.DBNullDateTimeHandler(rdr["RecordTime"]);
                    appointments.Add(appointment);
                }
            }
            return(appointments);
        }
Пример #23
0
        /// <summary>
        /// Method to gets lsc project
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="connectionString">connectionString</param>
        /// <returns>project object</returns>
        public List <ProjectInfo> GetProjects(int lscId, string lscName, string projectId, string projectName, DateTime fromTime, DateTime endTime, string connectionString)
        {
            SqlParameter[] parms = { new SqlParameter("@ProjectId",   SqlDbType.VarChar,    50),
                                     new SqlParameter("@ProjectName", SqlDbType.VarChar,   100),
                                     new SqlParameter("@BeginTime",   SqlDbType.DateTime),
                                     new SqlParameter("@EndTime",     SqlDbType.DateTime) };

            parms[0].Value = DBNull.Value;
            if (projectId != null && projectId != String.Empty)
            {
                parms[0].Value = projectId;
            }

            parms[1].Value = DBNull.Value;
            if (projectName != null && projectName != String.Empty)
            {
                parms[1].Value = projectName;
            }

            parms[2].Value = fromTime;
            parms[3].Value = endTime;

            var projects = new List <ProjectInfo>();

            SqlHelper.TestConnection(connectionString);
            using (var rdr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, SqlText.Sql_Appointment_Get_Projects, parms)) {
                while (rdr.Read())
                {
                    var project = new ProjectInfo();
                    project.LscID        = lscId;
                    project.LscName      = lscName;
                    project.ProjectId    = ComUtility.DBNullStringHandler(rdr["ProjectId"]);
                    project.ProjectName  = ComUtility.DBNullStringHandler(rdr["ProjectName"]);
                    project.BeginTime    = ComUtility.DBNullDateTimeHandler(rdr["BeginTime"]);
                    project.EndTime      = ComUtility.DBNullDateTimeHandler(rdr["EndTime"]);
                    project.Responsible  = ComUtility.DBNullStringHandler(rdr["Responsible"]);
                    project.ContactPhone = ComUtility.DBNullStringHandler(rdr["ContactPhone"]);
                    project.Company      = ComUtility.DBNullStringHandler(rdr["Company"]);
                    project.Comment      = ComUtility.DBNullStringHandler(rdr["Comment"]);
                    project.Enabled      = ComUtility.DBNullBooleanHandler(rdr["Enabled"]);
                    projects.Add(project);
                }
            }
            return(projects);
        }
Пример #24
0
 /// <summary>
 /// Method to get lsc combobox information
 /// </summary>
 /// <param name="lscIds">lscIds</param>
 public Dictionary <string, string> GetLscs(Dictionary <int, int> lscIds)
 {
     try {
         var dict = new Dictionary <string, string>();
         using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_COMBOBOX_GETLSCS, null)) {
             while (rdr.Read())
             {
                 var id   = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                 var name = ComUtility.DBNullStringHandler(rdr["LscName"]);
                 if (lscIds.ContainsKey(id))
                 {
                     dict.Add(String.Format("{0}&{1}", id, lscIds[id]), name);
                 }
             }
         }
         return(dict);
     } catch { throw; }
 }
Пример #25
0
        /// <summary>
        /// Method to get LSC user
        /// </summary>
        /// <param name="uId">uId</param>
        /// <param name="pwd">pwd</param>
        public List <LscUserInfo> GetUser(string uId, string pwd)
        {
            SqlParameter[] parms = { new SqlParameter("@UID", SqlDbType.VarChar, 20),
                                     new SqlParameter("@PWD", SqlDbType.VarChar, 20) };
            parms[0].Value = uId;
            if (pwd == null)
            {
                parms[1].Value = DBNull.Value;
            }
            else
            {
                parms[1].Value = pwd;
            }

            var lscUsers = new List <LscUserInfo>();

            using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_USER_GETUSER, parms)) {
                while (rdr.Read())
                {
                    var lscUser = new LscUserInfo();
                    lscUser.LscID                 = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                    lscUser.LscName               = ComUtility.DBNullStringHandler(rdr["LscName"]);
                    lscUser.UserID                = ComUtility.DBNullInt32Handler(rdr["UserID"]);
                    lscUser.UserName              = ComUtility.DBNullStringHandler(rdr["UserName"]);
                    lscUser.UID                   = ComUtility.DBNullStringHandler(rdr["UID"]);
                    lscUser.OpLevel               = ComUtility.DBNullUserLevelHandler(rdr["OpLevel"]);
                    lscUser.LimitTime             = ComUtility.DBNullDateTimeHandler(rdr["LimitTime"]);
                    lscUser.TelePhone             = ComUtility.DBNullStringHandler(rdr["TelePhone"]);
                    lscUser.MobilePhone           = ComUtility.DBNullStringHandler(rdr["MobilePhone"]);
                    lscUser.Email                 = ComUtility.DBNullStringHandler(rdr["Email"]);
                    lscUser.Address               = ComUtility.DBNullStringHandler(rdr["Address"]);
                    lscUser.PostalCode            = ComUtility.DBNullStringHandler(rdr["PostalCode"]);
                    lscUser.Remark                = ComUtility.DBNullStringHandler(rdr["Remark"]);
                    lscUser.AlarmSoundFiterItem   = ComUtility.DBNullAlarmSoundFiterItemHandler(rdr["AlarmSoundFiterItem"]);
                    lscUser.AlarmStaticFiterItem  = ComUtility.DBNullAlarmStaticFiterItemHandler(rdr["AlarmStaticFiterItem"]);
                    lscUser.ActiveValuesFiterItem = ComUtility.DBNullActiveValuesFiterItemHandler(rdr["ActiveValuesFiterItem"]);
                    lscUser.Group                 = null;
                    lscUser.UDGroups              = null;
                    lscUser.Enabled               = ComUtility.DBNullBooleanHandler(rdr["Enabled"]);
                    lscUsers.Add(lscUser);
                }
            }
            return(lscUsers);
        }
Пример #26
0
        /// <summary>
        /// Method to get trend count alarms
        /// </summary>
        public List <TrendAlarmInfo> GetTrendCountAlarms(int lscId, int nodeId, DateTime beginTime, DateTime endTime, float aiValue, int timeType, int valueType)
        {
            SqlParameter[] parms = { new SqlParameter("@LscID",     SqlDbType.Int),
                                     new SqlParameter("@AicID",     SqlDbType.Int),
                                     new SqlParameter("@BeginTime", SqlDbType.DateTime),
                                     new SqlParameter("@EndTime",   SqlDbType.DateTime),
                                     new SqlParameter("@AIValue",   SqlDbType.Real),
                                     new SqlParameter("@TimeType",  SqlDbType.Int),
                                     new SqlParameter("@ValueType", SqlDbType.Int) };

            parms[0].Value = lscId;
            if (nodeId == ComUtility.DefaultInt32)
            {
                parms[1].Value = DBNull.Value;
            }
            else
            {
                parms[1].Value = nodeId;
            }
            parms[2].Value = beginTime;
            parms[3].Value = endTime;
            parms[4].Value = aiValue;
            parms[5].Value = timeType;
            parms[6].Value = valueType;

            var alarms = new List <TrendAlarmInfo>();

            using (var rdr = SqlHelper.ExecuteReader(SqlHelper.HisConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_PREALARM_GETTRENDCOUNTALARMS, parms)) {
                while (rdr.Read())
                {
                    var alarm = new TrendAlarmInfo();
                    alarm.LscID      = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                    alarm.NodeID     = ComUtility.DBNullInt32Handler(rdr["AicID"]);
                    alarm.StartValue = ComUtility.DBNullFloatHandler(rdr["StartValue"]);
                    alarm.AlarmValue = ComUtility.DBNullFloatHandler(rdr["AlarmValue"]);
                    alarm.DiffValue  = ComUtility.DBNullFloatHandler(rdr["DiffValue"]);
                    alarm.StartTime  = ComUtility.DBNullDateTimeHandler(rdr["StartTime"]);
                    alarm.EndTime    = ComUtility.DBNullDateTimeHandler(rdr["EndTime"]);
                    alarms.Add(alarm);
                }
            }
            return(alarms);
        }
Пример #27
0
        /// <summary>
        /// Method to get history pictures information
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="fromTime">fromTime</param>
        /// <param name="toTime">toTime</param>
        /// <param name="picModels">picModels</param>
        public List <PicInfo> GetHisPictures(int lscId, DateTime fromTime, DateTime toTime, string[] picModels)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID",     SqlDbType.Int),
                                         new SqlParameter("@FromTime",  SqlDbType.DateTime),
                                         new SqlParameter("@ToTime",    SqlDbType.DateTime),
                                         new SqlParameter("@PicModels", SqlDbType.NVarChar, 1024) };
                parms[0].Value = lscId;
                parms[1].Value = fromTime;
                parms[2].Value = toTime;
                if (picModels != null && picModels.Length > 0)
                {
                    for (int i = 0; i < picModels.Length; i++)
                    {
                        picModels[i] = String.Format("\"{0}\"", picModels[i]);
                    }
                    parms[3].Value = String.Join(",", picModels);
                }
                else
                {
                    parms[3].Value = DBNull.Value;
                }

                var pics = new List <PicInfo>();
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.HisConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_REPORT_GETHISPICTURES, parms)) {
                    var id = 0;
                    while (rdr.Read())
                    {
                        var pic = new PicInfo();
                        pic.LscID    = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                        pic.LscName  = ComUtility.DefaultString;
                        pic.RtuID    = ComUtility.DBNullInt32Handler(rdr["RtuID"]);
                        pic.PicID    = ++id;
                        pic.PicName  = ComUtility.DefaultString;
                        pic.PicModel = ComUtility.DBNullStringHandler(rdr["PicModel"]);
                        pic.PicBytes = ComUtility.DBNullBytesHandler(rdr["PicBytes"]);
                        pic.PicTime  = ComUtility.DBNullDateTimeHandler(rdr["PicTime"]);
                        pics.Add(pic);
                    }
                }
                return(pics);
            } catch { throw; }
        }
Пример #28
0
 /// <summary>
 /// Method to get lscs information
 /// </summary>
 /// <param name="connectionString">connectionString</param>
 public List <LscInfo> GetLscs(string connectionString)
 {
     try {
         if (String.IsNullOrEmpty(connectionString))
         {
             connectionString = SqlHelper.ConnectionStringLocalTransaction;
         }
         var lscs = new List <LscInfo>();
         using (var rdr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, SqlText.SQL_SELECT_LSC_GETLSCS, null)) {
             while (rdr.Read())
             {
                 var lsc = new LscInfo();
                 lsc.LscID        = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                 lsc.LscName      = ComUtility.DBNullStringHandler(rdr["LscName"]);
                 lsc.LscIP        = ComUtility.DBNullStringHandler(rdr["LscIP"]);
                 lsc.LscPort      = ComUtility.DBNullInt32Handler(rdr["LscPort"]);
                 lsc.LscUID       = ComUtility.DBNullStringHandler(rdr["LscUID"]);
                 lsc.LscPwd       = ComUtility.DBNullStringHandler(rdr["LscPwd"]);
                 lsc.BeatInterval = ComUtility.DBNullInt32Handler(rdr["BeatInterval"]);
                 lsc.BeatDelay    = ComUtility.DBNullInt32Handler(rdr["BeatDelay"]);
                 lsc.DBServer     = ComUtility.DBNullStringHandler(rdr["DBServer"]);
                 lsc.DBPort       = ComUtility.DBNullInt32Handler(rdr["DBPort"]);
                 lsc.DBName       = ComUtility.DBNullStringHandler(rdr["DBName"]);
                 lsc.DBUID        = ComUtility.DBNullStringHandler(rdr["DBUID"]);
                 lsc.DBPwd        = ComUtility.DBNullStringHandler(rdr["DBPwd"]);
                 lsc.HisDBServer  = ComUtility.DBNullStringHandler(rdr["HisDBServer"]);
                 lsc.HisDBPort    = ComUtility.DBNullInt32Handler(rdr["HisDBPort"]);
                 lsc.HisDBName    = ComUtility.DBNullStringHandler(rdr["HisDBName"]);
                 lsc.HisDBUID     = ComUtility.DBNullStringHandler(rdr["HisDBUID"]);
                 lsc.HisDBPwd     = ComUtility.DBNullStringHandler(rdr["HisDBPwd"]);
                 lsc.Connected    = ComUtility.DBNullBooleanHandler(rdr["Connected"]);
                 lsc.ChangedTime  = ComUtility.DBNullDateTimeHandler(rdr["ChangedTime"]);
                 lsc.Enabled      = ComUtility.DBNullBooleanHandler(rdr["Enabled"]);
                 lscs.Add(lsc);
             }
         }
         return(lscs);
     } catch { throw; }
 }
Пример #29
0
        /// <summary>
        /// Method to get lsc information
        /// </summary>
        /// <param name="lscId">lscId</param>
        public LscInfo GetLsc(int lscId)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID", SqlDbType.Int) };
                parms[0].Value = lscId;

                LscInfo lsc = null;
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_LSC_GETLSC, parms)) {
                    if (rdr.Read())
                    {
                        lsc              = new LscInfo();
                        lsc.LscID        = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                        lsc.LscName      = ComUtility.DBNullStringHandler(rdr["LscName"]);
                        lsc.LscIP        = ComUtility.DBNullStringHandler(rdr["LscIP"]);
                        lsc.LscPort      = ComUtility.DBNullInt32Handler(rdr["LscPort"]);
                        lsc.LscUID       = ComUtility.DBNullStringHandler(rdr["LscUID"]);
                        lsc.LscPwd       = ComUtility.DBNullStringHandler(rdr["LscPwd"]);
                        lsc.BeatInterval = ComUtility.DBNullInt32Handler(rdr["BeatInterval"]);
                        lsc.BeatDelay    = ComUtility.DBNullInt32Handler(rdr["BeatDelay"]);
                        lsc.DBServer     = ComUtility.DBNullStringHandler(rdr["DBServer"]);
                        lsc.DBPort       = ComUtility.DBNullInt32Handler(rdr["DBPort"]);
                        lsc.DBName       = ComUtility.DBNullStringHandler(rdr["DBName"]);
                        lsc.DBUID        = ComUtility.DBNullStringHandler(rdr["DBUID"]);
                        lsc.DBPwd        = ComUtility.DBNullStringHandler(rdr["DBPwd"]);
                        lsc.HisDBServer  = ComUtility.DBNullStringHandler(rdr["HisDBServer"]);
                        lsc.HisDBPort    = ComUtility.DBNullInt32Handler(rdr["HisDBPort"]);
                        lsc.HisDBName    = ComUtility.DBNullStringHandler(rdr["HisDBName"]);
                        lsc.HisDBUID     = ComUtility.DBNullStringHandler(rdr["HisDBUID"]);
                        lsc.HisDBPwd     = ComUtility.DBNullStringHandler(rdr["HisDBPwd"]);
                        lsc.Connected    = ComUtility.DBNullBooleanHandler(rdr["Connected"]);
                        lsc.ChangedTime  = ComUtility.DBNullDateTimeHandler(rdr["ChangedTime"]);
                        lsc.Enabled      = ComUtility.DBNullBooleanHandler(rdr["Enabled"]);
                    }
                }
                return(lsc);
            } catch { throw; }
        }
Пример #30
0
        /// <summary>
        /// Method to get group
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="userId">userId</param>
        public GroupInfo GetGroup(int lscId, int userId)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID",  SqlDbType.Int),
                                         new SqlParameter("@UserID", SqlDbType.Int) };
                parms[0].Value = lscId;
                parms[1].Value = userId;

                GroupInfo group = null;
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_GROUP_GETGROUP, parms)) {
                    if (rdr.Read())
                    {
                        group            = new GroupInfo();
                        group.LscID      = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                        group.GroupID    = ComUtility.DBNullInt32Handler(rdr["GroupID"]);
                        group.GroupName  = ComUtility.DBNullStringHandler(rdr["GroupName"]);
                        group.GroupType  = ComUtility.DBNullGroupTypeHandler(rdr["GroupType"]);
                        group.GroupNodes = null;
                        group.Enabled    = ComUtility.DBNullBooleanHandler(rdr["Enabled"]);
                    }
                }
                return(group);
            } catch { throw; }
        }