Ejemplo n.º 1
1
 public static long ConvertDateTimeToTimeSpan(Nullable<DateTime> dt)
 {
     if (dt == null) return 0; 
     TimeSpan ts = dt.Value.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);  
     long timeSpan = Convert.ToInt64(ts.TotalMilliseconds);
     return timeSpan;
 }
Ejemplo n.º 2
1
 /// <summary>Draws a rectangle.</summary>
 /// <param name="texture">The texture, or a null reference.</param>
 /// <param name="point">The top-left coordinates in pixels.</param>
 /// <param name="size">The size in pixels.</param>
 /// <param name="color">The color, or a null reference.</param>
 internal static void DrawRectangle(Textures.Texture texture, Point point, Size size, Nullable<Color128> color)
 {
     // TODO: Remove Nullable<T> from color once RenderOverlayTexture and RenderOverlaySolid are fully replaced.
     if (texture == null || !Textures.LoadTexture(texture, Textures.OpenGlTextureWrapMode.ClampClamp)) {
         Gl.glDisable(Gl.GL_TEXTURE_2D);
         if (color.HasValue) {
             Gl.glColor4d(color.Value.R, color.Value.G, color.Value.B, color.Value.A);
         }
         Gl.glBegin(Gl.GL_QUADS);
         Gl.glVertex2d(point.X, point.Y);
         Gl.glVertex2d(point.X + size.Width, point.Y);
         Gl.glVertex2d(point.X + size.Width, point.Y + size.Height);
         Gl.glVertex2d(point.X, point.Y + size.Height);
         Gl.glEnd();
     } else {
         Gl.glEnable(Gl.GL_TEXTURE_2D);
         Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture.OpenGlTextures[(int)Textures.OpenGlTextureWrapMode.ClampClamp].Name);
         if (color.HasValue) {
             Gl.glColor4d(color.Value.R, color.Value.G, color.Value.B, color.Value.A);
         }
         Gl.glBegin(Gl.GL_QUADS);
         Gl.glTexCoord2f(0.0f, 0.0f);
         Gl.glVertex2d(point.X, point.Y);
         Gl.glTexCoord2f(1.0f, 0.0f);
         Gl.glVertex2d(point.X + size.Width, point.Y);
         Gl.glTexCoord2f(1.0f, 1.0f);
         Gl.glVertex2d(point.X + size.Width, point.Y + size.Height);
         Gl.glTexCoord2f(0.0f, 1.0f);
         Gl.glVertex2d(point.X, point.Y + size.Height);
         Gl.glEnd();
     }
 }
Ejemplo n.º 3
1
        // CRUD FUNCTION
        // ADD NEW ITEM USING AJAX
        public int AddData(string Name, Nullable<int> UOM, string Remarks, string BarCode,
            Nullable<bool> WithSerial, Nullable<int> Reorder, string Code, Nullable<int> G230, Nullable<int> G233, Nullable<int> G234, 
            string Model)
        {
            var allItem = from m in db.PDs select m;
            if (allItem.Any(c => c.Name.ToLower().Equals(Name.ToLower())))
            {
                Response.Write("Item with the name '" + Name + "' already exists");
                Response.StatusCode = 404;
                Response.End();
                return -1;
            }

            var pushPDS = new PD();
            pushPDS.Name = Name;
            pushPDS.UOM = UOM;
            pushPDS.Remarks = Remarks;
            pushPDS.BarCode = BarCode;
            pushPDS.WithSerial = WithSerial;
            pushPDS.Reorder = Reorder;
            pushPDS.Code = Code;
            pushPDS.G230 = G230;
            pushPDS.G233 = G233;
            pushPDS.G234 = G234;
            pushPDS.Model = Model;

            db.PDs.InsertOnSubmit(pushPDS);
            db.SubmitChanges();

            //Response.End();
            return pushPDS.ID;
        }
Ejemplo n.º 4
1
    public bool PosTest2()
    {
        bool retVal = true;

        const string c_TEST_DESC = "PosTest2: Verify the Nullable object's HasValue is false";
        const string c_TEST_ID = "P002";

        int? nullObj = new Nullable<int>();

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);

        try
        {
            if (nullObj.HasValue)
            {
                string errorDesc = "value is not false as expected: Actual(true)";
                TestLibrary.TestFramework.LogError("003 " + "TestID_" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004 " + "TestID_" + c_TEST_ID, "Unexpected exception: " + e );
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
Ejemplo n.º 5
1
    public bool PosTest1()
    {
        bool retVal = true;

        const string c_TEST_DESC = "PosTest1: Verify the Nullable object's HasValue is true";
        const string c_TEST_ID = "P001";

        int value = TestLibrary.Generator.GetInt32(-55);
        int? nullObj = new Nullable<int>(value);

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);

        try
        {
            if (!nullObj.HasValue)
            {
                string errorDesc = "value is not true as expected: Actual(false)";
                errorDesc += "\n value is " + value;
                TestLibrary.TestFramework.LogError("001 " + "TestID_" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002 " + "TestID_" + c_TEST_ID, "Unexpected exception: " + e + "\n value is " + value);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
 /// <summary>
 /// Sets the optional default values.
 /// </summary>
 /// <param name="shouldSet">if set to <c>true</c>, optional default values will be set.</param>
 public void SetDefaultValues(bool shouldSet)
 {
     if (shouldSet)
     {
         if (!this._isNCubeUniverse.HasValue) this._isNCubeUniverse = true;
     }
 }
 public void FacebookLogin()
 {
     fbWebContext = FacebookWebContext.Current; //get facebook session
     if (FacebookWebContext.Current.Session != null)
     {
         var app = new FacebookWebClient();
         var me = (IDictionary<string, object>)app.Get("me");   // get own information
         _FacebookUid = fbWebContext.UserId ;                // get own user id
         try
         {
             string fbName = (string)me["first_name"] + " " + (string)me["last_name"]; // get first name and last name
             if (OnFacebookLogin(fbName))
             {
                 SaveSessionInDB();
                 return;
             }
             else
             {
                 string notice = string.Format("<h2>Welcome, {0}.</h2>" +
                     "<h3>Login here to connect your Facebook login to your account<br/>" +
                     "Or sign-up to create full account, connected with your Facebook credentials</h3>", fbName);
             }
         }
         catch (Exception ex)
         {
         }
     }
 }
Ejemplo n.º 8
1
        public int AddNew(Guid PageGuid, string MetaKeywords, string MetaDesc, string Title, string ContentHtml, string TemplatePath, string ReleasePath, int Hits, Nullable<DateTime> DateCreated)
        {
            DbCommand command = DbProviderHelper.CreateCommand("INSERTPage",CommandType.StoredProcedure);
            command.Parameters.Add(DbProviderHelper.CreateParameter("@PageGuid",DbType.Guid,PageGuid));
            if (MetaKeywords!=null)
                command.Parameters.Add(DbProviderHelper.CreateParameter("@MetaKeywords",DbType.String,MetaKeywords));
            else
                command.Parameters.Add(DbProviderHelper.CreateParameter("@MetaKeywords",DbType.String,DBNull.Value));
            if (MetaDesc!=null)
                command.Parameters.Add(DbProviderHelper.CreateParameter("@MetaDesc",DbType.String,MetaDesc));
            else
                command.Parameters.Add(DbProviderHelper.CreateParameter("@MetaDesc",DbType.String,DBNull.Value));
            command.Parameters.Add(DbProviderHelper.CreateParameter("@Title",DbType.String,Title));
            if (ContentHtml!=null)
                command.Parameters.Add(DbProviderHelper.CreateParameter("@ContentHtml",DbType.String,ContentHtml));
            else
                command.Parameters.Add(DbProviderHelper.CreateParameter("@ContentHtml",DbType.String,DBNull.Value));
            command.Parameters.Add(DbProviderHelper.CreateParameter("@TemplatePath",DbType.String,TemplatePath));
            command.Parameters.Add(DbProviderHelper.CreateParameter("@ReleasePath",DbType.String,ReleasePath));
            command.Parameters.Add(DbProviderHelper.CreateParameter("@Hits",DbType.Int32,Hits));
            if (DateCreated.HasValue)
                command.Parameters.Add(DbProviderHelper.CreateParameter("@DateCreated",DbType.DateTime,DateCreated));
            else
                command.Parameters.Add(DbProviderHelper.CreateParameter("@DateCreated",DbType.DateTime,DBNull.Value));

            return Convert.ToInt32(DbProviderHelper.ExecuteScalar(command));
        }
Ejemplo n.º 9
1
 public ActionResult TweetPublished(Nullable<long> id, string actionPerformed, bool success = true)
 {
     ViewBag.TweetId = id;
     ViewBag.ActionType = actionPerformed;
     ViewBag.Success = success;
     return View();
 }
Ejemplo n.º 10
1
 /// <summary>
 /// Sets the optional default values.
 /// </summary>
 /// <param name="shouldSet">if set to <c>true</c>, optional default values will be set.</param>
 public void SetDefaultValues(bool shouldSet)
 {
     if (shouldSet)
     {
         if (!this._isOverride.HasValue) this._isOverride = false;
     }
 }
Ejemplo n.º 11
1
        public Scrollbar ( string name, Vector2 position, Axis axis, Nullable<int> width, Nullable<int> height, int max, int value )//, Style style)
        {
            this.Type = ControlType.Scrollbar;
            this.name = name;
            this.position = position;
            this.axis = axis;
            //this.style = style;

            this.min = 0;
            this.max = max;
            this.value = value;

            switch (axis)
            {
                case Axis.Horizontal:
                    if (width.HasValue)
                        size.X = width.Value;
                    break;
                case Axis.Vertical:
                    if (height.HasValue)
                        size.Y = height.Value;
                    break;
            }

            Init();

            scrollUp.OnMousePress += new EventHandler( On_ScrollUp );
            scrollDown.OnMousePress += new EventHandler( On_ScrollDown );
            OnValueChange += new EventHandler( onValueChange );
        }
Ejemplo n.º 12
1
 /// <summary>
 /// Default constructor.
 /// </summary>
 public Index()
 {
     this.row = -1;
     this.col = -1;
     this.dem = null;
     this.alt = null;
 }
Ejemplo n.º 13
1
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="row">Row index.</param>
 /// <param name="col">Column index.</param>
 /// <param name="nDem">DEM list index.</param>
 public Index(int row, int col, Dem dem)
 {
     this.col = col;
     this.row = row;
     this.dem = dem;
     this.alt = null;
 }
Ejemplo n.º 14
1
 public Doctor_Hospital_Search(Nullable<int> doctorId, string doctorName, Nullable<int> genderId, string gender, Nullable<int> specialistFieldId, string specialistField, 
                       Nullable<int> subSpecialistFieldId, string subSpecialistField, Nullable<int> specialPracticeId, Nullable<int> specialPractice,
                       Nullable<int> countryId, string country, Nullable<int> cityId, string city, string countryOfSpecializedDegree, 
                       Nullable<int> countryOfSpecializedDegreeId, string specializedExperience, Nullable<int> countryOfPostGraduateExperienceId, 
                       string countryOfPostGraduateExperience, Nullable<int> hospitalId, string hospital, Nullable<int> departmentId, string department)
 {
     this.DoctorId = doctorId;
       this.DoctorName = doctorName;
       this.GenderId = genderId;
       this.Gender = gender;
       this.SpecialistFieldId = specialistFieldId;
       this.SpecialistField = specialistField;
       this.SubSpecialistFieldId = subSpecialistFieldId;
       this.SubSpecialistField = subSpecialistField;
       this.SpecialPracticeId = specialPracticeId;
       this.SpecialPractice = specialPractice;
       this.CountryId = countryId;
       this.Country = country;
       this.CityId = cityId;
       this.City = city;
       this.CountryOfSpecializedDegreeId = countryOfSpecializedDegreeId;
       this.CountryOfSpecializedDegree = countryOfSpecializedDegree;
       this.SpecializedExperience = specializedExperience;
       this.CountryOfPostGraduateExperienceId = countryOfPostGraduateExperienceId;
       this.CountryOfPostGraduateExperience = countryOfPostGraduateExperience;
       this.HospitalId = hospitalId;
       this.Hospital = hospital;
       this.DepartmentId = departmentId;
       this.Department = department;
 }
Ejemplo n.º 15
1
        public string Crear(string p_id, Nullable<DateTime> p_fecha, PalmeralGenNHibernate.Enumerated.Default_.EstadoPedidoEnum p_estado, PalmeralGenNHibernate.Enumerated.Default_.TipoPagoEnum p_tipoPago, System.Collections.Generic.IList<PalmeralGenNHibernate.EN.Default_.LineaPedidoEN> p_lineas, string p_proveedor)
        {
            PedidoEN pedidoEN = null;
            string oid;

            //Initialized PedidoEN
            pedidoEN = new PedidoEN ();
            pedidoEN.Id = p_id;

            pedidoEN.Fecha = p_fecha;

            pedidoEN.Estado = p_estado;

            pedidoEN.TipoPago = p_tipoPago;

            pedidoEN.Lineas = p_lineas;

            if (p_proveedor != null) {
                pedidoEN.Proveedor = new PalmeralGenNHibernate.EN.Default_.ProveedorEN ();
                pedidoEN.Proveedor.Id = p_proveedor;
            }

            //Call to PedidoCAD

            oid = _IPedidoCAD.Crear (pedidoEN);
            return oid;
        }
Ejemplo n.º 16
1
        public Button(Texture2D texture, Vector2 position, string text, SpriteFont font, Game1 game)
            : base(position)
        {
            base.Text = text;
            this.texture = texture;
            this.Font = font;
            bounds = new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height);

            switch (Text) {
                case "Create":
                    change = MenuState.Create;
                    break;
                case "Join":
                    change = MenuState.Join;
                    break;
                case "Exit to menu":
                case "Back":
                    change = MenuState.Menu;
                    break;
                default:
                    change = null;
                    break;
            }

            if (Text.Contains("Level")) change = MenuState.Start;
            WireUpEvents(game);
        }
Ejemplo n.º 17
1
 /// <summary>
 /// Sets the optional default values.
 /// </summary>
 /// <param name="shouldSet">if set to <c>true</c>, optional default values will be set.</param>
 public new void SetDefaultValues(bool shouldSet)
 {
     if (shouldSet)
     {
         this._treatCodedDataAsNumeric = true;
     }
 }
Ejemplo n.º 18
1
 public static Rectangle Normalize(Rectangle rect, Vector2 pos, Vector2 origin, Nullable<Rectangle> sourceRectangle )
 {
     return new Rectangle(rect.X - (int)pos.X + sourceRectangle.Value.X + (int)origin.X,
                          rect.Y - (int)pos.Y + sourceRectangle.Value.Y + (int)origin.Y,
                          rect.Width,
                          rect.Height);
 }
Ejemplo n.º 19
1
 /// <summary>
 /// Sets the optional default values.
 /// </summary>
 /// <param name="shouldSet">if set to <c>true</c>, optional default values will be set.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 public void SetDefaultValues(bool shouldSet)
 {
     if(shouldSet)
     {
         if (!_isPrimary.HasValue) _isPrimary = true;
     }
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="InName">Nom de l'appender</param>
        /// <param name="InLogFile"> Nom du fichier de log (avec chemin)</param>
        public TextFileAppender(string InName, string InLogFile = "", Nullable<LogLevel> SpecifiLogLevel = null)
            : base(InName,SpecifiLogLevel)
        {

            LogFile = InLogFile;

        }// end constructeur
Ejemplo n.º 21
0
 public CDPShape(Nullable<Color> penColor, Nullable<Color> fillColor, double penWidth, Point referencePoint)
 {
     this.penColor = penColor;
     this.fillColor = fillColor;
     this.penWidth = penWidth;
     this.referencePoint = referencePoint;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="row">Row index</param>
 /// <param name="col">Column index</param>
 public Index(int row, int col)
 {
     this.row = row;
     this.col = col;
     this.dem = null;
     this.alt = null;
 }
Ejemplo n.º 23
0
        private static void AdjustResultForIntersectionWithSide( ref Nullable<Point> result, ref double distance, Segment intersection, Point point )
        {
            if( !intersection.IsEmpty )
              {
            if( intersection.Contains( point ) )
            {
              distance = 0;
              result = point;
              return;
            }

            double p1Distance = PointHelper.DistanceBetween( point, intersection.P1 );
            double p2Distance = double.PositiveInfinity;
            if( !intersection.IsPoint )
            {
              p2Distance = PointHelper.DistanceBetween( point, intersection.P2 );
            }

            if( Math.Min( p1Distance, p2Distance ) < distance )
            {
              if( p1Distance < p2Distance )
              {
            distance = p1Distance;
            result = intersection.P1;
              }
              else
              {
            distance = p2Distance;
            result = intersection.P2;
              }
            }
              }
        }
Ejemplo n.º 24
0
        public int CrearSolicitud(string p_solicitante, TravelnookGenNHibernate.Enumerated.Travelnook.EstadoSolicitudEnum p_estado, Nullable<DateTime> p_fecha, string p_solicitado)
        {
            SolicitudEN solicitudEN = null;
            int oid;

            //Initialized SolicitudEN
            solicitudEN = new SolicitudEN ();

            if (p_solicitante != null) {
                // El argumento p_solicitante -> Property solicitante es oid = false
                // Lista de oids id
                solicitudEN.Solicitante = new TravelnookGenNHibernate.EN.Travelnook.UsuarioEN ();
                solicitudEN.Solicitante.NomUsu = p_solicitante;
            }

            solicitudEN.Estado = p_estado;

            solicitudEN.Fecha = p_fecha;

            if (p_solicitado != null) {
                // El argumento p_solicitado -> Property solicitado es oid = false
                // Lista de oids id
                solicitudEN.Solicitado = new TravelnookGenNHibernate.EN.Travelnook.UsuarioEN ();
                solicitudEN.Solicitado.NomUsu = p_solicitado;
            }

            //Call to SolicitudCAD

            oid = _ISolicitudCAD.CrearSolicitud (solicitudEN);
            return oid;
        }
Ejemplo n.º 25
0
        public SelectGimnasticarUcesnikForm(int takmicenjeId, Nullable<Pol> pol,
            TakmicarskaKategorija kategorija)
        {
            InitializeComponent();
            Text = "Izaberi gimnasticara";

            this.takmicenjeId = takmicenjeId;
            this.gimnastika = null;
            if (pol != null)
            {
                if (pol == Pol.Muski)
                    gimnastika = Gimnastika.MSG;
                else if (pol == Pol.Zenski)
                    gimnastika = Gimnastika.ZSG;
            }
            this.kategorija = kategorija;
            initializeGridColumns();

            DataGridViewUserControl.GridColumnHeaderMouseClick += new EventHandler<GridColumnHeaderMouseClickEventArgs>(DataGridViewUserControl_GridColumnHeaderMouseClick);

            FetchModes.Add(new AssociationFetch(
                "Takmicenje", AssociationFetchMode.Eager));
            FetchModes.Add(new AssociationFetch(
                "TakmicarskaKategorija", AssociationFetchMode.Eager));
            FetchModes.Add(new AssociationFetch(
                "KlubUcesnik", AssociationFetchMode.Eager));
            FetchModes.Add(new AssociationFetch(
                "DrzavaUcesnik", AssociationFetchMode.Eager));

            this.ClientSize = new Size(800, 450);

            showAll();
        }
Ejemplo n.º 26
0
        //Initialize
        public void Initialize(Texture2D texture, Vector2 position)
        {
            //Initialize
            PlayerTexture = texture;
            Position = position;
            Heading = 0.0f;

            //Sensor Data
            enemyData = new List<EnemyData>();
            walls = new List<BoundingBox>();

            //Number of Rays to be cast
            rayCount = 5;
            rayDist = new Nullable<float>[rayCount];
            rayList = new Vector2[rayCount];

            //Number of Quadrants
            quadrants = new int[4];

            //Max Values
            FirstRay = new Vector2(0, -1);
            //FirstRay.Normalize();

            rayMax = 250;
            agentMax = 500;
            pieMax = 150;

            //ACTIVATE
            Active = true;
        }
Ejemplo n.º 27
0
        static void Main(string[] args)
        {
            int i = 3;
            long l = i;

            i = (int)l;

            //string s = "manuel";
            //i = (int)(object)s;

            int? n = null;
            if (n == null)
            {
                Console.WriteLine("n is een value type, maar wel degelijk null!?!?!?!");
            }

            Nullable<int> n2 = new Nullable<int>();
            if (!n2.HasValue)
            {
                Console.WriteLine("Oh, zo werkt dat dus!");
            }
            else
            {
                Console.WriteLine(n2.Value);
            }
        }
 public void Update()
 {
     this.UserActionID = UserAction.user_action_id;
     this.UserID = UserAction.user_id;
     this.ActionID = UserAction.action_id;
     this.HasRight = UserAction.hasRight;
 }
Ejemplo n.º 29
0
 private void SetDateTime()
 {
     if (string.IsNullOrEmpty(this.m_MergedDateString) == false)
     {
         DateTime dateIn;
         bool parseResult = DateTime.TryParse(this.m_MergedDateString.ToString(), out dateIn);
         if (parseResult == true)
         {
             if (this.m_MergedDateString.Length >= 8 && this.m_MergedDateString.Length <= 10)
             {
                 this.m_Date = DateTime.Parse(dateIn.ToString("MM/dd/yyyy"));
                 this.m_Time = null;
             }
             else if (this.m_MergedDateString.Length >= 14 && this.m_MergedDateString.Length <= 16)
             {
                 this.m_Date = DateTime.Parse(dateIn.ToString("MM/dd/yyyy"));
                 this.m_Time = DateTime.Parse(dateIn.ToString("MM/dd/yyyy HH:mm"));
             }
         }
         else
         {
             this.m_HasError = true;
         }
     }
     else
     {
         this.m_Date = null;
         this.m_Time = null;
     }
 }
Ejemplo n.º 30
0
     public virtual int InsertCourse(Nullable<int> authorID, string title, string description, Nullable<short> price, string levelString, Nullable<byte> level)
     {
         var authorIDParameter = authorID.HasValue ?
             new ObjectParameter("AuthorID", authorID) :
             new ObjectParameter("AuthorID", typeof(int));
 
         var titleParameter = title != null ?
             new ObjectParameter("Title", title) :
             new ObjectParameter("Title", typeof(string));
 
         var descriptionParameter = description != null ?
             new ObjectParameter("Description", description) :
             new ObjectParameter("Description", typeof(string));
 
         var priceParameter = price.HasValue ?
             new ObjectParameter("Price", price) :
             new ObjectParameter("Price", typeof(short));
 
         var levelStringParameter = levelString != null ?
             new ObjectParameter("LevelString", levelString) :
             new ObjectParameter("LevelString", typeof(string));
 
         var levelParameter = level.HasValue ?
             new ObjectParameter("Level", level) :
             new ObjectParameter("Level", typeof(byte));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertCourse", authorIDParameter, titleParameter, descriptionParameter, priceParameter, levelStringParameter, levelParameter);
     }
Ejemplo n.º 31
0
        //convierte en datatable
        private DataTable ToDataTable<T>(List<T> items)
        {
            DataTable dataTable = new DataTable(typeof(T).Name);

            //Get all the properties
            PropertyInfo[] Props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
            foreach (PropertyInfo prop in Props)
            {
                //Defining type of data column gives proper data table 
                var type = (prop.PropertyType.IsGenericType && prop.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>) ? Nullable.GetUnderlyingType(prop.PropertyType) : prop.PropertyType);
                //Setting column names as Property names
                dataTable.Columns.Add(prop.Name, type);
            }
            foreach (T item in items)
            {
                var values = new object[Props.Length];
                for (int i = 0; i < Props.Length; i++)
                {
                    //inserting property values to datatable rows
                    values[i] = Props[i].GetValue(item, null);
                }
                dataTable.Rows.Add(values);
            }
            //put a breakpoint here and check datatable
            return dataTable;
        }
Ejemplo n.º 32
0
            public static void SerializeInternal(int version, StringBuilder sb, Type type, object message, string keyName = "")
            {
                if (type.IsNullable())
                {
                    type = Nullable.GetUnderlyingType(type);
                }
                if (message == null)
                {
                    message = type.TypeDefaultValue(); //only underlying value type will be given a default value
                }

                //
                if (type == typeof(string))
                {
                    sb.Append('"');
                    if (!string.IsNullOrEmpty((string)message))
                    {
                        Escape(sb, message.ToString());
                    }
                    sb.Append('"');
                }
                else if (type.IsEnum)
                {
                    sb.Append(message.ToString());
                }
                else if (BuiltinMessageTypes.ContainsKey(type))
                {
                    if (type == typeof(bool))
                    {
                        sb.Append(string.Format(CultureInfo.InvariantCulture, "{0}", message).ToLowerInvariant());
                    }
                    else
                    {
                        sb.Append(string.Format(CultureInfo.InvariantCulture, "{0}", message));
                    }
                }
                else if (type.IsArray)
                {
                    if (type.GetElementType() == typeof(byte) && version == 1)
                    {
                        sb.Append('"');
                        sb.Append(System.Convert.ToBase64String((byte[])message));
                        sb.Append('"');
                    }
                    else
                    {
                        Array arr = (Array)message;
                        for (int i = 0; i < arr.Length; i++)
                        {
                            if (i > 0)
                            {
                                sb.Append(keyName);
                            }
                            SerializeInternal(version, sb, type.GetElementType(), arr.GetValue(i));
                            if (i < arr.Length - 1)
                            {
                                sb.Append(' ');
                            }
                        }
                    }
                }
                else if (type.IsGenericList())
                {
                    IList list = (IList)message;
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (i > 0)
                        {
                            sb.Append(keyName);
                        }
                        SerializeInternal(version, sb, list[i].GetType(), list[i]);
                        if (i < list.Count - 1)
                        {
                            sb.Append(' ');
                        }
                    }
                }
                else if (type == typeof(Time))
                {
                    Ros.Time t = (Ros.Time)message;
                    if (version == 1)
                    {
                        sb.AppendFormat("{{\"secs\":{0},\"nsecs\":{1}}}", (uint)t.secs, (uint)t.nsecs);
                    }
                    else
                    {
                        sb.AppendFormat("{{\"sec\":{0},\"nanosec\":{1}}}", (int)t.secs, (uint)t.nsecs);
                    }
                }
                else
                {
                    var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);

                    sb.Append('{');

                    for (int i = 0; i < fields.Length; i++)
                    {
                        var field = fields[i];
                        if (version == 2 && type == typeof(Header) && field.Name == "seq")
                        {
                            continue;
                        }

                        var fieldType = field.FieldType;
                        var fieldValue = field.GetValue(message);

                        if (fieldValue != null && typeof(IOneOf).IsAssignableFrom(fieldType)) //only when it is a OneOf field
                        {
                            var oneof = fieldValue as IOneOf;
                            if (oneof != null) //only when this is a non-null OneOf
                            {
                                var oneInfo = oneof.GetOne();
                                if (oneInfo.Value != null) //only hwne at least one subfield assgined
                                {
                                    var oneFieldName = oneInfo.Key;
                                    var oneFieldValue = oneInfo.Value;
                                    var oneFieldType = oneInfo.Value.GetType();

                                    sb.Append(oneFieldName);

                                    if (CheckBasicType(oneFieldType) || (oneFieldType.IsCollectionType() && CheckBasicType(oneFieldType.GetCollectionElement())))
                                    {
                                        sb.Append(':');
                                    }
                                    SerializeInternal(version, sb, oneFieldType, oneFieldValue, oneFieldName);

                                    sb.Append(' ');
                                }
                            }
                        }
                        else if (fieldValue != null || (fieldType.IsNullable() && Attribute.IsDefined(field, typeof(global::Apollo.RequiredAttribute))))
                        {
                            sb.Append(field.Name);
                            if (CheckBasicType(fieldType) || (fieldType.IsCollectionType() && CheckBasicType(fieldType.GetCollectionElement())))
                            {
                                sb.Append(':');
                            }
                            SerializeInternal(version, sb, fieldType, fieldValue, field.Name);
                            sb.Append(' ');
                        }
                    }

                    sb.Append('}');
                }
            }
Ejemplo n.º 33
0
 public override bool CanConvert(Type objectType)
 {
     // Check if it is type, or nullable of type
     return(objectType == typeof(T) || Nullable.GetUnderlyingType(objectType) == typeof(T));
 }
Ejemplo n.º 34
0
		public void Draw (
         	Texture2D texture,
         	Rectangle destinationRectangle,
         	Nullable<Rectangle> sourceRectangle,
         	Color color,
         	float rotation,
         	Vector2 origin,
         	SpriteEffects effect,
         	float depth
			)
		{
			if (texture == null )
			{
				throw new ArgumentException("texture");
			}
			
			SpriteBatchItem item = _batcher.CreateBatchItem();
			
			item.Depth = depth;
			item.TextureID = (int) texture.ID;
			
			if ( sourceRectangle.HasValue)
			{
				tempRect = sourceRectangle.Value;
			}
			else
			{
				tempRect.X = 0;
				tempRect.Y = 0;
				tempRect.Width = texture.Width;
				tempRect.Height = texture.Height;				
			}
			
			if (texture.Image == null) {
				float texWidthRatio = 1.0f / (float)texture.Width;
				float texHeightRatio = 1.0f / (float)texture.Height;
				// We are initially flipped vertically so we need to flip the corners so that
				//  the image is bottom side up to display correctly
				texCoordTL.X = tempRect.X*texWidthRatio;
				texCoordTL.Y = (tempRect.Y+tempRect.Height) * texHeightRatio;
				
				texCoordBR.X = (tempRect.X+tempRect.Width)*texWidthRatio;
				texCoordBR.Y = tempRect.Y*texHeightRatio;
				
			}
			else {
				texCoordTL.X = texture.Image.GetTextureCoordX( tempRect.X );
				texCoordTL.Y = texture.Image.GetTextureCoordY( tempRect.Y );
				texCoordBR.X = texture.Image.GetTextureCoordX( tempRect.X+tempRect.Width );
				texCoordBR.Y = texture.Image.GetTextureCoordY( tempRect.Y+tempRect.Height );
			}
			
			if ( effect == SpriteEffects.FlipVertically )
			{
				float temp = texCoordBR.Y;
				texCoordBR.Y = texCoordTL.Y;
				texCoordTL.Y = temp;
			}
			else if ( effect == SpriteEffects.FlipHorizontally )
			{
				float temp = texCoordBR.X;
				texCoordBR.X = texCoordTL.X;
				texCoordTL.X = temp;
			}
			
			item.Set 
				( 
				 destinationRectangle.X, 
				 destinationRectangle.Y, 
				 -origin.X, 
				 -origin.Y, 
				 destinationRectangle.Width,
				 destinationRectangle.Height,
				 (float)Math.Sin(rotation),
				 (float)Math.Cos(rotation),
				 color,
				 texCoordTL,
				 texCoordBR );			
		}
Ejemplo n.º 35
0
        public virtual int sp_creatediagram(string diagramname, Nullable <int> owner_id, Nullable <int> version, byte[] definition)
        {
            var diagramnameParameter = diagramname != null ?
                                       new ObjectParameter("diagramname", diagramname) :
                                       new ObjectParameter("diagramname", typeof(string));

            var owner_idParameter = owner_id.HasValue ?
                                    new ObjectParameter("owner_id", owner_id) :
                                    new ObjectParameter("owner_id", typeof(int));

            var versionParameter = version.HasValue ?
                                   new ObjectParameter("version", version) :
                                   new ObjectParameter("version", typeof(int));

            var definitionParameter = definition != null ?
                                      new ObjectParameter("definition", definition) :
                                      new ObjectParameter("definition", typeof(byte[]));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_creatediagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter));
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Inserta un registro en la tabla T304_SUBNODO.
        /// </summary>
        /// <returns></returns>
        /// <history>
        ///     Creado por [sqladmin]	10/06/2008 12:52:13
        /// </history>
        /// -----------------------------------------------------------------------------
        public static int Insert(SqlTransaction tr, string t304_denominacion, int t303_idnodo, int t304_orden, bool t304_estado, byte t304_maniobra, int t314_idusuario_responsable, Nullable <int> t313_idempresa)
        {
            SqlParameter[] aParam = new SqlParameter[7];
            aParam[0]       = new SqlParameter("@t304_denominacion", SqlDbType.Text, 50);
            aParam[0].Value = t304_denominacion;
            aParam[1]       = new SqlParameter("@t303_idnodo", SqlDbType.Int, 4);
            aParam[1].Value = t303_idnodo;
            aParam[2]       = new SqlParameter("@t304_orden", SqlDbType.Int, 4);
            aParam[2].Value = t304_orden;
            aParam[3]       = new SqlParameter("@t304_estado", SqlDbType.Bit, 1);
            aParam[3].Value = t304_estado;
            aParam[4]       = new SqlParameter("@t304_maniobra", SqlDbType.TinyInt, 1);
            aParam[4].Value = t304_maniobra;
            aParam[5]       = new SqlParameter("@t314_idusuario_responsable", SqlDbType.Int, 4);
            aParam[5].Value = t314_idusuario_responsable;
            aParam[6]       = new SqlParameter("@t313_idempresa", SqlDbType.Int, 4);
            aParam[6].Value = t313_idempresa;

            // Ejecuta la query y devuelve el valor del nuevo Identity.
            if (tr == null)
            {
                return(Convert.ToInt32(SqlHelper.ExecuteScalar("SUP_SUBNODO_I", aParam)));
            }
            else
            {
                return(Convert.ToInt32(SqlHelper.ExecuteScalarTransaccion(tr, "SUP_SUBNODO_I", aParam)));
            }
        }
Ejemplo n.º 37
0
        public virtual ObjectResult <SelectDisciplineAnouncementInRange_Result> SelectDisciplineAnouncementInRange(Nullable <int> start, Nullable <int> end)
        {
            var startParameter = start.HasValue ?
                                 new ObjectParameter("start", start) :
                                 new ObjectParameter("start", typeof(int));

            var endParameter = end.HasValue ?
                               new ObjectParameter("end", end) :
                               new ObjectParameter("end", typeof(int));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <SelectDisciplineAnouncementInRange_Result>("SelectDisciplineAnouncementInRange", startParameter, endParameter));
        }
Ejemplo n.º 38
0
        public virtual ObjectResult <SelectAnouncementTypeInRange_Result> SelectAnouncementTypeInRange(Nullable <int> start, Nullable <int> end, string type)
        {
            var startParameter = start.HasValue ?
                                 new ObjectParameter("start", start) :
                                 new ObjectParameter("start", typeof(int));

            var endParameter = end.HasValue ?
                               new ObjectParameter("end", end) :
                               new ObjectParameter("end", typeof(int));

            var typeParameter = type != null ?
                                new ObjectParameter("type", type) :
                                new ObjectParameter("type", typeof(string));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <SelectAnouncementTypeInRange_Result>("SelectAnouncementTypeInRange", startParameter, endParameter, typeParameter));
        }
Ejemplo n.º 39
0
        public virtual ObjectResult <GetScheduleForDetail1_Result> GetScheduleForDetail1(string studentID, string module, string year, string studyDate, Nullable <double> height, Nullable <double> width)
        {
            var studentIDParameter = studentID != null ?
                                     new ObjectParameter("StudentID", studentID) :
                                     new ObjectParameter("StudentID", typeof(string));

            var moduleParameter = module != null ?
                                  new ObjectParameter("Module", module) :
                                  new ObjectParameter("Module", typeof(string));

            var yearParameter = year != null ?
                                new ObjectParameter("Year", year) :
                                new ObjectParameter("Year", typeof(string));

            var studyDateParameter = studyDate != null ?
                                     new ObjectParameter("StudyDate", studyDate) :
                                     new ObjectParameter("StudyDate", typeof(string));

            var heightParameter = height.HasValue ?
                                  new ObjectParameter("Height", height) :
                                  new ObjectParameter("Height", typeof(double));

            var widthParameter = width.HasValue ?
                                 new ObjectParameter("Width", width) :
                                 new ObjectParameter("Width", typeof(double));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <GetScheduleForDetail1_Result>("GetScheduleForDetail1", studentIDParameter, moduleParameter, yearParameter, studyDateParameter, heightParameter, widthParameter));
        }
Ejemplo n.º 40
0
        //private String converteMapeamento(String entrada)
        //{
        //    String saida = entrada;
        //    if (!String.IsNullOrEmpty(sufixoMapeamento))
        //    {
        //        saida = String.Format("{0}.{1}", sufixoMapeamento, entrada);
        //    }

        //    return saida;
        //}
        protected void converterValor(PropertyInfo pInfo, Type tipoCampo, Object vlObj)
        {
            if (vlObj == DBNull.Value)
            {
                return;
            }

            if (tipoCampo.IsSubclassOf(typeof(AbstractEntidade)))
            {
                Mapear mapear = pInfo.obterAtributo <Mapear>(true);
                if (mapear == null || String.IsNullOrEmpty(mapear.SufixoTabela))
                {
                    return;
                }

                ConstructorInfo constructorInfo = tipoCampo.GetConstructor(Type.EmptyTypes);
                if (constructorInfo == null)
                {
                    throw new Exception(String.Format("Não foi possível instanciar {0}", tipoCampo.FullName));
                }

                AbstractEntidade obj = (AbstractEntidade)constructorInfo.Invoke(null);

                obj.sufixoMapeamento = mapear.SufixoTabela;
                if (vlObj is IDataReader)
                {
                    obj.deReader(vlObj as IDataReader);
                    pInfo.SetValue(obterInstancia(), obj, null);
                    return;
                }
                if (typeof(Hashtable) == vlObj.GetType())
                {
                    obj.deHashtable(vlObj as Hashtable);
                    pInfo.SetValue(obterInstancia(), obj, null);
                    return;
                }
                if (typeof(DataRow) == vlObj.GetType())
                {
                    obj.deTable(vlObj as DataRow);
                    pInfo.SetValue(obterInstancia(), obj, null);
                    return;
                }
                return;
            }

            if (tipoCampo.Name.IndexOf("Nullable") > -1)
            {
                tipoCampo = Nullable.GetUnderlyingType(pInfo.PropertyType);
            }

            if ((tipoCampo == typeof(int)) && (!(vlObj is int)))
            {
                pInfo.SetValue(obterInstancia(), int.Parse(vlObj.ToString()), null);
            }
            else if ((tipoCampo == typeof(Char)) && (!(vlObj is char)))
            {
                pInfo.SetValue(obterInstancia(), Char.Parse(vlObj.ToString()), null);
            }
            else if (tipoCampo.IsEnum)
            {
                if (vlObj is string)
                {
                    pInfo.SetValue(obterInstancia(), Enum.Parse(tipoCampo, vlObj.ToString(), true), null);
                }
                else
                {
                    pInfo.SetValue(obterInstancia(), Enum.ToObject(tipoCampo, vlObj), null);
                }
            }
            else
            {
                pInfo.SetValue(obterInstancia(), vlObj, null);
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Actualiza un registro de la tabla T304_SUBNODO.
        /// </summary>
        /// <history>
        ///     Creado por [sqladmin]	10/06/2008 12:52:13
        /// </history>
        /// -----------------------------------------------------------------------------
        public static int Update(SqlTransaction tr, int t304_idsubnodo, string t304_denominacion, int t303_idnodo, int t304_orden, bool t304_estado, int t314_idusuario_responsable, Nullable <int> t313_idempresa)
        {
            SqlParameter[] aParam = new SqlParameter[7];
            aParam[0]       = new SqlParameter("@t304_idsubnodo", SqlDbType.Int, 4);
            aParam[0].Value = t304_idsubnodo;
            aParam[1]       = new SqlParameter("@t304_denominacion", SqlDbType.Text, 50);
            aParam[1].Value = t304_denominacion;
            aParam[2]       = new SqlParameter("@t303_idnodo", SqlDbType.Int, 4);
            aParam[2].Value = t303_idnodo;
            aParam[3]       = new SqlParameter("@t304_orden", SqlDbType.Int, 4);
            aParam[3].Value = t304_orden;
            aParam[4]       = new SqlParameter("@t304_estado", SqlDbType.Bit, 1);
            aParam[4].Value = t304_estado;
            aParam[5]       = new SqlParameter("@t314_idusuario_responsable", SqlDbType.Int, 4);
            aParam[5].Value = t314_idusuario_responsable;
            aParam[6]       = new SqlParameter("@t313_idempresa", SqlDbType.Int, 4);
            aParam[6].Value = t313_idempresa;

            // Ejecuta la query y devuelve el numero de registros modificados.
            if (tr == null)
            {
                return(SqlHelper.ExecuteNonQuery("SUP_SUBNODO_U", aParam));
            }
            else
            {
                return(SqlHelper.ExecuteNonQueryTransaccion(tr, "SUP_SUBNODO_U", aParam));
            }
        }
Ejemplo n.º 42
0
 public Type EnsureNotNullableType(Type t)
 {
     return((IsNullableType(t))
         ? Nullable.GetUnderlyingType(t)
         : t);
 }
Ejemplo n.º 43
0
        public virtual int UpdateStudentProfile(string studentID, string parentName, string parentMobile, Nullable <bool> parentGender, string presentAddress, string permanentAddress, string mobile, Nullable <bool> gender)
        {
            var studentIDParameter = studentID != null ?
                                     new ObjectParameter("StudentID", studentID) :
                                     new ObjectParameter("StudentID", typeof(string));

            var parentNameParameter = parentName != null ?
                                      new ObjectParameter("ParentName", parentName) :
                                      new ObjectParameter("ParentName", typeof(string));

            var parentMobileParameter = parentMobile != null ?
                                        new ObjectParameter("ParentMobile", parentMobile) :
                                        new ObjectParameter("ParentMobile", typeof(string));

            var parentGenderParameter = parentGender.HasValue ?
                                        new ObjectParameter("ParentGender", parentGender) :
                                        new ObjectParameter("ParentGender", typeof(bool));

            var presentAddressParameter = presentAddress != null ?
                                          new ObjectParameter("PresentAddress", presentAddress) :
                                          new ObjectParameter("PresentAddress", typeof(string));

            var permanentAddressParameter = permanentAddress != null ?
                                            new ObjectParameter("PermanentAddress", permanentAddress) :
                                            new ObjectParameter("PermanentAddress", typeof(string));

            var mobileParameter = mobile != null ?
                                  new ObjectParameter("Mobile", mobile) :
                                  new ObjectParameter("Mobile", typeof(string));

            var genderParameter = gender.HasValue ?
                                  new ObjectParameter("Gender", gender) :
                                  new ObjectParameter("Gender", typeof(bool));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("UpdateStudentProfile", studentIDParameter, parentNameParameter, parentMobileParameter, parentGenderParameter, presentAddressParameter, permanentAddressParameter, mobileParameter, genderParameter));
        }
        public ModelDescription GetOrCreateModelDescription(Type modelType)
        {
            if (modelType == null)
            {
                throw new ArgumentNullException("modelType");
            }

            Type underlyingType = Nullable.GetUnderlyingType(modelType);

            if (underlyingType != null)
            {
                modelType = underlyingType;
            }

            ModelDescription modelDescription;
            string           modelName = ModelNameHelper.GetModelName(modelType);

            if (GeneratedModels.TryGetValue(modelName, out modelDescription))
            {
                if (modelType != modelDescription.ModelType)
                {
                    throw new InvalidOperationException(
                              String.Format(
                                  CultureInfo.CurrentCulture,
                                  "A model description could not be created. Duplicate model name '{0}' was found for types '{1}' and '{2}'. " +
                                  "Use the [ModelName] attribute to change the model name for at least one of the types so that it has a unique name.",
                                  modelName,
                                  modelDescription.ModelType.FullName,
                                  modelType.FullName));
                }

                return(modelDescription);
            }

            if (DefaultTypeDocumentation.ContainsKey(modelType))
            {
                return(GenerateSimpleTypeModelDescription(modelType));
            }

            if (modelType.IsEnum)
            {
                return(GenerateEnumTypeModelDescription(modelType));
            }

            if (modelType.IsGenericType)
            {
                Type[] genericArguments = modelType.GetGenericArguments();

                if (genericArguments.Length == 1)
                {
                    Type enumerableType = typeof(IEnumerable <>).MakeGenericType(genericArguments);
                    if (enumerableType.IsAssignableFrom(modelType))
                    {
                        return(GenerateCollectionModelDescription(modelType, genericArguments[0]));
                    }
                }
                if (genericArguments.Length == 2)
                {
                    Type dictionaryType = typeof(IDictionary <,>).MakeGenericType(genericArguments);
                    if (dictionaryType.IsAssignableFrom(modelType))
                    {
                        return(GenerateDictionaryModelDescription(modelType, genericArguments[0], genericArguments[1]));
                    }

                    Type keyValuePairType = typeof(KeyValuePair <,>).MakeGenericType(genericArguments);
                    if (keyValuePairType.IsAssignableFrom(modelType))
                    {
                        return(GenerateKeyValuePairModelDescription(modelType, genericArguments[0], genericArguments[1]));
                    }
                }
            }

            if (modelType.IsArray)
            {
                Type elementType = modelType.GetElementType();
                return(GenerateCollectionModelDescription(modelType, elementType));
            }

            if (modelType == typeof(NameValueCollection))
            {
                return(GenerateDictionaryModelDescription(modelType, typeof(string), typeof(string)));
            }

            if (typeof(IDictionary).IsAssignableFrom(modelType))
            {
                return(GenerateDictionaryModelDescription(modelType, typeof(object), typeof(object)));
            }

            if (typeof(IEnumerable).IsAssignableFrom(modelType))
            {
                return(GenerateCollectionModelDescription(modelType, typeof(object)));
            }

            return(GenerateComplexTypeModelDescription(modelType));
        }
        protected virtual object GetValueObject(PropertyInfo propertyInfo, string value)
        {
            var propertyType = Nullable.GetUnderlyingType(propertyInfo.PropertyType) ?? propertyInfo.PropertyType;
            var typeCode     = Type.GetTypeCode(propertyType);

            switch (typeCode)
            {
            case TypeCode.Boolean:
                return(bool.Parse(value));

            case TypeCode.Char:
                return(char.Parse(value));

            case TypeCode.SByte:
                return(sbyte.Parse(value, base.CultureInfo));

            case TypeCode.Byte:
                return(byte.Parse(value, base.CultureInfo));

            case TypeCode.Int16:
                return(short.Parse(value, base.CultureInfo));

            case TypeCode.UInt16:
                return(ushort.Parse(value, base.CultureInfo));

            case TypeCode.Int32:
                return(int.Parse(value, base.CultureInfo));

            case TypeCode.UInt32:
                return(uint.Parse(value, base.CultureInfo));

            case TypeCode.Int64:
                return(long.Parse(value, base.CultureInfo));

            case TypeCode.UInt64:
                return(ulong.Parse(value, base.CultureInfo));

            case TypeCode.Single:
                return(float.Parse(value, base.CultureInfo));

            case TypeCode.Double:
                return(double.Parse(value, base.CultureInfo));

            case TypeCode.Decimal:
                return(decimal.Parse(value, base.CultureInfo));

            case TypeCode.DateTime:
                return(DateTime.Parse(value, base.CultureInfo));

            case TypeCode.String:
                return(value);

            case TypeCode.Object:
                Guid guid;
                if (Guid.TryParse(value, out guid))
                {
                    return(guid);
                }

                TimeSpan timeSpan;
                if (TimeSpan.TryParse(value, out timeSpan))
                {
                    return(timeSpan);
                }

                DateTimeOffset dateTimeOffset;
                if (DateTimeOffset.TryParse(value, out dateTimeOffset))
                {
                    return(dateTimeOffset);
                }

                break;
            }

            return(null);
        }
Ejemplo n.º 46
0
        private static object ReadValue(Type inst_type, JsonReader reader)
        {
            reader.Read();

            if (reader.Token == JsonToken.ArrayEnd)
            {
                return(null);
            }

            Type underlying_type = Nullable.GetUnderlyingType(inst_type);
            Type value_type      = underlying_type ?? inst_type;

            if (reader.Token == JsonToken.Null)
            {
                #if NETSTANDARD1_5
                if (inst_type.IsClass() || underlying_type != null)
                {
                    return(null);
                }
                #else
                if (inst_type.IsClass || underlying_type != null)
                {
                    return(null);
                }
                #endif

                throw new JsonException(String.Format(
                                            "Can't assign null to an instance of type {0}",
                                            inst_type));
            }

            if (reader.Token == JsonToken.Double ||
                reader.Token == JsonToken.Int ||
                reader.Token == JsonToken.Long ||
                reader.Token == JsonToken.String ||
                reader.Token == JsonToken.Boolean)
            {
                Type json_type = reader.Value.GetType();

                if (value_type.IsAssignableFrom(json_type))
                {
                    return(reader.Value);
                }

                // If there's a custom importer that fits, use it
                if (custom_importers_table.ContainsKey(json_type) &&
                    custom_importers_table[json_type].ContainsKey(
                        value_type))
                {
                    ImporterFunc importer =
                        custom_importers_table[json_type][value_type];

                    return(importer(reader.Value));
                }

                // Maybe there's a base importer that works
                if (base_importers_table.ContainsKey(json_type) &&
                    base_importers_table[json_type].ContainsKey(
                        value_type))
                {
                    ImporterFunc importer =
                        base_importers_table[json_type][value_type];

                    return(importer(reader.Value));
                }

                // Maybe it's an enum
                if (value_type.IsEnum)
                {
                    return(Enum.ToObject(value_type, reader.Value));
                }

                // Try using an implicit conversion operator
                MethodInfo conv_op = GetConvOp(value_type, json_type);

                if (conv_op != null)
                {
                    return(conv_op.Invoke(null,
                                          new object[] { reader.Value }));
                }

                // No luck
                throw new JsonException(String.Format(
                                            "Can't assign value '{0}' (type {1}) to type {2}",
                                            reader.Value, json_type, inst_type));
            }

            object instance = null;

            if (reader.Token == JsonToken.ArrayStart)
            {
                AddArrayMetadata(inst_type);
                ArrayMetadata t_data = array_metadata[inst_type];

                if (!t_data.IsArray && !t_data.IsList)
                {
                    throw new JsonException(String.Format(
                                                "Type {0} can't act as an array",
                                                inst_type));
                }

                IList list;
                Type  elem_type;

                if (!t_data.IsArray)
                {
                    list      = (IList)Activator.CreateInstance(inst_type);
                    elem_type = t_data.ElementType;
                }
                else
                {
                    list      = new ArrayList();
                    elem_type = inst_type.GetElementType();
                }

                while (true)
                {
                    object item = ReadValue(elem_type, reader);
                    if (item == null && reader.Token == JsonToken.ArrayEnd)
                    {
                        break;
                    }

                    list.Add(item);
                }

                if (t_data.IsArray)
                {
                    int n = list.Count;
                    instance = Array.CreateInstance(elem_type, n);

                    for (int i = 0; i < n; i++)
                    {
                        ((Array)instance).SetValue(list[i], i);
                    }
                }
                else
                {
                    instance = list;
                }
            }
            else if (reader.Token == JsonToken.ObjectStart)
            {
                AddObjectMetadata(value_type);
                ObjectMetadata t_data = object_metadata[value_type];

                instance = Activator.CreateInstance(value_type);

                while (true)
                {
                    reader.Read();

                    if (reader.Token == JsonToken.ObjectEnd)
                    {
                        break;
                    }

                    string property = (string)reader.Value;

                    if (t_data.Properties.ContainsKey(property))
                    {
                        PropertyMetadata prop_data =
                            t_data.Properties[property];

                        if (prop_data.IsField)
                        {
                            ((FieldInfo)prop_data.Info).SetValue(
                                instance, ReadValue(prop_data.Type, reader));
                        }
                        else
                        {
                            PropertyInfo p_info =
                                (PropertyInfo)prop_data.Info;

                            if (p_info.CanWrite)
                            {
                                p_info.SetValue(
                                    instance,
                                    ReadValue(prop_data.Type, reader),
                                    null);
                            }
                            else
                            {
                                ReadValue(prop_data.Type, reader);
                            }
                        }
                    }
                    else
                    {
                        if (!t_data.IsDictionary)
                        {
                            if (!reader.SkipNonMembers)
                            {
                                throw new JsonException(String.Format(
                                                            "The type {0} doesn't have the " +
                                                            "property '{1}'",
                                                            inst_type, property));
                            }
                            else
                            {
                                ReadSkip(reader);
                                continue;
                            }
                        }

                        ((IDictionary)instance).Add(
                            property, ReadValue(
                                t_data.ElementType, reader));
                    }
                }
            }

            return(instance);
        }
Ejemplo n.º 47
0
        public virtual ObjectResult <sp_helpdiagrams_Result> sp_helpdiagrams(string diagramname, Nullable <int> owner_id)
        {
            var diagramnameParameter = diagramname != null ?
                                       new ObjectParameter("diagramname", diagramname) :
                                       new ObjectParameter("diagramname", typeof(string));

            var owner_idParameter = owner_id.HasValue ?
                                    new ObjectParameter("owner_id", owner_id) :
                                    new ObjectParameter("owner_id", typeof(int));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <sp_helpdiagrams_Result>("sp_helpdiagrams", diagramnameParameter, owner_idParameter));
        }
Ejemplo n.º 48
0
        public virtual ObjectResult <GetCoursesByStudentId_Result> GetCoursesByStudentId(Nullable <int> studentId)
        {
            var studentIdParameter = studentId.HasValue ?
                                     new ObjectParameter("StudentId", studentId) :
                                     new ObjectParameter("StudentId", typeof(int));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <GetCoursesByStudentId_Result>("GetCoursesByStudentId", studentIdParameter));
        }
Ejemplo n.º 49
0
        public virtual ObjectResult <Sales_by_Year_Result> Sales_by_Year(Nullable <System.DateTime> beginning_Date, Nullable <System.DateTime> ending_Date)
        {
            var beginning_DateParameter = beginning_Date.HasValue ?
                                          new ObjectParameter("Beginning_Date", beginning_Date) :
                                          new ObjectParameter("Beginning_Date", typeof(System.DateTime));

            var ending_DateParameter = ending_Date.HasValue ?
                                       new ObjectParameter("Ending_Date", ending_Date) :
                                       new ObjectParameter("Ending_Date", typeof(System.DateTime));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction <Sales_by_Year_Result>("Sales_by_Year", beginning_DateParameter, ending_DateParameter));
        }
Ejemplo n.º 50
0
 public deploymentfileDto(Int32 i_DeploymentFileId, String v_FileName, Byte[] b_FileData, String v_Description, Nullable <Int32> i_SoftwareComponentId, String v_TargetSoftwareComponentVersion, String v_PackageFiles, Nullable <Single> r_PackageSizeKb, String v_ComentaryUpdate, List <softwarecomponentreleaseDto> softwarecomponentrelease)
 {
     this.i_DeploymentFileId               = i_DeploymentFileId;
     this.v_FileName                       = v_FileName;
     this.b_FileData                       = b_FileData;
     this.v_Description                    = v_Description;
     this.i_SoftwareComponentId            = i_SoftwareComponentId;
     this.v_TargetSoftwareComponentVersion = v_TargetSoftwareComponentVersion;
     this.v_PackageFiles                   = v_PackageFiles;
     this.r_PackageSizeKb                  = r_PackageSizeKb;
     this.v_ComentaryUpdate                = v_ComentaryUpdate;
     this.softwarecomponentrelease         = softwarecomponentrelease;
 }
Ejemplo n.º 51
0
        static void Main(string[] args)
        {
            // Преметивные типы в C#
            SByte   bte  = 8;
            Int32   i32  = 5;
            Int64   i64  = 5;
            Int16   i16  = 5;
            Byte    ubt  = 192;
            UInt16  ui16 = 16;
            UInt32  ui32 = 1651513;
            UInt64  ui64 = 1657856875;
            Char    ch   = 'a';
            Boolean bol  = true;
            Single  sng  = 12.4f;
            Double  db   = 12.55;
            Decimal dcm  = 111.1m;
            String  str  = "gaga";
            Object  obj  = new Object();


            // Явное присваивание
            i32 = 5;
            bte = (SByte)ubt;
            Int32 ii32 = (Int32)i64;
            Byte  btta = (Byte)ch;
            Char  ch1  = (Char)ui16;

            // Не явное присваивание
            dcm = ui16;
            i32 = i16;
            i64 = i32;
            Single s  = i32;
            Single s2 = ch;
            Double B  = ubt;

            // Упаковка и распаковка значимых типов
            Object l   = i16;
            UInt32 z   = (UInt32)(Int16)l;
            Object lol = ubt;
            Char   c1  = (Char)(Byte)lol;

            // Неявное типизированная переменая
            var aa  = new[] { 2, 3, 4, 5 };
            var aa1 = 1;
            var aa2 = new List <int>(new int[] { 1, 2, 4 });

            Console.WriteLine(aa.GetType());
            Console.WriteLine(aa1.GetType());
            Console.WriteLine(aa2.GetType());

            // Nullabe
            int?n1 = null;
            int?n2 = 2;
            // если левый операнд не нуль, то он его выводит
            int y = n1 ?? 1;
            int x = n2 ?? 3;

            Console.WriteLine(y + "\t" + x);

            Nullable <Int64> z1 = 50000;

            if (z1.HasValue) // проверет если данный операнд индифецирован то выводит значение
            {
                Console.WriteLine(z1.Value);
            }

            string st  = "hello";
            string st2 = "hello";
            string st3 = "Bob";
            int    stn = String.Compare(st, st2);
            int    cmp = st.CompareTo(st2); // второй способ


            // сравнить строки
            if (stn == 0 || cmp == 0)
            {
                Console.WriteLine("Строки равны");
            }
            else
            {
                Console.WriteLine("Строки не равны");
            }

            /* выполнить сцепление(конкатенацию), копирование, выделение подстроки, разделение строки на слова,
             * вставка подстроки в заданную позицию, удаление заданной подстроки
             */
            Console.WriteLine();
            Console.WriteLine(st + st2 + st3);

            st = String.Copy(st3);
            Console.WriteLine(st);

            st = "privet mir. hah aaaa . agasdg";
            Console.WriteLine(st.Substring(6, 5));

            Console.WriteLine(String.Join(" ", st.Split('.')));

            char[] delims = ".:".ToCharArray();
            string stdel  = "privet.mir:hah:aaaa.agasdg";

            string[] words = stdel.Split(delims);
            foreach (string name in words)
            {
                Console.WriteLine(name);
            }

            Console.WriteLine(st.Insert(6, " LIKE A BOSS"));

            Console.WriteLine(st.Remove(6, 4));

            // создайте пустую строку и null строку и что нибудь выполнить
            String empty  = "";
            String nullst = null;

            empty = empty.Insert(0, "BOB");
            Console.WriteLine(empty);
            try
            {
                nullst = nullst.Insert(0, "BOB");
                Console.WriteLine(nullst);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.GetType());
            }
            // задание d
            StringBuilder stb = new StringBuilder("kjasdgjaipjg;oiaaksdjg");

            stb.Remove(3, 4);
            stb.Append("KEKS");
            stb.Insert(0, "LOL");
            Console.WriteLine(stb);

            // Массивы

            const int sz = 3;

            int[,] mass = new int[sz, sz] {
                { 3, 7, 6 }, { 4, 2, 3 }, { 7, 2, 1 }
            };
            for (int i = 0; i < sz; i++)
            {
                for (int j = 0; j < sz; j++)
                {
                    Console.Write(mass[i, j] + " ");
                }
                Console.WriteLine();
            }

            ///////

            String[] strArr = { "lol", "kek", "zzz" };

            foreach (String g in strArr)
            {
                Console.WriteLine(g);
            }

            Console.WriteLine($"\tДлинна массива = {strArr.Length}");


            int num = int.Parse(Console.ReadLine());

            Console.WriteLine("наше значение: ");
            strArr[num - 1] = Console.ReadLine();

            Console.WriteLine();
            foreach (String g in strArr)
            {
                Console.WriteLine(g);
            }
            ///////

            double[][] mas2 = new double[3][];
            mas2[0] = new double[1];
            mas2[1] = new double[2];
            mas2[2] = new double[3];
            Console.WriteLine("Введите массив: ");
            for (int i = 0; i < mas2.Length; i++)
            {
                Console.WriteLine($"Введите {mas2[i].Length} числа: ");
                int j = 0;
                foreach (String g in Console.ReadLine().Split(' '))
                {
                    mas2[i][j] = Convert.ToDouble(g);
                    j++;
                }
            }

            Console.WriteLine("\nВведенный массив: ");
            foreach (double[] arr in mas2)
            {
                foreach (double value in arr)
                {
                    Console.Write(value + " ");
                }
                Console.WriteLine();
            }
            ////////////
            var varIntg = new int[5];
            var varStrr = "строка";


            ////////////////////////////////////



            var MyTuple = (ammount : 10, st : "Hi", chr : 'z', st2 : "eeee", ulng : (ulong)1337);

            Console.WriteLine(MyTuple);
            Console.WriteLine(MyTuple.ammount + " " + MyTuple.chr + " " + MyTuple.st2);

            (int count, string stroka1, char chr, string stroka2, ulong ulngint) = MyTuple;
            Console.WriteLine(count + " " + stroka1 + " " + chr + " " + stroka2 + " " + ulngint);


            (int first, string second, char third, string four, ulong five)tuple2 = (123, "sdfsg", 'x', "four", 123);
            int cmpTuple = MyTuple.CompareTo(tuple2);



            if (cmpTuple == 0)
            {
                Console.WriteLine("Картежи одинаковые");
            }
            else
            {
                Console.WriteLine("Картежи разные");
            }

            //////////////////////

            int[] array = { 1, 2, 3, 4, 5, 6, 7 };

            (int, int, int, char) CortageF(int[] arr, string strin)
            {
                int  min = arr[0];
                int  max = arr[0];
                int  sum = arr[0];
                char c   = strin[0];

                for (int i = 1; i < arr.Length; i++)
                {
                    if (arr[i] < min)
                    {
                        min = arr[i];
                    }
                    if (arr[i] > max)
                    {
                        max = arr[i];
                    }
                    sum += arr[i];
                }

                return(max, min, sum, c);
            }

            Console.WriteLine(CortageF(array, "Slim Shady"));
        }
Ejemplo n.º 52
0
 public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, Nullable <TFrom> value)
 {
     if (value == null)
     {
         context.Writer.WriteNull();
     }
     else
     {
         _nonNullableEnumSerializer.Serialize(context, args, (TTo)Enum.ToObject(typeof(TTo), (object)value.Value));
     }
 }
        public virtual int InsertCourse(Nullable <int> authorID, string title, string description, Nullable <short> price, string levelString, Nullable <byte> level)
        {
            var authorIDParameter = authorID.HasValue ?
                                    new ObjectParameter("AuthorID", authorID) :
                                    new ObjectParameter("AuthorID", typeof(int));

            var titleParameter = title != null ?
                                 new ObjectParameter("Title", title) :
                                 new ObjectParameter("Title", typeof(string));

            var descriptionParameter = description != null ?
                                       new ObjectParameter("Description", description) :
                                       new ObjectParameter("Description", typeof(string));

            var priceParameter = price.HasValue ?
                                 new ObjectParameter("Price", price) :
                                 new ObjectParameter("Price", typeof(short));

            var levelStringParameter = levelString != null ?
                                       new ObjectParameter("LevelString", levelString) :
                                       new ObjectParameter("LevelString", typeof(string));

            var levelParameter = level.HasValue ?
                                 new ObjectParameter("Level", level) :
                                 new ObjectParameter("Level", typeof(byte));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertCourse", authorIDParameter, titleParameter, descriptionParameter, priceParameter, levelStringParameter, levelParameter));
        }
        public virtual int UpdateCourse(Nullable <int> courseID, string title, string description, string levelString, Nullable <byte> level)
        {
            var courseIDParameter = courseID.HasValue ?
                                    new ObjectParameter("CourseID", courseID) :
                                    new ObjectParameter("CourseID", typeof(int));

            var titleParameter = title != null ?
                                 new ObjectParameter("Title", title) :
                                 new ObjectParameter("Title", typeof(string));

            var descriptionParameter = description != null ?
                                       new ObjectParameter("Description", description) :
                                       new ObjectParameter("Description", typeof(string));

            var levelStringParameter = levelString != null ?
                                       new ObjectParameter("LevelString", levelString) :
                                       new ObjectParameter("LevelString", typeof(string));

            var levelParameter = level.HasValue ?
                                 new ObjectParameter("Level", level) :
                                 new ObjectParameter("Level", typeof(byte));

            return(((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("UpdateCourse", courseIDParameter, titleParameter, descriptionParameter, levelStringParameter, levelParameter));
        }
Ejemplo n.º 55
0
     public virtual int ELMAH_LogError(Nullable<System.Guid> errorId, string application, string host, string type, string source, string message, string user, string allXml, Nullable<int> statusCode, Nullable<System.DateTime> timeUtc)
     {
         var errorIdParameter = errorId.HasValue ?
             new ObjectParameter("ErrorId", errorId) :
             new ObjectParameter("ErrorId", typeof(System.Guid));
 
         var applicationParameter = application != null ?
             new ObjectParameter("Application", application) :
             new ObjectParameter("Application", typeof(string));
 
         var hostParameter = host != null ?
             new ObjectParameter("Host", host) :
             new ObjectParameter("Host", typeof(string));
 
         var typeParameter = type != null ?
             new ObjectParameter("Type", type) :
             new ObjectParameter("Type", typeof(string));
 
         var sourceParameter = source != null ?
             new ObjectParameter("Source", source) :
             new ObjectParameter("Source", typeof(string));
 
         var messageParameter = message != null ?
             new ObjectParameter("Message", message) :
             new ObjectParameter("Message", typeof(string));
 
         var userParameter = user != null ?
             new ObjectParameter("User", user) :
             new ObjectParameter("User", typeof(string));
 
         var allXmlParameter = allXml != null ?
             new ObjectParameter("AllXml", allXml) :
             new ObjectParameter("AllXml", typeof(string));
 
         var statusCodeParameter = statusCode.HasValue ?
             new ObjectParameter("StatusCode", statusCode) :
             new ObjectParameter("StatusCode", typeof(int));
 
         var timeUtcParameter = timeUtc.HasValue ?
             new ObjectParameter("TimeUtc", timeUtc) :
             new ObjectParameter("TimeUtc", typeof(System.DateTime));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("ELMAH_LogError", errorIdParameter, applicationParameter, hostParameter, typeParameter, sourceParameter, messageParameter, userParameter, allXmlParameter, statusCodeParameter, timeUtcParameter);
     }
Ejemplo n.º 56
0
        // --------------------------------------------------------------------------------------------------------------------

        public static object ChangeType(object value, Type targetType, IFormatProvider provider = null)
        {
            if (targetType == null)
            {
                throw new ArgumentNullException("targetType");
            }

            if (value == DBNull.Value)
            {
                value = null;
            }

            var valueType = value != null?value.GetType() : typeof(object);

            if (valueType == targetType || targetType.IsAssignableFrom(valueType))
            {
                return(value);                                                                   // (same type as target! [or at least compatible])
            }
            if (provider == null)
            {
                provider = Thread.CurrentThread.CurrentCulture;
            }

            var targetUnderlyingType = Nullable.GetUnderlyingType(targetType);

            if (targetUnderlyingType != null)
            {
                if (value == null)
                {
                    return(value);
                }
                // ... this is a nullable type target, so need to convert to underlying type first, then to a nullable type ...
                value = ChangeType(value, targetUnderlyingType, provider); // (recursive call to convert to the underlying nullable type)
                return(Activator.CreateInstance(targetType, value));
            }
            else if (targetType == typeof(string))
            {
                return(value != null?value.ToString() : "");
            }
            else if (targetType == typeof(Boolean))
            {
                if (value == null || value is string && ((string)value).IsNullOrWhiteSpace()) // (null or empty strings will be treated as 'false', but explicit text will try to be converted)
                {
                    value = false;
                }
                else if (Utilities.IsNumeric(valueType))
                {
                    value = Convert.ToDouble(value) != 0; // (assume any value other than 0 is true)
                }
                else if ((value = Utilities.ToBoolean(value, null)) == null)
                {
                    throw new InvalidCastException(string.Format("Types.ChangeType(): Cannot convert string value \"{0}\" to a Boolean.", value));
                }
                return(value); // (this has the correct type already, so just return now)
            }
            else if (targetType.IsValueType && targetType.IsPrimitive)
            {
                if (value == null || value is string && ((string)value).IsNullOrWhiteSpace())
                {
                    // ... cannot set values to 'null' or empty strings, so translate this to a value type before conversion ...
                    if (targetType == typeof(bool))
                    {
                        value = false;
                    }
                    else if (targetType == typeof(DateTime))
                    {
                        value = DateTime.MinValue;
                    }
                    else
                    {
                        value = 0;
                    }
                }
                else if (value is string)
                {
                    // ... a value type is expected, but 'value' is a string, so try converting the string to a number value first in preparation ...
                    double d;
                    if (double.TryParse((string)value, System.Globalization.NumberStyles.Any, provider, out d))
                    {
                        value = d;
                    }
                }
            }
            else if (value == null)
            {
                return(null);
            }

            try
            {
                return(Convert.ChangeType(value, targetType, provider));
            }
            catch (Exception ex)
            {
                throw new InvalidCastException(string.Format("Types.ChangeType(): Cannot convert value \"{0}\" (type: '{1}') to type '{2}'. If you are developing the source type yourself, implement the 'IConvertible' interface.", Utilities.ND(value, ""), value.GetType().FullName, targetType.FullName), ex);
            }
        }
Ejemplo n.º 57
0
     public virtual ObjectResult<string> ELMAH_GetErrorsXml(string application, Nullable<int> pageIndex, Nullable<int> pageSize, ObjectParameter totalCount)
     {
         var applicationParameter = application != null ?
             new ObjectParameter("Application", application) :
             new ObjectParameter("Application", typeof(string));
 
         var pageIndexParameter = pageIndex.HasValue ?
             new ObjectParameter("PageIndex", pageIndex) :
             new ObjectParameter("PageIndex", typeof(int));
 
         var pageSizeParameter = pageSize.HasValue ?
             new ObjectParameter("PageSize", pageSize) :
             new ObjectParameter("PageSize", typeof(int));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<string>("ELMAH_GetErrorsXml", applicationParameter, pageIndexParameter, pageSizeParameter, totalCount);
     }
Ejemplo n.º 58
0
        public static T ToDataType <T>(this Type type, bool isTopLevel = false)
            where T : DataType, new()
        {
            var dataType = new T();

            if (SwaggerTypeMapping.IsMappedType(type))
            {
                type = SwaggerTypeMapping.GetMappedType(type);
            }

            if (type == null)
            {
                dataType.Type = "void";

                return(dataType);
            }

            if (type.IsNullable())
            {
                type = Nullable.GetUnderlyingType(type);
            }
            if (Primitive.IsPrimitive(type))
            {
                var primitive = Primitive.FromType(type);

                dataType.Format = primitive.Format;
                dataType.Type   = primitive.Type;

                return(dataType);
            }


            if (type.IsContainer())
            {
                dataType.Type = "array";

                var itemsType = type.GetElementType() ?? type.GetTypeInfo().GetGenericArguments().FirstOrDefault();

                if (Primitive.IsPrimitive(itemsType))
                {
                    var primitive = Primitive.FromType(itemsType);

                    dataType.Items = new Item
                    {
                        Type   = primitive.Type,
                        Format = primitive.Format
                    };

                    return(dataType);
                }

                dataType.Items = new Item {
                    Ref = SwaggerConfig.ModelIdConvention(itemsType)
                };

                return(dataType);
            }

            if (isTopLevel)
            {
                dataType.Ref = SwaggerConfig.ModelIdConvention(type);
                return(dataType);
            }

            dataType.Type = SwaggerConfig.ModelIdConvention(type);

            return(dataType);
        }
Ejemplo n.º 59
0
     public virtual ObjectResult<spROL_Archivo_MTE_Result> spROL_Archivo_MTE(Nullable<int> idEmpresa, Nullable<int> idNominaTipo, Nullable<int> idNominatipoLiq, Nullable<int> idPeriodo, Nullable<System.DateTime> fechaI, Nullable<System.DateTime> fechaF, Nullable<int> idRubro)
     {
         var idEmpresaParameter = idEmpresa.HasValue ?
             new ObjectParameter("IdEmpresa", idEmpresa) :
             new ObjectParameter("IdEmpresa", typeof(int));
 
         var idNominaTipoParameter = idNominaTipo.HasValue ?
             new ObjectParameter("IdNominaTipo", idNominaTipo) :
             new ObjectParameter("IdNominaTipo", typeof(int));
 
         var idNominatipoLiqParameter = idNominatipoLiq.HasValue ?
             new ObjectParameter("IdNominatipoLiq", idNominatipoLiq) :
             new ObjectParameter("IdNominatipoLiq", typeof(int));
 
         var idPeriodoParameter = idPeriodo.HasValue ?
             new ObjectParameter("IdPeriodo", idPeriodo) :
             new ObjectParameter("IdPeriodo", typeof(int));
 
         var fechaIParameter = fechaI.HasValue ?
             new ObjectParameter("FechaI", fechaI) :
             new ObjectParameter("FechaI", typeof(System.DateTime));
 
         var fechaFParameter = fechaF.HasValue ?
             new ObjectParameter("FechaF", fechaF) :
             new ObjectParameter("FechaF", typeof(System.DateTime));
 
         var idRubroParameter = idRubro.HasValue ?
             new ObjectParameter("IdRubro", idRubro) :
             new ObjectParameter("IdRubro", typeof(int));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<spROL_Archivo_MTE_Result>("spROL_Archivo_MTE", idEmpresaParameter, idNominaTipoParameter, idNominatipoLiqParameter, idPeriodoParameter, fechaIParameter, fechaFParameter, idRubroParameter);
     }
Ejemplo n.º 60
0
 public DataPoint(long data, string category)
 {
     this._data = data;
     this._category = category;
 }