• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DBA.KuanMaiEntities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中KM.JXC.DBA.KuanMaiEntities的典型用法代码示例。如果您正苦于以下问题:C# KuanMaiEntities类的具体用法?C# KuanMaiEntities怎么用?C# KuanMaiEntities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



KuanMaiEntities类属于KM.JXC.DBA命名空间,在下文中一共展示了KuanMaiEntities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddProductProperties

        /// <summary>
        /// Add properties for parent product or child product
        /// </summary>
        /// <param name="product_id"></param>
        /// <param name="props"></param>
        /// <returns></returns>
        public bool AddProductProperties(int product_id, List<BProductProperty> props)
        {
            Product dbProduct = this.GetProduct(product_id);
            if (dbProduct == null)
            {
                throw new KMJXCException("产品不存在");
            }

            using (KuanMaiEntities db = new KuanMaiEntities())
            {
                if (props != null && props.Count > 0)
                {
                    List<Product_Specifications> specs = (from ps in db.Product_Specifications where ps.Product_ID == dbProduct.Product_ID select ps).ToList<Product_Specifications>();
                    foreach (BProductProperty prop in props)
                    {
                        Product_Specifications ps = (from sp in specs where sp.Product_Spec_ID == prop.PID && sp.Product_Spec_Value_ID == prop.PVID && sp.Product_ID==product_id select sp).FirstOrDefault<Product_Specifications>();
                        if (ps == null)
                        {
                            ps = new Product_Specifications();
                            ps.Product_Spec_Value_ID = prop.PVID;
                            ps.Product_Spec_ID = prop.PID;
                            ps.Product_ID = product_id;
                            db.Product_Specifications.Add(ps);
                        }
                    }
                    db.SaveChanges();
                }
            }

            return true;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:37,代码来源:ProductManager.cs


示例2: CreateSupplier

        /// <summary>
        /// Create new supplier
        /// </summary>
        /// <param name="supplier"></param>
        /// <returns></returns>
        public bool CreateSupplier(Supplier supplier)
        {
            bool result = false;

            if (this.CurrentUserPermission.ADD_SUPPLIER == 0)
            {
                throw new KMJXCException("没有权限添加新供应商");
            }

            if (string.IsNullOrEmpty(supplier.Name))
            {
                throw new KMJXCException("供应商名称不能为空");
            }

            if (supplier.User_ID == 0 && this.CurrentUser!=null)
            {
                supplier.User_ID = this.CurrentUser.ID;
            }

            using (KuanMaiEntities db = new KuanMaiEntities())
            {
                var obj = (from sp in db.Supplier where (sp.Shop_ID == this.Shop.Shop_ID || sp.Shop_ID == this.Main_Shop.Shop_ID) && supplier.Name.Contains(sp.Name) select sp);
                if (obj.ToList<Supplier>().Count > 0)
                {
                    throw new KMJXCException("供应商名称已经存在");
                }
                db.Supplier.Add(supplier);
                db.SaveChanges();
                result = true;
            }

            return result;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:38,代码来源:SupplierManager.cs


示例3: BBaseManager

 static BBaseManager()
 {
     using (KuanMaiEntities db = new KuanMaiEntities())
     {
         Areas = (from area in db.Common_District select area).ToList<Common_District>();
     }
 }
开发者ID:Bobom,项目名称:kuanmai,代码行数:7,代码来源:BBaseManager.cs


示例4: CreateNewBug

 /// <summary>
 /// 
 /// </summary>
 /// <param name="bug"></param>
 /// <returns></returns>
 public bool CreateNewBug(BBug bug)
 {
     if (bug.Created_By == null)
     {
         throw new KMJXCException("创建Bug时必须有创建人");
     }
     bool result = false;
     using (KuanMaiEntities db = new KuanMaiEntities())
     {
         Bug dbBug = new Bug();
         dbBug.Created = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
         if (bug.Created_By != null)
         {
             dbBug.Created_By = bug.Created_By.ID;
         }
         dbBug.Description = bug.Description;
         if (bug.Feature != null)
         {
             dbBug.Feature = bug.Feature.ID;
         }
         dbBug.Function = 0;
         dbBug.Modified = dbBug.Created;
         dbBug.Modified_By = dbBug.Created_By;
         dbBug.Resolved = 0;
         dbBug.Resolved_By = 0;
         dbBug.Status = 1;
         dbBug.Title = bug.Title;
         db.Bug.Add(dbBug);
         db.SaveChanges();
         result = true;
     }
     return result;
 }
开发者ID:Bobom,项目名称:kuanmai,代码行数:38,代码来源:BugManager.cs


示例5: AddChildShop

        /// <summary>
        /// 
        /// </summary>
        /// <param name="child_shop_id"></param>
        /// <returns></returns>
        public bool AddChildShop(int mall_type,string child_shop_name)
        {
            bool result = false;
            using (KuanMaiEntities db = new KuanMaiEntities())
            {
                Shop shop = (from sp in db.Shop where sp.Name == child_shop_name && sp.Mall_Type_ID==mall_type select sp).FirstOrDefault<Shop>();
                if (shop == null)
                {
                    throw new KMJXCException("您要添加的子店铺(" + child_shop_name + ")信息不存在,请先使用子店铺的主账户登录进销存,然后在执行添加子店铺操作");
                }

                if (shop.Parent_Shop_ID > 0)
                {
                    Shop mainshop = (from sp in db.Shop where sp.Shop_ID==shop.Parent_Shop_ID select sp).FirstOrDefault<Shop>();
                    if (mainshop != null)
                    {
                        throw new KMJXCException(child_shop_name+" 已经是 "+mainshop.Name+" 的子店铺,不能重复添加或者添加为别的店铺的子店铺");
                    }
                }

                result = this.AddChildShop(this.Shop, shop);
            }

            return result;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:30,代码来源:ShopManager.cs


示例6: OnActionExecuting

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
            string user_id = filterContext.HttpContext.User.Identity.Name;
            if (string.IsNullOrEmpty(user_id)) {
                filterContext.HttpContext.Response.Redirect("/Home/Login?message=登录信息过期,请重新登录");
            }
            //Verify if the cookie user is a valid user
            UserManager userMgr = new UserManager(int.Parse(user_id),null);
            BUser user = userMgr.CurrentUser;

            if (user == null)
            {
                filterContext.HttpContext.Response.Redirect("/Home/Login?message=登录信息丢失,请重新登录并授权");
            }

            //Verify if logon user already has access token in db
            KuanMaiEntities db = new KuanMaiEntities();

            Access_Token token = (from t in db.Access_Token where t.User_ID == user.ID && t.Mall_Type_ID == user.Type.ID select t).FirstOrDefault<Access_Token>();

            if (token == null) {
                filterContext.HttpContext.Response.Redirect("/Home/Login?message=没有授权信息,请登录并授权");
            }

            //Verify if the existed access token is expired
            long timeNow = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
            if (timeNow >= token.Request_Time + token.Expirse_In)
            {
                filterContext.HttpContext.Response.Redirect("/Home/Login?message=授权信息已经过期,请重新登录并授权");
            }
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:32,代码来源:AccessTokenValidation.cs


示例7: GetCorpInfo

 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public Corp_Info GetCorpInfo()
 {
     Corp_Info info = null;
     using (KuanMaiEntities db = new KuanMaiEntities())
     {
         info=(from ci in db.Corp_Info where ci.IsCurrent==true select ci).FirstOrDefault<Corp_Info>();
     }
     return info;
 }
开发者ID:Bobom,项目名称:kuanmai,代码行数:13,代码来源:CommonManager.cs


示例8: GetExpresses

 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public List<Express> GetExpresses()
 {
     List<Express> expresses = new List<Express>();
     using (KuanMaiEntities db = new KuanMaiEntities())
     {
         expresses=(from express in db.Express orderby express.Express_ID ascending select express).ToList<Express>();
     }
     return expresses;
 }
开发者ID:Bobom,项目名称:kuanmai,代码行数:13,代码来源:CommonManager.cs


示例9: GetMallTypes

        public List<Mall_Type> GetMallTypes()
        {
            List<Mall_Type> types = null;

            using (KuanMaiEntities db = new KuanMaiEntities())
            {
                types = (from mtype in db.Mall_Type select mtype).ToList<Mall_Type>();
            }

            return types;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:11,代码来源:CommonManager.cs


示例10: GetAreas

        /// <summary>
        /// 
        /// </summary>
        /// <param name="parent_id"></param>
        /// <returns></returns>
        public List<Common_District> GetAreas(int parent_id)
        {
            List<Common_District> areas = null;
            using (KuanMaiEntities db = new KuanMaiEntities())
            {
                var a=(from ass in db.Common_District where ass.upid==parent_id select ass);

                areas = a.ToList<Common_District>();
            }
            return areas;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:16,代码来源:CommonManager.cs


示例11: CreateImage

 /// <summary>
 /// 
 /// </summary>
 /// <param name="image"></param>
 /// <returns></returns>
 public bool CreateImage(KM.JXC.DBA.Image image)
 {
     bool result = false;
     using (KuanMaiEntities db = new KuanMaiEntities())
     {
         db.Image.Add(image);
         db.SaveChanges();
         result = true;
     }
     return result;
 }
开发者ID:Bobom,项目名称:kuanmai,代码行数:16,代码来源:ImageManager.cs


示例12: GetMallDetail

 /// <summary>
 /// Get mall object by mall id
 /// </summary>
 /// <param name="mall_type_id"></param>
 /// <returns></returns>
 public Mall_Type GetMallDetail(long mall_type_id)
 {
     Mall_Type mall = null;
     using (KuanMaiEntities db = new KuanMaiEntities())
     {
         var mt = from malltype in db.Mall_Type where malltype.Mall_Type_ID == mall_type_id select malltype;
         if (mt != null)
         {
             mall = mt.ToList<Mall_Type>()[0];
         }
     }
     return mall;
 }
开发者ID:Bobom,项目名称:kuanmai,代码行数:18,代码来源:MallManager.cs


示例13: GetMallType

        protected Mall_Type GetMallType()
        {
            Mall_Type type = null;
            using (KuanMaiEntities db = new KuanMaiEntities())
            {
                var t = from tp in db.Mall_Type where tp.Mall_Type_ID == this.Mall_Type_ID select tp;
                if (t.ToList<Mall_Type>().Count == 1)
                {
                    type = t.ToList<Mall_Type>()[0];
                }
            }

            return type;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:14,代码来源:OBaseManager.cs


示例14: CreateActionLog

        /// <summary>
        /// 
        /// </summary>
        /// <param name="action"></param>
        public void CreateActionLog(BUserActionLog action)
        {
            if (action == null || action.Shop==null)
            {
                return;
            }
            KuanMaiEntities db = null;
            try
            {
                db = new KuanMaiEntities();
                User_Action_Log log = new User_Action_Log();

                log.Action = action.Action.Action_ID;

                log.Description = action.Description;
                if (action.User != null && action.User.ID > 0)
                {
                    log.User_ID = action.User.ID;
                }
                else
                {
                    log.User_ID = this.CurrentUser.ID;
                }

                log.Created = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                if (string.IsNullOrEmpty(log.Description))
                {
                    log.Description = "";
                }
                log.Shop_ID = action.Shop.ID;
                db.User_Action_Log.Add(log);
                db.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {

            }
            catch (Exception ex)
            {

            }
            finally
            {
                if (db != null)
                {
                    db.Dispose();
                }
            }
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:53,代码来源:UserActionLogManager.cs


示例15: CreateNewUser

        /// <summary>
        /// Create new user
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public BUser CreateNewUser(BUser user)
        {
            if (user == null) {
                throw new UserException("用户实体不能为空引用");
            }

            if (string.IsNullOrEmpty(user.Name)) {
                throw new UserException("用户名不能为空");
            }

            if (this.CurrentUserPermission.ADD_USER == 0)
            {
                throw new UserException("没有权限创建新用户");
            }

            KuanMaiEntities dba = new KuanMaiEntities();
            try
            {
                if (GetUser(user) != null)
                    throw new UserException("用户名已经存在");

                User dbUser = new User();
                dbUser.User_ID = user.ID;
                dbUser.Mall_ID = user.Mall_ID;
                dbUser.Mall_Name = user.Mall_Name;
                dbUser.Name = user.Name;
                dbUser.Mall_Type = user.Type.ID;
                if (user.Parent != null)
                {
                    dbUser.Parent_Mall_ID = user.Parent.Mall_ID;
                    dbUser.Parent_Mall_Name = user.Parent.Mall_Name;
                    dbUser.Parent_User_ID = user.Parent.ID;
                }
                dba.User.Add(dbUser);
                dba.SaveChanges();
                return user;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dba != null)
                {
                    dba.Dispose();
                }
            }
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:54,代码来源:UserManager.cs


示例16: GetLocAccessToken

        public Access_Token GetLocAccessToken(long user_id)
        {
            Access_Token token = null;

            KuanMaiEntities db = new KuanMaiEntities();

            var etoken = from p in db.Access_Token where p.Mall_Type_ID == this.Mall_Type_ID && p.User_ID == user_id select p;

            if (etoken != null)
            {
                token = etoken.ToList<Access_Token>()[0];
            }

            return token;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:15,代码来源:BaseAccessToken.cs


示例17: CreateBuyPrice

        /// <summary>
        /// 
        /// </summary>
        /// <param name="buyPrice"></param>
        /// <returns></returns>
        public bool CreateBuyPrice(BBuyPrice buyPrice)
        {
            bool result = false;

            if (this.CurrentUserPermission.CREATE_BUY_PRICE == 0)
            {
                throw new KMJXCException("没有权限创建采购询价单");
            }

            if (buyPrice == null)
            {
                throw new KMJXCException("输入不正确");
            }

            using (KuanMaiEntities db = new KuanMaiEntities())
            {
                Buy_Price dbBuyPrice = new Buy_Price();
                if (buyPrice.Created <= 0)
                {
                    dbBuyPrice.Created = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                }

                dbBuyPrice.Shop_ID = this.Shop.Shop_ID;
                if (buyPrice.Shop != null && buyPrice.Shop.ID > 0)
                {
                    dbBuyPrice.Shop_ID = buyPrice.Shop.ID;
                }

                dbBuyPrice.User_ID = this.CurrentUser.ID;
                if (buyPrice.User != null && buyPrice.User.ID > 0)
                {
                    dbBuyPrice.User_ID = buyPrice.User.ID;
                }

                dbBuyPrice.Created = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
                dbBuyPrice.Title = buyPrice.Title;
                dbBuyPrice.Description = buyPrice.Desc;
                db.Buy_Price.Add(dbBuyPrice);
                db.SaveChanges();
                result = true;
                if (dbBuyPrice.ID > 0 && buyPrice.Details!=null && buyPrice.Details.Count>0)
                {
                    result = result & this.SaveBuyPriceDetails(buyPrice.Details, dbBuyPrice.ID);
                }
            }

            return result;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:53,代码来源:BuyManager.cs


示例18: DeleteProductImage

        /// <summary>
        /// 
        /// </summary>
        /// <param name="image_id"></param>
        /// <returns></returns>
        public bool DeleteProductImage(int product_id)
        {
            bool result = false;
            using (KuanMaiEntities db = new KuanMaiEntities())
            {
                List<Image> images = (from img in db.Image where img.ProductID == product_id select img).ToList<Image>();

                foreach (Image img in images)
                {
                    db.Image.Remove(img);
                }
                db.SaveChanges();
                result = true;
            }
            return result;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:21,代码来源:ImageManager.cs


示例19: DeleteImage

        /// <summary>
        /// 
        /// </summary>
        /// <param name="image_id"></param>
        /// <returns></returns>
        public bool DeleteImage(int image_id,out Image image)
        {
            bool result = false;
            using (KuanMaiEntities db = new KuanMaiEntities())
            {
                image=(from img in db.Image where img.ID==image_id select img).FirstOrDefault<Image>();
                if (image == null)
                {
                    throw new KMJXCException("图片不存在");
                }

                db.Image.Remove(image);
                db.SaveChanges();
                result = true;
            }
            return result;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:22,代码来源:ImageManager.cs


示例20: AddNewMall

 /// <summary>
 /// Add new mall in local db
 /// </summary>
 /// <param name="mall"></param>
 /// <returns></returns>
 public bool AddNewMall(Mall_Type mall)
 {
     bool result = false;
     if (mall == null)
     {
         return result;
     }
     if (string.IsNullOrEmpty(mall.Name)) {
         return result;
     }
     using (KuanMaiEntities db = new KuanMaiEntities())
     {
         db.Mall_Type.Add(mall);
         db.SaveChanges();
         result = true;
     }
     return result;
 }
开发者ID:Bobom,项目名称:kuanmai,代码行数:23,代码来源:MallManager.cs



注:本文中的KM.JXC.DBA.KuanMaiEntities类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Database.DataClasses1DataContext类代码示例发布时间:2022-05-26
下一篇:
C# Common.SessionInfo类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap