Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        public ReturnType UpdateItemPropValue(ItemPropValue itempropvalue)
        {
            throw new NotImplementedException();
            //try
            //{
            //    using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
            //    {
            //        /*ItemPropValue result = alading.ItemPropValue.Where(p => p.ItemPropValueID == itempropvalue.ItemPropValueID).FirstOrDefault();*/
            //        ItemPropValue result = alading.ItemPropValue.Where(p => p.ItemPropValueCode == itempropvalue.ItemPropValueCode).FirstOrDefault();
            //        if (result == null)
            //        {
            //            return ReturnType.NotExisted;
            //        }
            //        #region   Using Attach() Function Update,Default USE;
            //        alading.Attach(result);
            //        alading.ApplyPropertyChanges("ItemPropValue", itempropvalue);
            //        #endregion

            //        #region    Using All Items Replace To Update ,Default UnUse
            //        /*

            //            result.cid = itempropvalue.cid;

            //            result.pid = itempropvalue.pid;

            //            result.prop_name = itempropvalue.prop_name;

            //            result.vid = itempropvalue.vid;

            //            result.name = itempropvalue.name;

            //            result.name_alias = itempropvalue.name_alias;

            //            result.is_parent = itempropvalue.is_parent;

            //            result.status = itempropvalue.status;

            //            result.sort_order = itempropvalue.sort_order;

            //        */
            //        #endregion
            //        if (alading.SaveChanges() == 1)
            //        {
            //            return ReturnType.Success;
            //        }
            //    }
            //}
            //catch (SqlException sex)
            //{
            //    return ReturnType.ConnFailed;
            //}
            //catch (Exception ex)
            //{
            //    return ReturnType.OthersError;
            //}
        }
Beispiel #3
0
 public ItemPropValue GetItemPropValue(string cid, string pid, string vid)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             ItemPropValue itemPropValue = alading.ItemPropValue.FirstOrDefault(i => i.cid == cid && i.pid == pid && i.vid == vid);
             return(itemPropValue);
         }
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Beispiel #4
0
        public ReturnType UpdateItemPropValue(string itempropvalueCode, ItemPropValue itempropvalue)
        {
            throw new NotImplementedException();
            //try
            //{
            //    using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
            //    {
            //        /*var result = alading.ItemPropValue.Where(p => p.ItemPropValueID == itempropvalueID).ToList();*/
            //        var result = alading.ItemPropValue.Where(p => p.ItemPropValueCode == itempropvalueCode).ToList();
            //        if (result.Count == 0)
            //        {
            //            return ReturnType.NotExisted;
            //        }

            //        ItemPropValue ob = result.First();
            //        ob.cid = itempropvalue.cid;
            //        ob.pid = itempropvalue.pid;
            //        ob.prop_name = itempropvalue.prop_name;
            //        ob.vid = itempropvalue.vid;
            //        ob.name = itempropvalue.name;
            //        ob.name_alias = itempropvalue.name_alias;
            //        ob.is_parent = itempropvalue.is_parent;
            //        ob.status = itempropvalue.status;
            //        ob.sort_order = itempropvalue.sort_order;

            //        if (alading.SaveChanges() == 1)
            //        {
            //            return ReturnType.Success;
            //        }
            //        else
            //        {
            //            return ReturnType.OthersError;
            //        }
            //    }
            //}
            //catch (SqlException sex)
            //{
            //    return ReturnType.ConnFailed;
            //}
            //catch (System.Exception ex)
            //{
            //    return ReturnType.OthersError;
            //}
        }
 public static ReturnType UpdateItemPropValue(string itempropvalueCode, ItemPropValue itempropvalue)
 {
     return(DataProviderClass.Instance().UpdateItemPropValue(itempropvalueCode, itempropvalue));
 }
 public static ReturnType AddItemPropValue(ItemPropValue itempropvalue)
 {
     return(DataProviderClass.Instance().AddItemPropValue(itempropvalue));
 }