public bool UpdateDZDZInfo(DZDZInfoModel dzdzInfoModel) { try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); if (this.baseDAO.queryValueSQL <int>("aisino.Fwkp.Xtsz.XTDZDZXXIsExist", dictionary) <= 0) { return(false); } dictionary.Add("ACCEPT_WEB_SERVER", dzdzInfoModel.AcceptWebServer); dictionary.Add("UPLOADNOW", dzdzInfoModel.UploadNowFlag); dictionary.Add("INTERVALFLAG", dzdzInfoModel.IntervalFlag); dictionary.Add("INTERVALTIME", dzdzInfoModel.IntervalTime); dictionary.Add("ACCUMULATEFLAG", dzdzInfoModel.AccumulateFlag); dictionary.Add("ACCUMULATENUM", dzdzInfoModel.AccumulateNum); dictionary.Add("DATASIZE", dzdzInfoModel.DataSize); if (this.baseDAO.updateSQL("aisino.Fwkp.Xtsz.UpdateXTDZDZXX", dictionary) > 0) { return(true); } } catch (Exception exception) { ExceptionHandler.HandleError(exception); this.loger.Error("UpdateDZDZInfo failed!"); return(false); } return(false); }
public bool GetDZDZInfoFromDB(ref DZDZInfoModel dzdzInfoModel) { try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); DataTable table = this.baseDAO.querySQLDataTable("aisino.Fwkp.Xtsz.SelectDZDZXX", dictionary); if (table.Rows.Count <= 0) { return(false); } dzdzInfoModel.AcceptWebServer = table.Rows[0]["ACCEPT_WEB_SERVER"].ToString(); dzdzInfoModel.UploadNowFlag = Convert.ToBoolean(table.Rows[0]["UPLOADNOW"]); dzdzInfoModel.IntervalFlag = Convert.ToBoolean(table.Rows[0]["INTERVALFLAG"]); dzdzInfoModel.IntervalTime = Convert.ToInt32(table.Rows[0]["INTERVALTIME"]); dzdzInfoModel.AccumulateFlag = Convert.ToBoolean(table.Rows[0]["ACCUMULATEFLAG"]); dzdzInfoModel.AccumulateNum = Convert.ToInt32(table.Rows[0]["ACCUMULATENUM"]); dzdzInfoModel.DataSize = Convert.ToInt32(table.Rows[0]["DATASIZE"]); } catch (Exception exception) { ExceptionHandler.HandleError(exception); this.loger.Error("GetDZDZInfoFromDB failed"); return(false); } return(true); }
protected override object[] doService(object[] param) { DZDZInfoModel dzdzInfoModel = new DZDZInfoModel(); new ParaSetDAL(); if (!Config.GetDZDZInfoFromXML(ref dzdzInfoModel)) { return(null); } Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("ACCEPT_WEB_SERVER", dzdzInfoModel.AcceptWebServer); if (dzdzInfoModel.IsUseProxy) { dictionary.Add("proxyType", dzdzInfoModel.ProxyType); dictionary.Add("proxyHost", dzdzInfoModel.ProxyHost); dictionary.Add("proxyPort", dzdzInfoModel.ProxyPort); } else { dictionary.Add("proxyType", ""); dictionary.Add("proxyHost", ""); dictionary.Add("proxyPort", ""); } if (dzdzInfoModel.IsUseProxy && dzdzInfoModel.IsAuthConfirm) { dictionary.Add("proxyAuthType", dzdzInfoModel.ProxyAuthType); dictionary.Add("proxyAuthUser", dzdzInfoModel.ProxyAuthUser); dictionary.Add("proxyAuthPassword", dzdzInfoModel.ProxyAuthPassword); } else { dictionary.Add("proxyAuthType", ""); dictionary.Add("proxyAuthUser", ""); dictionary.Add("proxyAuthPassword", ""); } dictionary.Add("UPLOADNOW", dzdzInfoModel.UploadNowFlag); dictionary.Add("INTERVALFLAG", dzdzInfoModel.IntervalFlag); dictionary.Add("INTERVALTIME", dzdzInfoModel.IntervalTime); dictionary.Add("ACCUMULATEFLAG", dzdzInfoModel.AccumulateFlag); dictionary.Add("ACCUMULATENUM", dzdzInfoModel.AccumulateNum); dictionary.Add("DATASIZE", dzdzInfoModel.DataSize); return(new object[] { dictionary }); }
protected override object[] doService(object[] param) { if (param.Length == 6) { DZDZInfoModel dzdzInfoModel = new DZDZInfoModel(); new ParaSetDAL(); Config.GetDZDZInfoFromXML(ref dzdzInfoModel); dzdzInfoModel.UploadNowFlag = bool.Parse(param[0].ToString()); dzdzInfoModel.IntervalFlag = bool.Parse(param[1].ToString()); dzdzInfoModel.IntervalTime = int.Parse(param[2].ToString()); dzdzInfoModel.AccumulateFlag = bool.Parse(param[3].ToString()); dzdzInfoModel.AccumulateNum = int.Parse(param[4].ToString()); dzdzInfoModel.DataSize = int.Parse(param[5].ToString()); if (Config.CreateDZDZXML(dzdzInfoModel)) { return(new object[] { true }); } } return(new object[] { false }); }
public bool UpdateDZDZInfo(DZDZInfoModel dzdzInfoModel) { return(this.paraSetDAL.UpdateDZDZInfo(dzdzInfoModel)); }
public bool GetDZDZInfoFromDB(ref DZDZInfoModel dzdzInfoModel) { return(this.paraSetDAL.GetDZDZInfoFromDB(ref dzdzInfoModel)); }
public static bool GetDZDZInfoFromXML(ref DZDZInfoModel dzdzInfoModel) { try { if (!File.Exists(m_strDZDZConfigPath)) { loger.Debug("电子抵账配置文件不存在"); ParaSetDAL tdal = new ParaSetDAL(); DZDZInfoModel model = new DZDZInfoModel(); if (!tdal.GetDZDZInfoFromDB(ref model)) { loger.Debug("从数据库中获取电子抵账信息失败"); return(false); } string aQJRDZ = GetAQJRDZ(); if (!string.IsNullOrEmpty(aQJRDZ)) { model.AcceptWebServer = aQJRDZ; } if (!CreateDZDZXML(model)) { loger.Debug("从数据库中更新电子抵账配置文件失败"); return(false); } } XmlDocument document = new XmlDocument(); document.Load(m_strDZDZConfigPath); XmlNode node = document.DocumentElement.SelectSingleNode("IsUseProxy"); if (node != null) { dzdzInfoModel.IsUseProxy = bool.Parse(node.InnerText); } node = document.DocumentElement.SelectSingleNode("ProxyType"); if (node != null) { dzdzInfoModel.ProxyType = node.InnerText; } node = document.DocumentElement.SelectSingleNode("ProxyHost"); if (node != null) { dzdzInfoModel.ProxyHost = node.InnerText; } node = document.DocumentElement.SelectSingleNode("ProxyPort"); if (node != null) { dzdzInfoModel.ProxyPort = node.InnerText; } node = document.DocumentElement.SelectSingleNode("IsAuthConfirm"); if (node != null) { dzdzInfoModel.IsAuthConfirm = bool.Parse(node.InnerText); } node = document.DocumentElement.SelectSingleNode("ProxyAuthType"); if (node != null) { dzdzInfoModel.ProxyAuthType = node.InnerText; } node = document.DocumentElement.SelectSingleNode("ProxyAuthUser"); if (node != null) { dzdzInfoModel.ProxyAuthUser = node.InnerText; } node = document.DocumentElement.SelectSingleNode("ProxyAuthPassword"); if (node != null) { dzdzInfoModel.ProxyAuthPassword = node.InnerText; } node = document.DocumentElement.SelectSingleNode("UploadNowFlag"); if (node != null) { dzdzInfoModel.UploadNowFlag = bool.Parse(node.InnerText); } node = document.DocumentElement.SelectSingleNode("IntervalFlag"); if (node != null) { dzdzInfoModel.IntervalFlag = bool.Parse(node.InnerText); } node = document.DocumentElement.SelectSingleNode("IntervalTime"); if (node != null) { dzdzInfoModel.IntervalTime = int.Parse(node.InnerText); } node = document.DocumentElement.SelectSingleNode("AccumulateFlag"); if (node != null) { dzdzInfoModel.AccumulateFlag = bool.Parse(node.InnerText); } node = document.DocumentElement.SelectSingleNode("AccumulateNum"); if (node != null) { dzdzInfoModel.AccumulateNum = int.Parse(node.InnerText); } node = document.DocumentElement.SelectSingleNode("DataSize"); if (node != null) { dzdzInfoModel.DataSize = int.Parse(node.InnerText); } node = document.DocumentElement.SelectSingleNode("AcceptWebServer"); if (node != null) { dzdzInfoModel.AcceptWebServer = node.InnerText; string str2 = GetAQJRDZ(); if (!string.IsNullOrEmpty(str2)) { if (str2 != dzdzInfoModel.AcceptWebServer) { dzdzInfoModel.AcceptWebServer = str2; CreateDZDZXML(dzdzInfoModel); } } else if (!SetAQJRDZ(dzdzInfoModel.AcceptWebServer)) { return(false); } } return(true); } catch (Exception exception) { loger.Error(exception.Message); File.Delete(m_strDZDZConfigPath); if (!GetDZDZInfoFromXML(ref dzdzInfoModel)) { return(false); } } return(true); }
public static bool CreateDZDZXML(DZDZInfoModel dzdzInfoModel) { try { XmlDocument document = new XmlDocument(); string path = m_strDZDZConfigPath.Remove(m_strDZDZConfigPath.LastIndexOf(@"\")); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } XmlDeclaration newChild = document.CreateXmlDeclaration("1.0", "utf-8", null); document.AppendChild(newChild); XmlElement element = document.CreateElement("root"); document.AppendChild(element); XmlNode node = document.CreateNode("element", "AcceptWebServer", ""); node.InnerText = dzdzInfoModel.AcceptWebServer; element.AppendChild(node); node = document.CreateNode("element", "IsUseProxy", ""); node.InnerText = dzdzInfoModel.IsUseProxy.ToString(); element.AppendChild(node); node = document.CreateNode("element", "ProxyType", ""); node.InnerText = dzdzInfoModel.ProxyType; element.AppendChild(node); node = document.CreateNode("element", "ProxyHost", ""); node.InnerText = dzdzInfoModel.ProxyHost; element.AppendChild(node); node = document.CreateNode("element", "ProxyPort", ""); node.InnerText = dzdzInfoModel.ProxyPort; element.AppendChild(node); node = document.CreateNode("element", "IsAuthConfirm", ""); node.InnerText = dzdzInfoModel.IsAuthConfirm.ToString(); element.AppendChild(node); node = document.CreateNode("element", "ProxyAuthType", ""); node.InnerText = dzdzInfoModel.ProxyAuthType; element.AppendChild(node); node = document.CreateNode("element", "ProxyAuthUser", ""); node.InnerText = dzdzInfoModel.ProxyAuthUser; element.AppendChild(node); node = document.CreateNode("element", "ProxyAuthPassword", ""); node.InnerText = dzdzInfoModel.ProxyAuthPassword; element.AppendChild(node); node = document.CreateNode("element", "UploadNowFlag", ""); node.InnerText = dzdzInfoModel.UploadNowFlag.ToString(); element.AppendChild(node); node = document.CreateNode("element", "IntervalFlag", ""); node.InnerText = dzdzInfoModel.IntervalFlag.ToString(); element.AppendChild(node); node = document.CreateNode("element", "IntervalTime", ""); node.InnerText = dzdzInfoModel.IntervalTime.ToString(); element.AppendChild(node); node = document.CreateNode("element", "AccumulateFlag", ""); node.InnerText = dzdzInfoModel.AccumulateFlag.ToString(); element.AppendChild(node); node = document.CreateNode("element", "AccumulateNum", ""); node.InnerText = dzdzInfoModel.AccumulateNum.ToString(); element.AppendChild(node); node = document.CreateNode("element", "DataSize", ""); node.InnerText = dzdzInfoModel.DataSize.ToString(); element.AppendChild(node); if (!SetAQJRDZ(dzdzInfoModel.AcceptWebServer)) { return(false); } document.Save(m_strDZDZConfigPath); return(true); } catch (Exception) { return(false); } }