public bool InsertLocation(ESmsHistory info) { try { string sql = string.Format(@"insert into gps_smshistory(smshistory_id,LicenceNumber,telephone_number,UpSMSContent,DownSMSContent,ReceiveUserName,SendTime,TenantCode,SMSType,IsProfessional) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}');", info.smshistory_id.ToString(), info.LicenceNumber, info.telephone_number, info.UpSMSContent, info.DownSMSContent, info.ReceiveUserName, System.DateTime.Now, info.TenantCode, info.SMSType, info.IsProfessional); //Logger.Trace(sql); MySqlHelper.ExecuteNonQuery(MySqlHelper.DefaultConnectionString, sql); return true; } catch (Exception ex) { Logger.Error(ex); return false; } }
public static ESmsHistory ConvertInfo(DataRow row) { if (row == null) { return null; } ESmsHistory info = new ESmsHistory(); info.smshistory_id = ulong.Parse(row["smshistory_id"].ToString()); info.LicenceNumber = row["LicenceNumber"].ToString(); info.telephone_number = row["telephone_number"].ToString(); info.UpSMSContent = row["UpSMSContent"].ToString(); info.DownSMSContent = row["DownSMSContent"].ToString(); info.ReceiveUserName = row["ReceiveUserName"].ToString(); info.SendTime = DateTimeConvertHelper.Parse(row["SendTime"].ToString()); info.TenantCode = row["TenantCode"].ToString(); info.SMSType = int.Parse(row["SMSType"].ToString()); info.IsProfessional = row["IsProfessional"].ToString().Equals("1"); return info; }