Exemplo n.º 1
0
 public void Bind()
 {
     if (InfoID > 0)
     {
         Tm_Abnormal AbnormalInfo = Core.Container.Instance.Resolve <IServiceAbnormal>().GetEntity(InfoID);
         txtCostName.Text          = AbnormalInfo.AbnormalName;
         txtCode.Text              = AbnormalInfo.AbnormalCode;
         lblPY.Text                = AbnormalInfo.AbnormalPY;
         ddlIsUsed.SelectedValue   = AbnormalInfo.IsUsed.ToString();
         ddlCostType.SelectedValue = AbnormalInfo.AbnormalType;
     }
 }
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_Abnormal entity = Core.Container.Instance.Resolve <IServiceAbnormal>().GetEntity(ID);
                entity.IsUsed = int.Parse(isUsed);
                Core.Container.Instance.Resolve <IServiceAbnormal>().Update(entity);
            }
            // 重新绑定表格
            BindGrid();
        }
Exemplo n.º 3
0
        private void SaveItem()
        {
            Tm_Abnormal AbnormalInfo = new Tm_Abnormal();

            if (InfoID > 0)
            {
                AbnormalInfo = Core.Container.Instance.Resolve <IServiceAbnormal>().GetEntity(InfoID);
            }
            AbnormalInfo.AbnormalName = txtCostName.Text.Trim();
            AbnormalInfo.AbnormalType = ddlCostType.SelectedValue;
            AbnormalInfo.IsUsed       = int.Parse(ddlIsUsed.SelectedValue);
            AbnormalInfo.AbnormalCode = txtCode.Text.Trim();
            AbnormalInfo.AbnormalPY   = GetChinesePY(txtCostName.Text.Trim());;

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