public static void SmsAlarm(string number)
        {
            //var skype = new SKYPE4COMLib.Skype();
            //skype.Timeout = 120 * 1000;

            if (number.Length == 10)
            {
                number = "+90" + number;
            }
            else if (number.Length == 11)
            {
                number = "+9" + number;
            }

            //var smsType = SKYPE4COMLib.TSmsMessageType.smsMessageTypeOutgoing;
            //var message = skype.CreateSms(smsType, number);
            //message.Body = "Acil Durum:Evimde birileri var";
            //message.Send();
            AlertRequest request = new AlertRequest();

            request.AlarmNumber    = number;
            request.AlarmParameter = string.Empty;
            request.AlarmType      = "SmsAlarm";
            request.IsAlerted      = false;
            request.Insert();
        }
        public static void PanicSms(string number, string adres)
        {
            //var skype = new SKYPE4COMLib.Skype();
            //skype.Timeout = 120 * 1000;

            if (number.Length == 10)
            {
                number = "+90" + number;
            }
            else if (number.Length == 11)
            {
                number = "+9" + number;
            }

            //var smsType = SKYPE4COMLib.TSmsMessageType.smsMessageTypeOutgoing;
            //var message = skype.CreateSms(smsType, number);
            //message.Body = "Acil Durum! Güvende olmadığımı hissediyorum.Konum:"+adres;
            //message.Send();
            AlertRequest request = new AlertRequest();

            request.AlarmNumber    = number;
            request.AlarmParameter = adres;
            request.AlarmType      = "PanicSms";
            request.IsAlerted      = false;
            request.Insert();
        }
        public List <AlertRequest> GetNonCompletedAlarms()
        {
            var connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            var commandString    = "SELECT * FROM AlertRequest WHERE IsAlerted=0";

            var items = new List <AlertRequest>();

            using (var con = new SqlConnection(connectionString))
            {
                con.Open();
                using (var cmd = new SqlCommand(commandString, con))
                {
                    var dr = cmd.ExecuteReader();

                    while (dr.Read())
                    {
                        AlertRequest item = new AlertRequest();
                        item.AlarmNumber    = dr["AlarmNumber"] != DBNull.Value ? dr["AlarmNumber"].ToString():string.Empty;
                        item.AlarmParameter = dr["AlarmParameter"] != DBNull.Value ? dr["AlarmParameter"].ToString() : string.Empty;
                        item.AlarmRequestId = Convert.ToInt32(dr["AlarmRequestId"]);
                        item.AlarmType      = dr["AlarmType"] != DBNull.Value ? dr["AlarmType"].ToString() : string.Empty;

                        items.Add(item);
                    }
                }
            }
            return(items);
        }
        public static void CallAlarm(string number)
        {
            //Skype skype;
            //skype = new SKYPE4COMLib.Skype();
            if (number.Length == 10)
            {
                number = "+90" + number;
            }
            else if (number.Length == 11)
            {
                number = "+9" + number;
            }
            AlertRequest request = new AlertRequest();

            request.AlarmNumber    = number;
            request.AlarmParameter = string.Empty;
            request.AlarmType      = "CallAlarm";
            request.IsAlerted      = false;
            request.Insert();

            //Call call = skype.PlaceCall(number);
        }