示例#1
0
 public static string getFile(string scId)
 {
     try
     {
         initDaxue();
         if (Directory.Exists(file2Wei))
         {
             string numDaXue = null;
             if (Num_DaxueDic.TryGetValue(scId, out numDaXue))
             {
                 AFDictionary <string, FileInfo> dic1 = btnReNameFile_Click(file2Wei);
                 if (dic1.ContainsKey(numDaXue))
                 {
                     return(dic1[numDaXue].Name);
                 }
                 else
                 {
                     Cs.Warn(numDaXue + ",找不到文件");
                 }
             }
         }
     }
     catch (Exception ex1)
     {
         Cs.Warn(ex1.ToString());
     }
     return(scId);
 }
示例#2
0
    public static int GetSum(string sc, string kemuId, int optionType, ref string maxQuestionId)
    {
        AFDictionary <string, int>           dic1 = new AFDictionary <string, int>();
        AFDictionary <string, St_TTimuDaXue> d1   = GetDic(sc, kemuId, optionType, ref dic1);

        if (d1.Count > 0)
        {
            maxQuestionId = Convert.ToString(d1.Values[d1.Count - 1].QuestionId);
        }
        return(d1.Count);
    }
示例#3
0
 /// <summary>
 /// 枚举字段转变为json对象!
 /// </summary>
 /// <param name="attr"></param>
 /// <returns></returns>
 public JsonData AddEnum(AttributeItem attr)
 {
     if (dic5 == null)
     {
         dic5 = new AFDictionary <AttributeItem, string>();
     }
     if (!dic5.ContainsKey(attr))
     {
         dic5.Add(attr, attr.FieldNameHeadLower);
     }
     return(this);
 }
示例#4
0
 /// <summary>
 /// 枚举字段转变为json对象!
 /// </summary>
 /// <param name="attr"></param>
 /// <returns></returns>
 public JsonData AddEnum(string keyName, AttributeItem attr)
 {
     if (dic5 == null)
     {
         dic5 = new AFDictionary <AttributeItem, string>();
     }
     if (!dic5.ContainsKey(attr))
     {
         dic5.Add(attr, keyName);
     }
     return(this);
 }
示例#5
0
    /// <summary>
    /// 查找 会计 开头的课程
    /// </summary>
    public static AFDictionary <string, string> getSubKcName(string kcName)
    {
        AFDictionary <string, string> dic1 = new AFDictionary <string, string>();

        foreach (string key in dicEnZh.Keys)
        {
            if (key.StartsWith(kcName))
            {
                dic1.Add(key, dicEnZh[key]);
            }
        }
        return(dic1);
    }
示例#6
0
    public static string getSc(string sc)
    {
        string sc1 = "";

        if (!string.IsNullOrEmpty(sc))
        {
            AFDictionary <string, string> dic1 = getScOld();
            sc1 = Convert.ToString(sc).Trim();
            if (!string.IsNullOrEmpty(sc1) && dic1.ContainsKey(sc1))
            {
                return(dic1[sc1]);
            }
        }
        return(sc1);
    }
示例#7
0
 public JsonData Add2(string key1, string value1)
 {
     if (dic2 == null)
     {
         dic2 = new AFDictionary <string, string>();
     }
     if (!dic2.ContainsKey(key1))
     {
         dic2.Add(key1, Convert.ToString(value1));
     }
     else
     {
         dic2[key1] = Convert.ToString(value1);
     }
     return(this);
 }
示例#8
0
 public JsonData Add(string key1, string value)
 {
     if (dic1 == null)
     {
         dic1 = new AFDictionary <string, string>();
     }
     if (!dic1.ContainsKey(key1))
     {
         dic1.Add(key1, value);
     }
     else
     {
         dic1[key1] = value;
     }
     return(this);
 }
示例#9
0
    public static List <St_TTimuDaXue> getList(string sc, string kemuId, string leimu, string seq, string readType, int top, ref AFDictionary <string, int> dic1)
    {
        AFDictionary <string, St_TTimuDaXue> dicLeimu1 = BLL1.GetDic(sc, kemuId, leimu, ref dic1);

        int index1 = 0;

        if (dic1.ContainsKey(seq))
        {
            index1 = dic1[seq];
        }
        if (index1 < 0)
        {
            index1 = 0;
        }
        if (top == 0)
        {
            top = 50;
        }
        List <St_TTimuDaXue> list1 = new List <St_TTimuDaXue>();

        list1.AddRange(dicLeimu1.Values);

        if (list1.Count > 0)
        {
            List <St_TTimuDaXue> list2 = new List <St_TTimuDaXue>();
            if ((string.IsNullOrEmpty(readType) || readType == "0") && list1.Count > 0)
            {
                St_TTimuDaXue[] list3 = new St_TTimuDaXue[top];
                list1.CopyTo(index1, list3, 0, top);
                list2.AddRange(list3);
                return(list2);
            }
            else
            {
                int index2 = index1 - top;
                if (index2 < 0)
                {
                    index2 = 0;
                }
                St_TTimuDaXue[] list3 = new St_TTimuDaXue[top];
                list1.CopyTo(index2, list3, 0, top);
                list2.AddRange(list3);
                return(list2);
            }
        }
        return(list1);
    }
示例#10
0
    public static AFDictionary <string, St_TTimuDaXue> GetDic(string sc, string kemuId, string leimu, ref AFDictionary <string, int> dic2)
    {
        AFDictionary <string, St_TTimuDaXue> dic1 = new AFDictionary <string, St_TTimuDaXue>();

        if (string.IsNullOrEmpty(leimu))
        {
            leimu = "0";
        }
        dic1 = BLL1.GetDic(sc, kemuId, Convert.ToInt32(leimu), ref dic2);

        if (dic1.Count == 0)
        {
            sc   = "194";
            dic1 = BLL1.GetDic(sc, kemuId, Convert.ToInt32(leimu), ref dic2);
        }
        return(dic1);
    }
示例#11
0
    public static St_TTimuDaXue GetBySeq(string sc, string kemuId, string seq, string type, string leimu)
    {
        AFDictionary <string, int>           dic2 = new AFDictionary <string, int>();
        AFDictionary <string, St_TTimuDaXue> dic1 = GetDic(sc, kemuId, leimu, ref dic2);

        //if (type == "sequence")
        if (dic1.Values.Length > 0 && !string.IsNullOrEmpty(seq))
        {
            List <St_TTimuDaXue> list1 = new List <St_TTimuDaXue>();
            list1.AddRange(dic1.Values);
            //if (dic1.ContainsKey(id))
            //{
            //    return dic1[id];
            //}
            return(list1[Convert.ToInt32(seq) - 1]);
        }
        return(null);
    }
示例#12
0
    public static AFDictionary <string, TiMuXuanZe> fromTxt(string fileName)
    {
        AFDictionary <string, TiMuXuanZe> timulist = new AFDictionary <string, TiMuXuanZe>();

        try
        {
            if (File.Exists(fileName))
            {
                string content1 = File.ReadAllText(fileName, System.Text.Encoding.Default);
                content1 = content1.Replace("\r\n", "\n").Replace("\r\n\r\n", "");

                string[] clist = StringHelper.Split(content1, "/**********/");

                foreach (string s1 in clist)
                {
                    if (s1.Contains("题型:2"))
                    {
                    }
                    TiMuXuanZe t1 = From(s1);
                    if (t1 != null)
                    {
                        t1.id = (timulist.Count + 1).ToString();
                        try
                        {
                            if (!timulist.ContainsKey(t1.id))
                            {
                                timulist.Add(t1.id, t1);
                            }
                        }
                        catch (Exception ex2)
                        {
                            Cs.Error(ex2.ToString());
                        }
                    }
                }
                Cs.Warn(fileName + ",读题目:" + timulist.Count);
            }
        }
        catch (Exception ex)
        {
            Cs.Error(ex.ToString());
        }
        return(timulist);
    }
示例#13
0
    public static AFDictionary <string, St_TTimuDaXue> Init(string sc, string kemuId, ref AFDictionary <string, int> dic1)
    {
        initDaxue();
        readInt++;
        if (true)//每100次重新加载一次题目。
        {
            if (listMks.Count > 0 && DateTime.Now.Subtract(now1).TotalSeconds < 120)
            {
                now1    = DateTime.Now;
                readInt = 0;
                return(listMks);
            }
        }
        St_TTimuDaXue cond1 = new St_TTimuDaXue();

        cond1.Sc     = StringHelper.GetNumeric(sc);
        cond1.KemuId = Convert.ToInt32(kemuId);
        List <St_TTimuDaXue> list1 = BLLTable <St_TTimuDaXue> .Select(new St_TTimuDaXue(), cond1);

        int jj = 0;

        foreach (St_TTimuDaXue tt in list1)
        {
            jj++;
            listMks.Add(jj.ToString(), tt);
        }

        #region 其他题型
        AFDictionary <string, St_TTimuDaXue> listMks1 = new AFDictionary <string, St_TTimuDaXue>();
        AFDictionary <string, St_TTimuDaXue> listMks2 = new AFDictionary <string, St_TTimuDaXue>();
        AFDictionary <string, St_TTimuDaXue> listMks3 = new AFDictionary <string, St_TTimuDaXue>();
        AFDictionary <string, St_TTimuDaXue> listMks4 = new AFDictionary <string, St_TTimuDaXue>();

        AFDictionary <string, int> list2Mks  = new AFDictionary <string, int>();
        AFDictionary <string, int> list2Mks1 = new AFDictionary <string, int>();
        AFDictionary <string, int> list2Mks2 = new AFDictionary <string, int>();
        AFDictionary <string, int> list2Mks3 = new AFDictionary <string, int>();
        AFDictionary <string, int> list2Mks4 = new AFDictionary <string, int>();

        int i = -1;
        foreach (string id in listMks.Keys)
        {
            i++;
            list2Mks.Add(id, i);
            if (listMks[id].OptionType == "0")
            {
                listMks1.Add(id, listMks[id]);
                list2Mks1.Add(id, list2Mks1.Count);
            }
            if (listMks[id].OptionType == "1")
            {
                listMks2.Add(id, listMks[id]);
                list2Mks2.Add(id, list2Mks2.Count);
            }
            if (listMks[id].OptionType == "2")
            {
                listMks3.Add(id, listMks[id]);
                list2Mks3.Add(id, list2Mks3.Count);
            }
            if (listMks[id].OptionType == "3")
            {
                listMks4.Add(id, listMks[id]);
                list2Mks4.Add(id, list2Mks4.Count);
            }
        }
        string file1 = GetFile(sc, kemuId);
        if (dicDicTiMu.ContainsKey(file1))
        {
            dicDicTiMu[file1] = listMks;
        }
        else
        {
            dicDicTiMu.Add(file1, listMks);
        }

        if (dicDicTiMu1.ContainsKey(file1))
        {
            dicDicTiMu1[file1] = listMks1;
        }
        else
        {
            dicDicTiMu1.Add(file1, listMks1);
        }

        if (dicDicTiMu2.ContainsKey(file1))
        {
            dicDicTiMu2[file1] = listMks2;
        }
        else
        {
            dicDicTiMu2.Add(file1, listMks2);
        }

        if (dicDicTiMu3.ContainsKey(file1))
        {
            dicDicTiMu3[file1] = listMks3;
        }
        else
        {
            dicDicTiMu3.Add(file1, listMks3);
        }

        if (dicDicTiMu4.ContainsKey(file1))
        {
            dicDicTiMu4[file1] = listMks4;
        }
        else
        {
            dicDicTiMu4.Add(file1, listMks4);
        }
        /////

        if (dic2DicTiMu.ContainsKey(file1))
        {
            dic2DicTiMu[file1] = list2Mks;
        }
        else
        {
            dic2DicTiMu.Add(file1, list2Mks);
        }

        if (dic2DicTiMu1.ContainsKey(file1))
        {
            dic2DicTiMu1[file1] = list2Mks1;
        }
        else
        {
            dic2DicTiMu1.Add(file1, list2Mks1);
        }

        if (dic2DicTiMu2.ContainsKey(file1))
        {
            dic2DicTiMu2[file1] = list2Mks2;
        }
        else
        {
            dic2DicTiMu2.Add(file1, list2Mks2);
        }

        if (dic2DicTiMu3.ContainsKey(file1))
        {
            dic2DicTiMu3[file1] = list2Mks3;
        }
        else
        {
            dic2DicTiMu3.Add(file1, list2Mks3);
        }

        if (dic2DicTiMu4.ContainsKey(file1))
        {
            dic2DicTiMu4[file1] = list2Mks4;
        }
        else
        {
            dic2DicTiMu4.Add(file1, list2Mks4);
        }

        #endregion 其他题型

        if (dicDicTiMu.ContainsKey(file1))
        {
            return(dicDicTiMu[file1]);
        }
        if (dic2DicTiMu.ContainsKey(file1))
        {
            dic1 = dic2DicTiMu[file1];
        }
        return(new AFDictionary <string, St_TTimuDaXue>());
    }
示例#14
0
    public static AFDictionary <string, St_TTimuDaXue> Init(string sc, string kemuId)
    {
        AFDictionary <string, int> dic1 = new AFDictionary <string, int>();

        return(Init(sc, kemuId, ref dic1));
    }
示例#15
0
    public static AFDictionary <string, St_TTimuDaXue> GetDic(string sc, string kemuId, int optionType, ref AFDictionary <string, int> dic1)
    {
        Init(sc, kemuId);

        string file1 = GetFile(sc, kemuId);

        switch (optionType)
        {
        case 0:
            if (dicDicTiMu1.ContainsKey(file1))
            {
                dic1 = dic2DicTiMu1[file1];
                return(dicDicTiMu1[file1]);
            }
            break;

        case 1:
            if (dicDicTiMu2.ContainsKey(file1))
            {
                dic1 = dic2DicTiMu2[file1];
                return(dicDicTiMu2[file1]);
            }
            break;

        case 2:
            if (dicDicTiMu3.ContainsKey(file1))
            {
                dic1 = dic2DicTiMu3[file1];
                return(dicDicTiMu3[file1]);
            }
            break;

        case 3:
            if (dicDicTiMu4.ContainsKey(file1))
            {
                dic1 = dic2DicTiMu4[file1];
                return(dicDicTiMu4[file1]);
            }
            break;

        default:
            if (dicDicTiMu.ContainsKey(file1))
            {
                dic1 = dic2DicTiMu[file1];
                return(dicDicTiMu[file1]);
            }
            break;
        }
        return(new AFDictionary <string, St_TTimuDaXue>());
    }
示例#16
0
 public JsonData(bool isDebug)
 {
     this.isDebug = isDebug;
     dic1         = new AFDictionary <string, string>();
     tablelist    = new List <ITableImplement>();
 }
示例#17
0
    public static AFDictionary <string, St_TTimuDaXue> GetDic(string sc, string kemuId, string leimu)
    {
        AFDictionary <string, int> dic2 = new AFDictionary <string, int>();

        return(GetDic(sc, kemuId, leimu, ref dic2));
    }