Example #1
0
        public int CompareTo(object obj)
        {
            Size2Info b = obj as Size2Info;

            if (this.Status < b.Status)
            {
                return(1);
            }
            else if (this.Status > b.Status)
            {
                return(-1);
            }
            else
            {
                int result = String.Compare(this.Size2ID, b.Size2ID);
                if (result > 0)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }
        }
Example #2
0
File: SizeDac.cs Project: ue96/ue96
        public int Insert(Size2Info oParam)
        {
            string sql = @"INSERT INTO Size2
                            (
                             Size1SysNo, Size2ID, Size2Name,
                            Status
                            )
                            VALUES (
                             @Size1SysNo, @Size2ID, @Size2Name,
                            @Status
                            )";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSize1SysNo = new SqlParameter("@Size1SysNo", SqlDbType.Int, 4);
            SqlParameter paramSize2ID = new SqlParameter("@Size2ID", SqlDbType.NVarChar, 20);
            SqlParameter paramSize2Name = new SqlParameter("@Size2Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSize1SysNo.Value = oParam.Size1SysNo;
            paramSize2ID.Value = oParam.Size2ID;
            paramSize2Name.Value = oParam.Size2Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSize1SysNo);
            cmd.Parameters.Add(paramSize2ID);
            cmd.Parameters.Add(paramSize2Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Example #3
0
 public void Insert(Size2Info oParam)
 {
     foreach (Size2Info item in Size2Hash.Values)
     {
         if (item.Size2ID == oParam.Size2ID)
             throw new BizException("the same second Size ID exists");
     }
     oParam.SysNo = SequenceDac.GetInstance().Create("Size_Sequence");
     new SizeDac().Insert(oParam);
     SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.Category);
     Size2Hash.Add(oParam.SysNo, oParam);
 }
Example #4
0
 private void Map(Size2Info oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.Size1SysNo = Util.TrimIntNull(tempdr["Size1SysNo"]);
     oParam.Size2ID = Util.TrimNull(tempdr["Size2ID"]);
     oParam.Size2Name = Util.TrimNull(tempdr["Size2Name"]);
     oParam.Status = Util.TrimIntNull(tempdr["Status"]);
 }
Example #5
0
 private void InitSize2()
 {
     lock (categoryLocker)
     {
         Size2Hash.Clear();
         string sql = " select * from Size2 ";
         DataSet ds = SqlHelper.ExecuteDataSet(sql);
         if (!Util.HasMoreRow(ds))
             return;
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             Size2Info item = new Size2Info();
             Map(item, dr);
             Size2Hash.Add(item.SysNo, item);
         }
     }
 }
Example #6
0
        public void Update(Size2Info oParam)
        {
            foreach (Size2Info item in Size2Hash.Values)
            {
                if (item.SysNo != oParam.SysNo && item.Size2ID == oParam.Size2ID)
                    throw new BizException("the same Size ID exists");
            }
            new SizeDac().Update(oParam);
            SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.Category);

            if (Size2Hash.ContainsKey(oParam.SysNo))
            {
                Size2Hash.Remove(oParam.SysNo);
                Size2Hash.Add(oParam.SysNo, oParam);
            }
        }
Example #7
0
 public void UpdateSize2(Size2Info oParam)
 {
     string sql = "select * from size2 where Size2ID=" + oParam.Size2ID + " and SysNo<>" + oParam.SysNo;
        DataSet ds = SqlHelper.ExecuteDataSet(sql);
        if (Util.HasMoreRow(ds))
        throw new BizException("��ͬID��ŵij����Ѵ���");
        new SizeDac().Update(oParam);
 }
Example #8
0
        public Size2Info LoadSize2(int SysNo)
        {
            string sql = "select * from size2 where sysno=" + SysNo;
               DataSet ds = SqlHelper.ExecuteDataSet(sql);

               if (!Util.HasMoreRow(ds))
               return null;
               Size2Info oInfo = new Size2Info();
               map(oInfo, ds.Tables[0].Rows[0]);
               return oInfo;
        }
Example #9
0
 public void InsertSize2(Size2Info oParam)
 {
     new SizeDac().Insert(oParam);
 }
Example #10
0
File: SizeDac.cs Project: ue96/ue96
        public int Update(Size2Info oParam)
        {
            string sql = @"UPDATE Size2 SET
                            Size1SysNo=@Size1SysNo,
                            Size2ID=@Size2ID, Size2Name=@Size2Name,
                            Status=@Status
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramSize1SysNo = new SqlParameter("@Size1SysNo", SqlDbType.Int, 4);
            SqlParameter paramSize2ID = new SqlParameter("@Size2ID", SqlDbType.NVarChar, 20);
            SqlParameter paramSize2Name = new SqlParameter("@Size2Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSysNo.Value = oParam.SysNo;
            paramSize1SysNo.Value = oParam.Size1SysNo;
            paramSize2ID.Value = oParam.Size2ID;
            paramSize2Name.Value = oParam.Size2Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramSize1SysNo);
            cmd.Parameters.Add(paramSize2ID);
            cmd.Parameters.Add(paramSize2Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }