Exemplo n.º 1
0
 public void Bind()
 {
     if (InfoID > 0)
     {
         Tm_FlavorInfo FlavorInfo = Core.Container.Instance.Resolve <IServiceFlavor>().GetEntity(InfoID);
         txtCostName.Text        = FlavorInfo.FlavorName;
         ddlIsUsed.SelectedValue = FlavorInfo.IsUsed.ToString();
     }
 }
Exemplo n.º 2
0
        private void SetSelectedUsersEnableStatus(bool enabled)
        {
            string isUsed = enabled ? "2" : "1";
            // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames)
            List <int> ids = GetSelectedDataKeyIDs(Grid1);

            // 执行数据库操作
            foreach (int ID in ids)
            {
                Tm_FlavorInfo entity = Core.Container.Instance.Resolve <IServiceFlavor>().GetEntity(ID);
                entity.IsUsed = int.Parse(isUsed);
                Core.Container.Instance.Resolve <IServiceFlavor>().Update(entity);
            }
            // 重新绑定表格
            BindGrid();
        }
Exemplo n.º 3
0
        private void SaveItem()
        {
            Tm_FlavorInfo FlavorInfo = new Tm_FlavorInfo();

            if (InfoID > 0)
            {
                FlavorInfo = Core.Container.Instance.Resolve <IServiceFlavor>().GetEntity(InfoID);
            }
            FlavorInfo.FlavorName = txtCostName.Text.Trim();
            FlavorInfo.IsUsed     = int.Parse(ddlIsUsed.SelectedValue);
            FlavorInfo.ParentID   = 0;

            if (InfoID > 0)
            {
                Core.Container.Instance.Resolve <IServiceFlavor>().Update(FlavorInfo);
            }
            else
            {
                Core.Container.Instance.Resolve <IServiceFlavor>().Create(FlavorInfo);
            }
        }