コード例 #1
0
ファイル: PromotionJsonDate.cs プロジェクト: radtek/etowncode
        public static string EditActInfo(Member_Activity actinfo)
        {
            try
            {
                var pro = MemberActivityData.EditActInfo(actinfo);
                //if (actinfo.Id == 0)
                //{
                //    WxSubscribeSource source = new WxSubscribeSource
                //    {
                //        Id = 0,
                //        Activityid = pro,
                //        Channelcompanyid = 0,
                //        Sourcetype = 1,
                //        Comid = actinfo.Com_id,
                //        Whethercreateqrcode = false
                //    };

                //    int dd = new WxSubscribeSourceData().EditSubscribeSource(source);
                //}

                return(JsonConvert.SerializeObject(new { type = 100, msg = pro }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
コード例 #2
0
        public static string LoadingList(string comid, int pageindex, int pagesize, int userid)
        {
            var totalcount = 0;

            try
            {
                var list = new List <Member_Activity_Log>();
                B2b_company_manageuser userr = B2bCompanyManagerUserData.GetUser(userid);
                if (userr != null)
                {
                    if (userr.Channelcompanyid == 0)//总公司账户
                    {
                        list = new B2bCrmData().LoadingList(comid, pageindex, pagesize, out totalcount);
                    }
                    else //总公司下面渠道
                    {
                        list = new B2bCrmData().LoadingList(comid, pageindex, pagesize, int.Parse(userr.Channelcompanyid.ToString()), out totalcount);
                    }


                    IEnumerable result     = "";
                    var         memcompany = new MemberChannelcompanyData();
                    if (list != null)
                    {
                        result = from pro in list
                                 select new
                        {
                            ID     = pro.ID,
                            CardID = MemberCardData.GetCardId(pro.CardID).Cardcode.ToString(),
                            //CardID =pro.CardID,
                            ACTID               = MemberActivityData.GetActById(pro.ACTID).Title.ToString(),
                            OrderId             = pro.OrderId,
                            ServerName          = pro.ServerName,
                            Sales_admin         = pro.Sales_admin,
                            Num_people          = pro.Num_people,
                            Usesubdate          = pro.Usesubdate,
                            Per_capita_money    = pro.Per_capita_money * pro.Num_people,
                            Member_return_money = pro.Member_return_money,
                            username            = B2bCrmData.GetCrmCardcode(MemberCardData.GetCardId(pro.CardID).Cardcode) == null ? "--" : B2bCrmData.GetCrmCardcode(MemberCardData.GetCardId(pro.CardID).Cardcode).Name.ToString(),
                            channel             = memcompany.UpCompanyById(MemberCardData.GetCardId(pro.CardID).Cardcode.ToString())
                        }
                    }
                    ;

                    return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
コード例 #3
0
ファイル: PromotionJsonDate.cs プロジェクト: radtek/etowncode
        public static string VerAccountActPageList(int accountid, int comid, int channelcompanyid, int pageindex, int pagesize, int channelcomid)
        {
            var totalcount = 0;

            try
            {
                var         actdata = new MemberActivityData();
                var         list    = actdata.AccountActPageList(accountid, comid, channelcompanyid, pageindex, pagesize, out totalcount, channelcomid);
                IEnumerable result  = "";
                if (list != null)
                {
                    result = from pro in list
                             select new
                    {
                        Id          = pro.Id,
                        Title       = pro.Title.Length > 10 ? pro.Title.Substring(0, 10) + "." : pro.Title,
                        Actstar     = pro.Actstar,
                        Actend      = pro.Actend,
                        Acttype     = pro.Acttype,
                        Cashback    = pro.Cashback,
                        CashFull    = pro.CashFull,
                        Com_id      = pro.Com_id,
                        Discount    = pro.Discount,
                        Money       = pro.Money,
                        RepeatIssue = pro.RepeatIssue,
                        ReturnAct   = pro.ReturnAct,
                        UseOnce     = pro.UseOnce,
                        FaceObjects = pro.FaceObjects,
                        Runstate    = pro.Runstate,
                        Usestate    = pro.Usestate == 1 ? "未使用" : "已使用",
                        Actnum      = pro.Actnum,
                        Cardid      = pro.Cardid,
                        Aid         = pro.Aid,
                        Remark      = pro.Remark,
                        Usetitle    = pro.Usetitle,
                        Useremark   = pro.Useremark
                    }
                }
                ;

                if (totalcount == 0)
                {
                    return(JsonConvert.SerializeObject(new { type = 100, totalCount = 0, msg = "" }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
コード例 #4
0
ファイル: PromotionJsonDate.cs プロジェクト: radtek/etowncode
        public static string WhetherEditByIdJson(int actid, int operuserid)
        {
            Member_Activity model = new MemberActivityData().GetMemberActivityById(actid);

            if (model == null)
            {
                return(JsonConvert.SerializeObject(new { type = 100, msg = "获取优惠活动失败", data = "0" }));
            }
            else
            {
                //获得操作人信息
                B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(operuserid);
                if (user != null)
                {
                    if (model.Com_id == user.Com_id)
                    {
                        if (model.CreateUserId == 0)        //由于以前活动表中没有createuserid,所以createuserid=0认定为公司创建
                        {
                            if (user.Channelcompanyid == 0) //操作人属于公司,可以编辑活动
                            {
                                return(JsonConvert.SerializeObject(new { type = 100, msg = "", data = "1" }));
                            }
                            else
                            {
                                return(JsonConvert.SerializeObject(new { type = 100, msg = "", data = "0" }));
                            }
                        }
                        else
                        {
                            //判断创建人和现在的操作人是否属于同一单位(同一门市或者同一公司下)
                            bool whethersameunit = new MemberActivityData().WhetherSameunit(model.CreateUserId, user.Channelcompanyid);
                            if (whethersameunit)
                            {
                                return(JsonConvert.SerializeObject(new { type = 100, msg = "", data = "1" }));
                            }
                            else
                            {
                                return(JsonConvert.SerializeObject(new { type = 100, msg = "", data = "0" }));
                            }
                        }
                    }
                    else
                    {
                        return(JsonConvert.SerializeObject(new { type = 100, msg = "活动非本公司活动", data = "0" }));
                    }
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 100, msg = "获取操作人信息失败", data = "0" }));
                }
            }
        }
コード例 #5
0
ファイル: PromotionJsonDate.cs プロジェクト: radtek/etowncode
        public static string ActPageList(string comid, int pageindex, int pagesize, int userid = 0, string state = "0,1")
        {
            //活动过期
            TimeSpan ts = new TimeSpan(0, 0, 0, 0, 0);
            //DateTime dt2 = DateTime.Now.Subtract(ts);
            //string msg= DateTime.Now.ToString() + "-" + ts.Days.ToString() + "天/r/n";
            //msg += dt2.ToString();

            var totalcount = 0;

            try
            {
                var         manageuserdata = new B2bCompanyManagerUserData();
                var         actdata        = new MemberActivityData();
                var         list           = actdata.ActPageList(comid, pageindex, pagesize, out totalcount, state);
                IEnumerable result         = "";
                if (list != null)
                {
                    result = from pro in list
                             select new
                    {
                        Id             = pro.Id,
                        Title          = pro.Title,
                        Actstar        = pro.Actstar,
                        Actend         = pro.Actend,
                        Acttype        = pro.Acttype,
                        Cashback       = pro.Cashback,
                        CashFull       = pro.CashFull,
                        Com_id         = pro.Com_id,
                        Discount       = pro.Discount,
                        Money          = pro.Money,
                        RepeatIssue    = pro.RepeatIssue,
                        ReturnAct      = pro.ReturnAct,
                        UseOnceUseOnce = pro.UseOnce,
                        FaceObjects    = pro.FaceObjects,
                        Runstate       = pro.Runstate,
                        ExpiryDate     = DateTime.Now < pro.Actend ? "未过期" : "已过期",
                        Whetheredit    = WhetherEditByIdStr(pro.Id, userid) == "1"?"yes":"no",
                        CreateChannel  = manageuserdata.GetCompanynamebyUserid(pro.CreateUserId)
                    }
                }
                ;

                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
コード例 #6
0
ファイル: PromotionJsonDate.cs プロジェクト: radtek/etowncode
        public static string WhetherEditByIdStr(int actid, int operuserid)
        {
            Member_Activity model = new MemberActivityData().GetMemberActivityById(actid);

            if (model == null)
            {
                return("0");
            }
            else
            {
                //获得操作人信息
                B2b_company_manageuser user = B2bCompanyManagerUserData.GetUser(operuserid);
                if (user != null)
                {
                    if (model.Com_id == user.Com_id)
                    {
                        if (model.CreateUserId == 0)        //由于以前活动表中没有createuserid,所以createuserid=0认定为公司创建
                        {
                            if (user.Channelcompanyid == 0) //操作人属于公司,可以编辑活动
                            {
                                return("1");
                            }
                            else
                            {
                                return("0");
                            }
                        }
                        else
                        {
                            //判断创建人和现在的操作人是否属于同一单位(同一门市或者同一公司下)
                            bool whethersameunit = new MemberActivityData().WhetherSameunit(model.CreateUserId, user.Channelcompanyid);
                            if (whethersameunit)
                            {
                                return("1");
                            }
                            else
                            {
                                return("0");
                            }
                        }
                    }
                    else
                    {
                        return("0");
                    }
                }
                else
                {
                    return("0");
                }
            }
        }
コード例 #7
0
ファイル: PromotionJsonDate.cs プロジェクト: radtek/etowncode
        public static string GetActById(int actid)
        {
            try
            {
                var pro = MemberActivityData.GetActById(actid);

                return(JsonConvert.SerializeObject(new { type = 100, msg = pro }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
コード例 #8
0
ファイル: qrcodelist.aspx.cs プロジェクト: radtek/etowncode
 /// <summary>
 /// 获得活动名称
 /// </summary>
 /// <param name="channelunitid"></param>
 /// <returns></returns>
 public string GetActivityNameById(string activityid)
 {
     if (activityid == "0" || activityid == "")
     {
         return("");
     }
     else
     {
         Member_Activity model = new MemberActivityData().GetMemberActivityById(int.Parse(activityid));
         if (model == null)
         {
             return("");
         }
         else
         {
             return(model.Title);
         }
     }
 }
コード例 #9
0
        public static string Logcardact(int actid, int cardid, int comid)
        {
            var totalcount = 0;

            try
            {
                var         prodata    = new B2bCrmData();
                var         list       = prodata.Logcardact(actid, cardid, comid, out totalcount);
                IEnumerable result     = "";
                var         memcompany = new MemberChannelcompanyData();
                if (list != null)
                {
                    result = from pro in list
                             select new
                    {
                        ID     = pro.ID,
                        CardID = MemberCardData.GetCardId(pro.CardID).Cardcode,
                        ACTID  = MemberActivityData.GetActById(pro.ACTID).Title,
                        //OrderId = pro.OrderId,
                        ServerName = pro.ServerName,
                        //Sales_admin = pro.Sales_admin,
                        //Num_people = pro.Num_people,
                        Usesubdate       = pro.Usesubdate,
                        Per_capita_money = pro.Per_capita_money * pro.Num_people,
                        //Member_return_money = pro.Member_return_money,
                    }
                }
                ;

                return(JsonConvert.SerializeObject(new { type = 100, msg = result, totalcount = totalcount }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
コード例 #10
0
ファイル: PromotionJsonDate.cs プロジェクト: radtek/etowncode
        public static string AccountClaimActPageList(int aid, int cardid, int AccountId, int comid)
        {
            int totalcount = 0;
            var aaid       = 0;
            var ret        = "";

            try
            {
                if (cardid != 0)
                {
                    //查询优惠券
                    MemberActivityData Activitydata  = new MemberActivityData();
                    Member_Activity    Activitymodel = Activitydata.GetMemberActivityById(aid);

                    if (Activitymodel != null)
                    {
                        if (Activitymodel.Runstate == false)
                        {
                            return(JsonConvert.SerializeObject(new { type = 1, msg = "活动已结束" }));
                        }
                        var today = DateTime.Now;

                        if (Activitymodel.Actstar < today && Activitymodel.Actend.AddDays(1) > today)
                        {
                        }
                        else
                        {
                            return(JsonConvert.SerializeObject(new { type = 1, msg = "活动已结束" }));
                        }
                    }


                    //每个活动只能领取一次,防止重复领取,
                    var listact = Activitydata.AccountActInfo(aid, AccountId, comid, out totalcount);
                    if (listact == null)
                    {
                        //领取活动
                        aaid = Activitydata.AccountClaimActPageList(aid, cardid, comid);
                        if (aaid != 0)
                        {
                            if (Activitymodel != null)
                            {
                                if (Activitymodel.Acttype == 4)//只有积分优惠券才会领取时充入积分
                                {
                                    MemberIntegralData intdate = new MemberIntegralData();
                                    Member_Integral    Intinfo = new Member_Integral()
                                    {
                                        Id        = AccountId,
                                        Comid     = comid,
                                        Acttype   = "add_integral",      //操作类型,增加积分
                                        Money     = Activitymodel.Money, //交易金额
                                        Admin     = "领取积分优惠券",
                                        Ip        = "",
                                        Ptype     = 1,
                                        Oid       = 0,
                                        Remark    = "",
                                        OrderId   = 0,
                                        OrderName = Activitymodel.Atitle
                                    };
                                    var InsertIntegral = intdate.InsertOrUpdate(Intinfo);

                                    //优惠券确认使用
                                    Member_Activity actinfo     = null;
                                    string          phone       = "";
                                    string          name        = "";
                                    decimal         idcard      = 0;
                                    decimal         aggcardcode = 0;

                                    MemberCardData carddata = new MemberCardData();
                                    var            confirm  = carddata.EconfirmCard(aaid, aid, cardid, comid, out actinfo, out phone, out name, out idcard, out aggcardcode);



                                    B2bCrmData prodata = new B2bCrmData();
                                    var        list    = prodata.Readuser(AccountId, comid);
                                    //微信消息模板
                                    if (list.Weixin != "")
                                    {
                                        new Weixin_tmplmsgManage().WxTmplMsg_CrmIntegralReward(list.Com_id, list.Weixin, "您好," + AccountId + " 积分已经打入您的账户", list.Idcard.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "活动赠送", Intinfo.Money.ToString(), list.Integral.ToString(), "如有疑问,请致电客服。");
                                    }
                                }
                            }
                        }
                        ret = "OK";
                    }
                    else
                    {
                        ret = "已领取活动";
                    }

                    return(JsonConvert.SerializeObject(new { type = 100, msg = ret }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "Unlogin" }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
コード例 #11
0
        public string comlogo = ""; //公司logo地址

        protected void Page_Load(object sender, EventArgs e)
        {
            openid = Request["openid"];
            act    = Request["act"];
            aid    = Request["aid"].ToString();

            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();


            //如果SESSION有值,进行赋值
            if (openid == "" && Session["Openid"] != null)
            {
                openid = Session["Openid"].ToString();
            }

            //根据域名读取商户ID,如果没有绑定域名直接跳转后台
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }

            if (comid != 0)
            {
                //根据公司id得到公司logo地址和公司名称
                comname = B2bCompanyData.GetCompany(comid).Com_name;
                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

                if (pro != null)
                {
                    comlogo = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0));
                }
            }
            //如果账户登陆状态则读取用户信息
            if (Session["AccountId"] != null)
            {
                //获取用户卡号
                B2bCrmData crmdate  = new B2bCrmData();
                B2b_crm    crmmodle = crmdate.Readuser(Int32.Parse(Session["AccountId"].ToString()), comid);

                if (crmmodle != null)
                {
                    cardcode = crmmodle.Idcard;
                }

                //获取优惠劵信息 对已领的优惠劵和未领的优惠劵
                if (aid != "")
                {
                    MemberActivityData actdata = new MemberActivityData();
                    if (act == "A")//已领的优惠劵
                    {
                        Member_Activity actmodel = actdata.AccountActInfo(Int32.Parse(aid), Int32.Parse(Session["AccountId"].ToString()), comid, out totalcount);
                        if (actmodel != null)
                        {
                            Actend   = actmodel.Actend.ToString("yyyy-MM-dd");
                            Title    = actmodel.Title;
                            usestate = actmodel.Usestate;
                            Atitle   = actmodel.Atitle;
                            Remark   = actmodel.Remark.Replace(((char)10).ToString(), "<br />");
                            //Useremark = actmodel.Useremark;
                            Usetitle = actmodel.Usetitle.Replace(((char)10).ToString(), "<br />");
                        }
                    }
                    else
                    {//未领取的
                        Member_Activity actmodel = actdata.UnAccountActInfo(Int32.Parse(aid), 0, comid, out totalcount);
                        if (actmodel != null)
                        {
                            Actend = actmodel.Actend.ToString("yyyy-MM-dd");
                            Title  = actmodel.Title;
                            Atitle = actmodel.Atitle;
                            Remark = actmodel.Remark.Replace(((char)10).ToString(), "<br />");
                            //Useremark = actmodel.Useremark.Replace(((char)10).ToString(), "<br />");
                            Usetitle = actmodel.Usetitle;
                            usestate = 6;
                        }
                    }


                    //活动使用门市
                    MemberChannelcompanyData chandata = new MemberChannelcompanyData();
                    var list = chandata.GetUnitListselected(int.Parse(aid));
                    if (list != null)
                    {
                        for (int i = 0; i < list.Count(); i++)
                        {
                            Useremark += list[i].Companyname + " <br>";
                        }
                    }
                }
                else
                {
                    Response.Redirect("/M/Default.aspx");
                }
            }
            else
            {//非会员看未领取的
                if (aid != "")
                {
                    MemberActivityData actdata  = new MemberActivityData();
                    Member_Activity    actmodel = actdata.UnAccountActInfo(Int32.Parse(aid), 0, comid, out totalcount);
                    if (actmodel != null)
                    {
                        Actend    = actmodel.Actend.ToString("yyyy-MM-dd");
                        Title     = actmodel.Title;
                        Atitle    = actmodel.Atitle;
                        Remark    = actmodel.Remark.Replace(((char)10).ToString(), "<br />");
                        Useremark = actmodel.Useremark.Replace(((char)10).ToString(), "<br />");
                        Usetitle  = actmodel.Usetitle.Length > 14 ? actmodel.Usetitle.Substring(0, 13) + "." : actmodel.Useremark;
                        usestate  = 5;
                    }
                }
            }
        }