Example #1
0
 public int PersonInfoUpdate(PersonInfo personInfo)
 {
     try
     {
         string commandText =
             @"UPDATE PersonInfo SET Name = @name, SurName = @surName, NickName = @nickName, Description = @description, Address = @address, PostNumber = @postNumber, City = @city, Email = @email, Telephone= @telephone, TelephoneMobile = @telephoneMobile, Fax= @fax WHERE Id = " +
             personInfo.Id;
         Log.Debug("PersonInfoUpdate: [{0}], Item={1}", commandText, personInfo.Format());
         using (sqLiteConnection)
         {
             using (SQLiteCommand sqLiteCommand = new SQLiteCommand(commandText, sqLiteConnection))
             {
                 sqLiteConnection.Open();
                 sqLiteCommand.Parameters.AddWithValue("@name", personInfo.Name);
                 sqLiteCommand.Parameters.AddWithValue("@surName", personInfo.SurName);
                 sqLiteCommand.Parameters.AddWithValue("@nickName", personInfo.NickName);
                 sqLiteCommand.Parameters.AddWithValue("@description", personInfo.Description);
                 sqLiteCommand.Parameters.AddWithValue("@address", personInfo.Address);
                 sqLiteCommand.Parameters.AddWithValue("@postNumber", personInfo.PostNumber);
                 sqLiteCommand.Parameters.AddWithValue("@city", personInfo.City);
                 sqLiteCommand.Parameters.AddWithValue("@email", personInfo.Email);
                 sqLiteCommand.Parameters.AddWithValue("@telephone", personInfo.Telephone);
                 sqLiteCommand.Parameters.AddWithValue("@telephoneMobile", personInfo.TelephoneMobile);
                 sqLiteCommand.Parameters.AddWithValue("@fax", personInfo.Fax);
                 int rowsUpdated = sqLiteCommand.ExecuteNonQuery();
                 sqLiteConnection.Close();
                 return rowsUpdated;
             }
         }
     }
     catch (Exception exception)
     {
         Log.Error(exception.ToString);
         return 0;
     }
 }
Example #2
0
 private PersonInfo PersonInfoSelect(string commandText)
 {
     DataTable dataTable = GetDataTable(commandText);
     DataRowCollection dataRowCollection = dataTable.Rows;
     if (dataRowCollection.Count > 0)
     {
         object[] itemArray = dataRowCollection[0].ItemArray;
         PersonInfo personInfo = new PersonInfo
                                 {
                                     Id = Misc.String2Number(itemArray[0].ToString()),
                                     Name = itemArray[1].ToString(),
                                     SurName = itemArray[2].ToString(),
                                     NickName = itemArray[3].ToString(),
                                     Description = itemArray[4].ToString(),
                                     Address = itemArray[5].ToString(),
                                     PostNumber = Misc.String2Number(itemArray[6].ToString()),
                                     City = itemArray[7].ToString(),
                                     Email = itemArray[8].ToString(),
                                     Telephone = itemArray[9].ToString(),
                                     TelephoneMobile = itemArray[10].ToString(),
                                     Fax = itemArray[11].ToString(),
                                 };
         Log.Debug("have PersonInfo: {0}", personInfo.Format());
         return personInfo;
     }
     return null;
 }
Example #3
0
 public int PersonInfoInsert(PersonInfo personInfo)
 {
     string insertCommand =
         String.Format(
             @"INSERT INTO PersonInfo ( Name, SurName, NickName, Description, Address, PostNumber, City, Email, Telephone, TelephoneMobile, Fax) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', {5}, '{6}', '{7}', '{8}', '{9}', '{10}')",
             personInfo.Name,
             personInfo.SurName,
             personInfo.NickName,
             personInfo.Description,
             personInfo.Address,
             personInfo.PostNumber,
             personInfo.City,
             personInfo.Email,
             personInfo.Telephone,
             personInfo.TelephoneMobile,
             personInfo.Fax);
     return ExecuteNonQuery(insertCommand);
 }