Ejemplo n.º 1
0
        /// <summary>
        /// Adds a new parameter if it doesn't exist
        /// </summary>
        /// <param name="db"></param>
        /// <param name="parameterName"></param>
        private static void AddParameter(IntiDataContext db, string parameterName)
        {
            if (!db.Sys_Parameter.Any(p => p.Name == parameterName))
            {
                var parameter = new Sys_Parameter();
                parameter.GUID        = Guid.NewGuid();
                parameter.Name        = parameterName;
                parameter.Description = parameterName;


                db.Sys_Parameter.InsertOnSubmit(parameter);

                db.SubmitChanges();
            }
        }
Ejemplo n.º 2
0
    public void SaveInfo()
    {
        foreach (string ParameterName in txtParameterName.Text.Split(','))
        {
            objParameter = new Sys_Parameter();
            objParameter.ParameterTypeID = ParameterTypeID;
            objParameter.ParameterName   = ParameterName;
            objParameter.ParameterCode   = ParameterName;
            objParameter.ParameterCodeID = 0;
            objParameter.IsEnable        = true;
            objParameter.Remark          = "";
            objParameterRule.InsertParameter(objParameter);
        }

        MessageDialog("添加成功", "../../ServiceLayer/EnumType/ParameterList.aspx?ParameterTypeID=" + ParameterTypeID.ToString());
    }
Ejemplo n.º 3
0
 public override void RenderPage()
 {
     if (ParameterID.IsNoNull())
     {
         objParameter = objParameterRule.Sys_Parameter.FirstOrDefault(p => p.ParameterID == ParameterID);
         if (CheckEditObjectIsNull(objParameter))
         {
             return;
         }
         Page.DataBind();
     }
     else
     {
         IsEnable.Checked = true;
     }
 }
Ejemplo n.º 4
0
        public Sys_Parameter GetParameter(string parameterTypeCode, int parameterCodeID)
        {
            Sys_Parameter sys_Parameter = this.CurrentEntities.sys_parameter.FirstOrDefault((Sys_Parameter s) => s.Sys_ParameterType.ParameterTypeCode == parameterTypeCode && s.ParameterCodeID == parameterCodeID);

            if (sys_Parameter.IsNull())
            {
                SysAssert.ArgumentAssert <LogModuleType>(string.Concat(new object[]
                {
                    "未设置枚举参数",
                    parameterTypeCode,
                    "-",
                    parameterCodeID,
                    "值"
                }), LogModuleType.Framework);
            }
            return(sys_Parameter);
        }
Ejemplo n.º 5
0
    public void SaveInfo()
    {
        if (ParameterID.IsNull())
        {
            objParameter = new Sys_Parameter();
            objParameter.ParameterTypeID = ParameterTypeID;
            AutoObjectSetValue(objParameter);
            objParameterRule.InsertParameter(objParameter);

            MessageDialog("添加成功", "../../ServiceLayer/EnumType/ParameterList.aspx?ParameterTypeID=" + ParameterTypeID.ToString());
        }
        else
        {
            objParameter = objParameterRule.Sys_Parameter.First(p => p.ParameterID == ParameterID);
            AutoObjectSetValue(objParameter);
            objParameterRule.SaveChanges();
            MessageDialog("保存成功", "../../ServiceLayer/EnumType/ParameterList.aspx?ParameterTypeID=" + ParameterTypeID.ToString());
        }
    }
Ejemplo n.º 6
0
 public void InsertParameter(Sys_Parameter objParameter)
 {
     objParameter.ParameterCode.CheckIsNull("请输入参数代码", LogModuleType.ParameterLog);
     if (objParameter.ParameterCodeID == 0)
     {
         Sys_Parameter sys_Parameter = (from s in this.CurrentEntities.sys_parameter
                                        where s.ParameterTypeID == objParameter.ParameterTypeID
                                        orderby s.ParameterCodeID descending
                                        select s).FirstOrDefault <Sys_Parameter>();
         if (sys_Parameter.IsNull())
         {
             objParameter.ParameterCodeID = 1;
         }
         else
         {
             objParameter.ParameterCodeID = sys_Parameter.ParameterCodeID + 1;
         }
     }
     objParameter.ParameterName.CheckIsNull("请输入参数名称", LogModuleType.ParameterLog);
     this.CurrentEntities.AddTosys_parameter(objParameter);
     this.CurrentEntities.SaveChanges();
 }