Esempio n. 1
0
        public int Insert(Color2Info oParam)
        {
            string sql = @"INSERT INTO Color2
                            (
                            SysNo, Color1SysNo, Color2ID, Color2Name,
                            Status
                            )
                            VALUES (
                            @SysNo, @Color1SysNo, @Color2ID, @Color2Name,
                            @Status
                            )";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramColor1SysNo = new SqlParameter("@Color1SysNo", SqlDbType.Int, 4);
            SqlParameter paramColor2ID = new SqlParameter("@Color2ID", SqlDbType.NVarChar, 20);
            SqlParameter paramColor2Name = new SqlParameter("@Color2Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSysNo.Value = oParam.SysNo;
            paramColor1SysNo.Value = oParam.Color1SysNo;
            paramColor2ID.Value = oParam.Color2ID;
            paramColor2Name.Value = oParam.Color2Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramColor1SysNo);
            cmd.Parameters.Add(paramColor2ID);
            cmd.Parameters.Add(paramColor2Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Esempio n. 2
0
        public int CompareTo(object obj)
        {
            Color2Info b = obj as Color2Info;

            if (this.Status < b.Status)
            {
                return(1);
            }
            else if (this.Status > b.Status)
            {
                return(-1);
            }
            else
            {
                int result = String.Compare(this.Color2ID, b.Color2ID);
                if (result > 0)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }
        }
Esempio n. 3
0
 public void Insert(Color2Info oParam)
 {
     foreach (Color2Info item in Color2Hash.Values)
     {
         if (item.Color2ID == oParam.Color2ID)
             throw new BizException("the same second color ID exists");
     }
     oParam.SysNo = SequenceDac.GetInstance().Create("Color_Sequence");
     new ColorDac().Insert(oParam);
     SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.Category);
     Color2Hash.Add(oParam.SysNo, oParam);
 }
Esempio n. 4
0
 private void Map(Color2Info oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.Color1SysNo = Util.TrimIntNull(tempdr["Color1SysNo"]);
     oParam.Color2ID = Util.TrimNull(tempdr["Color2ID"]);
     oParam.Color2Name = Util.TrimNull(tempdr["Color2Name"]);
     oParam.Status = Util.TrimIntNull(tempdr["Status"]);
 }
Esempio n. 5
0
 private void InitColor2()
 {
     lock (categoryLocker)
     {
         Color2Hash.Clear();
         string sql = " select * from color2 ";
         DataSet ds = SqlHelper.ExecuteDataSet(sql);
         if (!Util.HasMoreRow(ds))
             return;
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             Color2Info item = new Color2Info();
             Map(item, dr);
             Color2Hash.Add(item.SysNo, item);
         }
     }
 }
Esempio n. 6
0
        public void Update(Color2Info oParam)
        {
            foreach (Color2Info item in Color2Hash.Values)
            {
                if (item.SysNo != oParam.SysNo && item.Color2ID == oParam.Color2ID)
                    throw new BizException("the same Color ID exists");
            }
            new ColorDac().Update(oParam);
            SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.Category);

            if (Color2Hash.ContainsKey(oParam.SysNo))
            {
                Color2Hash.Remove(oParam.SysNo);
                Color2Hash.Add(oParam.SysNo, oParam);
            }
        }
Esempio n. 7
0
        public int Update(Color2Info oParam)
        {
            string sql = @"UPDATE Color2 SET
                            Color1SysNo=@Color1SysNo,
                            Color2ID=@Color2ID, Color2Name=@Color2Name,
                            Status=@Status
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramColor1SysNo = new SqlParameter("@Color1SysNo", SqlDbType.Int, 4);
            SqlParameter paramColor2ID = new SqlParameter("@Color2ID", SqlDbType.NVarChar, 20);
            SqlParameter paramColor2Name = new SqlParameter("@Color2Name", SqlDbType.NVarChar, 200);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            paramSysNo.Value = oParam.SysNo;
            paramColor1SysNo.Value = oParam.Color1SysNo;
            paramColor2ID.Value = oParam.Color2ID;
            paramColor2Name.Value = oParam.Color2Name;
            paramStatus.Value = oParam.Status;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramColor1SysNo);
            cmd.Parameters.Add(paramColor2ID);
            cmd.Parameters.Add(paramColor2Name);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }