Ejemplo n.º 1
0
        // delete with EF context stored procedure
        private bool delete_sitetype_dependants(long typeId)
        {
            // sp_typeId wll do delete type and depandants( rate, place, coord )
            DataContext contextForProcedure = new DataContext();

            ObjectParameter success = new ObjectParameter("success", typeof(bool));
            ObjectParameter errMsg = new ObjectParameter("errMsg", typeof(string));

            ObjectResult<sp_delete_sitetype_dependants_Result> rslt = contextForProcedure.sp_delete_sitetype_dependants(typeId, success, errMsg);
            rslt.ToList();

            // can pass errMsg to html, if error condition
            success.Value.GetType();

            return Convert.ToBoolean(success.Value);
        }
Ejemplo n.º 2
0
        // save with EF context procedure : not currently used
        private bool saveCoordinatesWithProcedure()
        {
            DataContext contextForProcedure = new DataContext();
            contextForProcedure.Configuration.AutoDetectChangesEnabled = false;
            Polygons poly = Polygons.GetInstance();

            for (int i = 0; i < poly.Coords.Count; i++)
            {
                ObjectParameter success = new ObjectParameter("success", typeof(bool));
                ObjectParameter errMsg = new ObjectParameter("errMsg", typeof(string));

                //ObjectResult<sp_insert_coordinates_Result> rslt = contextForProcedure.sp_insert_coordinates(poly.Coords[i].eventId,
                //    (int)poly.Coords[i].placeId, poly.Coords[i].seqCoordinate, poly.Coords[i].y, poly.Coords[i].x,
                //    success, errMsg);

                //rslt.Dispose();
                //rslt.ToList();
                if (Convert.ToBoolean(success.Value) == true)
                    return false;
            }

            contextForProcedure.Configuration.AutoDetectChangesEnabled = false;

            return true;
        }
Ejemplo n.º 3
0
        // delete with EF context stored procedure
        public bool DeleteEventObjects(int eventId)
        {
            // sp_reset_event_derivatives wll do clear event related tables
            DataContext contextForProcedure = new DataContext();

            ObjectParameter success = new ObjectParameter("success", typeof(bool));
            ObjectParameter errMsg = new ObjectParameter("errMsg", typeof(string));

            ObjectResult<sp_reset_event_derivatives_Result> rslt = contextForProcedure.sp_reset_event_derivatives(eventId, success, errMsg);
            rslt.ToList();

            // can pass errMsg to html, if error condition
            success.Value.GetType();

            return Convert.ToBoolean(success.Value);
        }