Beispiel #1
0
        public int Insert(Color1Info oParam)
        {
            string sql = @"INSERT INTO Color1
                            (
                            SysNo, Color1ID, Color1Name, Status
                            )
                            VALUES (
                            @SysNo, @Color1ID, @Color1Name, @Status
                            )";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramColor1ID = new SqlParameter("@Color1ID", SqlDbType.NVarChar, 20);
            SqlParameter paramColor1Name = new SqlParameter("@Color1Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSysNo.Value = oParam.SysNo;
            paramColor1ID.Value = oParam.Color1ID;
            paramColor1Name.Value = oParam.Color1Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramColor1ID);
            cmd.Parameters.Add(paramColor1Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Beispiel #2
0
        public int CompareTo(object obj)
        {
            Color1Info b = obj as Color1Info;

            if (this.Status < b.Status)
            {
                return(1);
            }
            else if (this.Status > b.Status)
            {
                return(-1);
            }
            else
            {
                int result = String.Compare(this.Color1ID, b.Color1ID);
                if (result > 0)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }
        }
Beispiel #3
0
        public void Insert(Color1Info oParam)
        {
            foreach (Color1Info item in Color1Hash.Values)
            {
                if (item.Color1ID == oParam.Color1ID)
                    throw new BizException("the same first color ID exists");
            }
            oParam.SysNo = SequenceDac.GetInstance().Create("Color_Sequence");
            new ColorDac().Insert(oParam);
            SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.Category);

            Color1Hash.Add(oParam.SysNo, oParam);
        }
Beispiel #4
0
 private void Map(Color1Info oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.Color1ID = Util.TrimNull(tempdr["Color1ID"]);
     oParam.Color1Name = Util.TrimNull(tempdr["Color1Name"]);
     oParam.Status = Util.TrimIntNull(tempdr["Status"]);
 }
Beispiel #5
0
        private void InitColor1()
        {
            lock (categoryLocker)
            {
                Color1Hash.Clear();

                string sql = " select * from color1 ";
                DataSet ds = SqlHelper.ExecuteDataSet(sql);
                if (!Util.HasMoreRow(ds))
                    return;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Color1Info item = new Color1Info();
                    Map(item, dr);
                    Color1Hash.Add(item.SysNo, item);
                }
            }
        }
Beispiel #6
0
        public void Update(Color1Info oParam)
        {
            foreach (Color1Info item in Color1Hash.Values)
            {
                if (item.SysNo != oParam.SysNo && item.Color1ID == oParam.Color1ID)
                    throw new BizException("the same Color ID exists");
            }

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

            if (Color1Hash.ContainsKey(oParam.SysNo))
            {
                Color1Hash.Remove(oParam.SysNo);
                Color1Hash.Add(oParam.SysNo, oParam);
            }
        }
Beispiel #7
0
        public int Update(Color1Info oParam)
        {
            string sql = @"UPDATE Color1 SET
                            Color1ID=@Color1ID,
                            Color1Name=@Color1Name, Status=@Status
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramColor1ID = new SqlParameter("@Color1ID", SqlDbType.NVarChar, 20);
            SqlParameter paramColor1Name = new SqlParameter("@Color1Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSysNo.Value = oParam.SysNo;
            paramColor1ID.Value = oParam.Color1ID;
            paramColor1Name.Value = oParam.Color1Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramColor1ID);
            cmd.Parameters.Add(paramColor1Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }