public static void MyClassInitialize(TestContext testContext) { //client = new RestClient(); //mockServer = MockRestServiceServer.CreateServer(client.RestTemplate); //responseHeaders = new HttpHeaders(); //responseHeaders.ContentType = new MediaType("application", "json"); appInfo = new AppInfoBase { AppKey = ConfigHelper.GetString("AppKey", "D31B7F91-3068-4A49-91EE-F3E13AE5C48C"), //必须 AppSecret = ConfigHelper.GetString("AppSecret", "103CB639-840C-4E4F-8812-220ECE3C4E4D"), //必须 DbName = "NG0001", //可不传,默认为默认账套 UserId = 521180820000001, OrgId = 521180820000002, //DbServerName = "10.0.15.106", OCode = "", //OrgName = "组织名称", //SessionKey = "会话标识", //TokenKey = string.Empty, //UName = "帐套名称", //UserKey = "003", //UserName = "******", }; }
private void lvApps_ItemChecked(object sender, ItemCheckedEventArgs e) { if (initTag) { return; } AppInfoBase i = (AppInfoBase)myCmdMgr.InfoDB.Items[(int)e.Item.Tag]; if (e.Item.Checked) { if (myCmdMgr.DelectItems.Contains(e.Item.Tag)) { myCmdMgr.DelectItems.Remove(e.Item.Tag); } else { myCmdMgr.SelectItems.Add(e.Item.Tag); } i.setState(WinAptLib.Downloaded); } else { if (myCmdMgr.SelectItems.Contains(e.Item.Tag)) { myCmdMgr.SelectItems.Remove(e.Item.Tag); } else { myCmdMgr.DelectItems.Add(e.Item.Tag); } i.setState(WinAptLib.NoFile); } e.Item.Selected = true; btnApply.Enabled = true; }
/// <summary> /// get the local file path of certain item. /// </summary> /// <param name="index"></param> /// <returns></returns> public string GetFilePath(int index) { AppInfoBase it = (AppInfoBase)this.myAppDB.Items[index]; string filename = it.url; filename = filename.Substring(filename.LastIndexOf('/') + 1); filename = this.myConfig.basePath + @"\" + it.catalog + @"\" + filename; return(filename); }
///// <summary> ///// 日期格式转换 ///// 输入格式为yyyyMMddHHmmssfffzz00 ///// </summary> ///// <param name="albaba_dt"></param> ///// <returns></returns> //public DateTime FormatDateTime(string albaba_dt) //{ // int year = Int32.Parse(albaba_dt.Substring(0, 4)); // int mon = Int32.Parse(albaba_dt.Substring(4, 2)); // int day = Int32.Parse(albaba_dt.Substring(6, 2)); // int hour = Int32.Parse(albaba_dt.Substring(8, 2)); // int min = Int32.Parse(albaba_dt.Substring(10, 2)); // int sec = Int32.Parse(albaba_dt.Substring(12, 2)); // DateTime dt = new DateTime(year, mon, day, hour, min, sec, DateTimeKind.Local); // return dt; //} #region 私用函数 /// <summary> /// 创建webapiclient /// </summary> /// <param name="infor"></param> /// <returns></returns> private WebApiClient GetWebApiClient() { AppInfoBase appinfo = new AppInfoBase(); appinfo.AppKey = Secret.AppKey; appinfo.AppSecret = Secret.AppSecret; WebApiClient client = new WebApiClient(Secret.ApiUrl, appinfo, EnumDataFormat.Json); return(client); }
private void CancalChange(bool flag) { if (flag) { foreach (int i in cmdMgr.SelectItems) { AppInfoBase item = (AppInfoBase)cmdMgr.InfoDB.Items[i]; item.setState(WinAptLib.NoFile); } foreach (int i in cmdMgr.DelectItems) { AppInfoBase item = (AppInfoBase)cmdMgr.InfoDB.Items[i]; item.setState(WinAptLib.Downloaded); } } cmdMgr.SelectItems.Clear(); cmdMgr.DelectItems.Clear(); }
public static void MyClassInitialize(TestContext testContext) { appInfo = new AppInfoBase { AppKey = ConfigHelper.GetString("AppKey", "D31B7F91-3068-4A49-91EE-F3E13AE5C48C"), //必须 AppSecret = ConfigHelper.GetString("AppSecret", "103CB639-840C-4E4F-8812-220ECE3C4E4D"), //必须 DbName = "NG0001", //可不传,默认为默认账套 UserId = 631181115000001, OrgId = 547181121000001, //DbServerName = "10.0.13.168", OCode = "", //OrgName = "组织名称", //SessionKey = "会话标识", //TokenKey = string.Empty, //UName = "帐套名称", //UserKey = "003", //UserName = "******", }; }
private void btnOK_Click(object sender, EventArgs e) { // //TODO: add a new item // if ("" == txtVersion.Text || "" == txtName.Text || "" == txtUrl.Text) { MessageBox.Show("Please enter need messages."); return; } AppInfoBase item = cmd.CurItem; item.version = txtVersion.Text; item.name = txtName.Text; item.url = txtUrl.Text; item.description = rtxtDesc.Text; item.popular = int.Parse(cbPopularity.Text); item.catalog = cbCatalogs.Text; item.type = cbTypes.Text; Close(); }
public void Execute() { for (int i = 0; i < cmdMgr.SelectItems.Count; i++) { if (_stop) { break; } //We are downloading {0}/{1} string format = MainForm.LocRM.GetString("strExecuteFormDownloading"); string newStr = string.Format(format, i, cmdMgr.SelectItems.Count); UpdateLabel(newStr); AppInfoBase it = (AppInfoBase)cmdMgr.InfoDB.Items[(int)cmdMgr.SelectItems[i]]; string fname = cmdMgr.GetFilePath((int)cmdMgr.SelectItems[i]); string url = it.url; if (ExecuteCmd(fname, url)) { cmdMgr.Config.Items.Add(cmdMgr.InfoDB.Items[(int)cmdMgr.SelectItems[i]]); } } for (int i = 0; i < cmdMgr.DelectItems.Count; i++) { if (_stop) { break; } //Deleting files. UpdateLabel(MainForm.LocRM.GetString("strExecuteFormDeleting")); string cmd = cmdMgr.GetFilePath((int)cmdMgr.DelectItems[i]); //no exception if file doesnot exists. File.Delete(cmd); cmdMgr.Config.Items.Remove(cmdMgr.InfoDB.Items[(int)cmdMgr.DelectItems[i]]); } //Done. UpdateText(MainForm.LocRM.GetString("strExecuteFormDone")); CancalChange(_stop); WinAptLib.WriteToFile(cmdMgr.Config, MainForm.configFile); _stop = true; SetOKEnable(); }
public static void MyClassInitialize(TestContext testContext) { appInfo = new AppInfoBase { AppKey = ConfigHelper.GetString("AppKey", "D31B7F91-3068-4A49-91EE-F3E13AE5C48C"), //必须 AppSecret = ConfigHelper.GetString("AppSecret", "103CB639-840C-4E4F-8812-220ECE3C4E4D"), //必须 DbName = "NG0002", //可不传,默认为默认账套 UserId = 521180820000001, OrgId = 521180820000002, //DbServerName = "10.0.15.106", OCode = "100", OrgName = "广东省总工会", //SessionKey = "会话标识", //TokenKey = string.Empty, //UName = "帐套名称", //UserKey = "003", UserName = "******" }; //部门: orgid=521180820000002 orgcode=100.01 orgname=省总财务部 dataInfo = new GKPaymentModel(); }
public ExecuteForm(CmdMgr cmdMgr) { InitializeComponent(); this.cmdMgr = cmdMgr; //We will take follow changes: lbAction.Text = MainForm.LocRM.GetString("strExecuteFormLabelText"); if (cmdMgr.SelectItems.Count > 0) { needStart = true; //We are going to download:\n txtConsole.Text = MainForm.LocRM.GetString("strExecuteFormGoDownload"); txtConsole.AppendText("\n"); foreach (object item in cmdMgr.SelectItems) { AppInfoBase it = (AppInfoBase)cmdMgr.InfoDB.Items[(int)item]; txtConsole.AppendText(it.url + "\n"); } txtConsole.AppendText("\n\n"); } if (cmdMgr.DelectItems.Count > 0) { needStart = true; //We are going to delete:\n txtConsole.AppendText(MainForm.LocRM.GetString("strExecuteFormGoDel")); txtConsole.AppendText("\n"); foreach (object item in cmdMgr.DelectItems) { AppInfoBase it = (AppInfoBase)cmdMgr.InfoDB.Items[(int)item]; string filename = it.url; filename = filename.Substring(filename.LastIndexOf('/') + 1); string cmd = cmdMgr.Config.basePath + @"\" + it.catalog + @"\" + filename; txtConsole.AppendText(cmd + "\n"); } } }
public void Execute(IJobExecutionContext context) { //string assemblyFilePath = Assembly.GetExecutingAssembly().Location; //string assemblyDirPath = Path.GetDirectoryName(assemblyFilePath); //string configFilePath = assemblyDirPath + "\\Configs\\log4net.config"; //XmlConfigurator.ConfigureAndWatch(new FileInfo(configFilePath)); try { AppInfoBase appInfo; string url = string.Empty; string server = context.JobDetail.JobDataMap.Get("Server").ToString(); string port = context.JobDetail.JobDataMap.Get("Port").ToString(); string dir = context.JobDetail.JobDataMap.Get("Dir").ToString(); if (string.IsNullOrEmpty(server)) { server = "127.0.0.1"; } if (string.IsNullOrEmpty(port)) { port = "80"; } if (!string.IsNullOrEmpty(dir)) { url = "http://" + server + ":" + port + "/" + dir + "/"; } else { url = "http://" + server + ":" + port + "/"; } string appKey = context.JobDetail.JobDataMap.Get("AppKey").ToString(); string appSecret = context.JobDetail.JobDataMap.Get("AppSecret").ToString(); string dbname = context.JobDetail.JobDataMap.Get("DBName").ToString(); string userId = context.JobDetail.JobDataMap.Get("UserId").ToString(); string orgId = context.JobDetail.JobDataMap.Get("OrgId").ToString(); long UserID = 0; if (!string.IsNullOrEmpty(userId)) { UserID = long.Parse(userId); } long OrgID = 0; if (!string.IsNullOrEmpty(orgId)) { OrgID = long.Parse(orgId); } appInfo = new AppInfoBase { AppKey = appKey, //必须 AppSecret = appSecret, //必须 DbName = dbname, //可不传,默认为默认账套 UserId = UserID, OrgId = OrgID //DbServerName = "10.0.15.106", //OCode = "100", //OrgName = "广东省总工会", //SessionKey = "会话标识", //TokenKey = string.Empty, //UName = "帐套名称", //UserKey = "003", //UserName = "******" }; IScheduler scheduler = (IScheduler)context.JobDetail.JobDataMap.Get("scheduler"); logger.Info("刷新支付数据数据......开始"); WebApiClient client = new WebApiClient(url, appInfo, EnumDataFormat.Json); var res = client.Post("api/GGK/GKPaymentMstApi/PostRefreshAllPaymentsState", ""); logger.Info("刷新支付数据数据......完毕!"); } catch (Exception ex) { logger.Error("RefreshGKPaymentDataJob 运行异常", ex); } }