public static SmsResponseModel SendSmsDailyReport(ReportResponseModelWithContacts reportResponseModelWithContacts) { //msg = "Sravani Janapally Date : 11 Dec 2015 In Time : 8:26: AM Out Time : 3:08: PM" var msg = string.Format("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}", reportResponseModelWithContacts.Name, "'s Attendance for", " Date : ", reportResponseModelWithContacts.AttendanceDate, ",", " In Time : ", reportResponseModelWithContacts.InTime, ",", " Out Time : ", reportResponseModelWithContacts.OutTime); string smsUrl = String.Format("{0}&from={1}&to={2}&msg={3}", WebConfigurationManager.AppSettings["BulkSMSBaseUrl"], "SCHOOL", "9063713741", msg); var client = new WebClient(); var response = client.DownloadString(smsUrl); var status = "Failure"; if (!string.IsNullOrEmpty(response) && response.IsNumeric()) { status = "Success"; } return(new SmsResponseModel { Response = response, SmsUrl = smsUrl, Status = status }); }
public static List <ReportResponseModelWithContacts> GetAttendanceReportWithContacts(ReportRequestModel requestModel) { DataSet ds = new DataSet("TimeRanges"); var reportResponseModel = new ReportResponseModel(); var reportResponseModelWithContactsList = new List <ReportResponseModelWithContacts>(); //var reportResponseModelWithContacts = new ReportResponseModelWithContacts(); using (var con = new SqlConnection(ConnectionString)) { con.Open(); var sqlComm = new SqlCommand("GetAttendanceReportWithContacts", con) { CommandType = CommandType.StoredProcedure }; sqlComm.Parameters.AddWithValue("@name", requestModel.Name); sqlComm.Parameters.AddWithValue("@class", requestModel.StudentClass); sqlComm.Parameters.AddWithValue("@section", requestModel.Section); sqlComm.Parameters.AddWithValue("@fromDate", requestModel.DtFrom); sqlComm.Parameters.AddWithValue("@toDate", requestModel.DtTo); sqlComm.Parameters.AddWithValue("@category", requestModel.Category); SqlDataAdapter da = new SqlDataAdapter { SelectCommand = sqlComm }; da.Fill(ds); //sqlComm.ExecuteReader(); sqlComm.ExecuteNonQuery(); con.Close(); if (ds.Tables.Count > 0) { reportResponseModel.Rows = new List <Row>(); foreach (DataRow dataRow in ds.Tables[0].Rows) { var reportResponseModelWithContacts = new ReportResponseModelWithContacts { Name = dataRow[0].ToString(), Class = dataRow[1].ToString(), Section = dataRow[2].ToString(), Gender = dataRow[3].ToString(), RFID = dataRow[4].ToString(), AttendanceDate = dataRow[5].ToString(), InTime = dataRow[6].ToString(), OutTime = dataRow[7].ToString(), Duration = dataRow[8].ToString(), UserName = dataRow[9].ToString(), PhoneNumber = dataRow[10].ToString() }; reportResponseModelWithContactsList.Add(reportResponseModelWithContacts); } } } return(reportResponseModelWithContactsList); }