private void WriteOutputInvoice(List<InvoiceExcel> invoiceExcels) { string outputDir = Path.Combine(Output_OpenFolder.FileName, "OutputData"); string path; try { path = Path.Combine(outputDir, "InvoiceInfo.xml"); XMLHelpper.WriteXML<List<InvoiceExcel>>(path, invoiceExcels); } catch (Exception ex) { ErrorMessage.AppendLine(string.Format("Write file fail. =>Err: {0}", ex.Message)); } try { path = Path.Combine(outputDir, "InvoiceInsertScript.sql"); if (!Directory.Exists(outputDir)) { Directory.CreateDirectory(outputDir); } File.WriteAllText(path, OutputInvoice.ToString()); } catch (Exception ex) { ErrorMessage.AppendLine(string.Format("Write file fail. =>Err: {0}", ex.Message)); } }
private void WriteOutputwarehouseDetail(List <WarehouseDetailE> warehouseDetailEs) { string outputDir = Path.Combine(Warehouse_openFolder.FileName, "OutputData"); string path; try { path = Path.Combine(outputDir, "warehouseDetailInfo.xml"); XMLHelpper.WriteXML <List <WarehouseDetailE> >(path, warehouseDetailEs); } catch (Exception ex) { ErrorMessage.AppendLine(string.Format("Write file fail. =>Err: {0}", ex.Message)); } try { path = Path.Combine(outputDir, "warehouseDetailInsertScript.sql"); if (!Directory.Exists(outputDir)) { Directory.CreateDirectory(outputDir); } File.WriteAllText(path, OutputWarehouseDetail.ToString()); } catch (Exception ex) { ErrorMessage.AppendLine(string.Format("Write file fail. =>Err: {0}", ex.Message)); } }
private void ChungTuGhiSo_Button_Click(object sender, EventArgs e) { string path = GetPathFile(nameof(ChungTuGhiSo)); List <ChungTuGhiSo> chungTuGhiSos = GetChungTuGhiSo(); XMLHelpper.WriteXML <List <ChungTuGhiSo> >(path, chungTuGhiSos); MessageBox.Show("Success!"); }
public static void ReadConfig() { string path = Path.Combine(Directory.GetCurrentDirectory(), BSConst.ConfigFile_Path); CommonInfo.ConfigInfo = XMLHelpper.ReadXML <XMLConfigInfo>(path); if (CommonInfo.ConfigInfo == null) { CommonInfo.ConfigInfo = new XMLConfigInfo { FromDate = DateTime.Now.Date, ToDate = DateTime.Now.Date, }; } }
public static void WriteConfig() { string path = Path.Combine(Directory.GetCurrentDirectory(), BSConst.ConfigFile_Path); XMLHelpper.WriteXML <XMLConfigInfo>(path, CommonInfo.ConfigInfo); }
private void CheckVersion_LoadAsync() { string strExeFilePath = System.Reflection.Assembly.GetExecutingAssembly().Location; string strWorkPath = System.IO.Path.GetDirectoryName(strExeFilePath); string _filename = Path.Combine(strWorkPath, "BSGAPP", "XML", "Version.XML"); XMLVersionInfo versionInfo = XMLHelpper.ReadXML <XMLVersionInfo>(_filename); string connectionstring = ConfigurationManager.ConnectionStrings["BSContext"].ToString(); //Chứa chuỗi mã hóa chung string BSContextString = ConfigurationManager.AppSettings["BSContextString"].ToString().Trim(); //Chữa chuỗi mã hóa cá nhân string macadd = GetMacAddress().ToString(); string keyMacEx = macadd + "123@123"; #region Thực hiện tạo chuỗi kết nối cá nhân if (string.IsNullOrEmpty(BSContextString)) { //Giải mã chuỗi kết nối chung string strDecrypt = Decrypt(connectionstring.Trim(), "Sieunhangao@vsTethientethanh2021"); //Mã hóa chuỗi kết nối với mac string strEncrypt = Encrypt(strDecrypt, keyMacEx);// ghi chuỗi mã hóa này xuống file BSContextString = strEncrypt; SetSetting("BSContextString", BSContextString); } #endregion Thực hiện tạo chuỗi kết nối cá nhân //Giải mã chuỗi kết nối cá nhân string decryptString = Decrypt(BSContextString, keyMacEx); //Đây là chuỗi kết nối thật string encryptString = Encrypt(decryptString, macadd); //mã hóa theo mac của người dùng để gửi cho BSServer BSCommon.Utility.CommonInfo.Strconnection = encryptString; //Phát Check version BSGCURRENTVERSIONController bSGCURRENTVERSIONController = new BSGCURRENTVERSIONController(); List <BSGCURRENTVERSION> bSGCURRENTVERSIONs = new List <BSGCURRENTVERSION>(); bSGCURRENTVERSIONs = bSGCURRENTVERSIONController.BSGCURRENTVERSIONSelect(); if (bSGCURRENTVERSIONs.Count > 0) { if (bSGCURRENTVERSIONs[0].CurrentVersion != versionInfo.Version?.ToString()) { linkdownload = bSGCURRENTVERSIONs[0].LinkDownload; //Không đúng version if (MessageBox.Show("Vui lòng cập nhật phiên bản mới!\n Bạn có muốn tải phần mềm mới không?", "Truy cập link tải phần mềm mới.", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) { //Thực hiện download SplashScreenManager.ShowForm(typeof(WaitForm)); var t = Task.Run(() => ProcessAsync()); t.Wait(); SplashScreenManager.CloseForm(); } this.Close(); } else { ProcessStartInfo startInfo = new ProcessStartInfo { FileName = Path.Combine(strWorkPath, "BSGAPP", "BSClient.EXE") }; startInfo.UseShellExecute = true; Process.Start(startInfo); this.Close(); } } }