Exemple #1
0
        public void UpdateParameter(int parameterTypeID)
        {
            Sys_ParameterType sys_ParameterType = this.CurrentEntities.sys_parametertype.First((Sys_ParameterType p) => p.ParameterTypeID == parameterTypeID);

            sys_ParameterType.TypeName.CheckIsNull("请输入类名才能更新", LogModuleType.ParameterLog);
            IList <EnumParameter> enumMembers = sys_ParameterType.TypeName.GetEnumMembers(sys_ParameterType.AssemblyName);

            this.CurrentEntities.sys_parameter.DeleteData((Sys_Parameter s) => s.ParameterTypeID == parameterTypeID);
            int num = 0;

            foreach (EnumParameter current in enumMembers)
            {
                this.CurrentEntities.AddTosys_parameter(new Sys_Parameter
                {
                    ParameterTypeID = parameterTypeID,
                    ParameterName   = current.Description,
                    ParameterCode   = current.Key,
                    ParameterCodeID = current.Value,
                    Remark          = current.Description,
                    SortIndex       = num++,
                    IsEnable        = true
                });
            }
            this.CurrentEntities.SaveChanges();
        }
    public void SaveInfo()
    {
        if (ParameterTypeID.IsNoNull())
        {
            objParameterType = objParameterRule.Sys_ParameterType.First(p => p.ParameterTypeID == ParameterTypeID);



            if (objParameterRule.Sys_ParameterType.Any(s => s.ParameterTypeID != ParameterTypeID && s.ParameterTypeCode == txtParameterTypeCode.Text))
            {
                MessageDialog("代码已经存在无法修改");
                return;
            }
            objParameterType.ParameterTypeCode = txtParameterTypeCode.Text;
            objParameterType.Remark            = txtRemark.Text;
            objParameterType.ParameterTypeName = txtParameterTypeName.Text;
            objParameterType.TypeName          = txtTypeName.Text;
            objParameterType.AssemblyName      = txtAssemblyName.Text;
            objParameterRule.SaveChanges();
            MessageDialog("修改成功", "../../ServiceLayer/EnumType/ParameterTypeList.aspx");
        }
        else
        {
            objParameterType = new Sys_ParameterType();
            objParameterType.ParameterTypeCode = txtParameterTypeCode.Text;
            objParameterType.Remark            = txtRemark.Text;
            objParameterType.ParameterTypeName = txtParameterTypeName.Text;
            objParameterType.TypeName          = txtTypeName.Text;
            objParameterType.AssemblyName      = txtAssemblyName.Text;
            objParameterRule.InsertParameterType(objParameterType);
            MessageDialog("新增成功", "../../ServiceLayer/EnumType/ParameterTypeList.aspx");
        }
    }
Exemple #3
0
 public void InsertParameterType(Sys_ParameterType objParameterType)
 {
     objParameterType.ParameterTypeName.CheckIsNull("请输入参数类型名称", LogModuleType.ParameterLog);
     objParameterType.ParameterTypeCode.CheckIsNull("请输入参数类型代码", LogModuleType.ParameterLog);
     SysAssert.CheckCondition(this.CurrentEntities.sys_parametertype.Any((Sys_ParameterType p) => p.ParameterTypeCode == objParameterType.ParameterTypeCode), "输入的参数类型代码已经存在", LogModuleType.ParameterLog);
     this.CurrentEntities.AddTosys_parametertype(objParameterType);
     this.CurrentEntities.SaveChanges();
 }
    public override void RenderPage()
    {
        if (ParameterTypeID.IsNoNull())
        {
            objParameterType = objParameterRule.Sys_ParameterType.First(p => p.ParameterTypeID == ParameterTypeID);


            Page.DataBind();
        }
    }