Exemple #1
0
        public int Update(Size1Info oParam)
        {
            string sql = @"UPDATE Size1 SET
                            Size1ID=@Size1ID,
                            Size1Name=@Size1Name, Status=@Status
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramSize1ID = new SqlParameter("@Size1ID", SqlDbType.NVarChar, 20);
            SqlParameter paramSize1Name = new SqlParameter("@Size1Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSysNo.Value = oParam.SysNo;
            paramSize1ID.Value = oParam.Size1ID;
            paramSize1Name.Value = oParam.Size1Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramSize1ID);
            cmd.Parameters.Add(paramSize1Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Exemple #2
0
        public int Insert(Size1Info oParam)
        {
            string sql = @"INSERT INTO Size1
                            (
                             Size1ID, Size1Name, Status
                            )
                            VALUES (
                             @Size1ID, @Size1Name, @Status
                            )";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSize1ID = new SqlParameter("@Size1ID", SqlDbType.NVarChar, 20);
            SqlParameter paramSize1Name = new SqlParameter("@Size1Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSize1ID.Value = oParam.Size1ID;
            paramSize1Name.Value = oParam.Size1Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSize1ID);
            cmd.Parameters.Add(paramSize1Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Exemple #3
0
        public int CompareTo(object obj)
        {
            Size1Info b = obj as Size1Info;

            if (this.Status < b.Status)
            {
                return(1);
            }
            else if (this.Status > b.Status)
            {
                return(-1);
            }
            else
            {
                int result = String.Compare(this.Size1ID, b.Size1ID);
                if (result > 0)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }
        }
Exemple #4
0
        public void Insert(Size1Info oParam)
        {
            foreach (Size1Info item in Size1Hash.Values)
            {
                if (item.Size1ID == oParam.Size1ID)
                    throw new BizException("the same first Size ID exists");
            }
            oParam.SysNo = SequenceDac.GetInstance().Create("Size_Sequence");
            new SizeDac().Insert(oParam);
            SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.Category);

            Size1Hash.Add(oParam.SysNo, oParam);
        }
Exemple #5
0
 private void Map(Size1Info oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.Size1ID = Util.TrimNull(tempdr["Size1ID"]);
     oParam.Size1Name = Util.TrimNull(tempdr["Size1Name"]);
     oParam.Status = Util.TrimIntNull(tempdr["Status"]);
 }
Exemple #6
0
        private void InitSize1()
        {
            lock (categoryLocker)
            {
                Size1Hash.Clear();

                string sql = " select * from Size1 ";
                DataSet ds = SqlHelper.ExecuteDataSet(sql);
                if (!Util.HasMoreRow(ds))
                    return;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Size1Info item = new Size1Info();
                    Map(item, dr);
                    Size1Hash.Add(item.SysNo, item);
                }
            }
        }
Exemple #7
0
        public void Update(Size1Info oParam)
        {
            foreach (Size1Info item in Size1Hash.Values)
            {
                if (item.SysNo != oParam.SysNo && item.Size1ID == oParam.Size1ID)
                    throw new BizException("the same Size ID exists");
            }

            new SizeDac().Update(oParam);
            SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.Category);

            if (Size1Hash.ContainsKey(oParam.SysNo))
            {
                Size1Hash.Remove(oParam.SysNo);
                Size1Hash.Add(oParam.SysNo, oParam);
            }
        }
Exemple #8
0
 public void UpdateSize1(Size1Info oParam)
 {
     string sql="select * from size1 where Size1ID="+oParam.Size1ID+" and SysNo<>"+oParam.SysNo;
        DataSet ds=SqlHelper.ExecuteDataSet(sql);
        if(Util.HasMoreRow(ds))
        throw new BizException("��ͬID��ŵij����Ѵ���");
        new SizeDac().Update(oParam);
 }
Exemple #9
0
        public Size1Info LoadSize1(int SysNo)
        {
            string sql = "select * from size1 where sysno=" + SysNo;
               DataSet ds = SqlHelper.ExecuteDataSet(sql);

               if (!Util.HasMoreRow(ds))
               return null;
               Size1Info oInfo=new Size1Info();
               map(oInfo, ds.Tables[0].Rows[0]);
               return oInfo;
        }
Exemple #10
0
 public void InsertSize1(Size1Info oParam)
 {
     new SizeDac().Insert(oParam);
 }