/// <summary> /// 异步的执行事务的方法. /// </summary> /// <param name="sql"></param> public async Task <DataSet> ExcutSP_Async(string SPname, List <DbParameter> DbParameterS) { BllClass bc = await WC.CallWebAPI_Async(SPname, DbParameterS, "ExcutSP"); this.Core2Framework(bc); byte[] mbs = IoRyClass.StringToBytes(bc.JsonOut); return(IoRyClass.RetrieveXmlDataSet(mbs)); }
/// <summary> /// 异步的得到DataSet的方法,可以和按钮与进度条相关联用 /// </summary> /// <param name="sql"></param> /// <param name="cuser">执行者</param> /// <param name="myobj">可以传送到事件里面的东西</param> public async Task <DataSet> GetDataSet_Async(string sql, string cuser) { BllClass bc = await WC.CallWebAPI_Async(sql, cuser, "GetDataSet"); this.Core2Framework(bc); byte[] mbs = IoRyClass.StringToBytes(bc.JsonOut); return(IoRyClass.RetrieveXmlDataSet(mbs)); }
/// <summary> /// 同步的取得DataSet的方法 /// </summary> /// <param name="sql"></param> /// <param name="cuser">执行者</param> /// <returns></returns> public DataSet GetDataSet_Syn(string sql, string cuser) { BllClass bc = WC.CallWebAPI_Syn(sql, cuser, "GetDataSet_Log"); this.Core2Framework(bc); byte[] mbs = IoRyClass.StringToBytes(bc.JsonOut); return(IoRyClass.RetrieveXmlDataSet(mbs)); }
/// <summary> /// 同步的取得DataSet的方法 /// </summary> /// <param name="sql"></param> /// <returns></returns> public DataSet GetDataSet_Syn(string sql) { sql = IoRyClass.EncryptRSA_long(sql, Encrypt); string xl = myxml(Xml, "GetDataSet", new List <string> { sql }); string rst = MyISC.SynMessage("InvokeMember", xl, this.cOperator, "ydh"); XElement xmdata = XElement.Parse(rst); if (xmdata.Element("correct").Value == "false") { throw new Exception(xmdata.Element("Exception").FirstNode.ToString()); } byte[] mbs = IoRyClass.StringToBytes(xmdata.Element("return").FirstNode.ToString()); DataSet ds = IoRyClass.RetrieveXmlDataSet(mbs); return(ds); }
/// <summary> /// 执行存储过程,注意,调用服务的就没有out形式的入参了,这个失效 /// </summary> /// <param name="SPname">存储过程名</param> /// <param name="DbParameterS">参数</param> /// <returns></returns> public DataSet ExcutSP_Syn(string SPname, List <DbParameter> DbParameterS) { List <string> rc = new List <string>(); string jmapname = "<SPname>" + IoRyClass.EncryptRSA_long(SPname, Encrypt) + "</SPname>"; rc.Add(jmapname); foreach (var item in DbParameterS) { string cs = "<ParameterName>" + item.ParameterName + "</ParameterName><Value>" + item.Value.ToString() + "</Value>"; rc.Add(cs); } string xl = myxml(Xml, "ExecuteSP", rc); string rst = MyISC.SynMessage("ExcutSP", xl, this.cOperator, "ydh"); XElement xmdata = XElement.Parse(rst); if (xmdata.Element("correct").Value == "false") { throw new Exception(xmdata.Element("Exception").FirstNode.ToString()); } byte[] mbs = IoRyClass.StringToBytes(xmdata.Element("return").FirstNode.ToString()); DataSet ds = IoRyClass.RetrieveXmlDataSet(mbs); return(ds); }
/// <summary> /// Callback 成员 /// </summary> /// <param name="dler"></param> /// <returns></returns> public bool ServerSendData(ydhDeliver dler) { //检测上传是否重复. if (myList.Any(x => x.Name == dler.Name && x.Index == dler.Index)) { foreach (var item in myList.Where(x => x.Name == dler.Name && x.Index == dler.Index)) { myList.Remove(item); } } //保存 myList.Add(dler); if (myProgressBar != null) { if (myProgressBar.Value < myProgressBar.Maximum) { myProgressBar.Value++; } } //最终拼接. if (dler.IsFinish) { //这里再2015-11-13发现了一个边界bug,当传输的数据正好到达边界后,服务端还会再传输一个byte[0]的dler过来,需要处理掉 if (dler.Context.Count() == 0) { return(true); } var re = myList.Where(x => x.Name == dler.Name).OrderBy(x => x.Index); List <byte> mybt = new List <byte>(); foreach (var item in re) { mybt.AddRange(item.Context.ToList()); } switch (dler.FunctionName) { case "DataSet": DataSet DS = IoRyClass.RetrieveXmlDataSet(mybt.ToArray()); if (myDataGridView != null) { myDataGridView.DataSource = DS.Tables[0]; } if (myAsnyGetDataSet != null) { this.myAsnyGetDataSet(DS, obj); } break; case "GetFolderXml": string xml = IoRyClass.BytesToString(mybt.ToArray()); if (DuxMessage != null) { this.DuxMessage(xml, "GetFolderXml"); } break; case "CheckUpdateFiles": try { File.WriteAllBytes(System.AppDomain.CurrentDomain.BaseDirectory + dler.Name, mybt.ToArray()); } catch (Exception me) { if (DuxMessage != null) { this.DuxMessage(me.Message, "Error"); } } break; } if (myProgressBar != null) { myProgressBar.Visible = false; myProgressBar.Value = 0; } if (MyButtons.Count != 0) { foreach (Button item in MyButtons) { item.Enabled = true; } } myList.Clear(); } if (eGetDeliver != null) { this.eGetDeliver(ConvertDeliver(dler)); } return(true); }