public override Operator LogIn(string userName, string password) { using (LCSKDbDataContext db = new LCSKDbDataContext(connectionString)) { var entity = db.LiveChat_Operators.SingleOrDefault(x => x.OperatorName == userName && x.OperatorPassword == password); if (entity == null) return null; Operator op = new Operator(); op.Department = entity.Department; op.Email = entity.OperatorEmail; op.IsOnline = entity.IsOnline; op.OperatorId = entity.OperatorID; op.OperatorName = entity.OperatorName; op.Password = entity.OperatorPassword; return op; } }
public abstract bool Delete(Operator op);
public abstract bool Save(Operator op);
public List<ChatRequest> GetChatRequests(Guid key, Operator op) { if (!IsAuthenticated(key)) throw new Exception("The key is not authenticated"); return OperatorService.GetChatRequests(op.OperatorId, op.DepartmentList()); }
public bool Delete(Guid key, Operator op) { if (!IsAuthenticated(key)) throw new Exception("The key is not authenticated"); return OperatorService.Delete(op); }
public override bool Delete(Operator op) { using (LCSKDbDataContext db = new LCSKDbDataContext(connectionString)) { db.LiveChat_Operators.DeleteAllOnSubmit(db.LiveChat_Operators.Where(x => x.OperatorID == op.OperatorId)); db.SubmitChanges(); return true; } }
public override bool Save(Operator op) { using (LCSKDbDataContext db = new LCSKDbDataContext(connectionString)) { var entity = db.LiveChat_Operators.SingleOrDefault(x => x.OperatorID == op.OperatorId); if (entity == null) { entity = new LiveChat_Operator(); db.LiveChat_Operators.InsertOnSubmit(entity); } entity.Department = op.Department; entity.OperatorEmail = op.Email; entity.OperatorName = op.OperatorName; entity.OperatorPassword = op.Password.Length == 0 ? entity.OperatorPassword : op.Password; db.SubmitChanges(); return true; } }
public static bool Save(Operator op) { // Load the provider LoadProvider(); return _provider.Save(op); }