public int editByBearing(string id, string name, string no)
        {
            int flag = 0;
            using (ChooseDishesEntities entities = new ChooseDishesEntities())
            {
                Bearing bear = new Bearing()
                {
                    BearingId = int.Parse(id),
                    Code = int.Parse(no),
                    Name = name,
                    UpdateBy=1,
                    UpdateDatetime=DateTime.Now

                };
                DbEntityEntry<Bearing> entry = entities.Entry<Bearing>(bear);
                entry.State = System.Data.EntityState.Unchanged;
                entry.Property("Code").IsModified = true;
                entry.Property("Name").IsModified = true;
                entry.Property("UpdateBy").IsModified = true;
                entry.Property("UpdateDatetime").IsModified = true;
                try
                {
                    flag = entities.SaveChanges();
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }
            return flag;
        }
        public int delByBearing(string id)
        {
            int flag = 0;
            using (ChooseDishesEntities entities = new ChooseDishesEntities())
            {
                Bearing bear = new Bearing()
                {
                    BearingId = int.Parse(id),
                    UpdateBy=1,
                    Deleted = 1,
                    UpdateDatetime=DateTime.Now

                };
                DbEntityEntry<Bearing> entry = entities.Entry<Bearing>(bear);
                entry.State = System.Data.EntityState.Unchanged;
                entry.Property("UpdateBy").IsModified = true;
                entry.Property("Deleted").IsModified = true;
                entry.Property("UpdateDatetime").IsModified = true;
                try
                {
                    entities.Configuration.ValidateOnSaveEnabled = false; 
                    flag = entities.SaveChanges();
                    entities.Configuration.ValidateOnSaveEnabled = true; 
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }
            return flag;
        }
        public int addBearing(string name, string no)
        {
            int flag = 0;
            using (ChooseDishesEntities entities = new ChooseDishesEntities())
            {
                Bearing bear = new Bearing()
                {
                    Code = int.Parse(no),
                    Name = name,
                    CreateDatetime = DateTime.Now,
                    CreateBy = 1,
                    Deleted = 1,
                    Status = 1

                };
                entities.Bearing.Add(bear);
                try
                {
                    flag = entities.SaveChanges();
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }
            return flag;
        }