protected override CheckBackInAccept ExecuteCommand() { try { /*Initialize the command.*/ CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_CHECKBACKINACCEPT, System.Data.CommandType.StoredProcedure); /*add parameters to command object*/ cmd.AddWithValue("NotificationID", NotificationID); cmd.AddWithValue("StoreID", StoreID); /*execute command*/ CDAO.ExecReader(cmd); if (CDAO.DataReader.Read()) { IsBackInAcceptableRange = CDAO.DataReader["BackInRange"].ToBoolean(); LogCount = CDAO.DataReader["LogCount"].ToInt(); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
/// <summary> /// Get Format string /// </summary> /// <returns></returns> protected override FormatString ExecuteCommand() { try { CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETFORMATSTRING); cmd.AddWithValue("FormatID", FormatID); cmd.AddWithValue("LanguageID", LanguageID); cmd.AddWithValue("SensorType", SensorType); CDAO.ExecReader(cmd); if (CDAO.DataReader.Read()) { ComposeString = CDAO.DataReader["FormatString"].ToStr(); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
protected override NotificationAcknowledgement ExecuteCommand() { try { /* Create command object for sql operation*/ CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_IS_NOTIFICATION_ACKNOWLEDGED, System.Data.CommandType.StoredProcedure); cmd.AddWithValue("AlarmID", AlarmID); cmd.AddWithValue("StoreID", StoreID); /* execute the command */ CDAO.ExecReader(cmd); if (CDAO.DataReader.Read()) { IsAlarmCleared = CDAO.DataReader["IsAlarmCleared"].ToBoolean(); ClearedTime = CDAO.DataReader["ClearedTime"].ToDateTime(); IsAlarmClearedByUser = CDAO.DataReader["AlarmClearedByUser"].ToBoolean(); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
/// <summary> /// Get Contact state string value /// </summary> /// <returns></returns> protected override ContactState ExecuteCommand() { try { CSqlDbCommand cmd = new CSqlDbCommand("SP_TTGETCONTACTSENSORTEXT"); cmd.AddWithValue("UTID", UTID); cmd.AddWithValue("Probe", Probe); cmd.AddWithValue("State", contactState); cmd.AddWithValue("LanguageID", LanguageID); CDAO.ExecReader(cmd); if (CDAO.DataReader.Read()) { contactStateString = CDAO.DataReader["StateText"].ToStr(); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
/// <summary> /// Get Sensor Format ID /// </summary> /// <returns></returns> protected override SensorFormatString ExecuteCommand() { try { CSqlDbCommand cmd = new CSqlDbCommand("USP_NS_GETSENSORFORMATSTRINGID"); cmd.AddWithValue("UTID", UTID); cmd.AddWithValue("Probe", Probe); cmd.AddWithValue("FormatType", FormatType); cmd.AddWithValue("Action", Action); CDAO.ExecReader(cmd); if (CDAO.DataReader.Read()) { SensorFormatID = CDAO.DataReader["FormatID"].ToInt(); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
protected override IvrAlarmStatus ExecuteCommand() { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_IVR_ALARMCLEARED); //Bind IvrAlarmStatus property values as input parameters for procedure cmd.AddWithValue("AlarmID", AlarmID); cmd.AddWithValue("StoreID", StoreID); cmd.AddWithValue("IsSucceeded", IsSucceeded); //Execute command CDAO.ExecReader(cmd); //Bind output values to IvrAlarmStatus object if (CDAO.DataReader.Read()) { IsAlarmCleared = true; } else { IsAlarmCleared = false; } //return IvrAlarmStatus object return(this); }
protected override SensorCurrentStatus ExecuteCommand() { try { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETCURRENTVALUE); //Bind property values as input parameters for procedure cmd.AddWithValue("UTID", UTID); cmd.AddWithValue("Probe", Probe); //Execute command CDAO.ExecReader(cmd); //Bind output values to IvrAlarmStatus object if (CDAO.DataReader.Read()) { CurrentTime = TypeCommonExtensions.IfNull(CDAO.DataReader["CurrentTime"], DateTime.UtcNow).ToDateTime(); CurrentValue = CDAO.DataReader["CurrentValue"].ToDecimal(); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
//public int threadID { get; set; } protected override IvrIsInProcess ExecuteCommand() { try { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_IVR_ISINPROCESS); // cmd.AddWithValue("NotificationID", NotificationID); cmd.AddWithValue("StoreID", StoreID); // This stored procedure was changed to an integer because on SQL 2000 the bit was being sent as a 'T' or an 'F' instead of a 1 or 0 cmd.AddWithValue("PhoneNumber", phoneNumber); // cmd.AddWithValue("AlarmID", AlarmID); // cmd.AddWithValue("isSucceeded", IsSucceeded.ToInt()); // cmd.AddWithValue("numAttempts", numAttempts); //Execute command CDAO.ExecReader(cmd); //while (CDAO.DataReader.Read()) //{ // IsAlarmInIVRProcess = CDAO.DataReader["IsInProcess"].ToBoolean(); // LastAttemptTime = TypeCommonExtensions.IfNull(CDAO.DataReader["LastAttemptTime"], DateTime.UtcNow).ToDateTime(); // phoneNumber = CDAO.DataReader["PhoneNumber"].ToString(); // IsSucceeded = CDAO.DataReader["IsSuccess"].ToBoolean(); // numAttempts = CDAO.DataReader["numAttempts"].ToInt(); // threadID = CDAO.DataReader["ThreadID"].ToInt(); //} // Bind output values to IvrAlarmStatus object // if stored procedure returns a record, then it is either cleared,in-range, or in-process (call alert is not complete) if (CDAO.DataReader.Read()) { IsAlarmInIVRProcess = true; // IsSucceeded = CDAO.DataReader["IsSuccess"].ToBoolean(); // numAttempts = CDAO.DataReader["numAttempts"].ToInt(); } else { IsAlarmInIVRProcess = false; } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } //return IvrAlarmStatus object return(this); }
private void BindParams(CSqlDbCommand cmd, TTIvrNotifications entityObject) { CSqlDbParamter parm = new CSqlDbParamter("RecID", entityObject.RecID); parm.DbType = System.Data.DbType.Int32; parm.Direction = System.Data.ParameterDirection.InputOutput; cmd.Parameters.Add(parm); CSqlDbParamter phoneNumber = new CSqlDbParamter("PhoneNumber", entityObject.PhoneNumber); phoneNumber.DbType = System.Data.DbType.String; phoneNumber.Size = 20; phoneNumber.Direction = System.Data.ParameterDirection.InputOutput; cmd.Parameters.Add(phoneNumber); // cmd.AddWithValue("QueueTime", entityObject.QueueTime); cmd.AddWithValue("Notification_RecID", entityObject.Notification_RecID); cmd.AddWithValue("TransID", entityObject.TransID); cmd.AddWithValue("AlarmID", entityObject.AlarmID); cmd.AddWithValue("isSuccess", entityObject.isSuccess); cmd.AddWithValue("isInProcess", entityObject.isInProcess); cmd.AddWithValue("LastAttemptTime", entityObject.LastAttemptTime); cmd.AddWithValue("UserID", entityObject.UserID); cmd.AddWithValue("NumAttempts", entityObject.NumAttempts); cmd.AddWithValue("ThreadID", entityObject.ThreadID); }
protected override NotificationRemover ExecuteCommand() { /*Initialize the command.*/ CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_REMOVE_NOTIFICATION, System.Data.CommandType.StoredProcedure); /*add parameters to command object*/ cmd.AddWithValue("StoreID", StoreID); cmd.AddWithValue("NotificationID", NotificationID); /*execute command*/ CDAO.ExecCommand(cmd); return(this); }
/// <summary> /// to fetch the message board configuration list /// </summary> /// <param name="criteria"></param> /// <returns></returns> protected override MessageBoardConfigList LoadList(BaseCriteria criteria) { //CDAO.Connection = EnterpriseModel.Net. try { Criteria listCriteria = (Criteria)criteria; //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETNOTIFYMSGBOARDIDLIST); if (listCriteria.ID == null) { cmd.AddWithValue("MsgBoardNotifyID", System.DBNull.Value); } else { cmd.AddWithValue("MsgBoardNotifyID", listCriteria.ID); } //Execute reader CDAO.ExecReader(cmd); while (CDAO.DataReader.Read()) { MessageBoardConfig messageBoardConfig = new MessageBoardConfig() { NotifyID = CDAO.DataReader["NotifyID"].ToInt(), MessageBoardName = CDAO.DataReader["Name"].ToStr(), IsNetworkConnected = CDAO.DataReader["NetworkConnection"].ToBoolean(), IpAddress = CDAO.DataReader["IPAddress"].ToStr(), Port = CDAO.DataReader["Port"].ToInt(), COMSettings = CDAO.DataReader["Settings"].ToStr(), IsEnabled = CDAO.DataReader["isEnabled"].ToBoolean(), //IsGroup = CDAO.DataReader["IsGroup"].ToBoolean(), BoardType = CDAO.DataReader["BoardType"].ToInt() }; this.Add(messageBoardConfig); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
protected override NotifyMobileList LoadList(BaseCriteria criteria) { try { /*Initialize the command.*/ CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETNOTIFYMOBILELIST, System.Data.CommandType.StoredProcedure); cmd.AddWithValue("NotifyID", criteria.ID); //Execute command CDAO.ExecReader(cmd); while (CDAO.DataReader.Read()) { NotifyMobiles notifyMobiles = new NotifyMobiles(); notifyMobiles.MobileNumber = CDAO.DataReader["MobileNumber"].ToStr(); notifyMobiles.Name = CDAO.DataReader["Name"].ToStr(); this.Add(notifyMobiles); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
protected override NotifyPagerAddressList LoadList(BaseCriteria criteria) { try { CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETNOTIFYPAGERADDRESSLIST, System.Data.CommandType.StoredProcedure); cmd.AddWithValue("NotifyID", criteria.ID); //Execute command CDAO.ExecReader(cmd); while (CDAO.DataReader.Read()) { NotifyPagerAddress notifyPagerAddress = new NotifyPagerAddress(); notifyPagerAddress.PagerName = CDAO.DataReader["Name"].ToStr(); notifyPagerAddress.PhoneNumber = CDAO.DataReader["PagerPhone"].ToStr(); notifyPagerAddress.PagerDelay = CDAO.DataReader["PagerDelay"].ToInt(); notifyPagerAddress.DeliveryMethod = CDAO.DataReader["PagerDeliveryMethod"].ToInt(); notifyPagerAddress.PagerMessage = CDAO.DataReader["PagerMessage"].ToStr(); this.Add(notifyPagerAddress); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
protected override AlarmNote ExecuteCommand() { /*Initialize the command.*/ CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_ADDNOTE, System.Data.CommandType.StoredProcedure); /*add parameters to command object*/ cmd.AddWithValue("AlarmID", AlarmID); cmd.AddWithValue("Message", Message); cmd.AddWithValue("NoteType", NoteType); cmd.AddWithValue("StoreID", StoreID); /*execute command*/ CDAO.ExecCommand(cmd); return(this); }
protected override NotificationStatusUpdate ExecuteCommand() { /*Initialize the command.*/ CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_UPDATENOTIFICATIONSTATUS, System.Data.CommandType.StoredProcedure); /*add parameters to command object*/ cmd.AddWithValue("StoreID", StoreID); cmd.AddWithValue("NotificationID", NotificationID); // This stored procedure was changed to an integer because on SQL 2000 the bit was being sent as a 'T' or an 'F' instead of a 1 or 0 cmd.AddWithValue("IsProcessCompleted", Convert.ToInt32(IsProcessCompleted)); /*execute command*/ CDAO.ExecCommand(cmd); return(this); }
protected override FailsafeEscalation ExecuteCommand() { /* Initialize the command object*/ CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETFAILSAFEINFO, System.Data.CommandType.StoredProcedure); cmd.AddWithValue("StoreID", StoreID); cmd.AddWithValue("AlarmID", AlarmID); cmd.AddWithValue("UTID", UTID); cmd.AddWithValue("AlarmType", AlarmType); cmd.AddWithValue("Probe", Probe); object count = CDAO.ExecScalar(cmd); /*If the procedure returns count more than zero, consider it as the sensor comes to the normal range.*/ SensorIsInRange = count.ToInt() > 0; return(this); }
protected override IvrAlarmStatus ExecuteCommand() { try { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_ISALARMCLEARDORBACKINRANGE); //Bind IvrAlarmStatus property values as input parameters for procedure // cmd.AddWithValue("AlarmID" , AlarmID); cmd.AddWithValue("NotificationID", NotificationID); cmd.AddWithValue("StoreID", StoreID); // This stored procedure was change to an integer because on SQL 2000 the bit was being sent as a 'T' or an 'F' instead of a 1 or 0 //cmd.AddWithValue("IsSucceeded", Convert.ToInt32(IsSucceeded)); //call successed or not //Execute command CDAO.ExecReader(cmd); //Bind output values to IvrAlarmStatus object //if stored procedure returns a record, then it is either cleared,in-range, or in-process (call alert is not complete) if (CDAO.DataReader.Read()) { //if (CDAO.DataReader.HasRows) IsAlarmClearedOrBackInRange = true; } else { IsAlarmClearedOrBackInRange = false; } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } //return IvrAlarmStatus object return(this); }
protected override NotifyPopupAddressList LoadList(BaseCriteria criteria) { try { CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETNOTIFYPOPUPADDRESSLIST, System.Data.CommandType.StoredProcedure); cmd.AddWithValue("NotifyID", criteria.ID); //Execute command CDAO.ExecReader(cmd); while (CDAO.DataReader.Read()) { if (CDAO.DataReader["NetSendTo"].ToStr().Contains(";") == true) { string[] notifyPopupAddressEntries = CDAO.DataReader["NetSendTo"].ToStr().Split(';'); foreach (string notifyPopupAddressEntry in notifyPopupAddressEntries) { NotifyPopupAddress notifyPopupAddress = new NotifyPopupAddress(); notifyPopupAddress.NetSendTo = notifyPopupAddressEntry.Trim(); notifyPopupAddress.Name = CDAO.DataReader["Name"].ToStr().Trim(); this.Add(notifyPopupAddress); } } else if (CDAO.DataReader["NetSendTo"].ToStr().Contains(",") == true) { string[] notifyPopupAddressEntries = CDAO.DataReader["NetSendTo"].ToStr().Split(','); foreach (string notifyPopupAddressEntry in notifyPopupAddressEntries) { NotifyPopupAddress notifyPopupAddress = new NotifyPopupAddress(); notifyPopupAddress.NetSendTo = notifyPopupAddressEntry.Trim(); notifyPopupAddress.Name = CDAO.DataReader["Name"].ToStr().Trim(); this.Add(notifyPopupAddress); } } else { NotifyPopupAddress notifyPopupAddress = new NotifyPopupAddress(); notifyPopupAddress.NetSendTo = CDAO.DataReader["NetSendTo"].ToStr().Trim(); notifyPopupAddress.Name = CDAO.DataReader["Name"].ToStr().Trim(); this.Add(notifyPopupAddress); } } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
protected override NotificationProcessResume ExecuteCommand() { CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_DORESUMEPROCESS, System.Data.CommandType.StoredProcedure); cmd.AddWithValue("StoreID", StoreID); CDAO.ExecCommand(cmd); return(this); }
/// <summary> /// Record Notification /// </summary> /// <returns></returns> protected override RecordNotification ExecuteCommand() { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_RECORDNOTIFICATION, System.Data.CommandType.StoredProcedure); cmd.AddWithValue("NotificationID", NotificationID); cmd.AddWithValue("TransID", TransID); cmd.AddWithValue("Status", (int)Status); cmd.AddWithValue("LogText", LogText); cmd.AddWithValue("NotifyType", (int)this.NotifyType); //Execute command CDAO.ExecCommand(cmd); //Close the data reader. CDAO.CloseDataReader(); CDAO.Dispose(); //return filled object. return(this); }
protected override AlarmStatus ExecuteCommand() { try { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_ISALARMCLEARDORBACKINRANGE); //Bind IvrAlarmStatus property values as input parameters for procedure cmd.AddWithValue("NotificationID", NotificationID); cmd.AddWithValue("StoreID", StoreID); //Execute command CDAO.ExecReader(cmd); //Bind output values to IvrAlarmStatus object if (CDAO.DataReader.Read()) { IsAlarmClearedOrBackInRange = true; } else { IsAlarmClearedOrBackInRange = false; } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } //return IvrAlarmStatus object return(this); }
/// <summary> /// to fetch the notify id ,based on the notify profile id /// </summary> /// <returns></returns> protected override NotificationProfile ExecuteCommand() { try { CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETACTIVENOTIFICATIONS); cmd.AddWithValue("ProfileID", NotifyProfileID); cmd.AddWithValue("StoreID", StoreID); CDAO.ExecReader(cmd); if (CDAO.DataReader.Read()) { NotifyType = CDAO.DataReader["NotifyType"].ToInt(); EmailNotifyID = CDAO.DataReader["EmailNotifyID"].ToInt(); PagerNotifyID = CDAO.DataReader["PagerNotifyID"].ToInt(); MsgBoardNotifyID = CDAO.DataReader["MsgBoardNotifyID"].ToInt(); NetSendNotifyID = CDAO.DataReader["NetSendNotifyID"].ToInt(); SwitchNotifyID = CDAO.DataReader["SwitchNotifyID"].ToInt(); PagerPrompt = CDAO.DataReader["PagerPrompt"].ToStr(); SwitchBitMask = CDAO.DataReader["SwitchBitMask"].ToInt(); IVR_UserID = CDAO.DataReader["IVR_UserID"].ToInt(); IsAlertEnabled = CDAO.DataReader["IsAlertEnabled"].ToBoolean(); ProfileName = CDAO.DataReader["ProfileName"].ToStr(); SMSNotifyID = CDAO.DataReader.HasColumn("SMSNotifyID") ? CDAO.DataReader["SMSNotifyID"] != null ? CDAO.DataReader["SMSNotifyID"].ToInt() : 0 : 0; } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
protected override TTIvrNotifications ExecuteCommand() { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_IVR_RECORDIVRNOTIFICATION); //Add action parameter (C -Create), for insert new record in the database table cmd.AddWithValue("Action", Action); //Bind TTIVRNotifications entity property values as input parameters for procedure BindParams(cmd, this); //Execute command CDAO.ExecCommand(cmd); //Bind output values to TTIVRNotifications object this.RecID = Convert.ToInt32(CDAO.Parameters["RecID"].Value); this.TransID = Convert.ToInt32(CDAO.Parameters["TransID"].Value); this.PhoneNumber = CDAO.Parameters["PhoneNumber"].Value.ToStr(); this.isInProcess = Convert.ToInt16(CDAO.Parameters["isInProcess"].Value); //return TTIVRNotifications object return(this); }
protected override MissedCommInfo ExecuteCommand() { try { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETMISSEDCOMMSETTINGS); int storeID = ConfigurationManager.AppSettings["StoreID"].ToInt(); cmd.AddWithValue("StoreID", storeID); //Execute command CDAO.ExecReader(cmd); //Create new object to assign retrieved values. if (CDAO.DataReader.Read()) { this.StoreID = CDAO.DataReader["StoreID"].ToInt(); this.NotificationProfileID = CDAO.DataReader["NotificationProfileID"].ToInt(); this.SwitchBitmask = CDAO.DataReader["SwitchBitmask"].ToInt16(); this.PagerPrompt = CDAO.DataReader["PagerPrompt"].ToStr(); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } //return filled object. return(this); }
public void UpdateGenStoreValues() { GenStoreInfo genStoreInfo = null; try { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GENSTORES); int storeID = ConfigurationManager.AppSettings["StoreID"].ToInt(); cmd.AddWithValue("StoreID", storeID); //Execute command CDAO.ExecReader(cmd); //Create new object to assign retrieved values. if (CDAO.DataReader.Read()) { genStoreInfo = new GenStoreInfo { //JH - 10/22/15 //setting the StoreID value was causing issue on lines 54-59 of NotificationEligibility //StoreID = CDAO.DataReader["StoreID"].ToInt(), FromAddress = CDAO.DataReader["EmailFromAddress"].ToStr(), FromName = CDAO.DataReader["EmailFromName"].ToStr(), SmtpSendMethod = CDAO.DataReader["SMTPSendMethod"].ToInt(), SmtpAuthDomain = CDAO.DataReader["SMTPAuthDomain"].ToStr(), SmtpAuthPassword = CDAO.DataReader["SMTPAuthPass"].ToStr(), SmtpAuthUserName = CDAO.DataReader["SMTPAuthUser"].ToStr(), SmtpFlags = CDAO.DataReader["SMTPFlags"].ToInt(), SmtpPort = CDAO.DataReader["SMTPport"].ToInt(), SmtpServer = CDAO.DataReader["SMTPserver"].ToStr(), SNPPPort = CDAO.DataReader["SNPPPort"].ToInt(), SNPPServer = CDAO.DataReader["SNPPServer"].ToStr(), PagerComPort = CDAO.DataReader["PagerCOMport"].ToInt16(), ComPortInitStr = CDAO.DataReader["COMportInitString"].ToStr(), SMTPAuthMethod = CDAO.DataReader["SMTPAuthMethod"].ToStr(), //for Mobile SMS PIN1 = CDAO.DataReader["SMSPIN1"].ToStr(), PIN2 = CDAO.DataReader["SMSPIN2"].ToStr(), MobileCOMPort = CDAO.DataReader["SMSCOMPort"].ToStr(), MobileCOMSettings = CDAO.DataReader["SMSSettings"].ToStr(), SMSProviderServiceCenter = CDAO.DataReader["SMSServiceContactNo"].ToStr(), StoreName = CDAO.DataReader["StoreName"].ToStr(), StorePhoneNumber = CDAO.DataReader["Telephone"].ToStr(), FrequencyBand = CDAO.DataReader.HasColumn("FrequencyBand") ? CDAO.DataReader["FrequencyBand"] != null ? CDAO.DataReader["FrequencyBand"].ToStr() : string.Empty : string.Empty, CDYNE_ACCOUNT = CDAO.DataReader.HasColumn("IVRSvcAcctID") ? CDAO.DataReader["IVRSvcAcctID"] != null ? CDAO.DataReader["IVRSvcAcctID"].ToStr() : string.Empty : string.Empty }; } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } _GenStoreInfo = genStoreInfo; }
/// <summary> /// Gets all active IVR alarms. /// </summary> /// <param name="criteria"></param> /// <returns></returns> protected override IvrAlarmList LoadList(BaseCriteria criteria) { try { Criteria listCriteria = (Criteria)criteria; //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GET_IVRALARMLIST, System.Data.CommandType.StoredProcedure); cmd.AddWithValue("numAttempts", NumAttempts); //Execute reader CDAO.ExecReader(cmd); /*fill the object and add to list.*/ while (CDAO.DataReader.Read()) { IvrAlarm alarm = new IvrAlarm(); alarm.IVRPhoneNumber = CDAO.DataReader["PhoneNumber"].ToStr(); alarm.AlarmID = CDAO.DataReader["AlarmID"].ToInt(); alarm.IsSuccess = CDAO.DataReader["isSuccess"].ToBoolean(); alarm.NotificationID = CDAO.DataReader["Notification_RecID"].ToInt(); alarm.AttemptCount = CDAO.DataReader["numAttempts"].ToInt16(); alarm.QueueTime = TypeCommonExtensions.IfNull(CDAO.DataReader["QueueTime"], DateTime.UtcNow).ToDateTime(); alarm.LastAttemptTime = TypeCommonExtensions.IfNull(CDAO.DataReader["LastAttemptTime"], DateTime.UtcNow).ToDateTime(); alarm.IvrAlarmID = CDAO.DataReader["RecID"].ToInt(); alarm.UTID = CDAO.DataReader["UTID"].ToStr(); alarm.Probe = CDAO.DataReader["Probe"].ToInt(); alarm.SensorType = CDAO.DataReader["SensorType"].ToStr(); if (CDAO.DataReader["IVR_SensorName"] != DBNull.Value) { alarm.IVR_SensorName = CDAO.DataReader["IVR_SensorName"].ToStr(); } else { alarm.IVR_SensorName = (CDAO.DataReader["PuckName"].ToStr() == string.Empty ? "Sensor" : CDAO.DataReader["PuckName"].ToStr()); } alarm.Value = CDAO.DataReader["AlarmData"].ToDecimal(); alarm.AlarmMaxValue = CDAO.DataReader["CondMaxValue"].ToDecimal(); alarm.AlarmMinValue = CDAO.DataReader["CondMinValue"].ToDecimal(); alarm.CondThresholdMins = CDAO.DataReader["CondThresholdMins"].ToInt(); alarm.AlarmTime = TypeCommonExtensions.IfNull(CDAO.DataReader["AlarmTime"], DateTime.UtcNow).ToDateTime(); alarm.IVRUserID = CDAO.DataReader["UserID"].ToInt(); alarm.PersonName = CDAO.DataReader["FirstName"].ToString() + " " + CDAO.DataReader["LastName"].ToString(); alarm.LanguageID = (CDAO.DataReader["LanguageID"].ToInt() == 0 ? 1 : CDAO.DataReader["LanguageID"].ToInt()); alarm.IsCelsius = CDAO.DataReader["isCelsius"].ToBoolean(); alarm.StoreName = GenStoreInfo.GetInstance().StoreName; alarm.IvrID = CDAO.DataReader["RecID"].ToInt(); alarm.StoreNumber = GenStoreInfo.GetInstance().StorePhoneNumber.ToString(); alarm.AlarmStartTime = TypeCommonExtensions.IfNull(CDAO.DataReader["AlarmStartTime"], DateTime.UtcNow).ToDateTime(); //if (alarm.AlarmID > 0) this.Add(alarm); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } return(this); }
/// <summary> /// Gets Email Body /// </summary> /// <returns></returns> protected override EmailBody ExecuteCommand() { try { //Initialize the CSqlDbCommand for execute the stored procedure CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.SP_TTNOTIFY_EMAILBODY); cmd.AddWithValue("emailFormat", EmailFormat); cmd.AddWithValue("UTID", UTID); cmd.AddWithValue("Probe", Probe); //cmd.AddWithValue("logTime", LogTime); if (LogTime.HasValue == true) { cmd.AddWithValue("logTime", ((DateTime)LogTime).ToString("yyyy-MM-dd HH:mm:ss")); } else { cmd.AddWithValue("logTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); } cmd.AddWithValue("tzOffset", TzOffset); cmd.AddWithValue("SensorReading", SensorReading); if (AlarmStartTime.HasValue == true) { cmd.AddWithValue("AlarmStartTime", ((DateTime)AlarmStartTime).ToString("yyyy-MM-dd HH:mm:ss")); } else { cmd.AddWithValue("AlarmStartTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); } cmd.AddWithValue("AlarmProfileRecID", AlarmProfileRecID); cmd.AddWithValue("ThresholdMins", ThresholdMins); cmd.AddWithValue("CondThresholdMins", CondThresholdMins); cmd.AddWithValue("CondMinValue", CondMinValue); cmd.AddWithValue("CondMaxValue", CondMaxValue); cmd.AddWithValue("IncludeHistory", IncludeHistory); cmd.AddWithValue("ValuesUOM", ValuesUOM); cmd.AddWithValue("HTMLlink", HTMLlink); cmd.AddWithValue("Severity", (int)Severity); //Execute command CDAO.ExecReader(cmd); //Create new object to assign retrieved values. while (CDAO.DataReader.Read()) { this.Body = this.Body + CDAO.DataReader[0].ToStr(); CDAO.DataReader.NextResult(); } } catch { throw; } finally { CDAO.CloseDataReader(); CDAO.Dispose(); } //return filled object. return(this); }