Esempio n. 1
0
 public uint bIsExitst(ArrayList list, string szName, uint uEndLine)
 {
     for (int i = 0; i < list.Count; i++)
     {
         classGroup temp = new classGroup();
         temp = (classGroup)list[i];
         if (temp.szGroupName == szName)
         {
             return(temp.uGroupID);
         }
     }
     UNIGROUP[] groupList;
     groupList = GetGroupByName(szName);
     if (groupList != null && groupList.Length > 0 && (groupList[0].szName.ToString() == szName) && (groupList[0].dwDeadLine.ToString() == uEndLine.ToString()))
     {
         return((uint)groupList[0].dwGroupID);
     }
     return(0);
 }
Esempio n. 2
0
    void Import(string szFilePath, string szErrListRawFile, out uint nImported, out uint nFailed, out string szOutError)
    {
        szOutError  = "";
        szOutError += "<table border='1px' class='tblCSV'>";
        ErrorLines  = new ArrayList();
        nImported   = 0;
        nFailed     = 0;
        string strline;

        StreamWriter tWrite = new StreamWriter(szErrListRawFile, false, Encoding.GetEncoding("gb2312"));

        System.IO.StreamReader mysr = new StreamReader(Server.MapPath(szFilePath), Encoding.GetEncoding("gb2312"));
        ArrayList list      = new ArrayList();
        string    szEndLine = Request["dwDeadLine"];
        uint      uEndLine  = Parse(szEndLine);

        if (uEndLine == 0)
        {
            return;
        }
        int nCountTemp = 0;

        while ((strline = mysr.ReadLine()) != null)
        {
            if (nCountTemp == 0)
            {
                nCountTemp = nCountTemp + 1;
                continue;
            }
            string[] szList = strline.Split(',');

            string szGrouName = szList[0].Trim();
            uint   uGroupID   = bIsExitst(list, szGrouName, uEndLine);
            if (uGroupID == 0)
            {
                UNIGROUP newGroup;
                if (NewGroup(szGrouName, (uint)UNIGROUP.DWKIND.GROUPKIND_RERV, out newGroup, uEndLine))
                {
                    classGroup newGroupTemp = new classGroup();
                    newGroupTemp.uGroupID    = (uint)newGroup.dwGroupID;
                    newGroupTemp.szGroupName = szGrouName;
                    list.Add(newGroupTemp);
                    uGroupID = (uint)newGroup.dwGroupID;
                }
            }
            else
            {
                //szOutError += "<tr><td>" + szGrouName + "</td><td>" +"已存在,不新建直接插入成员"+"</td></tr>";
            }
            string     szPID      = szList[1].Trim();
            uint       szTrueName = Parse(szList[1]);
            UNIACCOUNT accinfo;
            if (GetAccByLogonName(szPID, out accinfo, true) && uGroupID != 0)
            {
                if (IsInClassGroupMember(uGroupID, accinfo.dwAccNo, (uint)GROUPMEMBER.DWKIND.MEMBERKIND_PERSONAL))
                {
                    szOutError += "<tr><td>" + szPID + "</td><td>" + "已经添加" + "</td></tr>";
                    nFailed     = nFailed + 1;
                }
                else
                {
                    REQUESTCODE uResponse = AddGroupMember(uGroupID, accinfo.dwAccNo, (uint)GROUPMEMBER.DWKIND.MEMBERKIND_PERSONAL, accinfo.szTrueName.ToString());
                    if (uResponse == REQUESTCODE.EXECUTE_SUCCESS)
                    {
                        nImported = nImported + 1;
                    }
                    else
                    {
                        szOutError += "<tr><td>" + szPID + "</td><td>" + "添加失败," + m_Request.szErrMessage.ToString() + "</td></tr>";
                        nFailed     = nFailed + 1;
                    }
                }
            }
            else
            {
                szOutError += "<tr><td>" + szPID + "</td><td>" + ":不存在" + "</td></tr>";
            }
        }

        tWrite.Close();
        szOutError += "</table>";
    }