Ejemplo n.º 1
0
 public SKUATTModel(SKUATT att)
 {
     this.ID = att.ID;
     this.Code = att.Code;
     this.Name = att.Name;
     this.ATTType = att.ATTType;
     this.SKUCID = att.SKUID;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加属性
 /// </summary>
 /// <param name="cgy"></param>
 /// <returns></returns>
 public int AddATT(SKUATT att)
 {
     int result = -1;
     string sql = @"INSERT INTO SKUATT
                    (ID, CODE, NAME, ATTTYPE, SKUCID)
                    VALUES(@ID, @CODE, @NAME, @ATTTYPE, @SKUCID)";
     using (DbCommand cmd = _database.GetSqlStringCommand(sql))
     {
         _database.AddInParameter(cmd, "@ID", DbType.Guid, att.ID);
         _database.AddInParameter(cmd, "@CODE", DbType.String, att.Code);
         _database.AddInParameter(cmd, "@NAME", DbType.String, att.Name);
         _database.AddInParameter(cmd, "@ATTTYPE", DbType.Int16, att.ATTType);
         _database.AddInParameter(cmd, "@SKUCID", DbType.Guid, att.SKUID);
         result = _database.ExecuteNonQuery(cmd);
     }
     return result;
 }
Ejemplo n.º 3
0
 public bool AddATT(SKUATT att)
 {
     bool result = false;
     try
     {
         int count = _dal.AddATT(att);
         if (count > 0)
         {
             result = true;
         }
     }
     catch (Exception e)
     {
         string excepMsg = string.Format(@"{0},{1}", DateTime.Now.ToString(), e.Message);
         Trace.TraceError(excepMsg);
         throw new Exception("添加属性出错:BLLAttManagement.AddATT(SKUATT att)", e);
     }
     return result;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 更新属性名称
 /// </summary>
 /// <param name="att"></param>
 /// <returns></returns>
 public int UpdateATT(SKUATT att)
 {
     int result = -1;
     string sql = @"UPDATE SKUATT
                    SET NAME = @NAME
                    WHERE ID = @ID";
     using (DbCommand cmd = _database.GetSqlStringCommand(sql))
     {
         _database.AddInParameter(cmd, "@NAME", DbType.String, att.Name);
         _database.AddInParameter(cmd, "@ID", DbType.Guid, att.ID);
         result = _database.ExecuteNonQuery(cmd);
     }
     return result;
 }
Ejemplo n.º 5
0
        private List<SKUATT> GenerateSKUATTList(DataTable dt)
        {
            List<SKUATT> result = null;
            if (dt != null && dt.Rows.Count > 0)
            {
                result = new List<SKUATT>();
                SKUATT att = null;
                foreach (DataRow dr in dt.Rows)
                {
                    att = new SKUATT()
                    {
                        Code = dr[0].ToString(),
                        Name = dr[1].ToString(),
                        ATTType = this.SelectedAttType.ID,
                        SKUID = this.SelectedSKUCGY.ID,
                    };
                    result.Add(att);
                }
            }

            return result;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 根据SKUCID获取所有属性
        /// </summary>
        /// <param name="SKUCID"></param>
        /// <returns></returns>
        public List<SKUATT> GetSKUATTByCondition(Guid SKUCID)
        {
            List<SKUATT> result = null;
            try
            {
                DataTable dt = _dal.GetSKUATTByCondition(SKUCID);
                if (dt != null && dt.Rows.Count > 0)
                {
                    result = new List<SKUATT>();
                    SKUATT attType;
                    foreach (DataRow dr in dt.Rows)
                    {
                        Guid ID = dr.GetFieldValue<Guid>("ID");
                        string code = dr.GetFieldValue<string>("CODE");
                        string name = dr.GetFieldValue<string>("NAME");
                        short attTypeID = dr.GetFieldValue<short>("ATTTYPE");
                        Guid skucid = dr.GetFieldValue<Guid>("SKUCID");
                        attType = new SKUATT(ID)
                        {
                            Code = code,
                            Name = name,
                            ATTType = attTypeID,
                            SKUID = skucid,
                        };
                        result.Add(attType);
                    }
                }
            }
            catch (Exception e)
            {
                string excepMsg = string.Format(@"{0},{1}", DateTime.Now.ToString(), e.Message);
                Trace.TraceError(excepMsg);
                throw new Exception("获取属性列表出错:BLLAttManagement.GetSKUATTBySKUID(Guid SKUCID)", e);
            }

            return result;
        }