예제 #1
0
        public int CompareTo(object obj)
        {
            CategoryAttribute1Info b = obj as CategoryAttribute1Info;

            if (this._ordernum > b._ordernum)
            {
                return(1);
            }
            else
            {
                return(-1);
            }
        }
예제 #2
0
 //---------------------------Category_Attribute2_Option------------------------
 //---------------------------Category_Attribute1-------------------------
 public bool IsExistAttribute1(CategoryAttribute1Info oParam)
 {
     return new CategoryDac().IsExistAttribute1(oParam);
 }
예제 #3
0
        public int InsertAttribute1(CategoryAttribute1Info oParam)
        {
            string _atrribute1ID = "";
            string _tmpStr = "";
            int _tmpInt = -1;
            string sql = "select max(Attribute1ID) from Category_Attribute1 where C3SysNo=" + oParam.C3SysNo.ToString();
            _tmpStr = SqlHelper.ExecuteScalar(sql).ToString();
            if (_tmpStr.Trim() == "")
                _tmpStr = "0";
            if (!Util.IsInteger(_tmpStr))
                throw new BizException("�Բ������ɱ�Ŵ��󣬲������");
            _tmpInt = Convert.ToInt32(_tmpStr);
            _tmpInt++;

            _atrribute1ID = _tmpInt.ToString();

            oParam.Attribute1ID = _atrribute1ID;

            return new CategoryDac().InsertAttribute1(oParam);
        }
예제 #4
0
 public int GetCatetoryAttribute1NewOrderNum(CategoryAttribute1Info oParam)
 {
     return new CategoryDac().GetCatetoryAttribute1NewOrderNum(oParam);
 }
예제 #5
0
 private void Map(CategoryAttribute1Info oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.C3SysNo = Util.TrimIntNull(tempdr["C3SysNo"]);
     oParam.Attribute1ID = Util.TrimNull(tempdr["Attribute1ID"]);
     oParam.Attribute1Name = Util.TrimNull(tempdr["Attribute1Name"]);
     oParam.OrderNum = Util.TrimIntNull(tempdr["OrderNum"]);
     oParam.Status = Util.TrimIntNull(tempdr["Status"]);
     oParam.Attribute1Type  = Util.TrimIntNull(tempdr["Attribute1Type"]);
 }
예제 #6
0
 public int UpdateAttribute1(CategoryAttribute1Info oParam)
 {
     return new CategoryDac().UpdateAttribute1(oParam);
 }
예제 #7
0
        public void MoveUp(CategoryAttribute1Info oParam)
        {
            if ( oParam.OrderNum == 1 )
            {
                throw new BizException("it's the first one, can't be moved up");
            }
            SortedList sl = GetAttribute1List(oParam.C3SysNo);
            if ( sl == null )
            {
                throw new BizException("no attributes");
            }

            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                CategoryDac o = new CategoryDac();

                foreach(CategoryAttribute1Info item  in sl.Keys)
                {
                    if ( item.OrderNum == oParam.OrderNum-1 )
                    {
                        item.OrderNum += 1;
                        o.SetOrderNum(item);
                    }
                }
                oParam.OrderNum -= 1;
                o.SetOrderNum(oParam);

                scope.Complete();
            }
        }
예제 #8
0
 public SortedList GetAttribute1List(int paramC3SysNo)
 {
     string sql = " select * from category_attribute1 where c3sysno = " + paramC3SysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if ( !Util.HasMoreRow(ds))
         return null;
     SortedList sl = new SortedList(ds.Tables[0].Rows.Count);
     foreach( DataRow dr in ds.Tables[0].Rows )
     {
         CategoryAttribute1Info item = new CategoryAttribute1Info();
         Map(item, dr);
         sl.Add(item, null);
     }
     return sl;
 }
예제 #9
0
 public CategoryAttribute1Info LoadCategoryAttribute1(int paramAttribute1SysNo)
 {
     string sql = "select * from category_attribute1 where sysno=" + paramAttribute1SysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if ( !Util.HasMoreRow(ds))
         return null;
     CategoryAttribute1Info item = new CategoryAttribute1Info();
     Map( item, ds.Tables[0].Rows[0]);
     return item;
 }
예제 #10
0
파일: CategoryDac.cs 프로젝트: ue96/ue96
        public int UpdateAttribute1(CategoryAttribute1Info oParam)
        {
            string sql = @"UPDATE Category_Attribute1 SET
                            C3SysNo=@C3SysNo,
                            Attribute1ID=@Attribute1ID, Attribute1Name=@Attribute1Name,
                            OrderNum=@OrderNum, Status=@Status,Attribute1Type=@Attribute1Type
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4);
            SqlParameter paramC3SysNo = new SqlParameter("@C3SysNo", SqlDbType.Int,4);
            SqlParameter paramAttribute1ID = new SqlParameter("@Attribute1ID", SqlDbType.NVarChar,20);
            SqlParameter paramAttribute1Name = new SqlParameter("@Attribute1Name", SqlDbType.NVarChar,50);
            SqlParameter paramOrderNum = new SqlParameter("@OrderNum", SqlDbType.Int,4);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int,4);
            SqlParameter paramAttribute1Type = new SqlParameter("@Attribute1Type", SqlDbType.Int,4);

            paramSysNo.Value = oParam.SysNo;
            paramC3SysNo.Value = oParam.C3SysNo;
            paramAttribute1ID.Value = oParam.Attribute1ID;
            paramAttribute1Name.Value = oParam.Attribute1Name;
            paramOrderNum.Value = oParam.OrderNum;
            paramStatus.Value = oParam.Status;
            paramAttribute1Type.Value = oParam.Attribute1Type;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramC3SysNo);
            cmd.Parameters.Add(paramAttribute1ID);
            cmd.Parameters.Add(paramAttribute1Name);
            cmd.Parameters.Add(paramOrderNum);
            cmd.Parameters.Add(paramStatus);
            cmd.Parameters.Add(paramAttribute1Type);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
예제 #11
0
파일: CategoryDac.cs 프로젝트: ue96/ue96
 public int SetOrderNum(CategoryAttribute1Info oParam)
 {
     string sql = "update category_attribute1 set ordernum = " + oParam.OrderNum + " where sysno = " + oParam.SysNo;
     SqlCommand cmd = new SqlCommand(sql);
     return SqlHelper.ExecuteNonQuery(cmd);
 }
예제 #12
0
파일: CategoryDac.cs 프로젝트: ue96/ue96
        public bool IsExistAttribute1(CategoryAttribute1Info oParam)
        {
            string sql = "select top 1 sysno from category_attribute1 where c3sysno=@c3sysno and Attribute1Name=@Attribute1Name and SysNo!=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramC3SysNo = new SqlParameter("@C3SysNo", SqlDbType.Int,4);
            SqlParameter paramAttribute1Name = new SqlParameter("@Attribute1Name", SqlDbType.NVarChar,50);
            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            paramC3SysNo.Value = oParam.C3SysNo;
            paramAttribute1Name.Value = oParam.Attribute1Name;
            paramSysNo.Value = oParam.SysNo;

            cmd.Parameters.Add(paramC3SysNo);
            cmd.Parameters.Add(paramAttribute1Name);
            cmd.Parameters.Add(paramSysNo);

            DataSet ds = SqlHelper.ExecuteDataSet(cmd);;
            if ( Util.HasMoreRow(ds))
                return true;
            else
                return false;
        }
예제 #13
0
파일: CategoryDac.cs 프로젝트: ue96/ue96
        public int InsertAttribute1(CategoryAttribute1Info oParam)
        {
            string sql = @"INSERT INTO Category_Attribute1
                            (
                            C3SysNo, Attribute1ID, Attribute1Name,
                            OrderNum, Status, Attribute1Type
                            )
                            VALUES (
                            @C3SysNo, @Attribute1ID, @Attribute1Name,
                            @OrderNum, @Status, @Attribute1Type
                            )";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramC3SysNo = new SqlParameter("@C3SysNo", SqlDbType.Int,4);
            SqlParameter paramAttribute1ID = new SqlParameter("@Attribute1ID", SqlDbType.NVarChar,20);
            SqlParameter paramAttribute1Name = new SqlParameter("@Attribute1Name", SqlDbType.NVarChar,50);
            SqlParameter paramOrderNum = new SqlParameter("@OrderNum", SqlDbType.Int,4);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int,4);
            SqlParameter paramAttribute1Type = new SqlParameter("@Attribute1Type",SqlDbType.Int,4);

            paramC3SysNo.Value = oParam.C3SysNo;
            paramAttribute1ID.Value = oParam.Attribute1ID;
            paramAttribute1Name.Value = oParam.Attribute1Name;
            paramOrderNum.Value = oParam.OrderNum;
            paramStatus.Value = oParam.Status;
            paramAttribute1Type.Value = oParam.Attribute1Type;

            cmd.Parameters.Add(paramC3SysNo);
            cmd.Parameters.Add(paramAttribute1ID);
            cmd.Parameters.Add(paramAttribute1Name);
            cmd.Parameters.Add(paramOrderNum);
            cmd.Parameters.Add(paramStatus);
            cmd.Parameters.Add(paramAttribute1Type);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
예제 #14
0
파일: CategoryDac.cs 프로젝트: ue96/ue96
 public int GetCatetoryAttribute1NewOrderNum(CategoryAttribute1Info oParam)
 {
     string sql = "select isnull(max(OrderNum),0)+1 as newOrderNum from Category_Attribute1 where C3SysNo=" + oParam.C3SysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if(Util.HasMoreRow(ds))
     {
         return Int32.Parse(ds.Tables[0].Rows[0][0].ToString());
     }
     else
     {
         return 1;
     }
 }