Ejemplo n.º 1
0
 public static int Add(FlashInfo entity)
 {
     entity.Id = dal.Add(entity);
     UploadBLL.UpdateUpload(TableID, 0, entity.Id, Cookies.Admin.GetRandomNumber(false));
     CacheHelper.Remove(cacheKey);
     return(entity.Id);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 增加一条链接数据
 /// </summary>
 /// <param name="link">链接模型变量</param>
 public static int AddLink(LinkInfo link)
 {
     link.ID = dal.AddLink(link);
     UploadBLL.UpdateUpload(TableID, 0, link.ID, Cookies.Admin.GetRandomNumber(false));
     CacheHelper.Remove(cacheKey);
     return(link.ID);
 }
Ejemplo n.º 3
0
        public static int Add(ProductInfo entity)
        {
            entity.Id = dal.Add(entity);

            UploadBLL.UpdateUpload(TableID, 0, entity.Id, Cookies.Admin.GetRandomNumber(false));

            int[] classIds = Array.ConvertAll <string, int>(entity.ClassId.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
            ProductClassBLL.ChangeProductCount(classIds, ChangeAction.Plus);
            CacheHelper.Remove("ProductClass");

            return(entity.Id);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 彻底删除
        /// </summary>
        /// <param name="id"></param>
        public static void Delete(int id)
        {
            bool canDel = true;

            if (OrderDetailBLL.ReadListByProductId(id).Count > 0)
            {
                foreach (OrderDetailInfo myOD in OrderDetailBLL.ReadListByProductId(id))
                {
                    OrderInfo tempOrder = OrderBLL.Read(myOD.OrderId, 0);
                    if (tempOrder.IsDelete == 0)
                    {
                        canDel = false;
                        break;
                    }
                }
                if (!canDel)
                {
                    ScriptHelper.Alert("该产品存在相关订单,不能删除。");
                }
                else
                {
                    var product = Read(id);

                    if (product.Id > 0)
                    {
                        UploadBLL.DeleteUploadByRecordID(TableID, id.ToString());
                        dal.Delete(id);
                        ProductPhotoBLL.DeleteList(id, 0);

                        int[] classIds = Array.ConvertAll <string, int>(product.ClassId.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
                        ProductClassBLL.ChangeProductCount(classIds, ChangeAction.Minus);
                        CacheHelper.Remove("ProductClass");
                    }
                }
            }
            else
            {
                var product = Read(id);

                if (product.Id > 0)
                {
                    UploadBLL.DeleteUploadByRecordID(TableID, id.ToString());
                    dal.Delete(id);
                    ProductPhotoBLL.DeleteList(id, 0);

                    int[] classIds = Array.ConvertAll <string, int>(product.ClassId.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
                    ProductClassBLL.ChangeProductCount(classIds, ChangeAction.Minus);
                    CacheHelper.Remove("ProductClass");
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 删除多条链接数据
 /// </summary>
 /// <param name="strID">链接的主键值,以,号分隔</param>
 public static void DeleteLink(string strID)
 {
     UploadBLL.DeleteUploadByRecordID(TableID, strID);
     dal.DeleteLink(strID);
     CacheHelper.Remove(cacheKey);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 更新一条链接数据
 /// </summary>
 /// <param name="link">链接模型变量</param>
 public static void UpdateLink(LinkInfo link)
 {
     dal.UpdateLink(link);
     UploadBLL.UpdateUpload(TableID, 0, link.ID, Cookies.Admin.GetRandomNumber(false));
     CacheHelper.Remove(cacheKey);
 }
Ejemplo n.º 7
0
 public static void Update(ProductInfo entity)
 {
     dal.Update(entity);
     UploadBLL.UpdateUpload(TableID, 0, entity.Id, Cookies.Admin.GetRandomNumber(false));
 }
Ejemplo n.º 8
0
 public static void Delete(int[] ids)
 {
     UploadBLL.DeleteUploadByRecordID(TableID, string.Join(",", ids));
     dal.Delete(ids);
     CacheHelper.Remove(cacheKey);
 }
Ejemplo n.º 9
0
 public static void Update(LotteryActivityInfo entity)
 {
     dal.Update(entity);
     CacheHelper.Remove(cacheKey);
     UploadBLL.UpdateUpload(TableID, 0, entity.Id, Cookies.Admin.GetRandomNumber(false));
 }