Пример #1
0
        public void updateCKGPoint(CKGPoint p_code)
        {
            string l_strSql = "UPDATE [KG].[dbo].[tbKGPoint] SET ";

            l_strSql += "[f_Name] = N'" + p_code.f_Name業代姓名 + "',";
            l_strSql += "[f_Point] = '" + p_code.f_Point現有點數 + "'";
            l_strSql += " WHERE [f_Smid] = '" + p_code.f_Smid業代員編 + "'";
            ivContext.資料管理員.excuteSqlNonquery(l_strSql);
        }
Пример #2
0
        public void updateOldCKGPoint(CKGPoint p_code)
        {
            string l_strSql = "UPDATE [KG].[dbo].[tbKGPoint] SET ";

            l_strSql += "[f_Point] = (f_Point + " + p_code.f_Point現有點數.ToString() + ") ,";//有點數資料的加上匯入的點數
            l_strSql += "[f_Name] = N'" + p_code.f_Name業代姓名 + "'";
            l_strSql += " WHERE f_Smid = '" + p_code.f_Smid業代員編 + "'";

            ivContext.資料管理員.excuteSqlNonquery(l_strSql);
        }
Пример #3
0
        public void insertCKGPoint(CKGPoint p_code)
        {
            string l_strSql = "INSERT INTO [KG].[dbo].[tbKGPoint] ([f_Smid],[f_Name],[f_Point])VALUES(";

            l_strSql += "  '" + p_code.f_Smid業代員編 + "' ";
            l_strSql += ", N'" + p_code.f_Name業代姓名 + "' ";
            l_strSql += ", '" + p_code.f_Point現有點數 + "' ";
            l_strSql += ")";

            ivContext.資料管理員.excuteSqlNonquery(l_strSql);
        }
Пример #4
0
        private CKGPoint[] queryBySql(string p_sql)
        {
            DataView        l_dv    = ivContext.資料管理員.getDataViewBySql(p_sql);
            List <CKGPoint> l_datas = new List <CKGPoint>();

            if (l_dv.Count > 0)
            {
                for (int i = 0; i < l_dv.Count; i++)
                {
                    CKGPoint l_code = createCKGPoint();
                    l_code.f_Smid業代員編  = l_dv[i]["f_Smid"].ToString();
                    l_code.f_Name業代姓名  = l_dv[i]["f_Name"].ToString();
                    l_code.f_Point現有點數 = Convert.ToInt32(l_dv[i]["f_Point"].ToString());
                    l_datas.Add(l_code);
                }
                return(l_datas.ToArray());
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
        /// <summary>
        /// //(Yu 20090617) 用Hashtable將點數匯入虛擬帳戶並寫入匯入記錄
        /// </summary>
        /// <param name="p_codes"></param>
        public void insert點數與記錄ByHashtable(Hashtable p_ht)
        {
            foreach (string l_strSmid in p_ht.Keys)
            {
                string   l_strSql = "SELECT * FROM [KG].[dbo].[tbKGPoint] WHERE f_Smid ='" + l_strSmid + "'";
                DataView l_dv     = ivContext.資料管理員.getDataViewBySql(l_strSql);
                CKGPoint l_code   = createCKGPoint();
                l_code.f_Smid業代員編  = l_strSmid;
                l_code.f_Name業代姓名  = ((List <CKGPointDetail>)p_ht[l_strSmid])[0].f_Name業代姓名;
                l_code.f_Point現有點數 = sum((List <CKGPointDetail>)p_ht[l_strSmid]);

                if (l_dv.Count > 0)
                {
                    updateOldCKGPoint(l_code);; //有點數資料的加上匯入的點數
                }
                else
                {
                    insertCKGPoint(l_code);//沒有點數資料的直接新增
                }

                CKGPointDetailFactory l_factory = new CKGPointDetailFactory(ivContext);
                l_factory.insertCKGPointDetailBy點數匯入(((List <CKGPointDetail>)p_ht[l_strSmid]).ToArray());
            }
        }