Ejemplo n.º 1
0
        /// <summary>
        /// 获取所有报价等级
        /// </summary>
        /// <param name="companyId">公司编号</param>
        /// <returns>报价等级集合</returns>
        public IList <MComStand> GetList(string companyId)
        {
            string sql = "SELECT Id,CompanyId,[Name],OperatorId,IssueTime,IsSystem FROM tbl_ComStand WHERE IsDelete = '0' AND CompanyId = @CompanyId";

            DbCommand comm = this._db.GetSqlStringCommand(sql);

            this._db.AddInParameter(comm, "@CompanyId", DbType.AnsiStringFixedLength, companyId);
            IList <MComStand> list = new List <MComStand>();
            MComStand         item = null;

            using (IDataReader reader = DbHelper.ExecuteReader(comm, this._db))
            {
                while (reader.Read())
                {
                    list.Add(item = new MComStand()
                    {
                        Id         = (int)reader["Id"],
                        CompanyId  = reader["CompanyId"].ToString(),
                        Name       = reader["Name"].ToString(),
                        OperatorId = reader["OperatorId"].ToString(),
                        IssueTime  = DateTime.Parse(reader["IssueTime"].ToString()),
                        IsSystem   = GetBoolean(reader["IsSystem"].ToString())
                    });
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加报价等级
        /// </summary>
        /// <param name="item">报价等级实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Add(MComStand item)
        {
            string    sql  = "INSERT INTO tbl_ComStand(CompanyId,[Name],OperatorId) VALUES(@CompanyId,@Name,@OperatorId)";
            DbCommand comm = this._db.GetSqlStringCommand(sql);

            this._db.AddInParameter(comm, "@CompanyId", DbType.AnsiStringFixedLength, item.CompanyId);
            this._db.AddInParameter(comm, "@Name", DbType.String, item.Name);
            this._db.AddInParameter(comm, "@OperatorId", DbType.AnsiStringFixedLength, item.OperatorId);

            int result = DbHelper.ExecuteSql(comm, this._db);

            return(result > 0 ? true : false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 修改报价等级
        /// </summary>
        /// <param name="item">报价等级实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Update(MComStand item)
        {
            string    sql  = "Update tbl_ComStand SET [Name] = @Name,OperatorId = @OperatorId WHERE Id = @Id AND CompanyId = @CompanyId";
            DbCommand comm = this._db.GetSqlStringCommand(sql);

            this._db.AddInParameter(comm, "@Name", DbType.String, item.Name);
            this._db.AddInParameter(comm, "@OperatorId", DbType.AnsiStringFixedLength, item.OperatorId);
            this._db.AddInParameter(comm, "@Id", DbType.Int32, item.Id);
            this._db.AddInParameter(comm, "@CompanyId", DbType.AnsiStringFixedLength, item.CompanyId);

            int result = DbHelper.ExecuteSql(comm, this._db);

            return(result > 0 ? true : false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 修改报价标准
        /// </summary>
        /// <param name="item">报价标准实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Update(MComStand item)
        {
            bool result = false;

            if (item != null)
            {
                result = dal.Update(item);
                if (result)
                {
                    EyouSoft.BLL.SysStructure.BSysLogHandle.Insert(string.Format("修改报价标准,编号为:{0}", item.Id));
                    EyouSoft.Cache.Facade.EyouSoftCache.Remove(string.Format(TagName.BaoJiaBiaoZhun, item.CompanyId));
                }
            }
            return(result);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取报价标准信息业务实体
        /// </summary>
        /// <param name="biaoZhunId">报价标准编号</param>
        /// <param name="companyId">公司编号</param>
        /// <returns></returns>
        public MComStand GetInfo(int biaoZhunId, string companyId)
        {
            var items = GetList(companyId);

            if (items == null || items.Count == 0)
            {
                return(null);
            }

            MComStand info = null;

            foreach (var item in items)
            {
                if (item.Id == biaoZhunId)
                {
                    info = item; break;
                }
            }

            return(info);
        }