Пример #1
0
 public static string getQueryUpdateGateway(Gateway gateway)
 {
     return string.Format("UPDATE {0} SET {1}='{2}', {3}='{4}',{5}='{6}',{7}='{8}',{9}='{10}' WHERE {11}='{12}'",
          ID_TABLE_GATEWAY,
          ID_DESCRIPTION_GATEWAY, gateway.Description,
          ID_MACADR_GATEWAY,gateway.MacAddress,
          ID_MANUFACTURER_GATEWAY,gateway.Manufacturer.Id,
          ID_UPDATETIME_GATEWAY, gateway.UpdateLocalDateTime.ToString(DATETIMEFORMATINSERT_GATEWAY),
          ID_UPDATEUSER_GATEWAY, gateway.UpdateUser,
          ID_ID_GATEWAY, gateway.Id
         );
 }
Пример #2
0
 public static string getQuerySaveGateway(Gateway gateway)
 {
     return string.Format("INSERT INTO {0} VALUES('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", ID_TABLE_GATEWAY,
         gateway.Id,
         gateway.Description,
         gateway.MacAddress,
         gateway.Manufacturer.Id,
         gateway.LocalInsertTime.ToString(DATETIMEFORMATINSERT_GATEWAY),
         gateway.InsertUser,
         gateway.UpdateLocalDateTime.ToString(DATETIMEFORMATINSERT_GATEWAY),
         gateway.UpdateUser);
 }
Пример #3
0
 public void Update(Gateway gateway)
 {
     _repositoryHelper.UpdateGateway(gateway);
 }
Пример #4
0
 public void Save(Gateway gateway)
 {
     _repositoryHelper.SaveGateway(gateway);
 }
Пример #5
0
 public bool Exists(Gateway gateway)
 {
     return Get(gateway.Id) != null;
 }
Пример #6
0
        public static IList<Gateway> ParseDataSetToGateway(DataTable dataTable)
        {
            IList<Gateway> gatewayList = new List<Gateway>();
            foreach (DataRow row in dataTable.Rows)
            {
                Gateway gateway = new Gateway()
                {
                    Id = row[POSITION_ID_GATEWAY].ToString(),
                    Description = row[POSITION_DESCRIPTION_GATEWAY].ToString(),
                    MacAddress = int.Parse(row[POSITION_MACADR_GATEWAY].ToString()),
                    Manufacturer=new Manufacturer(row[POSITION_MACADR_GATEWAY].ToString()),
                    LocalInsertTime = getDateTime(row[POSITION_INSERTTIME_GATEWAY].ToString(), DATETIMEFORMATINSERT_GATEWAY),
                    InsertUser = row[POSITION_INSERTUSER_GATEWAY].ToString(),
                    UpdateLocalDateTime = getDateTime(row[POSITION_UPDATETIME_GATEWAY].ToString(), DATETIMEFORMATINSERT_GATEWAY),
                    UpdateUser = row[POSITION_UPDATEUSER_GATEWAY].ToString()
                };
                gatewayList.Add(gateway);
            }

            return gatewayList;
        }
Пример #7
0
 internal void UpdateGateway(Gateway gateway)
 {
     string query = GatewayQuery.getQueryUpdateGateway(gateway);
     GatewayQuery.ParseDataSetToGateway(_provider.queryExecute(query,UPDATE_TYPE));
 }
Пример #8
0
 internal void SaveGateway(Gateway gateway)
 {
     string query = GatewayQuery.getQuerySaveGateway(gateway);
     GatewayQuery.ParseDataSetToGateway(_provider.queryExecute(query,INSERT_TYPE));
 }