public DeviceUser AddDeviceUser(DeviceUser ins) { DeviceUserRepository devurep = new DeviceUserRepository(); DeviceUser ins2 = devurep.InsertDeviceUser(ins); return ins2; }
public bool CheckDeviceUserRegistration(string DeviceId, string Phone, string Client, string Password) { DeviceUserRepository devurep = new DeviceUserRepository(); DeviceUser checkMe = devurep.GetDeviceUser(Phone, Client); if (checkMe.DeviceUserId == 0) { return false; } else { return true; } }
public string CheckDeviceUserLogin(string Phone, string Client, string Password) { DeviceUserRepository devurep = new DeviceUserRepository(); DeviceUser checkMe = devurep.GetDeviceUser(Phone, Client); StringBuilder w = new StringBuilder(); if (checkMe.Approved) { if (checkMe.Password.Equals(Password)) { w.Append("0#").Append(checkMe.DeviceUserId); return w.ToString(); ; //... Success } else { return "1"; //... Incorrect Password } } else { return "2"; //... Not Approved } }
public ActionResult RequestService(int DeviceUserId, string ServiceRequest, string Query) { DeviceUserRepository DevURep = new DeviceUserRepository(); ServicesRepository ServRep = new ServicesRepository(); Services service = new Services(); DeviceUser user = DevURep.GetDeviceUser(DeviceUserId); service.ClientId = user.ClientId; service.DeviceUserId = DeviceUserId; service.Service = ServiceRequest; service.Query = Query; service.ModifiedDate = DateTime.Now; StringBuilder w = new StringBuilder(); w.Append(user.Name).Append(" ").Append(user.Surname).Append("\n"); w.Append("Address: ").Append(user.Address).Append("\n"); w.Append("Contact Details: Phone - ").Append(user.Phone).Append(" Email - ").Append(user.Email).Append("\n"); w.Append("Request: ").Append(service.Service); w.Append("\n").Append(service.Query); Services ins = ServRep.AddServices(service); if (ins.ServiceId != 0) { //Send email Functions f = new Functions(); //Get Client Service Mail List List<Settings> mails = setRep.GetSettings("email", user.ClientId); if (mails.Count >= 1) { StringBuilder maillist = new StringBuilder(); foreach (Settings setting in mails) { maillist.Append(setting.Value).Append(","); } maillist.Remove(maillist.Length - 1, 1); f.SendEmail(w.ToString(), maillist.ToString(), service.Service); } return Content("Success", "text/html"); } else { return Content("Fail", "text/html"); } }