Exemple #1
0
        public bool HandleCommitPoint(RemoteStoreMember remoteStoreMember, List <RemotePointCommit> remotePointCommitlist)
        {
            int    totalCommit          = 0;
            string remotePointCommitIds = "";

            foreach (RemotePointCommit remotePointCommit in remotePointCommitlist)
            {
                totalCommit          += remotePointCommit.point;
                remotePointCommitIds += remotePointCommit.pointCommitId + ",";
            }
            if (remotePointCommitIds.Length > 0)
            {
                remotePointCommitIds = remotePointCommitIds.Substring(0, remotePointCommitIds.Length - 1);
            }
            ArrayList     list    = new ArrayList();
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat(
                MemberSqls.UPDATE_REMOTE_POINT_COMMIT_STATE,
                remotePointCommitIds
                );
            string sql = builder.ToString();

            list.Add(sql);
            builder.Clear();
            builder.AppendFormat(
                MemberSqls.UPDATE_REMOTE_STORE_MEMBER_POINT_ADD,
                remoteStoreMember.storeMemberId,
                totalCommit
                );
            sql = builder.ToString();
            list.Add(sql);
            return(DatabaseOperationWeb.ExecuteDML(list));
        }
Exemple #2
0
        public List <RemoteStoreMember> GetRemoteStoreMemberList(string memberId)
        {
            List <RemoteStoreMember> list    = new List <RemoteStoreMember>();
            StringBuilder            builder = new StringBuilder();

            builder.AppendFormat(MemberSqls.SELECT_REMOTE_STORE_MEMBER_LIST, memberId);
            string    sql = builder.ToString();
            DataTable dt  = DatabaseOperationWeb.ExecuteSelectDS(sql, "T").Tables[0];

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    RemoteStoreMember remoteStoreMember = new RemoteStoreMember
                    {
                        cardCode      = dr["CARD_CODE"].ToString(),
                        phone         = dr["PHONE"].ToString(),
                        point         = Convert.ToInt32(dr["POINT"]),
                        regTime       = dr["REG_TIME"].ToString(),
                        storeId       = dr["STORE_ID"].ToString(),
                        storeMemberId = dr["STORE_MEMBER_ID"].ToString(),
                        storeRate     = Convert.ToInt32(dr["STORE_RATE"]),
                        storeImg      = dr["STORE_IMG"].ToString(),
                        storeName     = dr["STORE_NAME"].ToString(),
                    };
                    list.Add(remoteStoreMember);
                }
            }

            return(list);
        }
Exemple #3
0
        public List <RemotePointCommit> GetRemotePointCommitList(RemoteStoreMember remoteStoreMember)
        {
            List <RemotePointCommit> list    = new List <RemotePointCommit>();
            StringBuilder            builder = new StringBuilder();

            builder.AppendFormat(MemberSqls.SELECT_REMOTE_POINT_COMMIT, remoteStoreMember.storeId, remoteStoreMember.phone);
            string    sql = builder.ToString();
            DataTable dt  = DatabaseOperationWeb.ExecuteSelectDS(sql, "T").Tables[0];

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    RemotePointCommit remotePointCommit = new RemotePointCommit
                    {
                        phone         = dr["PHONE"].ToString(),
                        point         = Convert.ToInt32(dr["POINT"]),
                        memberId      = dr["MEMBER_ID"].ToString(),
                        storeId       = dr["STORE_ID"].ToString(),
                        pointCommitId = dr["POINT_COMMIT_ID"].ToString(),
                        state         = dr["STATE"].ToString(),
                        type          = dr["TYPE"].ToString(),
                    };
                    list.Add(remotePointCommit);
                }
            }
            return(list);
        }
Exemple #4
0
        public RemoteStoreMember GetRemoteStoreMember(string storeMemberId)
        {
            RemoteStoreMember remoteStoreMember = null;
            StringBuilder     builder           = new StringBuilder();

            builder.AppendFormat(MemberSqls.SELECT_REMOTE_STORE_MEMBER_BY_ID, storeMemberId);
            string    sql = builder.ToString();
            DataTable dt  = DatabaseOperationWeb.ExecuteSelectDS(sql, "T").Tables[0];

            if (dt != null && dt.Rows.Count == 1)
            {
                remoteStoreMember = new RemoteStoreMember
                {
                    cardCode      = dt.Rows[0]["CARD_CODE"].ToString(),
                    phone         = dt.Rows[0]["PHONE"].ToString(),
                    point         = Convert.ToInt32(dt.Rows[0]["POINT"]),
                    regTime       = dt.Rows[0]["REG_TIME"].ToString(),
                    storeId       = dt.Rows[0]["STORE_ID"].ToString(),
                    storeMemberId = dt.Rows[0]["STORE_MEMBER_ID"].ToString(),
                    storeRate     = Convert.ToInt32(dt.Rows[0]["STORE_RATE"]),
                    exchangeLimit = Convert.ToInt32(dt.Rows[0]["EXCHANGE_LIMIT"]),
                };
            }

            return(remoteStoreMember);
        }
Exemple #5
0
        public RemoteStoreMember GetNewRemoteStoreMember(string storeId, string phone)
        {
            RemoteStoreMember remoteStoreMember = null;
            StringBuilder     builder           = new StringBuilder();

            builder.AppendFormat(MemberSqls.INSERT_REMOTE_STORE_MEMBER, storeId, phone);
            string sql = builder.ToString();

            if (DatabaseOperationWeb.ExecuteDML(sql))
            {
                builder.Clear();
                builder.AppendFormat(MemberSqls.SELECT_REMOTE_STORE_MEMBER, storeId, phone);
                sql = builder.ToString();
                DataTable dt = DatabaseOperationWeb.ExecuteSelectDS(sql, "T").Tables[0];
                if (dt != null && dt.Rows.Count == 1)
                {
                    remoteStoreMember = new RemoteStoreMember
                    {
                        cardCode      = dt.Rows[0]["CARD_CODE"].ToString(),
                        phone         = dt.Rows[0]["PHONE"].ToString(),
                        point         = Convert.ToInt32(dt.Rows[0]["POINT"]),
                        regTime       = dt.Rows[0]["REG_TIME"].ToString(),
                        storeId       = dt.Rows[0]["STORE_ID"].ToString(),
                        storeMemberId = dt.Rows[0]["STORE_MEMBER_ID"].ToString(),
                    };
                }
            }

            return(remoteStoreMember);
        }
Exemple #6
0
        public bool BindMemberStore(string memberId, RemoteStoreMember remoteStoreMember, bool setDefault)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat(
                MemberSqls.INSERT_MEMBER_STORE,
                remoteStoreMember.storeId,
                memberId,
                remoteStoreMember.phone,
                remoteStoreMember.cardCode,
                setDefault
                );
            string sql = builder.ToString();

            return(DatabaseOperationWeb.ExecuteDML(sql));
        }
Exemple #7
0
        public bool AddCommitPoint(string memberId, RemoteStoreMember remoteStoreMember, int point, int heart, int oriHeart)
        {
            ArrayList     list    = new ArrayList();
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat(
                MemberSqls.INSERT_REMOTE_POINT_COMMIT,
                remoteStoreMember.storeId,
                remoteStoreMember.phone,
                memberId,
                0,
                1,
                point
                );
            string sql = builder.ToString();

            list.Add(sql);
            builder.Clear();
            builder.AppendFormat(
                MemberSqls.UPDATE_REMOTE_STORE_MEMBER_POINT_MINUS,
                remoteStoreMember.storeMemberId,
                point
                );
            sql = builder.ToString();
            list.Add(sql);
            builder.Clear();
            builder.AppendFormat(
                MemberSqls.UPDATE_MEMBER_HEART_BY_MEMBER_ID,
                memberId,
                heart
                );
            sql = builder.ToString();
            list.Add(sql);
            builder.Clear();
            builder.AppendFormat(
                MemberSqls.INSERT_HEART_CHANGE,
                heart,
                point,
                memberId,
                oriHeart,
                remoteStoreMember.storeId
                );
            sql = builder.ToString();
            list.Add(sql);
            return(DatabaseOperationWeb.ExecuteDML(list));
        }