public static byte[] getByte(object value) { try { if (value != null) { switch (value.GetType().ToString()) { case "System.String": return(ToolUtil.GetBytes((string)value)); case "System.Int64": return(ToolUtil.GetBytes(getString(value))); case "System.Int32": return(ToolUtil.GetBytes(getString(value))); case "System.Boolean": return(ToolUtil.GetBytes(getString(value))); case "System.DateTime": return(ToolUtil.GetBytes(getString(value))); case "System.IO.MemoryStream": return(ToolUtil.GetBytes(getString(value))); } } return(null); } catch { return(null); } }
public string ExportDistrict(string pathFile, string separator) { string path = pathFile.Remove(pathFile.LastIndexOf(@"\")); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } DataTable exportData = this.bmkhDAL.GetExportData(); if (exportData.Rows.Count == 0) { return("没有行政区"); } StringBuilder builder = new StringBuilder(); using (StreamWriter writer = new StreamWriter(pathFile, false, ToolUtil.GetEncoding())) { writer.WriteLine("{行政区编码}[分隔符]\"" + separator + "\""); writer.WriteLine("// 每行格式 :"); string str2 = "// 编码,名称"; writer.WriteLine(str2.Replace(",", separator)); for (int i = 0; i < exportData.Rows.Count; i++) { builder.Remove(0, builder.Length); builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["BM"].ToString(), separator)); builder.Append(separator); builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["MC"].ToString(), separator)); builder.Append(separator); builder.Replace(",,", ",\"\","); writer.WriteLine(builder.ToString()); } } return("0"); }
private void _SetHzxx() { this.lab_hj_je.Text = "¥" + this._fpxx.GetHjJe(); this.lab_hj_se.Text = "¥" + this._fpxx.GetHjSe(); this.lab_hj_jshj.Text = "¥" + this._fpxx.GetHjJeHs(); this.lab_hj_jshj_dx.Text = ToolUtil.RMBToDaXie(decimal.Parse(this._fpxx.GetHjJeHs())); }
private bool GetBillList(string strBillPath, ref List <string> strBillList, ref string _strCause) { try { string[] strArray = File.ReadAllLines(strBillPath, ToolUtil.GetEncoding()); for (int i = 0; i < strArray.Length; i++) { if (!(!(strArray[i].Trim() != "") || strArray[i].Trim().StartsWith(this.strRemark))) { strBillList.Add(strArray[i].Trim().Trim(new char[1])); } } if (strBillList.Count > 0) { string str = strBillList[0]; if (!str.Substring(0, str.IndexOf(this.strSplitter)).Equals(this.strBeginFlag)) { _strCause = "不是作废单据文本文件"; return(false); } strBillList.RemoveAt(0); } else { return(false); } } catch (Exception) { throw new Exception("不是作废单据文本文件"); } return(true); }
public void SaveAllFPxxToTxt(List <Fpxx> fpList, string Path, DateTime StartDt, DateTime EndDt) { try { if ((fpList == null) || (fpList.Count == 0)) { MessageManager.ShowMsgBox("FPCX-000039"); } else { using (StreamWriter writer = new StreamWriter(Path, false, ToolUtil.GetEncoding())) { writer.WriteLine("//发票主体明细信息"); writer.WriteLine("//" + StartDt.ToString("yyyyMMdd") + "~~" + EndDt.ToString("yyyyMMdd")); int num = 0; foreach (Fpxx fpxx in fpList) { num++; writer.WriteLine("//发票" + num.ToString()); string str = fpxx.fpdm + "~~" + ShareMethods.FPHMTo8Wei(fpxx.fphm) + "~~" + fpxx.kpjh.ToString() + "~~" + fpxx.gfmc + "~~" + fpxx.gfsh + "~~" + fpxx.xfsh + "~~" + Aisino.Fwkp.Fpkj.Common.Tool.ObjectToDateTime(fpxx.kprq).ToString("yyyy-MM-dd") + "~~" + fpxx.je + "~~" + fpxx.se + "~~" + ToolUtil.GetString(Convert.FromBase64String(fpxx.bz)) + "~~" + (fpxx.zfbz ? "1" : "0"); writer.WriteLine(str); } } fpList = null; } } catch (Exception exception) { this.loger.Error(exception.Message); } }
private static string GetAQJRDZ() { string path = Path.Combine(PropertyUtil.GetValue("MAIN_PATH"), "Bin", "AQJRDZ.txt"); if (!File.Exists(path)) { return(GetAQJRAddrFromConfigFile()); } try { FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); StreamReader reader = new StreamReader(stream, ToolUtil.GetEncoding()); reader.BaseStream.Seek(0L, SeekOrigin.Begin); string str2 = reader.ReadLine(); reader.Close(); stream.Close(); string aQJRAddrFromConfigFile = ""; if (((str2 == null) || (str2 == "")) || ((str2.IndexOf("127.0.0.1") > -1) || (str2.ToLower().IndexOf("localhost") > -1))) { aQJRAddrFromConfigFile = GetAQJRAddrFromConfigFile(); if ((aQJRAddrFromConfigFile != null) && (aQJRAddrFromConfigFile != "")) { str2 = aQJRAddrFromConfigFile; } } return(str2); } catch (Exception) { return(""); } }
private void method_2(object sender, EventArgs0 e) { if (((e.method_0() != null) && (e.method_0().Name != null)) && (e.method_0().Name != "")) { ToolUtil.RunFuction(e.method_0().Name); } }
public static DockForm RunCommand(byte[] value) { string str = "Aisino.Fwkp.Invoice.ActiveX.TaxCardQuery_Status"; byte[] bytes = ToolUtil.GetBytes(MD5_Crypt.GetHashStr(str)); byte[] destinationArray = new byte[0x20]; Array.Copy(bytes, 0, destinationArray, 0, 0x20); byte[] buffer3 = new byte[0x10]; Array.Copy(bytes, 0x20, buffer3, 0, 0x10); DateTime time = DateTime.Parse(ToolUtil.GetString(AES_Crypt.Decrypt(value, destinationArray, buffer3, null))); DateTime now = DateTime.Now; if ((time.CompareTo(now) > 0) || (time.CompareTo(now.AddSeconds(-1.0)) < 0)) { return(null); } WaitForm form = new WaitForm { StartPosition = FormStartPosition.CenterScreen, ShowInTaskbar = false }; form.Show(); bool flag = form.DataCheck(); form.Close(); if (!flag) { return(null); } if (form.bIsNeedRepair) { MessageManager.ShowMsgBox("INP-253207", new string[] { form.strRet }); } return(new InvoiceReportForm()); }
private static void RecordUpdateAB(string starget) { DirectoryInfo path = new DirectoryInfo(Application.dataPath + "/../update/" + _version + "/" + starget); JsonData assetNameJson = new JsonData(); foreach (FileInfo file in path.GetFiles("*.*", SearchOption.AllDirectories)) { string name = file.Name; ToolUtil.WriteFile(path + "/" + name, GetEncryptBytes(file.FullName)); JsonData resJson = new JsonData(); resJson["name"] = name; resJson["md5"] = ToolUtil.GetMD5(path + "/" + name); resJson["size"] = ToolUtil.GetFileSize(path + "/" + name); assetNameJson.Add(resJson); } JsonData verJson = new JsonData(); verJson["ver"] = Convert.ToInt32(_version); verJson["target"] = starget; verJson["down"] = _updateurl + _version + "/" + starget + "/"; verJson["entryres"] = ToolUtil.EntryRes; verJson["entryscript"] = ToolUtil.EntryScript; verJson["list"] = assetNameJson; ToolUtil.SaveAndEncryptFile(path + "/assets.dat", verJson.ToJson()); ToolUtil.SaveFile(Application.dataPath + "/../update/" + starget + "/assets.json", verJson.ToJson()); Debug.Log("versionupdate -------->" + verJson.ToJson()); }
public string ExportData(string pathFile, string separator, DataTable khTable = null) { DataTable exportData; string path = pathFile.Remove(pathFile.LastIndexOf(@"\")); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (khTable == null) { exportData = this.bmkhDAL.GetExportData(); } else { exportData = khTable; } if (exportData.Rows.Count == 0) { return("没有客户"); } StringBuilder builder = new StringBuilder(); using (StreamWriter writer = new StreamWriter(pathFile, false, ToolUtil.GetEncoding())) { writer.WriteLine("{客户编码}[分隔符]\"" + separator + "\""); writer.WriteLine("// 每行格式 :"); string str2 = "// 编码,名称,简码,税号,地址电话,银行账号,邮件地址,备注,身份证校验"; writer.WriteLine(str2.Replace(",", separator)); for (int i = 0; i < exportData.Rows.Count; i++) { builder.Remove(0, builder.Length); builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["BM"].ToString(), separator)); builder.Append(separator); builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["MC"].ToString(), separator)); builder.Append(separator); builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["JM"].ToString(), separator)); if (exportData.Rows[i]["WJ"].ToString() == "1") { builder.Append(separator); builder.Append(exportData.Rows[i]["SH"]); builder.Append(separator); string item = exportData.Rows[i]["DZDH"].ToString().Replace("\r\n", "#|#"); builder.Append(GetSafeData.ExportItem(item, separator)); builder.Append(separator); string str4 = exportData.Rows[i]["YHZH"].ToString().Replace("\r\n", "#|#"); builder.Append(GetSafeData.ExportItem(str4, separator)); builder.Append(separator); builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["YJDZ"].ToString(), separator)); builder.Append(separator); builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["BZ"].ToString(), separator)); builder.Append(separator); builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["SFZJY"].ToString(), separator)); } builder.Replace(",,", ",\"\","); writer.WriteLine(builder.ToString()); } } return("0"); }
private void LoginCheck(object sender, EventArgs e) { string userName = inputName.Text; string password = inputPwd.Text; if (ToolUtil.isEmpty(userName) || ToolUtil.isEmpty(password)) { MessageBox.Show("请输入用户名和密码!"); return; } string sqlStr = "SELECT COUNT(*) FROM my_user WHERE username = @userName AND password = @password "; SqlParameter[] parameters = { new SqlParameter("userName", SqlDbType.NVarChar), new SqlParameter("password", SqlDbType.VarChar) }; parameters[0].Value = userName; parameters[1].Value = password; if (DBHelper.getCount(sqlStr, parameters) > 0) { this.Hide(); new FrmTable().Show(); } else { MessageBox.Show("用户名或密码错误!"); } }
private void SaveUpdateVerFile(string name, string md5) { int c = _verList.Count; bool update = false; for (int i = 0; i < c; i++) { JsonData data = _verList[i]; if (name.Equals(data["name"].ToString(), StringComparison.InvariantCultureIgnoreCase)) { data["md5"] = md5; update = true; break; } } if (!update) { JsonData one = new JsonData(); one["name"] = name; one["md5"] = md5; _verList.Add(one); } JsonData saveJson = new JsonData(); saveJson["ver"] = _curVer; saveJson["list"] = _verList; ToolUtil.SaveAndEncryptFile(PathUtil.ResPath + "/assets.dat", saveJson.ToJson()); }
public ResultNormal RegistRebot(string userAccount) { ResultNormal result = new ResultNormal(); try { if (string.IsNullOrEmpty(userAccount)) { userAccount = DateTime.Now.ToString("yyyy-MM-dd") + ToolUtil.GetRnd(2, true, false, false, false); } var phone = "199" + ToolUtil.GetRnd(8, true, false, false, false); RegUser regUser = new RegUser { Account = $"r{userAccount}", Phone = phone, Pwd = "111111", }; var ui = _userServices.Register(regUser); result.Message = ui.UerInfo.UserAccount; } catch (Exception ex) { result.ErrorMsg = ex.Message; } return(result); }
internal static string GetSafeStringWithoutTrim(string text, int length) { text = text; int byteCount = ToolUtil.GetByteCount(text); Encoding encoding = ToolUtil.GetEncoding(); byte[] bytes = encoding.GetBytes(text); if (bytes.GetLength(0) <= length) { return(text); } byte num3 = bytes[length - 1]; int index = length - 1; while ((bytes[index] >= 0xa1) && (bytes[index] <= 0xfe)) { index--; if (index < 0) { break; } } if (((length - index) % 2) == 0) { length--; } return(encoding.GetString(bytes, 0, length)); }
public static ResponceModel Change(string username, int id, string content, string pic) { if (content != "") { MsgUni msg = new MsgUni(id); if (msg.TryQuery()) { if (msg.mark == 2) { return(new ResponceModel(403, "该留言已删除")); } msg.content = content; if (pic != null) { msg.pic = ToolUtil.HexToByte(pic); } msg.Update("body"); msg.SavePic(); return(new ResponceModel(200, "修改留言成功", msg)); } else { return(new ResponceModel(403, "该留言不存在")); } } else { return(new ResponceModel(403, "留言内容为空")); } }
/// <summary> /// 加载数据 /// </summary> /// <param name="id">对象商品促销信息Id</param> /// <returns></returns> public ActionResult Create(long?id) { ProductRuleModel model = null; if (id.HasValue) { var result = _productRuleService.GetProductRuleById(id.Value); if (result.Data != null) { model = result.Data; model.TempStarDate = model.StarDate.ToString(); model.TempEndDate = model.EndDate.ToString(); AddProductModel _addProductModel = _productService.GetSKU_ProductById(model.ProductId, ACultureHelper.GetLanguageID).Data; if (_addProductModel != null) { model.HKPrice = ToolUtil.Round(_addProductModel.HKPrice, 2); model.ProductName = _addProductModel.ProductName; model.SalePrice = ToolUtil.Round(model.HKPrice * _addProductModel.Discount, 2); model.SKU_ProductModels = _addProductModel.SKU_ProductModels; } } } else { model = new ProductRuleModel(); //model.TempStarDate = DateTime.Now.AddDays(0).ToString("yyyy-MM-dd hh:mm"); // model.TempEndDate = DateTime.Now.AddDays(3).ToString("yyyy-MM-dd hh:mm"); } DrowSalesRuleList(); return(PartialView(model)); }
private void cmbName_SelectedIndexChanged(object sender, EventArgs e) { if (this.cmbName.Text.Trim() != "") { string str = PropertyUtil.GetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(this.cmbName.Text.Trim())).Replace("-", "")); if (!string.IsNullOrEmpty(str)) { string[] strArray = str.Split(new char[] { '-' }); this.method_6(strArray[0]); if (string.Equals(this.taxCard_0.SoftVersion, "FWKP_V2.0_Svr_Client")) { this.method_7(PropertyUtil.GetValue("KPS_PROXY_URL", "")); } else { this.method_7(strArray[1]); } this.aisinoCHK_0.Checked = true; } else { this.method_6(""); this.method_7(""); this.aisinoCHK_0.Checked = false; } } }
private void SelectFPJRow() { if (this.FPJ.SelectedRows.Count > 0) { DataGridViewRow row = this.FPJ.SelectedRows[0]; fpdmhm[0] = row.Cells["LBDM"].Value.ToString(); fpdmhm[1] = row.Cells["QSHM"].Value.ToString(); TaxCard card = TaxCardFactory.CreateTaxCard(); string str = string.Empty; if (this.mfplx == 0x29) { str = card.SetInvVols(0x29, fpdmhm[0], fpdmhm[1]); } else if (this.mfplx == 2) { str = card.SetInvVols(2, fpdmhm[0], fpdmhm[1]); } if (ToolUtil.GetReturnErrCode(str) != 0) { MessageManager.ShowMsgBox(str); } base.DialogResult = DialogResult.OK; } else { MessageManager.ShowMsgBox("至少选择一卷发票"); } }
internal TreeNodeCommand(Function function_1, object object_1, ArrayList arrayList_1) { this.ilog_0 = LogUtil.GetLogger <TreeNodeCommand>(); if (arrayList_1 == null) { arrayList_1 = new ArrayList(); } this.function_0 = function_1; this.object_0 = object_1; this.arrayList_0 = arrayList_1; string str = string.Empty; if (function_1.Properties.TryGetValue("icon", out str)) { base.ImageKey = str; } base.Name = function_1.Id; ToolUtil.SetText(this, function_1); foreach (object obj2 in arrayList_1) { if (obj2 is TreeNodeCommand) { base.Nodes.Add((TreeNodeCommand)obj2); } } }
public bool ChangePortrait(BitmapImage portrait) { try { var postdata = $"credit={UserData.credit}&portrait={ToolUtil.BytesToHex(ToolUtil.BitmapImageToBytes(portrait))}"; var result = JsonConvert.DeserializeObject <ResponceModel <_E_Result> >(HttpUtil.post(API[APIKey.SetInfo], postdata)); if (result.code == 200 && result.data.e_portrait == 2) { UserData.Portrait = portrait; UserData.userstate = Data.UserState.Success; MessageInvoked?.Invoke(this, new MessageEventArgs("changeportrait", "修改用户头像成功")); return(true); } UserData.userstate = Data.UserState.Waring; MessageInvoked?.Invoke(this, new MessageEventArgs("changportrait", result.msg)); return(false); } catch (Exception ex) { MessageInvoked?.Invoke(this, new MessageEventArgs("changeportrait", $"修改用户头像失败 {ex.Message}")); return(false); } }
private List <string> GetBillList(string strBillPath) { List <string> list = new List <string>(); string[] strArray = File.ReadAllLines(strBillPath, ToolUtil.GetEncoding()); for (int i = 0; i < strArray.Length; i++) { if (!(!(strArray[i].Trim() != "") || strArray[i].Trim().StartsWith(this.strRemark))) { list.Add(strArray[i]); } } if (list.Count <= 0) { throw new Exception("不是作废销售单据"); } string str = list[0]; if (!str.Substring(0, str.IndexOf(this.strSplitter)).Equals(this.strBeginFlag)) { throw new Exception("不是作废销售单据"); } list.RemoveAt(0); return(list); }
public bool Register(string nickname, string password, out string msg) { try { var postdata = $"method=register2&nickname={nickname}&password={ToolUtil.MD5Encrypt32(password)}"; var result = JsonConvert.DeserializeObject <ResponceModel <_UserCredit> >( HttpUtil.post(API[APIKey.User], postdata) ); msg = result.msg + "注册账号为:" + result.data.username; if (result.code == 200) { MessageInvoked?.Invoke(this, new MessageEventArgs("register", result.msg + "注册账号为:" + result.data.username)); return(true); } else { MessageInvoked?.Invoke(this, new MessageEventArgs("register", result.msg)); return(false); } } catch (Exception ex) { MessageInvoked?.Invoke(this, new MessageEventArgs("register", $"注册失败 {ex.Message}")); msg = ""; return(false); } }
public void EncryptXML(List <Fpxx> fpList, string Path) { try { if ((fpList != null) && (fpList.Count != 0)) { XmlDocument document = this.FpzjDaoChuCreateXml(fpList); if (document == null) { this.loger.Error("[EncryptXML异常]构造的XMLDocument对象为空"); } else { Encryptor encryptor = (Encryptor)Activator.CreateInstance(System.Type.GetTypeFromCLSID(new Guid("C0A6B38B-16A7-4374-BB51-0084087910CD"))); string outerXml = document.OuterXml; outerXml = encryptor.CryptEncrypt(ref outerXml); using (StreamWriter writer = new StreamWriter(Path, false, ToolUtil.GetEncoding())) { writer.Write(outerXml); } fpList = null; } } } catch (Exception exception) { this.loger.Error(exception.Message); } }
public void Login(string username, string password) { try { var postdata = $"method=login&username={username}&password={ToolUtil.MD5Encrypt32(password)}&devicetype=pc"; var result = JsonConvert.DeserializeObject <ResponceModel <_UserCredit> >( HttpUtil.post(API[APIKey.User], postdata) ); //var data = result.data; if (result.code == 200) { UserData.username = result.data.username; UserData.nickname = result.data.nickname; UserData.credit = result.data.credit; UserData.userstate = Data.UserState.Success; } MessageInvoked?.Invoke(this, new MessageEventArgs("login", result.msg)); UpdateUserInfo(); } catch (Exception ex) { MessageInvoked?.Invoke(this, new MessageEventArgs("login", $"登录操作失败 {ex.Message}")); } }
private void SelectFPJRow() { if (this.FPJ.SelectedRows.Count > 0) { DataGridViewRow row = this.FPJ.SelectedRows[0]; fpdmhm[0] = row.Cells["LBDM"].Value.ToString(); fpdmhm[1] = row.Cells["QSHM"].Value.ToString(); int num = int.Parse(row.Cells["FPZS"].Value.ToString()); endnum = (int.Parse(fpdmhm[1]) + num) - 1; TaxCard card = TaxCardFactory.CreateTaxCard(); string str = string.Empty; if ((int)this.mfplx == 0x29) { str = card.SetInvVols((InvoiceType)0x29, fpdmhm[0], fpdmhm[1]); } else if ((int)this.mfplx == 2) { str = card.SetInvVols((InvoiceType)2, fpdmhm[0], fpdmhm[1]); } //逻辑修改 if (!InternetWare.Config.Constants.IsTest) { if (ToolUtil.GetReturnErrCode(str) != 0) { MessageManager.ShowMsgBox(str); } } base.DialogResult = DialogResult.OK; } else { MessageManager.ShowMsgBox("至少选择一卷发票"); } }
public void UpdateUserInfo() { try { var postdata = $"type=base&credit={UserData.credit}"; var result = JsonConvert.DeserializeObject <ResponceModel <_UserInfo> >(HttpUtil.post(API[APIKey.GetInfo], postdata)); if (result.code == 200) { // TODO 正在修改 UserData.nickname = result.data.nickname; UserData.Portrait = ToolUtil.BytesToBitmapImage(ToolUtil.HexToBytes(result.data.portrait)); UserData.email = result.data.email; UserData.phone = result.data.phone; UserData.userstate = Data.UserState.Success; } else { UserData.userstate = Data.UserState.Waring; } MessageInvoked?.Invoke(this, new MessageEventArgs("getinfo_base", result.msg)); } catch (Exception ex) { MessageInvoked?.Invoke(this, new MessageEventArgs("getinfo_base", $"获取用户基础信息失败 {ex.Message}")); } }
public static string DecryptFile(string inFileName) { string path = sysTempDir + Path.GetFileName(inFileName); try { FileStream stream = new FileStream(inFileName, FileMode.Open, FileAccess.Read); byte[] buffer = new byte[stream.Length]; stream.Read(buffer, 0, buffer.Length); DateTime time = new DateTime(0x7dd, 9, 10, 8, 0x22, 30); TimeSpan span = (TimeSpan)(DateTime.Now - time); byte[] buffer2 = AES_Crypt.Encrypt(ToolUtil.GetBytes(span.TotalSeconds.ToString("F1")), new byte[] { 0xff, 0x42, 0xae, 0x95, 11, 0x51, 0xca, 0x15, 0x21, 140, 0x4f, 170, 220, 0x92, 170, 0xed, 0xfd, 0xeb, 0x4e, 13, 0xac, 0x80, 0x52, 0xff, 0x45, 0x90, 0x85, 0xca, 0xcb, 0x9f, 0xaf, 0xbd }, new byte[] { 0xf2, 0x1f, 0xac, 0x5b, 0x2c, 0xc0, 0xa9, 0xd0, 0xbc, 0xaf, 0x86, 0x99, 0xad, 170, 0xfb, 0x60 }); byte[] buffer3 = AES_Crypt.Decrypt(buffer, key, vec, buffer2); if (buffer3 == null) { stream.Close(); return(""); } FileStream stream2 = new FileStream(path, FileMode.Create, FileAccess.Write) { Position = 0L }; stream2.Write(buffer3, 0, buffer3.Length); stream.Close(); stream2.Close(); } catch { return(""); } return(path); }
public static ResponceModel Add(string username, string content, string pic) { if (content != "") { //SOLVED BUG ?? byte[] data = null; if (pic != null) { data = ToolUtil.HexToByte(pic); } MsgUni msg = new MsgUni(username, content, data) { time = DateTime.Now.ToString(), updatetime = DateTime.Now.ToString(), }; msg.Add(); msg = SqlExtension.GetLastRecord <MsgUni>(); if (data != null) { msg.SavePic(); } return(new ResponceModel(200, "添加成功", msg)); } else { return(new ResponceModel(403, "留言内容为空")); } }
public static Stream getStream(object value) { try { if (value == null) { return(new MemoryStream(ToolUtil.GetBytes("null"))); } switch (value.GetType().ToString()) { case "System.String": return(new MemoryStream(ToolUtil.GetBytes((string)value))); case "System.Int64": return(new MemoryStream(ToolUtil.GetBytes(getString(value)))); case "System.Int32": return(new MemoryStream(ToolUtil.GetBytes(getString(value)))); case "System.Boolean": return(new MemoryStream(ToolUtil.GetBytes(getString(value)))); case "System.DateTime": return(new MemoryStream(ToolUtil.GetBytes(getString(value)))); case "System.Byte[]": return(new MemoryStream(ToolUtil.GetBytes(getString(value)))); } return(new MemoryStream(ToolUtil.GetBytes("null"))); } catch { return(new MemoryStream(ToolUtil.GetBytes("null"))); } }
private void FormLogin_Load(object sender, EventArgs e) { Interface0 interface2 = new Class2(); try { List <string> list = interface2.imethod_0(); this.cmbName.Items.AddRange(list.ToArray()); if (this.cmbName.Items.Count > 0) { this.cmbName.SelectedIndex = 0; } object obj2 = PropertyUtil.GetValue("MAIN_VER", null); if (obj2 != null) { this.lblVer.Text = obj2.ToString(); } else { this.lblVer.Text = "未知版本号"; } string str = string.Empty; object obj4 = PropertyUtil.GetValue("MAIN_CODE", null); if (obj4 != null) { str = obj4.ToString(); } object obj3 = PropertyUtil.GetValue("MAIN_MACHINE", null); if ((obj3 != null) && !string.IsNullOrEmpty(obj3.ToString())) { if (obj3.ToString() == "0") { str = str + " 主机"; } else { str = str + " 分机" + obj3.ToString(); } } if (!string.Empty.Equals(str)) { this.Text = "用户登录 【" + str + "】"; } string str2 = PropertyUtil.GetValue("Login_" + BitConverter.ToString(ToolUtil.GetBytes(this.cmbName.Text.Trim())).Replace("-", "")); if (!string.IsNullOrEmpty(str2)) { string[] strArray = str2.Split(new char[] { '-' }); this.txtPwd.Text = strArray[0]; this.txtCertPassword.Text = strArray[1]; this.aisinoCHK_0.Checked = true; } } catch (Exception exception) { MessageBoxHelper.Show("数据库连接异常", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); ilog_0.Error(exception.Message, exception); this.lblStatus.Text = ""; } }