예제 #1
0
 public ActionResult Create(LOGO model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var dao = new LogoDao();
             int id  = dao.Insert(model);
             if (id > 0)
             {
                 SetAlert("Thêm thành công", "success");
                 return(RedirectToAction("Index", "Logo"));
             }
             else
             {
                 ModelState.AddModelError("", "Thêm thất bại");
             }
         }
         return(View(model));
     }
     catch
     {
         return(View());
     }
 }
예제 #2
0
 public int Insert(LOGO entity)
 {
     try
     {
         db.LOGO.Add(entity);
         db.SaveChanges();
         return(entity.ID);
     }
     catch (Exception)
     {
         return(0);
     }
 }
예제 #3
0
        private void cargarGrilla()
        {
            NegocioArticulos negocio = new NegocioArticulos();

            try
            {
                listaArticulos = negocio.listar();
                dataGridViewPrincipal.DataSource = listaArticulos;
                dataGridViewPrincipal.Columns["ImagenUrl"].Visible = false;
                LOGO.Load("https://topcbd.deals/wp-content/uploads/2020/01/farmacy.png");
                cargarImagen(listaArticulos[0].ImagenURl);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #4
0
 public ActionResult Edit(LOGO model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var result = new LogoDao().Update(model);
             if (result)
             {
                 SetAlert("Cập nhật thành công", "success");
                 return(RedirectToAction("Index", "Logo"));
             }
             else
             {
                 ModelState.AddModelError("", "Cập nhật thất bại");
             }
         }
         return(View(model));
     }
     catch
     { return(View()); }
 }
예제 #5
0
 public bool Update(LOGO entity)
 {
     try
     {
         var logo = db.LOGO.Find(entity.ID);
         logo.Logo          = entity.Logo;
         logo.DisplayOrder  = entity.DisplayOrder;
         logo.Link          = entity.Link;
         logo.Created_Date  = DateTime.Now;
         logo.Status        = entity.Status;
         logo.Description   = entity.Description;
         logo.Created_By    = entity.Created_By;
         logo.Modified_By   = entity.Modified_By;
         logo.Modified_Date = DateTime.Now;
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #6
0
        // ReSharper restore InconsistentNaming

        private void init_tree(LOGO logo)
        {
            init_tree((UInt32)logo);
        }
예제 #7
0
        /// <summary>
        /// Method used to add a property to the instance. Will be placed in the correct class Property.
        /// </summary>
        /// <param name="input">The vCard.Property to add.</param>
        public void AddProperty(Props.IProperty input)
        {
            if (input == null || input.IsValueNull)
            {
                return;
            }

            switch (input.Property)
            {
            case KnownProperties.ADR:
                ADR.AddIfNotNull(input as Props.ADR);
                break;

            case KnownProperties.ANNIVERSARY:
                ANNIVERSARY = input as Props.ANNIVERSARY;
                break;

            case KnownProperties.BDAY:
                BDAY = input as Props.BDAY;
                break;

            case KnownProperties.CALADRURI:
                CALADRURI.AddIfNotNull(input as Props.CALADRURI);
                break;

            case KnownProperties.CALURI:
                CALURI.AddIfNotNull(input as Props.CALURI);
                break;

            case KnownProperties.CATEGORIES:
                CATEGORIES.AddIfNotNull(input as Props.CATEGORIES);
                break;

            case KnownProperties.CLIENTPIDMAP:
                CLIENTPIDMAP.AddIfNotNull(input as Props.CLIENTPIDMAP);
                break;

            case KnownProperties.EMAIL:
                EMAIL.AddIfNotNull(input as Props.EMAIL);
                break;

            case KnownProperties.FBURL:
                FBURL.AddIfNotNull(input as Props.FBURL);
                break;

            case KnownProperties.FN:
                FN.AddIfNotNull(input as Props.FN);
                break;

            case KnownProperties.GENDER:
                GENDER = input as Props.GENDER;
                break;

            case KnownProperties.GEO:
                GEO.AddIfNotNull(input as Props.GEO);
                break;

            case KnownProperties.IMPP:
                IMPP.AddIfNotNull(input as Props.IMPP);
                break;

            case KnownProperties.KEY:
                KEY.AddIfNotNull(input as Props.KEY);
                break;

            case KnownProperties.KIND: {
                char k = (input as Props.KIND).Value.ToLower()[0];
                if (k == 'i')
                {
                    KIND = Kinds.Individual;
                }
                else if (k == 'g')
                {
                    KIND = Kinds.Group;
                }
                else if (k == 'o')
                {
                    KIND = Kinds.Org;
                }
                else if (k == 'l')
                {
                    KIND = Kinds.Location;
                }
                else
                {
                    KIND = Kinds.Individual;
                }
                break;
            }

            case KnownProperties.LANG:
                LANG.AddIfNotNull(input as Props.LANG);
                break;

            case KnownProperties.LOGO:
                LOGO.AddIfNotNull(input as Props.LOGO);
                break;

            case KnownProperties.MEMBER:
                MEMBER.AddIfNotNull(input as Props.MEMBER);
                break;

            case KnownProperties.N:
                N = input as Props.N;
                break;

            case KnownProperties.NICKNAME:
                NICKNAME.AddIfNotNull(input as Props.NICKNAME);
                break;

            case KnownProperties.NOTE:
                NOTE.AddIfNotNull(input as Props.NOTE);
                break;

            case KnownProperties.ORG:
                ORG.AddIfNotNull(input as Props.ORG);
                break;

            case KnownProperties.PHOTO:
                PHOTO.AddIfNotNull(input as Props.PHOTO);
                break;

            case KnownProperties.PRODID:
                PRODID = input as Props.PRODID;
                break;

            case KnownProperties.RELATED:
                RELATED.AddIfNotNull(input as Props.RELATED);
                break;

            case KnownProperties.REV:
                REV = input as Props.REV;
                break;

            case KnownProperties.ROLE:
                ROLE.AddIfNotNull(input as Props.ROLE);
                break;

            case KnownProperties.SOUND:
                SOUND.AddIfNotNull(input as Props.SOUND);
                break;

            case KnownProperties.SOURCE:
                SOURCE.AddIfNotNull(input as Props.SOURCE);
                break;

            case KnownProperties.TEL:
                TEL.AddIfNotNull(input as Props.TEL);
                break;

            case KnownProperties.TITLE:
                TITLE.AddIfNotNull(input as Props.TITLE);
                break;

            case KnownProperties.TZ:
                TZ.AddIfNotNull(input as Props.TZ);
                break;

            case KnownProperties.UID:
                UID = input as Props.UID;
                break;

            case KnownProperties.URL:
                URL.AddIfNotNull(input as Props.URL);
                break;

            case KnownProperties.VERSION:
                VERSION = input as Props.VERSION;
                break;

            case KnownProperties.XML:
                XML.AddIfNotNull(input as Props.XML);
                break;

            default:
                return;
            }
        }
        // ReSharper restore InconsistentNaming

        private void init_tree(LOGO logo)
        {
            init_tree((UInt32)logo);
        }