public ReturnType AddItemPropValue(List <ItemPropValue> itempropvalueList) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { foreach (ItemPropValue itempropvalue in itempropvalueList) { Alading.Entity.ItemPropValue dbpropvalue = alading.ItemPropValue.FirstOrDefault(p => p.cid == itempropvalue.cid && p.pid == itempropvalue.pid && p.vid == itempropvalue.vid); if (dbpropvalue == null) { alading.AddToItemPropValue(itempropvalue); } } alading.SaveChanges(); return(ReturnType.Success); } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }
public ReturnType UpdateItemPropValueIsParent(string cid, string pid, string vid, bool value) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { Alading.Entity.ItemPropValue propvalue = alading.ItemPropValue.FirstOrDefault(p => p.cid == cid && p.pid == pid && p.vid == vid); if (propvalue != null) { propvalue.is_parent = value; alading.SaveChanges(); return(ReturnType.Success); } else { return(ReturnType.NotExisted); } } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }
public ReturnType AddItemPropValue(ItemPropValue itempropvalue) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { Alading.Entity.ItemPropValue DBpropvalue = alading.ItemPropValue.Where(p => p.cid == itempropvalue.cid && p.pid == itempropvalue.pid && p.vid == itempropvalue.vid).FirstOrDefault(); if (DBpropvalue == null) { alading.AddToItemPropValue(itempropvalue); if (alading.SaveChanges() == 1) { return(ReturnType.Success); } else { return(ReturnType.SaveFailed); } } else { return(ReturnType.PropertyExisted); } } } catch (SqlException sex) { return(ReturnType.ConnFailed); } catch (Exception ex) { return(ReturnType.OthersError); } }
public bool IsPropValueExistedCid(string cid) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { Alading.Entity.ItemPropValue propvalue = alading.ItemPropValue.Where(p => p.cid == cid).FirstOrDefault(); if (propvalue == null) { return(false); } else { return(true); } } } catch (System.Exception ex) { throw ex; } }