/// <summary> /// 返回行中数据 /// </summary> /// <param name="row">表数据</param> /// <param name="Row">行索引</param> /// <param name="Collum">列名称</param> /// <returns>返回货币类型</returns> public static decimal GetValue_Decimal(this System.Data.DataRow row, int Collum) { return(Convert.ToDecimal(row[Collum])); }
private bool SerializeDataTableData(System.Data.DataTable table) { var rows = table.Rows; int count = rows.Count; if (count == 0) { return(true); } System.Data.DataColumnCollection cols = table.Columns; var columnType = new List <Tuple <string, ValueMemberInfo, int> >(); int columnCount = 0; foreach (System.Data.DataColumn column in cols) { var valueMember = new ValueMemberInfo(column.DataType); var columnName = BuildPropertyName(column.ColumnName, _options.TextCase, true); columnType.Add(new Tuple <string, ValueMemberInfo, int>(columnName, valueMember, column.Ordinal)); columnCount++; } var tableName = table.TableName; if (tableName.IsNullOrWhiteSpace()) { tableName = "_empty_"; } bool rowseparator = false; _jsonWriter.WritePropertyName(tableName, true); _jsonWriter.WriteStartArray(); try { for (var i = 0; i < count; i++) { System.Data.DataRow row = rows[i]; if (rowseparator) { _jsonWriter.WriteComma(); } else { rowseparator = true; } _jsonWriter.WriteStartObject(); try { for (var c = 0; c < columnCount; c++) { var column = columnType[c]; //build column name _jsonWriter.WritePropertyNameFast(column.Item1); //build column data var value = row[column.Item3]; if (value == null || value == DBNull.Value) { _jsonWriter.WriteNull(); } else if (!WriteObjectValue(value, column.Item2)) { return(false); } } } finally { _jsonWriter.WriteEndObject(); } } } finally { _jsonWriter.WriteEndArray(); } return(true); }
/// <summary> /// 返回行中数据 /// </summary> /// <param name="row">表数据</param> /// <param name="Row">行索引</param> /// <param name="Collum">列名称</param> /// <returns>返回整形</returns> public static int GetValue_Int(this System.Data.DataRow row, int Collum) { return(Convert.ToInt32(row[Collum])); }
protected override System.Data.Common.RowUpdatingEventArgs CreateRowUpdatingEvent(System.Data.DataRow dataRow, System.Data.IDbCommand?command, System.Data.StatementType statementType, System.Data.Common.DataTableMapping tableMapping) { throw null; }
public DataRowDrop(System.Data.DataRow dataRow) { _dataRow = dataRow; }
private void LoadData() { taskDataAdapter = new System.Data.SQLite.SQLiteDataAdapter("SELECT * FROM tasks WHERE ID=" + id, connection); alertsDataAdapter = new System.Data.SQLite.SQLiteDataAdapter("SELECT * FROM tasks_alerts WHERE task_id=" + id, connection); subTasksDataAdapter = new System.Data.SQLite.SQLiteDataAdapter("SELECT ID, child_of, name FROM tasks WHERE child_of=" + id, connection); dataSet = new System.Data.DataSet(); var taskCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(taskDataAdapter); var alertsCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(alertsDataAdapter); var subTasksCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(subTasksDataAdapter); taskDataAdapter.Fill(dataSet, "task"); taskDataAdapter.AcceptChangesDuringUpdate = true; alertsDataAdapter.Fill(dataSet, "alerts"); alertsDataAdapter.AcceptChangesDuringUpdate = true; subTasksDataAdapter.Fill(dataSet, "sub_tasks"); subTasksDataAdapter.AcceptChangesDuringUpdate = true; var parentColumn = dataSet.Tables["task"].Columns["ID"]; { var childColumn = dataSet.Tables["alerts"].Columns["task_id"]; var relation = new System.Data.DataRelation("task_alerts", parentColumn, childColumn); dataSet.Relations.Add(relation); } { var childColumn = dataSet.Tables["sub_tasks"].Columns["child_of"]; var relation = new System.Data.DataRelation("task_sub_tasks", parentColumn, childColumn); dataSet.Relations.Add(relation); } row = dataSet.Tables["task"].Rows[0]; dataSet.Tables["task"].RowChanged += table_RowChanged; dataSet.Tables["alerts"].RowChanged += table_RowChanged; dataSet.Tables["alerts"].RowDeleted += table_RowDeleted; dataSet.Tables["alerts"].TableNewRow += table_TableNewRow; dataSet.Tables["sub_tasks"].RowChanged += table_RowChanged; dataSet.Tables["sub_tasks"].RowDeleted += table_RowDeleted; dataSet.Tables["sub_tasks"].TableNewRow += table_TableNewRow; FillDeadline(row); FillTags(id); TaskGrid.DataContext = dataSet.Tables["task"].DefaultView; AlertsDataGrid.ItemsSource = dataSet.Tables["alerts"].DefaultView; SubTasksDataGrid.ItemsSource = dataSet.Tables["sub_tasks"].DefaultView; FillPrioritiesComboBox(); }
/// <summary> /// /// </summary> /// <param name="idProfile"></param> /// <param name="reg"></param> private static bool sendNotificaAnnulla(string idProfile, DocsPaVO.utente.Registro reg) { System.Data.DataSet ds; bool esito = true; //presume successo try { //BusinessLogic.Interoperabilità.InteroperabilitaControlloRicevute.processaRicevutaConferma(); DocsPaDB.Query_DocsPAWS.Interoperabilita obj = new DocsPaDB.Query_DocsPAWS.Interoperabilita(); obj.getCampiReg(out ds, reg); System.Data.DataRow regRow = ds.Tables["REGISTRO"].Rows[0]; reg.codAmministrazione = regRow["VAR_CODICE_AMM"].ToString(); //inserimento dei files in una cartella temporanea string basePathFiles = ConfigurationManager.AppSettings["LOG_PATH"]; basePathFiles = basePathFiles.Replace("%DATA", DateTime.Now.ToString("yyyyMMdd")); basePathFiles = basePathFiles + "\\Invio_notifica_annullamento_files"; string pathFiles = basePathFiles + "\\" + regRow["VAR_CODICE"].ToString(); DocsPaUtils.Functions.Functions.CheckEsistenzaDirectory(pathFiles); // logger.Debug(""+regRow["CHA_STR_SEGNATURA"].ToString().ToCharArray().Length); //costruzione del file xml string numRegMitt = ""; DocsPaVO.addressbook.QueryCorrispondente qco = new DocsPaVO.addressbook.QueryCorrispondente(); //costruisciXml(idProfile, reg,ref numRegMitt,ref qco, regRow["CHA_STR_SEGNATURA"].ToString(),pathFiles); string separatore = DocsPaDB.Utils.Personalization.getInstance(reg.idAmministrazione).getSepSegnatura(); costruisciXml(idProfile, reg, ref numRegMitt, ref qco, separatore, pathFiles); //invio mail string mailMitt = Interoperabilità.InteroperabilitaUtils.getMailAddress(qco, idProfile); logger.Debug("Invio mail all'indirizzo " + mailMitt); string porta = null; if (regRow["NUM_PORTA_SMTP"] != null) { porta = regRow["NUM_PORTA_SMTP"].ToString(); } string smtp_user = (regRow["VAR_USER_SMTP"] != null && regRow["VAR_USER_SMTP"] != System.DBNull.Value) ? regRow["VAR_USER_SMTP"].ToString() : null; string smtp_pwd; if (regRow["VAR_PWD_SMTP"] != null && regRow["VAR_PWD_SMTP"] != System.DBNull.Value && regRow["VAR_USER_SMTP"] != null && regRow["VAR_USER_SMTP"] != System.DBNull.Value) { smtp_pwd = Crypter.Decode(regRow["VAR_PWD_SMTP"].ToString(), regRow["VAR_USER_SMTP"].ToString()); } else { smtp_pwd = string.Empty; } //aggiunta la trim() per gestire la presenza di spazi bianchi nei campi VAR_USER_SMTP e VAR_PWD_SMTP if (smtp_user != null) { smtp_user = smtp_user.Trim(); } if (smtp_pwd != null) { smtp_pwd = smtp_pwd.Trim(); } // copia il file di segnatura //System.IO.File.Copy(System.AppDomain.CurrentDomain.BaseDirectory + @"xml\segnatura.dtd",pathFiles + "\\segnatura.dtd",true); creaMail(regRow["VAR_SERVER_SMTP"].ToString(), smtp_user, smtp_pwd, regRow["VAR_EMAIL_REGISTRO"].ToString(), mailMitt, numRegMitt, pathFiles, porta, regRow["CHA_SMTP_SSL"].ToString(), regRow["CHA_POP_SSL"].ToString(), regRow["CHA_SMTP_STA"].ToString()); System.IO.File.Delete(pathFiles + "\\Annullamento.xml"); DocsPaUtils.Functions.Functions.CancellaDirectory(pathFiles); DocsPaUtils.Functions.Functions.CancellaDirectory(basePathFiles); } catch (Exception e) { esito = false; logger.Error("Errore nella gestione dell'interoperabilità. (sendNotificaAnnullamento)", e); throw e; } return(esito); }
public void SetDataRowZongLiang(List <InCommonNoteItemEntity> inCommonNoteItemEntityList, System.Data.DataRow dr, System.Data.DataTable dt) { }
protected override void Execute(CodeActivityContext context) { { System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; string userName; string password; userName = Username.Get(context); //username from context password = Password.Get(context) + SecurityToken.Get(context); //password+token from context SforceService SfdcBinding = null; LoginResult CurrentLoginResult = null; SfdcBinding = new SforceService(); try { CurrentLoginResult = SfdcBinding.login(userName, password); } catch (System.Web.Services.Protocols.SoapException e) { // This is likley to be caused by bad username or password SfdcBinding = null; throw (e); } catch (Exception e) { // This is something else, probably comminication SfdcBinding = null; throw (e); } //Change the binding to the new endpoint SfdcBinding.Url = CurrentLoginResult.serverUrl; //Console.WriteLine(SfdcBinding.Url); //Console.ReadLine(); //Create a new session header object and set the session id to that returned by the login SfdcBinding.SessionHeaderValue = new SessionHeader(); SfdcBinding.SessionHeaderValue.sessionId = CurrentLoginResult.sessionId; QueryResult queryResult = null; String SOQL = ""; SOQL = SOQLQuery.Get(context); //SOQL Query from context queryResult = SfdcBinding.query(SOQL); System.Data.DataTable table = new System.Data.DataTable(); if (queryResult.size > 0) { int NoOfColumns = queryResult.records[0].Any.Count(); for (int i = 0; i < NoOfColumns; i++) { string ColumnName = queryResult.records[0].Any[i].Name; table.Columns.Add(ColumnName); //Console.WriteLine("Name of Column:" + ColumnName); } for (int j = 0; j < queryResult.records.Length; j++) { System.Data.DataRow dr = table.NewRow(); object[] rowArray = new object[table.Columns.Count]; for (int k = 0; k < table.Columns.Count; k++) { rowArray[k] = queryResult.records[j].Any[k].InnerText; } dr.ItemArray = rowArray; table.Rows.Add(dr); } } else { Console.WriteLine("No Records Available."); } OutputDataTable.Set(context, table);//output table to context } }
/// <summary> /// Retorna true si el usuario loged acutal tiene permiso al controlador-acción /// </summary> /// <param name="actionName">Nombre de la acción</param> /// <param name="ControllerName">Nombre del controlador</param> /// <returns></returns> public AccessPermission HasPermission(string actionName, string ControllerName) { System.Data.DataRow user = Helper.getData("select * from [BaseUser] where ID=" + WebSecurity.CurrentUserId.ToString(), db).Rows[0]; int userID = int.Parse(user["ID"].ToString()); BaseUser userObj = Helper.GetUser(db); if (user["superUser"].ToString() == "True") { return(AccessPermission.Grant); } DateTime nowy = DateTime.Now; BaseUserAction action = db.BaseUserActions.FirstOrDefault(d => d.BaseAction.name == actionName && d.BaseAction.BaseController.name == ControllerName && d.userID == userID ); BaseAction outside = null; foreach (var item in userObj.BaseProfiles) { foreach (var act in item.BaseActions) { if (act.name.ToLower() == actionName.ToLower() && act.BaseController.name.ToLower() == ControllerName.ToLower()) { outside = act; } } } if (action != null) { if (action.forever) { if (action.untilDate < DateTime.UtcNow) { Helper.currentExpired = action.untilDate; return(AccessPermission.Expired); } } if (!string.IsNullOrEmpty(action.password)) { if (!string.IsNullOrEmpty(action.password)) { if (action.passwordAccess.HasValue) { if (action.passwordAccess.Value) { if (action.leftSeconds == null) { Helper.executeNonQUery(string.Format("UPDATE [USER] SET tryAction='{0}', tryController='{1}' WHERE ID={2}", actionName, ControllerName, userID), db); return(AccessPermission.Password); } else { action.leftSeconds = null; db.SaveChanges(); } } } } } return(AccessPermission.Grant); } else { if (outside != null) { return(AccessPermission.Grant); } return(AccessPermission.Deny); } }
private void loadInfoFromXMLFile() { try { var keyPrefix = _mParentForm.GetType().Namespace + "." + _mParentForm.GetType().Name; if (!_mParentForm.IsMdiChild) keyPrefix += "$SINGLE"; if (System.IO.File.Exists(_internalXMLFilePath) && _mDsNotLoaded) { try { MWindowStateDs.ReadXml(_internalXMLFilePath); } catch (Exception ex) { _log.Error("Errore non previsto nel caricamento delle dimensioni di una finestra - mWindowState_DS.ReadXml - " + Gipasoft.Library.Utility.GetMethodDescription() + " - internalXMLFilePath:" + _internalXMLFilePath, ex); throw; } try { MWindowStateDs.ReadXmlSchema(_internalXMLFilePath); } catch (Exception ex) { _log.Error("Errore non previsto nel caricamento delle dimensioni di una finestra - mWindowState_DS.ReadXmlSchema - " + Gipasoft.Library.Utility.GetMethodDescription() + " - internalXMLFilePath:" + _internalXMLFilePath, ex); throw; } _mDsNotLoaded = false; } if (MWindowStateDs.WindowStateInfo.Rows.Contains(keyPrefix)) { _mWindowStateInfoDr = MWindowStateDs.WindowStateInfo.Select("FormId='" + keyPrefix + "'")[0]; var left = (int)_mWindowStateInfoDr["Left"]; var top = (int)_mWindowStateInfoDr["Top"]; var width = (int)_mWindowStateInfoDr["Width"]; var height = (int)_mWindowStateInfoDr["Height"]; var windowState = (FormWindowState)_mWindowStateInfoDr["WindowState"]; _mParentForm.Location = new System.Drawing.Point(left, top); _mParentForm.Size = new System.Drawing.Size(width, height); _mParentForm.WindowState = windowState; _mWindowInfo.Left = _mParentForm.Left; _mWindowInfo.Top = _mParentForm.Top; _mWindowInfo.Height = _mParentForm.Height; _mWindowInfo.Width = _mParentForm.Width; _mWindowInfo.WindowState = _mParentForm.WindowState; } if (!System.IO.File.Exists(_internalXMLFilePath)) { onClosing(null, null); _mDsNotLoaded = false; } } catch (Exception ex) { _log.Error("Errore non previsto nel caricamento delle dimensioni di una finestra - " + Gipasoft.Library.Utility.GetMethodDescription() + " - internalXMLFilePath:" + _internalXMLFilePath, ex); try { if (System.IO.File.Exists(_internalXMLFilePath)) System.IO.File.Delete(_internalXMLFilePath); } catch (Exception ex2) { _log.Error("Errore non previsto nel caricamento delle dimensioni di una finestra - Cancellazione file XML - " + Gipasoft.Library.Utility.GetMethodDescription() + " (DELETE) - internalXMLFilePath:" + _internalXMLFilePath, ex2); } } }
public void Load(System.Data.DataRow row) { try { _id = row["ID"] != null ? new Guid(row["ID"] as string) : Guid.NewGuid(); _deviceID = row["DeviceID"] as string; _name = row["Name"] as string; _manufacture = row["Manufacture"] as string; _devType = row["DevType"] as string; _model = row["Model"] as string; _owner = row["Owner"] as string; _cvilCode = row["CvilCode"] != null?Convert.ToInt32(row["CvilCode"]) : 0; _platformId = row["PlatformId"] as string; _ip = row["IP"] as string; _port = row["Port"] != null?Convert.ToInt32(row["Port"]) : 0; _userName = row["UserName"] as string; _password = row["Password"] as string; _onvifAddress = row["ONVIFAddress"] as string; _onvifVersion = row["ONVIFVersion"] as string; _isAnalyzer = row["IsAnalyzer"] != null?Convert.ToInt32(row["IsAnalyzer"]) : 0; _isBackRecord = row["IsBackRecord"] != null?Convert.ToInt32(row["IsBackRecord"]) : 0; _localIP = row["LocalIP"] as string; _localPort = row["LocalPort"] != null?Convert.ToInt32(row["LocalPort"]) : 5060; _localID = row["LocalID"] as string; _macAddress = row["MacAddress"] as string; _firmware = row["Firmware"] as string; _channelNum = row["ChannelNum"] != null?Convert.ToInt32(row["ChannelNum"]) : 1; _status = row["Status"] != null?Convert.ToInt32(row["Status"]) : 0; _reason = row["Reason"] as string; _deviceTime = row["DeviceTime"] != DBNull.Value ? Convert.ToDateTime(row["DeviceTime"]) : DateTime.Now; _parental = row["Parental"] != null?Convert.ToInt32(row["Parental"]) : 0; _parentID = row["ParentID"] != null?Convert.ToInt32(row["ParentID"]) : 0; _address = row["Address"] as string; _block = row["Block"] != null?Convert.ToInt32(row["Block"]) : 0; _registerWay = row["RegisterWay"] != null?Convert.ToInt32(row["RegisterWay"]) : 0; _secrecy = row["Secrecy"] != null?Convert.ToInt32(row["Secrecy"]) : 0; _endTime = row["EndTime"] != DBNull.Value ? Convert.ToDateTime(row["EndTime"]) : DateTime.Now; _errCode = row["ErrCode"] != null?Convert.ToInt32(row["ErrCode"]) : 0; _certifiable = row["Certifiable"] != null?Convert.ToInt32(row["Certifiable"]) : 0; _certNum = row["CertNum"] != null?Convert.ToInt32(row["CertNum"]) : 0; _uri = row["URI"] as string; _webPort = row["WebPort"] != null?Convert.ToInt32(row["WebPort"]) : 0; _latitude = row["Latitude"] as string; _longitude = row["Longitude"] as string; _createTime = row["CreateTime"] != DBNull.Value ? Convert.ToDateTime(row["CreateTime"]) : DateTime.Now; _updateTime = row["UpdateTime"] != DBNull.Value ? Convert.ToDateTime(row["UpdateTime"]) : DateTime.Now; } catch (Exception excp) { logger.Error("Exception Device Load. " + excp); throw excp; } }
public Entity(System.Data.DataRow row) { this.SetRow(row); //Création du datarow depuis une requette sql }
/// <summary></summary> /// <param name="idProfile"></param> /// <param name="reg"></param> /// <param name="numRegMitt"></param> /// <param name="qco"></param> /// <param name="separatore"></param> /// <param name="filePath"></param> private static void costruisciXml(string idProfile, DocsPaVO.utente.Registro reg, ref string numRegMitt, ref DocsPaVO.addressbook.QueryCorrispondente qco, string separatore, string filePath) { System.Data.DataSet ds; try { logger.Debug("costruisciXml"); logger.Debug("" + separatore); DocsPaDB.Query_DocsPAWS.Interoperabilita obj = new DocsPaDB.Query_DocsPAWS.Interoperabilita(); obj.getMittSegn(out ds, idProfile); System.Data.DataRow mittRow = ds.Tables["INFO_MITT"].Rows[0]; char[] separator = { separatore.ToCharArray()[0] }; //si trova il codice amministrazione del mittente string codiceAmmMittString = ""; if (mittRow["CHA_TIPO_IE"].ToString().Equals("I")) { //mittente interno codiceAmmMittString = reg.codAmministrazione; } else { //mittente esterno codiceAmmMittString = mittRow["VAR_CODICE_AMM"].ToString(); } string protoIn = mittRow["VAR_PROTO_IN"].ToString(); logger.Debug(protoIn + " " + protoIn.Split(separator).Length); string codiceAOOMittString = protoIn.Split(separator)[0]; string numeroRegMittString = (protoIn.Split(separator).Length > 1 ? protoIn.Split(separator)[1] : string.Empty); numRegMitt = numeroRegMittString; //costruzione dell'oggetto per la richiesta mittente qco.codiceRubrica = mittRow["VAR_COD_RUBRICA"].ToString(); qco.idAmministrazione = mittRow["ID_AMM"].ToString(); if (mittRow["CHA_TIPO_IE"].ToString().Equals("I")) { qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.INTERNO; } else { qco.tipoUtente = DocsPaVO.addressbook.TipoUtente.ESTERNO; } qco.getChildren = false; string dataRegMittString = (!string.IsNullOrEmpty(mittRow["DTA_PROTO_IN"].ToString()) ? System.Convert.ToDateTime(mittRow["DTA_PROTO_IN"]).ToString("yyyy-MM-dd") : string.Empty); obj.getIdent(out ds, idProfile); System.Data.DataRow protoRow = ds.Tables["INFO_PROTO"].Rows[0]; string numeroRegString = protoRow["NUM_PROTO"].ToString(); string dataRegString = ""; if (protoRow["DTA_PROTO"] != null && !protoRow["DTA_PROTO"].ToString().Equals("")) { dataRegString = System.Convert.ToDateTime(protoRow["DTA_PROTO"]).ToString("yyyy-MM-dd"); } string dataAnnullamento = ""; if (protoRow["DTA_ANNULLA"] != null && !protoRow["DTA_ANNULLA"].ToString().Equals("")) { dataAnnullamento = System.Convert.ToDateTime(protoRow["DTA_ANNULLA"]).ToString("yyyy-MM-dd"); } string motivoAnnullamento = protoRow["VAR_AUT_ANNULLA"].ToString(); //costruzione del file xml logger.Debug("Costruzione file xml"); XmlDocument xdoc = new XmlDocument(); //impostazione xdoc.XmlResolver = null; XmlDeclaration dec = xdoc.CreateXmlDeclaration("1.0", "UTF-8", null); xdoc.AppendChild(dec); //XmlDocumentType dtd = xdoc.CreateDocumentType("AnnullamentoProtocollazione", null, "Segnatura.dtd", null); //xdoc.AppendChild(dtd); //logger.Debug("dtd impostato"); //creazione della root XmlElement root = xdoc.CreateElement("AnnullamentoProtocollazione"); root.SetAttribute("xmlns", "http://www.digitPa.gov.it/protocollo/"); xdoc.AppendChild(root); //creazione dell'identificatore XmlElement identificatore = xdoc.CreateElement("Identificatore"); root.AppendChild(identificatore); XmlElement codiceAmm = xdoc.CreateElement("CodiceAmministrazione"); codiceAmm.InnerText = reg.codAmministrazione; identificatore.AppendChild(codiceAmm); XmlElement codiceAOO = xdoc.CreateElement("CodiceAOO"); //se è un RF, io devo comunque inviare la ricevuta dall'AOO. DocsPaVO.utente.Registro registro = new DocsPaVO.utente.Registro(); if (reg.chaRF != null && reg.chaRF == "1") { if (!string.IsNullOrEmpty(reg.idAOOCollegata)) { registro = BusinessLogic.Utenti.RegistriManager.getRegistro(reg.idAOOCollegata); } else { throw new Exception("Errore in costruiscixml conferma, l'RF " + reg.descrizione + " non ha una AOO collegata."); } } if (registro != null) { reg = registro; } codiceAOO.InnerText = reg.codRegistro; identificatore.AppendChild(codiceAOO); XmlElement codiceRegistro = xdoc.CreateElement("CodiceRegistro"); codiceRegistro.InnerText = reg.codRegistro; identificatore.AppendChild(codiceRegistro); XmlElement numeroReg = xdoc.CreateElement("NumeroRegistrazione"); numeroReg.InnerText = numeroRegString; identificatore.AppendChild(numeroReg); XmlElement dataReg = xdoc.CreateElement("DataRegistrazione"); dataReg.InnerText = dataRegString; identificatore.AppendChild(dataReg); //creazione motivo annullamento XmlElement motivoAnnulla = xdoc.CreateElement("Motivo"); motivoAnnulla.InnerText = motivoAnnullamento; root.AppendChild(motivoAnnulla); //creazione provvedimento annullamento XmlElement provvedimento = xdoc.CreateElement("Provvedimento"); provvedimento.InnerText = ""; root.AppendChild(provvedimento); /* NON E' RICHIESTO * //creazione dell'identificatore mittente; * XmlElement messRicevuto=xdoc.CreateElement("MessaggioRicevuto"); * XmlElement identificatoreMitt=xdoc.CreateElement("Identificatore"); * * XmlElement codiceAmmMitt=xdoc.CreateElement("CodiceAmministrazione"); * codiceAmmMitt.InnerText=codiceAmmMittString; * identificatoreMitt.AppendChild(codiceAmmMitt); * * * XmlElement codiceAOOMitt=xdoc.CreateElement("CodiceAOO"); * codiceAOOMitt.InnerText=codiceAOOMittString; * identificatoreMitt.AppendChild(codiceAOOMitt); * * XmlElement numeroRegMitt=xdoc.CreateElement("NumeroRegistrazione"); * numeroRegMitt.InnerText=numeroRegMittString; * identificatoreMitt.AppendChild(numeroRegMitt); * * XmlElement dataRegMitt=xdoc.CreateElement("DataRegistrazione"); * dataRegMitt.InnerText=dataRegMittString; * identificatoreMitt.AppendChild(dataRegMitt); * * messRicevuto.AppendChild(identificatoreMitt); * root.AppendChild(messRicevuto); */ //salvataggio file System.IO.FileStream fs = new System.IO.FileStream(filePath + "\\Annullamento.xml", System.IO.FileMode.Create); xdoc.Save(fs); fs.Close(); } catch (Exception e) { logger.Error("Errore nella gestione dell'interoperabilità. (costruisciXml)", e); throw e; } }
private void LoadData() { taskDataAdapter = new System.Data.SQLite.SQLiteDataAdapter("SELECT * FROM events WHERE ID=" + id, connection); alertsDataAdapter = new System.Data.SQLite.SQLiteDataAdapter("SELECT * FROM events_alerts WHERE event_id=" + id, connection); dataSet = new System.Data.DataSet(); var taskCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(taskDataAdapter); var alertsCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(alertsDataAdapter); taskDataAdapter.Fill(dataSet, "event"); alertsDataAdapter.Fill(dataSet, "alerts"); var parentColumn = dataSet.Tables["event"].Columns["ID"]; { var childColumn = dataSet.Tables["alerts"].Columns["event_id"]; var relation = new System.Data.DataRelation("event_alerts", parentColumn, childColumn); dataSet.Relations.Add(relation); } //var table = dataSet.Tables["event"]; row = dataSet.Tables["event"].Rows[0]; dataSet.Tables["event"].RowChanged += table_RowChanged; dataSet.Tables["alerts"].RowChanged += table_RowChanged; dataSet.Tables["alerts"].RowDeleted += table_RowDeleted; dataSet.Tables["alerts"].TableNewRow += table_TableNewRow; FillDeadline(row); FillTags(id); TaskGrid.DataContext = dataSet.Tables["event"].DefaultView; AlertsDataGrid.ItemsSource = dataSet.Tables["alerts"].DefaultView; }
public string Tree1() { string roleID = Request.QueryString["roleid"]; Guid roleGuid; if (!roleID.IsGuid(out roleGuid)) { return("[]"); } Business.Platform.RoleApp BRoleApp = new Business.Platform.RoleApp(); var appDt = BRoleApp.GetAllDataTableByRoleID(roleGuid); if (appDt.Rows.Count == 0) { return("[]"); } var root = appDt.Select("ParentID='" + Guid.Empty.ToString() + "'"); if (root.Length == 0) { return("[]"); } var apps = appDt.Select("ParentID='" + root[0]["ID"].ToString() + "'"); System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000); System.Data.DataRow rootDr = root[0]; json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", rootDr["ID"]); json.AppendFormat("\"title\":\"{0}\",", rootDr["Title"]); json.AppendFormat("\"ico\":\"{0}\",", rootDr["Ico"]); json.AppendFormat("\"link\":\"{0}\",", rootDr["Address"]); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", rootDr["OpenMode"]); json.AppendFormat("\"width\":\"{0}\",", rootDr["Width"]); json.AppendFormat("\"height\":\"{0}\",", rootDr["Height"]); json.AppendFormat("\"hasChilds\":\"{0}\",", apps.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); for (int i = 0; i < apps.Length; i++) { System.Data.DataRow dr = apps[i]; var childs = appDt.Select("ParentID='" + dr["ID"].ToString() + "'"); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", dr["ID"]); json.AppendFormat("\"title\":\"{0}\",", dr["Title"]); json.AppendFormat("\"ico\":\"{0}\",", dr["Ico"]); json.AppendFormat("\"link\":\"{0}\",", dr["Address"]); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", dr["OpenMode"]); json.AppendFormat("\"width\":\"{0}\",", dr["Width"]); json.AppendFormat("\"height\":\"{0}\",", dr["Height"]); json.AppendFormat("\"hasChilds\":\"{0}\",", childs.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); json.Append("]"); json.Append("}"); if (i < apps.Length - 1) { json.Append(","); } } json.Append("]"); json.Append("}"); json.Append("]"); return(json.ToString()); }
public RowItem(System.Data.DataRow row) { _row = row; }
//------------------------------------------------------------------- public CRelationSchemaReseau_ChampCustom(System.Data.DataRow row) : base(row) { }
public MyProperties(System.Data.DataTable schema, System.Data.DataRow data) { this.m_schema = schema; this.m_data = data; this.m_XmlEndcoder = new MyXmlEncoder(); }
public virtual int Update(System.Data.DataRow dataRow) { return(this.Adapter.Update(new System.Data.DataRow[] { dataRow })); }
protected override void ApplyParameterInfo(System.Data.Common.DbParameter parameter, System.Data.DataRow datarow, System.Data.StatementType statementType, bool whereClause) { }
//------------------------------------------------------------------- public CRelationTypeTableParametrable_Formulaire(System.Data.DataRow row) : base(row) { }
/// <summary> /// Get the value from a column in a ado datarow. The column can /// either be delimited by ## or !!. If delimited by the value ## then /// the column value is returned. If the column is delimited by the value /// of !! then the column value is translated. for example, if a /// statecd had a value of !!41!! then the returned value would be Oregon. /// The translation of the !! value can also be dependent upon the value /// of multiple columns in the data row. For example, each state has a /// county code of 1. Therefore, the translation of the county code is /// dependent upon the value that is in the statecd column. /// </summary> /// <param name="str"></param> /// <param name="p_row"></param> /// <returns></returns> private string ExecuteMacroSubst(string str, System.Data.DataRow p_row) { //check for no macros if (this._bUseRandomData == true) { return(str); } if (str.IndexOf("##", 0) < 0 && str.IndexOf("!!", 0) < 0) { return(str); } string strNewString = ""; string strVariable; try { for (int x = 0; x <= str.Trim().Length - 1; x++) { if (x == str.Trim().Length - 1) { strNewString = strNewString + str.Substring(x, 1); break; } if (str.Substring(x, 2) == "##" || str.Substring(x, 2) == "!!") { strVariable = ""; for (int y = x + 2; y <= str.Trim().Length - 1; y++) { if (str.Substring(y, 2) == "##" || str.Substring(y, 2) == "!!") { for (int z = 0; z <= p_row.Table.Columns.Count - 1; z++) { if (p_row.Table.Columns[z].ColumnName.ToString().Trim().ToUpper() == strVariable.Trim().ToUpper()) { if (str.Substring(y, 2) == "##") { strNewString = strNewString + p_row[strVariable].ToString().Trim(); break; } else { //find the correct variable substitution field for (int xx = 0; xx <= this._dsVarSub.Tables.Count - 1; xx++) { if (_dsVarSub.Tables[xx].TableName.Trim().ToUpper() == strVariable.Trim().ToUpper()) { //locate the current value and what it's substitute is for (int yy = 0; yy <= _dsVarSub.Tables[xx].Rows.Count - 1; yy++) { bool bFound = true; /****************************************************************** **compare the value in each column ******************************************************************/ for (int zzz = 0; zzz <= _dsVarSub.Tables[xx].Columns.Count - 1; zzz++) { //check the column value if it is not equal to the variable substituition column if (_dsVarSub.Tables[xx].Columns[zzz].ColumnName.Trim().ToUpper() != "VARSUB") { if (_dsVarSub.Tables[xx].Rows[yy][zzz].ToString().Trim() != p_row[_dsVarSub.Tables[xx].Columns[zzz].ColumnName.Trim()].ToString().Trim()) { bFound = false; break; } } } if (bFound == true) { // if (p_dt.Rows[p_intRowNum][strVariable].ToString().Trim()== // _dsVarSub.Tables[xx].Rows[yy]["value"].ToString().Trim()) // { strNewString = strNewString + _dsVarSub.Tables[xx].Rows[yy]["varsub"].ToString().Trim(); break; // } } } } } } } } x = y + 1; break; } else { strVariable = strVariable + str.Substring(y, 1); } } } else { strNewString = strNewString + str.Substring(x, 1); } } } catch { return(strNewString); } return(strNewString); }
internal override AddTransactionCommandBase Create(Account account, System.Data.DataRow dataRowTran) { return(new Command.AddBOTransactionCommand(account, dataRowTran)); }
public void FillData(System.Data.DataRow dr) { dr.FillData(this); }
partial void AfterInsert(System.Data.DataRow row, string SheetName, string TableName) { }
public abstract bool DrToMember(System.Data.DataRow dr);
override public void Assembly(System.Data.DataRow dr) { ActivityInstId = Convert.ToInt32(dr["ACTIVITY_INST_ID"].ToString()); PreActivityInstId = Convert.ToInt32(dr["PRE_ACTIVITY_INST_ID"].ToString()); }
/// <summary> /// 返回行中数据 /// </summary> /// <param name="row">表数据</param> /// <param name="Row">行索引</param> /// <param name="Collum">列名称</param> /// <returns>返回双精度型</returns> public static double GetValue_Double(this System.Data.DataRow row, int Collum) { return(Convert.ToDouble(row[Collum])); }
/// <summary> /// Parses TimeZones and Rules from the files in the provided /// Olson/TZ Database directory. The directory provided must be a valid TZ Database. /// </summary> /// <param name="directory">The valid directory to parse Rules and TimeZones from.</param> public void ReadTZDirectory() { try { // Mapping from TZname to: id, Ccode, Cname. var tzNameToInfo = ReadTabFiles(); TimeZones.BeginLoadData(); Rules.BeginLoadData(); Leaps.BeginLoadData(); foreach (OlsonFileInfo file in _olsonFiles.GetConsumingEnumerable()) { if (!file.IsTabFile) { RaiseFileParsing(file); string[] lines = File.ReadAllLines(file.FullName); // Process items. for (int i = 0; i < lines.Length; i++) { string line = lines[i].TrimStart(); if (!isCommentNullOrWhiteSpace(line)) { string[] fields = ParseFields(line); switch (fields[0]) { case Rule.RULE_NAME: { short from = Rule.ParseStartYear(fields[Rule.FromIndex]); short to = Rule.ParseEndYear(fields[Rule.ToIndex], from); if (from > _curYear || to < _curYear) { continue; } // No parsing necessary. string name = fields[Rule.NameIndex]; var rule = Rules.NewRow(); rule[1] = name; rule[2] = Rule.ParseBias(fields[Rule.SaveIndex]); rule[3] = from; rule[4] = to; rule[5] = Rule.ParseMonth(fields[Rule.InIndex]); rule[6] = fields[Rule.OnIndex]; rule[7] = Rule.ParseTime(fields[Rule.AtIndex]); rule[8] = Rule.ParseTimeType(ref fields[Rule.AtIndex]); rule[9] = Rule.ParseAbrev(fields[Rule.LetterIndex]) ?? (object)System.DBNull.Value; _ruleRows.Add(rule); RaiseEntryParsed(null); break; } case TimeZone.ZONE_NAME: { // First TZ. int init = i; // Count to last do { i++; } while (i < lines.Length && TimeZone.IsContinuation(lines[i])); // If first was not the only... if (i - init != 1) { string[] continuation = ParseFields(lines[--i].Trim()); // Continuation has a non-tab delimited date... if (continuation.Length > 4 && int.Parse(continuation[3]) < _curYear) { continue; } System.Array.Copy(continuation, 0, fields, 2, continuation.Length); } else { if (fields.Length > 5 && int.Parse(fields[5]) < _curYear) { continue; } } string name = TimeZone.ParseName(fields[TimeZone.NameIndex]); string countryCode = null; string countryName = null; string coord = null; string comments = null; int id = 0; string[] tokens; if (tzNameToInfo.TryGetValue(name, out tokens)) { id = System.Convert.ToInt32(tokens[0]); countryCode = tokens[1]; countryName = tokens[2]; coord = tokens[3]; comments = tokens[4]; } else { App.ExceptionLogger.LogLow(new System.Exception("OlsonParser.cs Ln 390:" + "Error attempting to get a TimeZone's iso/tab info.")); continue; } short bias = TimeZone.ParseBias(fields[TimeZone.GMTOffsetIndex]); string ruleName = TimeZone.ParseRuleName(fields[TimeZone.RuleIndex]); string tzAbrev = TimeZone.ParseTzAbrev(fields[TimeZone.FormatIndex]); var timeZone = TimeZones.NewRow(); timeZone[0] = id; timeZone[1] = name; timeZone[2] = bias; timeZone[3] = ruleName; timeZone[4] = tzAbrev; timeZone[5] = countryCode; timeZone[6] = countryName; timeZone[7] = comments; timeZone[8] = coord; TimeZoneLookupTable[name] = timeZone; _timeZoneRows.Add(timeZone); RaiseEntryParsed(null); break; } case Link.LINK_NAME: { var link = new string[] { fields[Link.FromZoneNameIndex], fields[Link.ToZoneNameIndex] }; _links.Add(link); RaiseEntryParsed(null); break; } case Leap.LEAP_NAME: { var leap = Leaps.NewRow(); leap[1] = Leap.ParseYear(fields[Leap.YearIndex]); leap[2] = fields[Leap.MonthIndex]; leap[3] = Leap.ParseDay(fields[Leap.DayIndex]); leap[4] = Leap.ParseTime(fields[Leap.TimeIndex]); leap[5] = Leap.ParseCorrection(fields[Leap.CorrectionIndex]); leap[6] = Leap.ParseRs(fields[Leap.RsIndex]); _leapRows.Add(leap); RaiseEntryParsed(null); break; } } ParsedEntries++; } } RaiseFileParsed(file); } } // Adding all links to list of TimeZones. foreach (string[] link in _links) { System.Data.DataRow from; if (!TimeZoneLookupTable.TryGetValue(link[Link.FromZoneNameIndex], out from)) { App.ExceptionLogger.LogLow(new System.Exception("OlsonParser.cs Ln 364: Error attempting to find the \"From\" TimeZone for the link:" + link[0].ToString())); continue; } string toName = link[Link.ToZoneNameIndex]; System.Data.DataRow to = TimeZones.NewRow(); to[0] = ++_lastUID; to[1] = toName; to[2] = from[2]; to[3] = from[3]; to[4] = from[4]; to[5] = from[5]; to[6] = from[6]; to[7] = from[7]; to[8] = from[8]; if (!TimeZoneLookupTable.TryAdd(toName, to)) { App.ExceptionLogger.LogLow(new System.Exception("OlsonParser.cs Ln 373: Error attempting to add the TimeZone for the link:" + link.ToString())); continue; } try { _timeZoneRows.Add(to); RaiseEntryParsed(null); ParsedEntries++; } catch (System.Exception e) { App.ExceptionLogger.LogLow(e); continue; } } RaiseDirectoryParsed(Directory); } finally { TimeZones.EndLoadData(); Rules.EndLoadData(); Leaps.EndLoadData(); } }
/// <summary> /// 返回行中数据 /// </summary> /// <param name="row">表数据</param> /// <param name="Row">行索引</param> /// <param name="Collum">列名称</param> /// <returns>返回字符串类型</returns> public static string GetValue_String(this System.Data.DataRow row, string Collum) { return(Convert.ToString(row[Collum])); }
//------------------------------------------------------------------- public CRelationTypeMetaProjet_Formulaire(System.Data.DataRow row) : base(row) { }
private void LoadInfoFromXMLFile() { string KeyPrefix = this.mParentForm.GetType().Namespace+"."+this.mParentForm.GetType().Name; if (System.IO.File.Exists(this.mXMLFilePath) && mDSNotLoaded) { mWindowState_DS.ReadXml(this.mXMLFilePath); mWindowState_DS.ReadXmlSchema(this.mXMLFilePath); mDSNotLoaded = false; } if (mWindowState_DS.WindowStateInfo.Rows.Contains(KeyPrefix)) { this.mWindowStateInfo_DR = mWindowState_DS.WindowStateInfo.Select("FormId='"+KeyPrefix+"'")[0]; int left = (int)mWindowStateInfo_DR["Left"]; int top = (int)mWindowStateInfo_DR["Top"]; int width = (int)mWindowStateInfo_DR["Width"]; int height = (int)mWindowStateInfo_DR["Height"]; FormWindowState windowState = (FormWindowState)mWindowStateInfo_DR["WindowState"]; mParentForm.Location = new System.Drawing.Point(left, top); mParentForm.Size = new System.Drawing.Size(width, height); mParentForm.WindowState = windowState; this.mWindowInfo.Left = mParentForm.Left; this.mWindowInfo.Top = mParentForm.Top; this.mWindowInfo.Height = mParentForm.Height; this.mWindowInfo.Width = mParentForm.Width; this.mWindowInfo.WindowState = mParentForm.WindowState; } if (! System.IO.File.Exists(this.mXMLFilePath)) { this.OnClosing(null, null); mDSNotLoaded = false; } }
public bool IsExistForHolidayDate(System.Data.DataRow dr) { return(accessor.IsExistForHolidayDate(dr)); }
public SPListDefinition(System.Data.DataRow list) { _ListData = list; _Type = (Convert.ToInt32(list["BaseType"]) == 1) ? SharepointListType.DocumenLibrary : SharepointListType.Other; }
protected override Division Mapear(Division entidad, System.Data.DataRow registro) { entidad.Codigo = registro["codigo"].ToString().Trim(); entidad.Nombre = registro["nombre"].ToString().Trim(); return(entidad); }
internal TableRow(Table datatable, System.Data.DataRow datarow) { _datatable = datatable; _datarow = datarow; }
public OdbcRowUpdatingEventArgs(System.Data.DataRow row, System.Data.IDbCommand?command, System.Data.StatementType statementType, System.Data.Common.DataTableMapping tableMapping) : base(default(System.Data.DataRow), default(System.Data.IDbCommand), default(System.Data.StatementType), default(System.Data.Common.DataTableMapping)) { }
internal void SetCell(System.Data.DataRow datarow, int column, object value) { if (_cells == null) return; int row; if (datarow == _cacheRow) { row = _cacheIndex; } else { row = _rowsall.IndexOf(datarow); row += _hasheaders ? 2 : 1; //convert to base 1 _cacheRow = datarow; _cacheIndex = row; } column += 1; //convert to base 1 ((IRange)_cells[row, column]).Value2 = value; }
public DataRowDrop(System.Data.DataRow dataRow) { _dataRow = dataRow; }