/// <summary> /// Get the values of Planning table to set configs vars... /// </summary> /// <param name="unique_id"></param> /// <returns></returns> public static Configs ReadPlanning(string unique_id) { Configs cfg = new Configs(); // String sql = @"SELECT ColSiteNum , OperatorName , UniqueId , DUName , InstanceId , DataExpCtrChk , WaiverChk , VolumeGB , DurationWorkDays , PlanAOReceiveDate , ActAOReceiveDate , PlanAOStartDate , ActAOStartDate , PlanAOEndDate , ActAOEndDate , Status , Comment FROM Shell_AutoArchDB.dbo.shell_Planning WHERE UniqueId LIKE '%{0}%'"; SqlCommand comm = new SqlCommand(); comm.CommandText = string.Format(sql, unique_id); comm.CommandType = CommandType.Text; using (SqlDataReader dataReader = SQLServer.DataAccess.ExecuteReader(comm)) { if (dataReader.Read()) { cfg.COLSITENUM = dataReader.GetInt32(0).ToString().Trim(); // if (!dataReader.IsDBNull(1)) cfg.OPERATORNAME = dataReader.GetString(1).Trim(); // cfg.UNIQUEID = dataReader.GetString(2).Trim(); cfg.DUNAME = dataReader.GetString(3).Trim(); cfg.INSTANCEID = dataReader.GetString(4).Trim(); // if (!dataReader.IsDBNull(5)) cfg.DATAEXPCTRCHK = dataReader.GetInt32(5).ToString().Trim(); if (!dataReader.IsDBNull(6)) cfg.WAIVERCHK = dataReader.GetInt32(6).ToString().Trim(); cfg.VOLUMEGB = dataReader.GetDecimal(7).ToString().Trim(); // if (!dataReader.IsDBNull(8)) cfg.DURATIONWORKDAYS = dataReader.GetInt32(8).ToString().Trim(); // if (!dataReader.IsDBNull(9)) { cfg.PLANAORECEIVEDATE = dataReader.GetDateTime(9).ToString().Trim(); } if (!dataReader.IsDBNull(10)) { cfg.ACTAORECEIVEDATE = dataReader.GetDateTime(10).ToString().Trim(); } if (!dataReader.IsDBNull(11)) { cfg.PLANAOSTARTDATE = dataReader.GetDateTime(11).ToString().Trim(); } if (!dataReader.IsDBNull(12)) { cfg.ACTAOSTARTDATE = dataReader.GetDateTime(12).ToString().Trim(); } if (!dataReader.IsDBNull(13)) { cfg.PLANAOENDDATE = dataReader.GetDateTime(13).ToString().Trim(); } if (!dataReader.IsDBNull(14)) { cfg.ACTAOENDDATE = dataReader.GetDateTime(14).ToString().Trim(); } // cfg.STATUS = dataReader.GetString(15).Trim(); // if (!dataReader.IsDBNull(16)) cfg.COMMENT = dataReader.GetString(16).Trim(); } } return cfg; }
/// <summary> /// Get the values of LAPI table to set configs vars... /// </summary> /// <param name="id_instance"></param> /// <returns></returns> public static Configs ReadLAPI(string id_instance) { Configs cfg = new Configs(); // String sql = @"SELECT ID_INSTANCE ,LL_IP ,LL_PORT ,LL_BASE_URI ,TSI_Managed ,ArchTool_Max_Thread_Ini ,ArchTool_Max_Thread_fim FROM Shell_AutoArchDB.dbo.shell_LAPIconf WHERE ID_INSTANCE LIKE '%{0}%'"; SqlCommand comm = new SqlCommand(); comm.CommandText = string.Format(sql, id_instance); comm.CommandType = CommandType.Text; using (SqlDataReader dataReader = SQLServer.DataAccess.ExecuteReader(comm)) { if (dataReader.Read()) { cfg.ID_INSTANCE = dataReader.GetString(0).Trim(); cfg.LL_IP = dataReader.GetString(1).Trim(); cfg.LL_PORT = dataReader.GetString(2).Trim(); cfg.LL_BASE_URI = dataReader.GetString(3).Trim(); cfg.TSI_MANAGED = dataReader.GetInt32(4); cfg.ARCHTOOL_MAX_THREAD_INI = dataReader.GetInt32(5).ToString().Trim(); cfg.ARCHTOOL_MAX_THREAD_FIM = dataReader.GetInt32(6).ToString().Trim(); } } return cfg; }