Пример #1
0
    static DefectDefaults LoadValues()
    {
        DefectDefaults v = new DefectDefaults();

        foreach (var p in v.GetType().GetProperties())
        {
            if (p.CanWrite && p.PropertyType == typeof(int))
            {
                p.SetValue(v, _undef);
            }
        }
        string fields = "";

        foreach (var k in v._ivalues.Keys)
        {
            fields += string.Format(", '{0}'", k);
        }
        fields = fields.Remove(0, 1);
        string sql = string.Format("select FieldCode, DefaultVal from {0} where FieldCode in ({1}) AND EntityType = 1684431732", _Tabl, fields);

        foreach (DataRow row in DBHelper.GetRows(sql))
        {
            v._ivalues[row[0].ToString()] = int.Parse(row[1].ToString());
        }
        return(v);
    }
Пример #2
0
 public DefectDefaults(DefectDefaults copy)
 {
     foreach (string key in copy._ivalues.Keys)
     {
         _ivalues.Add(key, copy._ivalues[key]);
     }
 }
Пример #3
0
 public void setDefaults(DefectDefaults d)
 {
     if (!CurrentContext.Valid || !CurrentContext.Admin)
     {
         return;
     }
     DefectDefaults.CurrentDefaults = d;
 }