public object Register(string phone, string code, string token, string createdDate) { DataTable result = DALServicesM.Register(phone, code, token, createdDate); if (result == null) { return(null); } if (result.Columns.Count > 1) { User user = new User { UserID = int.Parse(result.Rows[0]["UserID"].ToString()), Phone = result.Rows[0]["Phone"].ToString(), Code = result.Rows[0]["Code"].ToString(), Token = result.Rows[0]["Token"].ToString(), CreatedDate = result.Rows[0]["CreatedDate"].ToString(), }; return(new JavaScriptSerializer().Serialize(user)); } var error = new { Error = result.Rows[0][0].ToString() }; return(new JavaScriptSerializer().Serialize(error)); }
public object Login(string id, string code) { DataTable result = DALServicesM.Login(id, code); if (result == null) { return(null); } if (result.Columns.Count > 1) { User user = new User { UserID = int.Parse(result.Rows[0]["UserID"].ToString()), Phone = result.Rows[0]["Phone"].ToString(), Code = result.Rows[0]["Code"].ToString(), Token = result.Rows[0]["Token"].ToString(), CreatedDate = result.Rows[0]["CreatedDate"].ToString(), }; return(new JavaScriptSerializer().Serialize(user)); } var error = new { Error = "something went wrong" }; return(new JavaScriptSerializer().Serialize(error)); }
public object InsertReport(int userId, int reportTypeId, string reportDate, string reportTime, string lat, string lon, int isVictim, string reportInfo) { DataTable result = DALServicesM.InsertReport(userId, reportTypeId, reportDate, reportTime, lat, lon, isVictim, reportInfo); if (result == null) { return(null); } if (result.Columns.Count > 1) { Report report = new Report { ReportID = int.Parse(result.Rows[0]["ReportID"].ToString()), UserID = int.Parse(result.Rows[0]["UserID"].ToString()), ReportTypeID = int.Parse(result.Rows[0]["ReportTypeID"].ToString()), ReportDate = result.Rows[0]["ReportDate"].ToString(), ReportTime = result.Rows[0]["ReportTime"].ToString(), Latitude = result.Rows[0]["Latitude"].ToString(), Longitude = result.Rows[0]["Longitude"].ToString(), IsVictim = bool.Parse(result.Rows[0]["IsVictim"].ToString()), ReportInfo = result.Rows[0]["ReportInfo"].ToString(), ReportStatus = (ReportStatus)Enum.Parse(typeof(ReportStatus), result.Rows[0]["ReportStatus"].ToString()), }; return(new JavaScriptSerializer().Serialize(report)); } var error = new { Error = result.Rows[0][0].ToString() }; return(new JavaScriptSerializer().Serialize(error)); }
public object GetDailyReportsByLocation(string lat1, string lon1) { DataTable table = DALServicesM.GetDailyReportsByLocation(lat1, lon1); List <DailyReport> report = null; double lat2, lon2; if (table.Columns.Count <= 1) { var error = new { Error = table.Rows[0][0].ToString() }; return(new JavaScriptSerializer().Serialize(error)); } foreach (DataRow row in table.Rows) { lat2 = double.Parse(row["Latitude"].ToString()); lon2 = double.Parse(row["Longitude"].ToString()); if (IsDiffBetweenTwoGivenPointsLessThanRadiusToCheck(double.Parse(lat1), double.Parse(lon1), lat2, lon2)) { if (report == null) { report = new List <DailyReport>(); } report.Add(new DailyReport() { ID = int.Parse(row["ReportID"].ToString()), TypeID = int.Parse(row["ReportTypeID"].ToString()), TypeName = row["TypeName"].ToString(), Date = row["ReportDate"].ToString(), Time = row["ReportTime"].ToString(), Latitude = lat2, Longitude = lon2, Info = row["ReportInfo"].ToString(), ReportStatus = (ReportStatus)Enum.Parse(typeof(ReportStatus), row["ReportStatus"].ToString()), }); } } return(new JavaScriptSerializer().Serialize(report)); }
public static string GetDTBAdmin() { List <Admin> a = DALServicesM.GetDTBAdmin(); return(new JavaScriptSerializer().Serialize(a)); }
public static string GetReportTypes() { List <ReportType> reportTypes = DALServicesM.GetReportTypes(); return(new JavaScriptSerializer().Serialize(reportTypes)); }
public static string GetDTBReports() { List <Report> report = DALServicesM.GetDTBReports(); return(new JavaScriptSerializer().Serialize(report)); }
public static string GetDTBUser() { List <User> user = DALServicesM.GetDTBUser(); return(new JavaScriptSerializer().Serialize(user)); }
public static string DeleteUser(int userId, string phone) { string msg = DALServicesM.DeleteUser(userId, phone); return(new JavaScriptSerializer().Serialize(msg)); }
public static string UpdateUser(int userId, string phone, string code) { User user = DALServicesM.UpdateUser(userId, phone, code); return(new JavaScriptSerializer().Serialize(user)); }
public static string UserLogin(string phone, string code) { User u = DALServicesM.UserLogin(phone, code); return(new JavaScriptSerializer().Serialize(u)); }
public static string InsertUser(string phone, string code, string token, string createdDate) { string retStr = DALServicesM.InsertUser(phone, code, token, createdDate); return(new JavaScriptSerializer().Serialize(retStr)); }
public static string DeleteAdmin(int adminId, string username) { string response = DALServicesM.DeleteAdmin(adminId, username); return(new JavaScriptSerializer().Serialize(response)); }
public static string UpdateAdmin(int adminId, string username, string password) { Admin admin = DALServicesM.UpdateAdmin(adminId, username, password); return(new JavaScriptSerializer().Serialize(admin)); }
public static string InsertAdmin(string username, string password) { Admin admin = DALServicesM.InsertAdmin(username, password); return(new JavaScriptSerializer().Serialize(admin)); }
public static Admin AdminLogin(string username, string password) { Admin a = DALServicesM.AdminLogin(username, password); return(a); }
public static void UpdatePushNotificationToken(string phone, string token) { DALServicesM.UpdatePushNotificationToken(phone, token); }