Пример #1
0
        private static DateTime GetLastVisitDate(ReturnVisitDataItem r)
        {
            DateTime lv = SqlCeConstants.DateTimeMinValue;

            try {
                RvPreviousVisitData[] x = RvPreviousVisitsDataInterface.GetPreviousVisits(r.ItemId, SortOrder.DateNewestToOldest);
                if (x.Any())
                {
                    lv = x.First().Date;
                }
            } catch (Exception) { }
            return(lv);
        }
Пример #2
0
        /// <summary>
        /// Deletes the return visit.
        /// </summary>
        /// <param name="itemId">The item id.</param>
        public static bool DeleteReturnVisit(int itemId, bool deleteCalls)
        {
            using (var db = new ReturnVisitDataContext(ReturnVisitDataContext.DBConnectionString)) {
                try {
                    ReturnVisitDataItem rv = db.ReturnVisitItems.Single(s => s.ItemId == itemId);

                    db.ReturnVisitItems.DeleteOnSubmit(rv);
                    db.SubmitChanges();
                    if (deleteCalls)
                    {
                        return(RvPreviousVisitsDataInterface.DeleteAllCallsFromRv(itemId));
                    }
                    return(true);
                } catch (InvalidOperationException) { return(false); }
            }
        }