/// <summary> /// 获得学习中心 /// </summary> /// <param name="learnCenterId"></param> /// <returns></returns> public static LearnCenter Get(string learnCenterId) { var learnCenterEntity = new LearnCenter(); var xmlDoc = new XMLProcess(XmlPath); var nodeList = xmlDoc.ReadAllChild("item"); int _learnCenterId = int.MinValue; if (!string.IsNullOrEmpty(learnCenterId) && int.TryParse(learnCenterId, out _learnCenterId)) { if (nodeList != null && nodeList.Count > 0) { foreach (XmlNode node in nodeList) { if (node.Attributes != null && (node.Attributes["id"] == null || node.Attributes["name"] == null)) { continue; } if (int.Parse(node.Attributes["id"].Value) == _learnCenterId) { learnCenterEntity = new LearnCenter(int.Parse(node.Attributes["id"].Value), node.Attributes["name"].Value); continue; } } } } return(learnCenterEntity); }
protected void Page_Load(object sender, EventArgs e) { if (!ExtNet.IsAjaxRequest) { HideColumn(); hdfMenuID.SetValue(MenuId); hdfUserID.SetValue(CurrentUser.User.Id); hdfDepartments.Text = string.Join(",", CurrentUser.Departments.Select(d => d.Id)); new Core.Framework.Common.BorderLayout() { menuID = MenuId, script = "#{hdfDepartmentSelectedId}.setValue('" + Core.Framework.Common.BorderLayout.nodeID + "');Store1.reload();", }.AddDepartmentList(br, CurrentUser, true); // Handle config in manifest List <ManifestInfo> lists = new XMLProcess().GetManifestByVisible(Server.MapPath("../../../") + "Manifest.xml", "SalaryDecision", false); foreach (var item in lists) { FindControl(item.id).Visible = item.visible; } } if (btnEdit.Visible) { GridPanel1.DirectEvents.RowDblClick.Event += new ComponentDirectEvent.DirectEventHandler(btnEdit_Click); GridPanel1.DirectEvents.RowDblClick.Before += "#{hdfButtonClick}.setValue('Edit');#{btnCapNhat}.hide();#{btnCapNhatSua}.show();#{btnCapNhatDongLai}.hide();"; GridPanel1.DirectEvents.RowDblClick.EventMask.ShowMask = true; } ucChooseEmployee1.AfterClickAcceptButton += new EventHandler(ucChooseEmployee1_AfterClickAcceptButton); }
static void Main(string[] args) { XMLProcess xMLProcess = new XMLProcess(Directory.GetCurrentDirectory() + "\\XML\\New Text Document.XML"); JSONModel jSON = xMLProcess.XMLReader(); var options = new JsonSerializerOptions { WriteIndented = true }; string jsonString = JsonSerializer.Serialize <JSONModel>(jSON, options); Console.WriteLine(jsonString); Console.ReadLine(); }
private void btnCreateXML_Click(object sender, EventArgs e) { //检测并生成 XMLProcess.Create("UpdateInfo.xml"); //插入FTPInformation子节点,并插入相应的值 XMLProcess.Insert("UpdateInfo.xml", "UpdateInformation", "FTPPath", "", txtFTPPath.Text); XMLProcess.Insert("UpdateInfo.xml", "UpdateInformation", "FTPUser", "", txtFTPUser.Text); XMLProcess.Insert("UpdateInfo.xml", "UpdateInformation", "FTPPassword", "", txtFTPPassword.Text); //插入ApplicationInformation子节点 XMLProcess.Insert("UpdateInfo.xml", "UpdateInformation", "ApplicationName", "", txtAppName.Text); XMLProcess.Insert("UpdateInfo.xml", "UpdateInformation", "ApplicationVersion", "", txtVersion.Text); XMLProcess.Insert("UpdateInfo.xml", "UpdateInformation", "ApplicationUpdateTime", "", dtpUpdateTime.Text); XMLProcess.Insert("UpdateInfo.xml", "UpdateInformation", "ApplicationMessages", "", txtUpdateInfo.Text); }
private void VersionForm_Load(object sender, EventArgs e) { string strNewAppName = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationName"); string strNewAppVersion = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationVersion"); string strNewAppMessages = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationMessages"); string[] str = strNewAppMessages.Split(new char[] { ';' }); lblAppName_Version.Text = strNewAppName + " " + strNewAppVersion; for (int i = 0; i < str.Length; i++) { txtUpdateInfo.Text = txtUpdateInfo.Text + str[i] + Environment.NewLine; } txtUpdateInfo.SelectionStart = 0; txtUpdateInfo.SelectionLength = 0; }
protected void HandleChangesTuDien(object sender, BeforeStoreChangedEventArgs e) { ChangeRecords <MathRule> mathRule = e.DataHandler.ObjectData <MathRule>(); XMLProcess xmlProcess = new XMLProcess(); foreach (var item in mathRule.Updated) { xmlProcess.UpdateTuDien(Server.MapPath(MathRuleXmlUrl), item); GridPanel2.UpdateCell(item.ColumnInDB, "MathStatus", "true"); if (Store3.UseIdConfirmation) { e.ConfirmationList.ConfirmRecord(item.ColumnInDB.ToString()); } hdfMathStatus.Text = hdfMathStatus.Text.Replace(item.ColumnInDB + ",", ""); } }
public static Process GetOneProcess() { DataRow iDr = null; iDr = XMLProcess.Select(); Process proc = null; if (iDr != null) { proc = new Process(); proc.Guid = iDr[0] != DBNull.Value ? new Guid(iDr[0].ToString()) : new Guid(); proc.Status = iDr[1] != DBNull.Value ? Convert.ToInt32(iDr[1]) : 0; proc.Date = iDr[2] != DBNull.Value ? Convert.ToDateTime(iDr[2]) : DateTime.MinValue; } return(proc); }
protected void RefreshData(object sender, StoreRefreshDataEventArgs e) { try { List <MathRule> tudien = new XMLProcess().GetAll(XDocument.Load(Server.MapPath(MathRuleXmlUrl)), true); List <object> obj = new List <object>(); foreach (var item in tudien) { obj.Add(new { ColumnInDB = item.ColumnInDB, ColumnInSoftware = item.ColumnInSoftware, ColumnInExcel = item.ColumnInExcel, AllowBlank = item.AllowBlank, MathStatus = item.MathStatus, DataType = item.DataType }); } Store3.DataSource = obj; Store3.DataBind(); } catch (Exception ex) { Dialog.ShowError(ex.Message.ToString()); } }
/// <summary> /// 部门列表 /// </summary> /// <returns></returns> public static List <LearnCenter> GetLearnCenter() { List <LearnCenter> centerList = new List <LearnCenter>(); var xmlDoc = new XMLProcess(XmlPath); var nodeList = xmlDoc.ReadAllChild("item"); if (nodeList != null && nodeList.Count > 0) { foreach (XmlNode node in nodeList) { if (node.Attributes != null && (node.Attributes["id"] == null || node.Attributes["name"] == null)) { continue; } centerList.Add(new LearnCenter(int.Parse(node.Attributes["id"].Value), node.Attributes["name"].Value)); } } return(centerList); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #region 检查是否存在UpdateInfo.xml文件,如果不存在则启动设置窗口,创建UpdateInfo.xml文件,并配置该文件 if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "UpdateInfo.xml")) { //启动设置窗口 SettingsForm settingForm = new SettingsForm(); settingForm.ShowDialog(); } #endregion #region 连接到FTP,下载最新的XML配置文件到临时文件夹 //从原程序目录下读取XML文件中的FTP信息,并下载最新的XML文件 FTPPath = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "FTPInformation", "FTPPath"); FTPUser = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "FTPInformation", "FTPUser"); FTPPassword = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "FTPInformation", "FTPPassword"); //检查temp文件夹是否存在,并创建temp文件夹 DirFile.CreateDir("temp"); //将最新的XML文件下载到temp文件夹中 ftp = new FTPHelper(FTPPath, "", FTPUser, FTPPassword); ftp.Download(FTPPath, AppDomain.CurrentDomain.BaseDirectory.ToString() + @"\temp", "UpdateInfo.xml"); #endregion #region 获取临时文件夹XML文件中的版本更新日期,以及原程序的版本更新日期 //获取旧版本版本号及更新时间 strOldAppName = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationName"); strOldAppVersion = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationVersion"); strOldAppUpdateTime = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationUpdateTime"); strOldAppMessages = XMLProcess.Read("UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationMessages"); //获取新版本版本号及更新时间 strNewAppName = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationName"); strNewAppVersion = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationVersion"); strNewAppUpdateTime = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationUpdateTime"); strNewAppMessages = XMLProcess.Read(@"temp\UpdateInfo.xml", "UpdateInformation", "ApplicationInformation", "ApplicationMessages"); #endregion #region 比较两个版本的更新日期,提示用户是否升级,若选择不升级,则退出升级程序 if (strOldAppVersion != strNewAppVersion || strOldAppUpdateTime != strNewAppUpdateTime) { VersionForm versionform = new VersionForm(); versionform.ShowDialog(); } else { Application.Exit(); } #endregion #region 检测原程序是否在运行,若运行则杀死 //检测原程序是否在运行,若运行则杀死。 proc = Process.GetProcessesByName(strOldAppName); if (proc.Length != 0) { KillForm killform = new KillForm(); killform.ShowDialog(); } #endregion #region 开始批量下载文件到临时文件夹 //下载FTP上的文件到temp文件夹 string[] filelist = ftp.GetFileList(FTPPath); for (int i = 0; i < filelist.Length; i++) { ftp.Download(FTPPath, AppDomain.CurrentDomain.BaseDirectory.ToString() + @"\temp", filelist[i]); } //下载FTP上的文件夹到temp文件夹(包括文件夹下内容),如果没有文件夹,则folderlist.Length=0,不执行下列循环 string[] folderlist = ftp.GetFolderList(FTPPath); for (int i = 0; i < folderlist.Length; i++) { //根据得到的文件夹列表,在temp下创建相应的文件夹 DirFile.CreateDir(@"\temp\" + folderlist[i]); //获取该文件夹下的文件列表,并下载到文件夹下 string ftpURI = FTPPath + folderlist[i] + "/"; string[] InnerFilelist = ftp.GetFileList(ftpURI); for (int j = 0; j < InnerFilelist.Length; j++) { ftp.Download(ftpURI, AppDomain.CurrentDomain.BaseDirectory.ToString() + @"\temp\" + folderlist[i], InnerFilelist[j]); } } #endregion #region 将原程序删除(包括文件和文件夹),拷贝临时文件夹中的文件到原目录 //删除原程序中的文件 string[] deletefilelist = DirFile.GetFileNames(AppDomain.CurrentDomain.BaseDirectory.ToString()); for (int i = 0; i < deletefilelist.Length; i++) { if (!deletefilelist[i].Contains("UpdateProgram") & !deletefilelist[i].Contains("CSkin")) { DirFile.DeleteFile(deletefilelist[i]); } } //删除原程序中的文件夹 string[] deletefolderlist = DirFile.GetFolderNames(AppDomain.CurrentDomain.BaseDirectory.ToString()); for (int i = 0; i < deletefolderlist.Length; i++) { if (!deletefolderlist[i].Contains("temp") & !deletefolderlist[i].Contains("Backup")) { DirFile.DeleteDirectory(deletefolderlist[i]); } } //拷贝temp文件夹下文件到原程序目录 string[] copyfilelist = DirFile.GetFileNames(AppDomain.CurrentDomain.BaseDirectory.ToString() + "temp"); string[] strFileName = new string[copyfilelist.Length]; for (int i = 0; i < copyfilelist.Length; i++) { strFileName[i] = Path.GetFileName(copyfilelist[i]); DirFile.CopyFile(copyfilelist[i], AppDomain.CurrentDomain.BaseDirectory.ToString() + strFileName[i]); } //拷贝temp文件夹下文件夹到原程序目录 string[] copyfolderlist = DirFile.GetFolderNames(AppDomain.CurrentDomain.BaseDirectory.ToString() + "temp"); string[] strFolderName = new string[copyfolderlist.Length]; for (int i = 0; i < copyfolderlist.Length; i++) { strFolderName[i] = Path.GetFileName(copyfolderlist[i]); DirFile.CopyFolder(copyfolderlist[i], AppDomain.CurrentDomain.BaseDirectory.ToString() + strFolderName[i]); } #endregion #region 拷贝完成后,删除temp文件夹,提示更新完毕,然后启动新的主程序 DirFile.DeleteDirectory(AppDomain.CurrentDomain.BaseDirectory.ToString() + "temp"); Process.Start(strNewAppName + ".exe"); #endregion Application.Run(new UpdateForm()); }
public static void UpdateProcess(Process proc) { XMLProcess.Update(proc.Guid, proc.Status, proc.Date); }
public static void InsertProcess(Process proc) { XMLProcess.Insert(proc.Guid, proc.Status, proc.Date); }
public void Process(Request request, Account account) { IProcessRequest p1 = new XMLProcess(new CSVProcess(new PercentProcess(null))); p1.ProcessRequest(request, account); }
public static void DeleteProcess(Guid guid) { XMLProcess.Delete(guid); }
public static void Open(string pathXML) { XMLProcess.pathXML = pathXML; XMLProcess.OpenAndLoad(); }
public static IList GetProcessList() { return(XMLProcess.SelectAll()); }
public static void Close() { XMLProcess.Close(); }