public int InsertHingePositions(HingePositions pHingePositions)
 {
     try
     {
         return(_AD.InsertHingePositions(pHingePositions));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public bool UpdateHingePositions(HingePositions pHingePositions)
 {
     try
     {
         _AD.UpdateHingePositions(pHingePositions);
         return(true);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public int InsertHingePositions(HingePositions pHingePositions)
        {
            string sql = @"[spInsertHingePositions] '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}'";

            sql = string.Format(sql, pHingePositions.Position1, pHingePositions.Position2, pHingePositions.Position3, pHingePositions.Position4, pHingePositions.Position5, pHingePositions.Status.Id,
                                pHingePositions.CreatorUser, pHingePositions.ModificationUser);
            try
            {
                return(_MB.EjecutarSQL(_CN, sql));
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        public void UpdateHingePositions(HingePositions pHingePositions)
        {
            string sql = @"[spUpdateHingePositions] '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}'";

            sql = string.Format(sql, pHingePositions.Id, pHingePositions.Position1, pHingePositions.Position2, pHingePositions.Position3, pHingePositions.Position4, pHingePositions.Position5, pHingePositions.Status.Id,
                                pHingePositions.ModificationUser);
            try
            {
                _MB.EjecutarSQL(_CN, sql);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        public HingePositions GetHingePositionsById(int Id)
        {
            HingePositions hingep = new HingePositions();
            string         sql    = @"[spGetHingePositions] '{0}' ";

            sql = string.Format(sql, Id);

            try
            {
                DataSet ds = new DataSet();
                ds = _MB.CreaDS(ds, "HingePositions", sql, _CN);
                if (ds.Tables["HingePositions"].Rows.Count > 0)
                {
                    foreach (DataRow item in ds.Tables["HingePositions"].Rows)
                    {
                        hingep = new HingePositions()
                        {
                            Id     = int.Parse(item["Id"].ToString()),
                            Status = new Status()
                            {
                                Id = int.Parse(item["IdStatus"].ToString()), Description = item["DescripStatus"].ToString()
                            },
                            Position1        = item["Position1"].ToString(),
                            Position2        = item["Position2"].ToString(),
                            Position3        = item["Position3"].ToString(),
                            Position4        = item["Position4"].ToString(),
                            Position5        = item["Position5"].ToString(),
                            CreationDate     = (item["CreationDate"].ToString() != "") ? DateTime.Parse(item["CreationDate"].ToString()) : DateTime.Parse("01/01/1900"),
                            ModificationDate = (item["ModificationDate"].ToString() != "") ? DateTime.Parse(item["ModificationDate"].ToString()) : DateTime.Parse("01/01/1900"),
                            CreatorUser      = int.Parse(item["CreatorUser"].ToString()),
                            ModificationUser = int.Parse(item["ModificationUser"].ToString()),
                        };
                    }
                }
                return(hingep);
            }
            catch (Exception)
            {
                throw;
            }
        }