예제 #1
0
파일: SMS.cs 프로젝트: sanadsa/Cellular
 public SMS(int lineId, DateTime month, string destinationNum, eCallTo callTo)
 {
     LineID         = lineId;
     Month          = month;
     DestinationNum = destinationNum;
     CallTo         = callTo;
 }
예제 #2
0
 /// <summary>
 /// add sms to line in selected day
 /// </summary>
 public SMS SimulateSms(int lineId, DateTime month, string destinationNum, eCallTo callTo)
 {
     try
     {
         using (var client = new HttpClient())
         {
             client.BaseAddress = new Uri(url);
             var    sms    = new SMS(lineId, month, destinationNum, callTo);
             string json   = JsonConvert.SerializeObject(sms);
             var    result = client.PostAsync("api/crm/sms", new StringContent(json, System.Text.Encoding.UTF8, "application/json")).Result;
             if (result.IsSuccessStatusCode)
             {
                 string response = result.Content.ReadAsStringAsync().Result;
                 return(JsonConvert.DeserializeObject <SMS>(response));
             }
             else
             {
                 throw new Exception(result.Content.ReadAsStringAsync().Result);
             }
         }
     }
     catch (Exception e)
     {
         log.LogWrite("Add sms error: " + e.Message);
         throw new Exception("Add sms exception: " + e.Message);
     }
 }
예제 #3
0
 public Call(int lineId, double duration, DateTime month, string destination, eCallTo callTo)
 {
     LineID         = lineId;
     Duration       = duration;
     Month          = month;
     DestinationNum = destination;
     CallTo         = callTo;
 }
        public string MakeCall(eCallTo callTo, string name, string phoneNumber)
        {
            try
            {
                if (!string.IsNullOrEmpty(this.AccountCode))
                {
                    //    string MyConString = "";
                    using (MySqlConnection connection = new MySqlConnection("SERVER=db1.247365isp.net;DATABASE=taxi_autocall;UID=taxi_autocall;PASSWORD=taxi_autocall__991_;"))
                    {
                        MySqlCommand command = connection.CreateCommand();
                        command.CommandText = "INSERT INTO call_queue (`dialout_number`,`accountcode`,`callerid`) VALUES ('" + phoneNumber + "','" + this.AccountCode + "','" + this.CallerNumber + "')";

                        //   command.CommandText = "INSERT INTO call_queue (`dialout_number`,`accountcode`) VALUES ('07411330306','781123');";
                        if (connection.State == ConnectionState.Open)
                        {
                            connection.Close();
                        }

                        connection.Open();
                        int row = command.ExecuteNonQuery();

                        connection.Close();
                    }

                    (new Taxi_Model.TaxiDataContext()).stp_InsertRingBackLog(name, General.GetCLIFirstExtensions().ToStr().Trim(), phoneNumber, callTo == eCallTo.Customer ? true : false);


                    if (callTo == eCallTo.Driver)
                    {
                        return("<html><b><span><color=Blue>Driver No : " + name + Environment.NewLine + "Phone No : " + phoneNumber + "</span></b></html>");
                    }
                    else
                    {
                        return("<html><b><span><color=Blue>Customer Name : " + name + Environment.NewLine + "Phone No : " + phoneNumber + "</span></b></html>");
                    }
                }
                else
                {
                    return("<html><b><span><color=Blue>CALL FAILED : " + Environment.NewLine + "Account Code is not specified</span></b></html>");
                }
            }
            catch (MySqlException ex)
            {
                return("<html><b><span><color=Blue>CALL FAILED :" + Environment.NewLine + "Name : " + name + "(" + phoneNumber + ")" + Environment.NewLine + "Reason : " + ex.Message + "</span></b></html>");
            }
        }