private static Dictionary <string, string> GetData(Gdxj xj, SendDataClass gdc) { Dictionary <string, string> result = new Dictionary <string, string>(); string url = (gdc.GetType() == typeof(GetGeneralDictClass)) ? setting.url.QueryGeneralDicUrl : setting.url.QueryForDicUrl; try { AjaxCommand.Send.ContextCommandParams ccp = new AjaxCommand.Send.ContextCommandParams() { @params = gdc }; string json = JsonConvert.SerializeObject(ccp, Formatting.Indented); string html = RequestHelper.GetByPostJsonWithCsrf(url, json, ref xj.GdxjCookie.cookie, Csrf.GetCsrfToken(), setting.url.QueryGradeRefererUrl); ReceiveDictDataClass receiveStudentData = JsonConvert.DeserializeObject <ReceiveDictDataClass>(html); receiveStudentData.rows.ForEach(r => { result.Add(r.value, r.text); }); } catch (Exception e) { throw (e); } return(result); }
public LoginViewModel(Gdxj gdxj) { this.gdxj = gdxj; VerificationCodeImageRefresh = new DelegateCommand(() => { this.gdxj.Login.VerificationCodeImageRefresh(); }); LoginCommand = new DelegateCommand(() => { if (Username.Length < 1) { LoginInfo = "´íÎó£ºÕ˺Ų»ÄÜΪ¿Õ£¡"; return; } gdxj.Login.Username = Username; gdxj.Login.Password = Password; gdxj.Login.VerificationCode = VerificationCode; gdxj.Login.Login(); }) { IsEnabled = false }; Username = "******"; Password = "******"; gdxj.Subscribe(Login); gdxj.Initialization(); }
public MainViewModel() { try { gdxj = new Gdxj(); Initialization(); #region 初始化文件夹 #endregion LoginCommand = new DelegateCommand(() => SelectedModuleNumber = 0) { IsEnabled = false }; AllCommand = new DelegateCommand(() => SelectedModuleNumber = 1) { IsEnabled = false }; MailCommand = new DelegateCommand(() => SelectedModuleNumber = 2) { IsEnabled = false }; DocumentCommand = new DelegateCommand(() => SelectedModuleNumber = 3) { IsEnabled = false }; DeliveryCommand = new DelegateCommand(() => SelectedModuleNumber = 4) { IsEnabled = false }; SetupCommand = new DelegateCommand(() => SelectedModuleNumber = 5) { IsEnabled = true }; Models.Add(new LoginModule(gdxj)); Models.Add(new StudentManagementModule(gdxj)); //Models.Add(new MailModule(ccoa)); //Models.Add(new NewMailBoxModule(ccoa)); //Models.Add(new DepartmentSetupModule(ccoa)); //Models.Add(new PrintTaskListModule(ccoa)); //Models.Add(new SetupModule(ccoa)); //ccoa.Subscribe(Login); } catch (Exception e) { if (gdxj != null) { gdxj.Login.Logout(); } MessageBox.Show("系统初始化失败\n" + e.Message, "系统运行错误", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } }
public StudentManagementViewModel(Gdxj gdxj) { this.gdxj = gdxj; Thread t = new Thread(BuildObjectTree) { IsBackground = true }; t.Start(); }
public static void GetDictionarys(Gdxj xj) { ClassDict = GetData(xj, new GetGeneralDictClass(xj.GdxjUser.organ.organCode)); Country = GetData(xj, new GetDictClass(SendDataSetting.CountryID)); CertificateType = GetData(xj, new GetDictClass(SendDataSetting.CertificateType)); GATQ = GetData(xj, new GetDictClass(SendDataSetting.GATQ)); ZXSKJ = GetData(xj, new GetDictClass(SendDataSetting.ZXSKJ)); HKXZ = GetData(xj, new GetDictClass(SendDataSetting.HKXZ)); YesOrNo = GetData(xj, new GetDictClass(SendDataSetting.YesOrNo)); LSET = GetData(xj, new GetDictClass(SendDataSetting.LSET)); XB = GetData(xj, new GetDictClass(SendDataSetting.XB)); MZ = GetData(xj, new GetDictClass(SendDataSetting.MZ)); schoolName = xj.GdxjUser.organ.organName; schoolInfo = GetSchoolInfo(xj, xj.GdxjUser.organ.organCode); }
private static ReceiveSchoolInfoClass GetSchoolInfo(Gdxj xj, string schoolID) { ReceiveSchoolInfoClass result = new ReceiveSchoolInfoClass(); GetSchoolInfoClass gsic = new GetSchoolInfoClass(schoolID); try { AjaxCommand.Send.ContextCommandParams ccp = new AjaxCommand.Send.ContextCommandParams() { @params = gsic }; string json = JsonConvert.SerializeObject(ccp, Formatting.Indented); string html = RequestHelper.GetByPostJsonWithCsrf(setting.url.QuerySchoolInfoUrl, json, ref xj.GdxjCookie.cookie, Csrf.GetCsrfToken(), setting.url.QueryGradeRefererUrl); result = JsonConvert.DeserializeObject <ReceiveSchoolInfoClass>(html); } catch (Exception e) { throw (e); } return(result); }
public static string GetOrganName(Gdxj xj, GetOrganDictClass godc) { string result = string.Empty; try { AjaxCommand.Send.ContextCommandParams ccp = new AjaxCommand.Send.ContextCommandParams() { @params = godc }; string json = JsonConvert.SerializeObject(ccp, Formatting.Indented); string html = RequestHelper.GetByPostJsonWithCsrf(setting.url.QueryOrganDicUrl, json, ref xj.GdxjCookie.cookie, Csrf.GetCsrfToken(), setting.url.QueryGradeRefererUrl); ReceiveOrganNameClass receiveData = JsonConvert.DeserializeObject <ReceiveOrganNameClass>(html); if (receiveData.map != null) { result = receiveData.map.text; } } catch (Exception e) { throw (e); } return(result); }
public LoginModule(Gdxj gdxj) { this.gdxj = gdxj; }
public StudentManagementModule(Gdxj gdxj) { this.gdxj = gdxj; }