private void DelTutor(string szID) { REQUESTCODE uResponse = REQUESTCODE.EXECUTE_FAIL; EXTIDENTACC delTuro = new EXTIDENTACC(); delTuro.dwAccNo = Parse(szID); uResponse = m_Request.Account.ExtIdentAccDel(delTuro); if (uResponse != REQUESTCODE.EXECUTE_SUCCESS) { MessageBox(m_Request.szErrMessage, "提示", MSGBOX.ERROR); } }
private bool UpdateTutor(uint accno, string name, uint ckStat) { string auto = ConfigurationManager.AppSettings["autoToTutor"];//若教师不是导师则自动转为导师 if (auto == null || auto == "1") { UNIACCOUNT[] tmp = GetAccByAccNo(accno.ToString()); if (tmp != null && tmp.Length > 0) { UNIACCOUNT acc = tmp[0]; if (!IsStat(acc.dwIdent, (uint)UNIACCOUNT.DWIDENT.EXTIDENT_TUTOR)) { EXTIDENTACC para = new EXTIDENTACC(); para.dwAccNo = accno; para.szTrueName = name; para.dwIdent = (uint)UNIACCOUNT.DWIDENT.EXTIDENT_TUTOR; m_Request.Account.ExtIdentAccSet(para); } } } //临时 如果已有导师则解除关系 if (curAcc.dwTutorID != null && curAcc.dwTutorID > 0) { TUTORSTUDENT para = new TUTORSTUDENT(); para.dwTutorID = curAcc.dwTutorID; para.dwAccNo = curAcc.dwAccNo; m_Request.Account.TutorStudentDel(para); } //////// TUTORSTUDENT set = new TUTORSTUDENT(); set.dwTutorID = accno; set.szTutorName = name; set.dwAccNo = curAcc.dwAccNo; set.szTrueName = curAcc.szTrueName; if (ckStat != 0) { set.dwStatus = ckStat; } if (m_Request.Account.TutorStudentSet(set) != REQUESTCODE.EXECUTE_SUCCESS) { return(false); } //更新session curAcc.dwTutorID = accno; curAcc.szTutorName = name; Session["LOGIN_ACCINFO"] = curAcc; return(true); }
void Import(string szFilePath, string szErrListRawFile, out uint nImported, out uint nFailed) { 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")); while ((strline = mysr.ReadLine()) != null) { string[] szList = strline.Split(','); if (szList.Length < 5) { continue; } string szSLogonName = szList[0]; string szSTrueName = szList[1]; string szSHandPhone = szList[2]; string szSEmail = szList[3]; string szSTel = szList[3]; UNIACCOUNT studentAcc = new UNIACCOUNT(); UNIACCOUNT teacherAcc = new UNIACCOUNT(); if (GetAccByLogonName(szSLogonName.Trim(), out studentAcc)) { EXTIDENTACC extAccount = new EXTIDENTACC(); extAccount.dwAccNo = studentAcc.dwAccNo; extAccount.dwIdent = (uint)UNIACCOUNT.DWIDENT.EXTIDENT_RTLEADER; extAccount.szHandPhone = szSHandPhone; extAccount.szEmail = szSEmail; extAccount.szTel = szSTel; m_Request.Account.ExtIdentAccSet(extAccount); nImported = nImported + 1; } } tWrite.Close(); }
protected void Page_Load(object sender, EventArgs e) { ACCREQ vrParameter = new ACCREQ(); UNIACCOUNT[] vrResult; GetHTTPObj(out vrParameter); vrParameter.dwIdent = (uint)UNIACCOUNT.DWIDENT.EXTIDENT_RTLEADER; GetPageCtrlValue(out vrParameter.szReqExtInfo); if (Request["delID"] != null) { UNIACCOUNT accno = new UNIACCOUNT(); if (GetAccByAccno(Request["delID"], out accno)) { EXTIDENTACC delAccount = new EXTIDENTACC(); delAccount.dwAccNo = accno.dwAccNo; delAccount.dwIdent = (uint)UNIACCOUNT.DWIDENT.EXTIDENT_TUTOR; m_Request.Account.ExtIdentAccDel(delAccount); } } if (m_Request.Account.Get(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS) { for (int i = 0; i < vrResult.Length; i++) { m_szOut += "<tr>"; m_szOut += "<td data-id='" + vrResult[i].dwAccNo.ToString() + "'>" + vrResult[i].szLogonName + "</td>"; m_szOut += "<td>" + vrResult[i].szTrueName + "</td>"; m_szOut += "<td>" + GetJustNameEqual((uint)vrResult[i].dwSex, "ACCNO_sex") + "</td>"; m_szOut += "<td>" + GetJustName((uint)vrResult[i].dwIdent, "ACCNO_IDENT") + "</td>"; m_szOut += "<td>" + vrResult[i].szClassName + "</td>"; m_szOut += "<td>" + vrResult[i].szDeptName + "</td>"; m_szOut += "<td>" + vrResult[i].szHandPhone + "</td>"; m_szOut += "<td>" + vrResult[i].szEmail + "</td>"; m_szOut += "<td>" + vrResult[i].szMemo + "</td>"; m_szOut += "<td><div class='OPTD'></div></td>"; m_szOut += "</tr>"; } UpdatePageCtrl(m_Request.Account); } PutBackValue(); }
void Import(string szFilePath, string szErrListRawFile, out uint nImported, out uint nFailed) { 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")); while ((strline = mysr.ReadLine()) != null) { string[] szList = strline.Split(','); if (szList.Length < 8) { continue; } string szSLogonName = szList[0]; string szSTrueName = szList[1]; string szSHandPhone = szList[2]; string szSEmail = szList[3]; string szTLogonName = szList[4]; string szTTrueName = szList[5]; string szTHandPhone = szList[6]; string szTEmail = szList[7]; UNIACCOUNT studentAcc = new UNIACCOUNT(); UNIACCOUNT teacherAcc = new UNIACCOUNT(); if (GetAccByLogonName(szSLogonName.Trim(), out studentAcc, true) && GetAccByLogonName(szTLogonName.Trim(), out teacherAcc)) { int uAuto = ConfigConst.GCTurtorReacher; if (uAuto == 1) { TUTORREQ tutorReq = new TUTORREQ(); tutorReq.dwTutorID = teacherAcc.dwAccNo; UNITUTOR[] vtTutor; if (m_Request.Account.TutorGet(tutorReq, out vtTutor) == REQUESTCODE.EXECUTE_SUCCESS && vtTutor != null && vtTutor.Length > 0) { } else { UNITUTOR setTutor = new UNITUTOR(); setTutor.dwAccNo = teacherAcc.dwAccNo; setTutor.szTrueName = teacherAcc.szTrueName; RESEARCHTEST setResarch = new RESEARCHTEST(); setResarch.szRTName = teacherAcc.szTrueName; setResarch.dwRTKind = (uint)RESEARCHTEST.DWRTKIND.RTKIND_RTASK; UNIGROUP setGroup = new UNIGROUP(); setGroup.dwKind = (uint)UNIGROUP.DWKIND.GROUPKIND_RERV; setGroup.szName = teacherAcc.szTrueName + ConfigConst.GCTutorName + "组"; if (m_Request.Group.SetGroup(setGroup, out setGroup) == REQUESTCODE.EXECUTE_SUCCESS) { setResarch.dwGroupID = setGroup.dwGroupID; } setResarch.szRTName = setTutor.szTrueName + ConfigConst.GCReachTestName; setResarch.dwLeaderID = setTutor.dwAccNo; setResarch.szLeaderName = setTutor.szTrueName; if (m_Request.Reserve.SetResearchTest(setResarch, out setResarch) == REQUESTCODE.EXECUTE_SUCCESS) { // m_Request.Account.TutorSet(setTutor); } } } else { TUTORREQ tutorReq = new TUTORREQ(); tutorReq.dwTutorID = teacherAcc.dwAccNo; UNITUTOR[] vtTutor; if (m_Request.Account.TutorGet(tutorReq, out vtTutor) == REQUESTCODE.EXECUTE_SUCCESS && vtTutor != null && vtTutor.Length > 0) { } else { EXTIDENTACC setTutor = new EXTIDENTACC(); setTutor.dwAccNo = teacherAcc.dwAccNo; setTutor.szTrueName = teacherAcc.szTrueName; RESEARCHTEST setResarch = new RESEARCHTEST(); setResarch.szRTName = teacherAcc.szTrueName; setResarch.dwRTKind = (uint)RESEARCHTEST.DWRTKIND.RTKIND_RTASK; setResarch.szRTName = setTutor.szTrueName + ConfigConst.GCReachTestName; setResarch.dwLeaderID = setTutor.dwAccNo; setResarch.szLeaderName = setTutor.szTrueName; if (m_Request.Reserve.SetResearchTest(setResarch, out setResarch) == REQUESTCODE.EXECUTE_SUCCESS) { m_Request.Account.ExtIdentAccSet(setTutor); } } } TUTORSTUDENT turtorStudent = new TUTORSTUDENT(); turtorStudent.dwTutorID = teacherAcc.dwAccNo; turtorStudent.szTutorName = teacherAcc.szTrueName; turtorStudent.dwAccNo = studentAcc.dwAccNo; turtorStudent.dwStatus = ((uint)ADMINCHECK.DWCHECKSTAT.CHECKSTAT_ADMINOK); turtorStudent.szPID = studentAcc.szLogonName; turtorStudent.szTrueName = studentAcc.szTrueName; m_Request.Account.TutorStudentSet(turtorStudent); nImported = nImported + 1; } } tWrite.Close(); }
void Import(string szFilePath, string szErrListRawFile, out uint nImported, out uint nFailed) { 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")); REQUESTCODE uResponse = REQUESTCODE.EXECUTE_FAIL; System.IO.StringWriter swCSV = new System.IO.StringWriter(); bool bAllRight = true; int count = 0; while ((strline = mysr.ReadLine()) != null) { count = count + 1; string[] szList = strline.Split(','); if (szList.Length < 8) { continue; } string researchSN = szList[0]; string researchName = szList[1]; string szLogonName = szList[2]; string szTrueName = szList[3]; string szDeptName = szList[4]; string szDate = szList[5]; string szDeptName2 = szList[6]; string szLevel = szList[7]; UNIACCOUNT studentAcc; UNIACCOUNT[] accList; string szLogonNameError = "不能存在账户:"; string szMemo = ""; if (GetAccByLogonName(szLogonName.Trim(), out studentAcc)) { } else { accList = GetAccByTrueName(szTrueName.Trim()); if (accList == null) { szMemo = "账户不存在"; } else if (accList.Length > 1) { for (int i = 0; i < accList.Length; i++) { szMemo += accList[i].szLogonName + "," + accList[i].szTrueName + "," + accList[i].szDeptName + ";"; } } else { studentAcc = accList[0]; } } if (studentAcc.dwAccNo == null) { System.Text.StringBuilder sbText = new System.Text.StringBuilder(); sbText = AppendCSVFields(sbText, researchSN); sbText = AppendCSVFields(sbText, researchName); sbText = AppendCSVFields(sbText, szLogonName); sbText = AppendCSVFields(sbText, szTrueName); sbText = AppendCSVFields(sbText, szDeptName); //协助 sbText = AppendCSVFields(sbText, szDate); ////使用 sbText = AppendCSVFields(sbText, szDeptName2); //样品费 sbText = AppendCSVFields(sbText, szLevel); //样品费 sbText = AppendCSVFields(sbText, szMemo); //样品费 sbText.Remove(sbText.Length - 1, 1); swCSV.WriteLine(sbText.ToString()); if (count != 1) { bAllRight = false; } continue; } UNIDEPT dept; RESEARCHTEST setValue = new RESEARCHTEST(); if (GetDeptByName(szDeptName, out dept)) { setValue.dwDeptID = dept.dwID; } else { setValue.dwDeptID = 0; } setValue.dwLeaderID = studentAcc.dwAccNo; setValue.dwLeaderID = studentAcc.dwAccNo; setValue.szLeaderName = studentAcc.szTrueName; setValue.szLeaderName = studentAcc.szTrueName; setValue.szRTName = researchName; setValue.szRTSN = researchSN; setValue.dwBeginDate = GetDate(szDate); setValue.dwRTLevel = Parse(szLevel); setValue.szFromUnit = szDeptName2; UNIGROUP setGroup; if (NewGroup(setValue.szRTName, (uint)UNIGROUP.DWKIND.GROUPKIND_RERV, out setGroup)) { setValue.dwGroupID = setGroup.dwGroupID; } else { continue; } uResponse = m_Request.Reserve.SetResearchTest(setValue, out setValue); if (uResponse == REQUESTCODE.EXECUTE_SUCCESS) { nImported = nImported + 1; AddGroupMember(setGroup.dwGroupID, setValue.dwLeaderID, (uint)GROUPMEMBER.DWKIND.MEMBERKIND_PERSONAL); EXTIDENTACC setTutor = new EXTIDENTACC(); setTutor.dwAccNo = setValue.dwLeaderID; m_Request.Account.ExtIdentAccSet(setTutor); } else { szMemo = m_Request.szErrMessage; System.Text.StringBuilder sbText = new System.Text.StringBuilder(); sbText = AppendCSVFields(sbText, researchSN); sbText = AppendCSVFields(sbText, researchName); sbText = AppendCSVFields(sbText, szLogonName); sbText = AppendCSVFields(sbText, szTrueName); sbText = AppendCSVFields(sbText, szDeptName); //协助 sbText = AppendCSVFields(sbText, szDate); ////使用 sbText = AppendCSVFields(sbText, szDeptName2); //样品费 sbText = AppendCSVFields(sbText, szLevel); //样品费 sbText = AppendCSVFields(sbText, szMemo); //样品费 sbText.Remove(sbText.Length - 1, 1); swCSV.WriteLine(sbText.ToString()); bAllRight = false; uResponse = m_Request.Group.DelGroup(setGroup); } { szLogonNameError += szLogonName + ","; } } if (!bAllRight) { DownloadFile(Response, swCSV.GetStringBuilder(), "resarchTestImport.csv"); } swCSV.Close(); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string sAccno = Request["sLogonName"]; string tLogonName = Request["tLogonName"]; string szHandPhone = Request["Handphone"]; string szEmail = Request["email"]; Response.CacheControl = "no-cache"; UNIACCOUNT studentAcc = new UNIACCOUNT(); UNIACCOUNT teacherAcc = new UNIACCOUNT(); if (GetAccByLogonName(sAccno, out studentAcc) && GetAccByLogonName(tLogonName, out teacherAcc)) { int uAuto = ConfigConst.GCTurtorReacher; if (uAuto == 1) { TUTORREQ tutorReq = new TUTORREQ(); tutorReq.dwTutorID = teacherAcc.dwAccNo; UNITUTOR[] vtTutor; if (m_Request.Account.TutorGet(tutorReq, out vtTutor) == REQUESTCODE.EXECUTE_SUCCESS && vtTutor != null && vtTutor.Length > 0) { } else { EXTIDENTACC setTutor = new EXTIDENTACC(); setTutor.dwAccNo = teacherAcc.dwAccNo; setTutor.szTrueName = teacherAcc.szTrueName; RESEARCHTEST setResarch = new RESEARCHTEST(); setResarch.szRTName = teacherAcc.szTrueName; setResarch.dwRTKind = (uint)RESEARCHTEST.DWRTKIND.RTKIND_RTASK; UNIGROUP setGroup = new UNIGROUP(); setGroup.dwKind = (uint)UNIGROUP.DWKIND.GROUPKIND_RERV; setGroup.szName = teacherAcc.szTrueName + ConfigConst.GCTutorName + "组"; if (m_Request.Group.SetGroup(setGroup, out setGroup) == REQUESTCODE.EXECUTE_SUCCESS) { setResarch.dwGroupID = setGroup.dwGroupID; } setResarch.szRTName = setTutor.szTrueName + ConfigConst.GCReachTestName; setResarch.dwLeaderID = setTutor.dwAccNo; setResarch.szLeaderName = setTutor.szTrueName; if (m_Request.Reserve.SetResearchTest(setResarch, out setResarch) == REQUESTCODE.EXECUTE_SUCCESS) { m_Request.Account.ExtIdentAccSet(setTutor); } } } TUTORSTUDENT turtorStudent = new TUTORSTUDENT(); turtorStudent.dwTutorID = teacherAcc.dwAccNo; turtorStudent.szTutorName = teacherAcc.szTrueName; turtorStudent.dwAccNo = studentAcc.dwAccNo; //turtorStudent.dwStatus = ((uint)ADMINCHECK.DWCHECKSTAT.CHECKSTAT_ADMINOK); turtorStudent.szPID = studentAcc.szLogonName; turtorStudent.szTrueName = studentAcc.szTrueName; if (szHandPhone != null) { studentAcc.szHandPhone = szHandPhone; } if (szEmail != null) { studentAcc.szEmail = szEmail; } m_Request.Account.Set(studentAcc, out studentAcc); if (m_Request.Account.TutorStudentSet(turtorStudent) == REQUESTCODE.EXECUTE_SUCCESS) { Response.Write("{\"message\":\"succ\"}"); } else { Response.Write("{\"message\":\"" + m_Request.szErrMessage + "\"}"); } } else { Response.Write("{\"message\":\"" + ConfigConst.GCTutorName + "信息未指定" + "\"}"); } }