public void AddFillRectangle(FillArea rect) { if (!FillRectExists(rect)) { HttpDataClient.Default.AddFillRectangle(rect); //HttpDataAccess.AddFillRectangle(rect); } }
public void UpdateFillRectangle(FillArea area) { }
public bool FillRectExists(FillArea area) { return FillRectExists(new FillArea[] { area }).FirstOrDefault(); }
public bool[] FillRectExists(FillArea[] areas) { var result = new bool[] { }; using (var dc = alphaEntities.New()) { var cmpIds = areas.Select(a => a.FKOperatorID).Distinct().ToArray(); var rectangles = dc.import_rectangle.Where(r => cmpIds.Contains((int)r.companyId)).ToArray(); result = areas.Select( area => rectangles.Any(rect => (int)rect.companyId == area.FKOperatorID && rect.height == area.Height && rect.width == area.Width && rect.type == area.Type && rect.x1 == area.X1 && rect.x2 == area.X2 && rect.y1 == area.Y1 && rect.y2 == area.Y2) ).ToArray(); } return result; }
public void AddFillRectangle(FillArea rect) { bool wasException = false; var logSession = Helpers.Old.Log.SessionStart(string.Format("HttpDataClient.AddFillRectangle(operator:'{0}')", rect.FKOperatorID), true); try { var strRequest = GetLoginPasswordCouple() + "&company[0]=" + rect.FKOperatorID + "&data[0][height]=" + rect.Height + "&data[0][type]=" + rect.Type + "&data[0][width]=" + rect.Width + "&data[0][x1]=" + rect.X1 + "&data[0][x2]=" + rect.X2 + "&data[0][y1]=" + rect.Y1 + "&data[0][y2]=" + rect.Y2; Helpers.Old.Log.Add(logSession, "Client query: " + strRequest.Replace(UserPassword, "*")); var result = Post(GetUrl(PathAddFillRectangle), Uri.EscapeUriString(strRequest), Cookies, Proxy); Helpers.Old.Log.Add(logSession, "Server answer: " + result); if (result == "error") { throw new InvalidDataException("Сервер сообщает об ошибке"); } } catch (Exception ex) { wasException = true; Helpers.Old.Log.Add(logSession, ex.GetExceptionText()); throw ex; } finally { Helpers.Old.Log.SessionEnd(logSession, wasException || IsWebDebug); } }