Esempio n. 1
0
        /// <summary>
        /// 批量新增店铺分配表
        /// </summary>
        /// <param name="NickIds">要分配的店铺列表</param>
        /// <param name="customerID">负责人ID</param>
        /// <param name="depId">部门Id</param>
        public void BatchMarkXMNickCustomerMappingsInsert(List <int> NickIds, int customerID, int depId)
        {
            foreach (var nickId in NickIds)
            {
                var query = from p in this._context.XMNickCustomerMappings
                            where  //NickIds.Contains(System.Convert.ToInt32(p.NickId))
                            NickIds.Contains(p.NickId.Value) &&
                            p.CustomerTypeID == (int)depId && p.CustomerID == (int)customerID
                            select p;
                var objLst = query.ToList();
                if (objLst.Count == 0)
                {
                    var contractCustomerMapping = new XMNickCustomerMapping()
                    {
                        NickId         = nickId,
                        CustomerID     = customerID,
                        CustomerTypeID = depId,
                        Created        = DateTime.Now,
                        CreatorID      = HozestERPContext.Current.User.CustomerID,
                        Updated        = DateTime.Now,
                        UpdatorID      = HozestERPContext.Current.User.CustomerID
                    };
                    _context.XMNickCustomerMappings.AddObject(contractCustomerMapping);
                }
            }

            _context.SaveChanges();
        }
Esempio n. 2
0
        /// <summary>
        /// Insert into XMNickCustomerMapping
        /// </summary>
        /// <param name="xmnickcustomermapping">XMNickCustomerMapping</param>
        public void InsertXMNickCustomerMapping(XMNickCustomerMapping xmnickcustomermapping)
        {
            if (xmnickcustomermapping == null)
            {
                return;
            }

            if (!this._context.IsAttached(xmnickcustomermapping))
            {
                this._context.XMNickCustomerMappings.AddObject(xmnickcustomermapping);
            }

            this._context.SaveChanges();
        }
Esempio n. 3
0
        /// <summary>
        /// Update into XMNickCustomerMapping
        /// </summary>
        /// <param name="xmnickcustomermapping">XMNickCustomerMapping</param>
        public void UpdateXMNickCustomerMapping(XMNickCustomerMapping xmnickcustomermapping)
        {
            if (xmnickcustomermapping == null)
            {
                return;
            }

            if (this._context.IsAttached(xmnickcustomermapping))
            {
                this._context.XMNickCustomerMappings.Attach(xmnickcustomermapping);
            }

            this._context.SaveChanges();
        }