Exemple #1
0
        private DataTable GetQueryData(bool isDownload)
        {
            searchAppUpdateEntity entity = new searchAppUpdateEntity();
            int          totalcnt        = 0;
            int          AppType         = 0;
            BCtrl_Common bll             = new BCtrl_Common();

            if (!string.IsNullOrEmpty(txtStartTime))
            {
                string.Format("{0} 00:00:00", txtStartTime);
                entity.txtStartTime = txtStartTime;
            }
            if (!string.IsNullOrEmpty(txtEndTime))
            {
                string.Format("{0} 23:59:59", txtEndTime);
                entity.txtEndTime = txtEndTime;
            }
            if (!string.IsNullOrEmpty(txtVersion))
            {
                entity.txtVersion = txtVersion;
            }
            int.TryParse(selAppType, out AppType);
            entity.selAppType      = AppType;
            entity.PageSize        = base.PageSize;
            entity.PageIndex       = base.PageIndex;
            entity.UseDBPagination = !isDownload;
            entity.OrderfieldType  = OrderFieldType.Desc;
            DataTable db = bll.GetAppUpdateList(entity, out totalcnt);

            base.TotalRecords = totalcnt;
            return(db);
        }
Exemple #2
0
        public void InitData()
        {
            BCtrl_Common    commonobj = new BCtrl_Common();
            AppUpdateEntity entity    = new AppUpdateEntity();

            entity = commonobj.TryGetVersion(id);
            if (entity.AppType != 0)
            {
                this.txtapptype.Value        = entity.AppType.ToString();
                this.txtVersion.Value        = entity.Version;
                this.txtdownloadUrl.Value    = entity.DownloadUrl;
                this.txtforcedUpdate.Value   = (entity.ForcedUpdate?"1":"0");
                this.txtSize.Value           = entity.AppSize.ToString();
                this.txt_updateProfile.Value = entity.UpdateProfile;
                this.Hidtime.Value           = Convert.ToDateTime(entity.CreateTime).ToString();
                this.hidPid.Value            = id.ToString();
            }
        }
        public string delAppUpdate(HttpContext context)
        {
            int    appid = 0;
            string stat  = "{\"status\":0}";

            int.TryParse(context.Request.Form["appid"], out appid);
            BCtrl_Common bll = new BCtrl_Common();
            string       flg = bll.deleteAppUpdate(appid);

            if (flg == "1")
            {
                stat = "{\"status\":1}";
            }
            else
            {
                stat = "{\"status\":0}";
            }
            return(stat);
        }
        public string UpdateAppVersion(HttpContext context)
        {
            string statu = "{\"status\":0}";
            bool   flg   = false;
            int    type  = 0;
            bool   force = false;
            int    size  = 0;
            int    appid = 0;

            try
            {
                BCtrl_Common    bll    = new BCtrl_Common();
                AppUpdateEntity entity = new AppUpdateEntity();
                int.TryParse(context.Request.Form["apptype"].ToString(), out type);
                entity.AppType       = type;
                entity.Version       = context.Request.Form["version"];
                entity.UpdateProfile = HttpUtility.UrlDecode(context.Request.Form["profile"], Encoding.UTF8);
                entity.DownloadUrl   = HttpUtility.UrlDecode(context.Request.Form["downurl"], Encoding.UTF8);
                bool.TryParse(context.Request.Form["forcedupdate"] == "1" ? "true" : "false", out force);
                entity.ForcedUpdate = force;
                int.TryParse(context.Request.Form["size"], out size);
                int.TryParse(context.Request.Form["appid"], out appid);
                entity.AppId   = appid;
                entity.AppSize = size;
                flg            = bll.UpdateAppVersion(entity);
                if (flg)
                {
                    statu = "{\"status\":1}";
                }
                else
                {
                    statu = "{\"status\":2}";  //修改失败
                }
            }
            catch (Exception e)
            {
                LogUtil.WriteLog(e);
                statu = "{\"status\":0}";  //数据传输错误
            }
            return(statu);
        }
Exemple #5
0
        public ExhibitionModule()
            : base("/Exhibition")
        {
            #region  设置展场根据时间展示
            Get["/ActivityTime"] = _ =>
            {
                BCtrl_Exhibition exhibition = new BCtrl_Exhibition();
                bool             isPush     = exhibition.IsPublished();
                return(JsonObj <JsonMessageBase <bool> > .ToJson(new JsonMessageBase <bool>() { Status = 1, Msg = "数据传输完成!!", Value = isPush }));

                //return JsonObj<JsonMessageBase<bool>>.ToJson(new JsonMessageBase<bool>() { Status = 1, Msg = "数据传输完成!!", Value = true });
            };
            #endregion

            #region  获取是否是版本审核
            Get["/CheckState"] = _ =>
            {
                try
                {
                    BCtrl_Common commonobj = new BCtrl_Common();
                    dynamic      data      = FecthQueryData();
                    string       verCode   = data.VerCode; //string verCode = "1";
                    bool         isCheck   = commonobj.IsVersionCheck(verCode);
                    return(JsonObj <JsonMessageBase <bool> > .ToJson(new JsonMessageBase <bool>() { Status = 1, Msg = "Data transfer Complete!!", Value = isCheck }));
                }
                catch (Exception ex)
                {
                    LogUtil.WriteLog(ex);
                    return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                    {
                        Status = 0, Msg = "Failed to connect to the server,Try again later."
                    }));
                }
            };
            #endregion

            #region 发送邮件
            Get["/SendEmail"] = _ =>
            {
                dynamic data = FecthQueryData();
                ExhibitionEmailEntity entity = new ExhibitionEmailEntity();
                string eID   = data.Eid;      //展场ID
                string cID   = data.UserID;   //用户ID
                string cName = data.NickName; //用户名
                string email = data.Email;    //email

                int exhibitionID = 0;
                int customerID   = 0;
                int.TryParse(eID, out exhibitionID);
                int.TryParse(cID, out customerID);
                entity.ExhibitionID  = exhibitionID;
                entity.CustomerID    = customerID.ToString();
                entity.CustomerName  = cName;
                entity.CustomerEmail = email;
                entity.CreateTime    = DateTime.Now;
                entity.SendTypeID    = 0;
                //展场邮件时间设定
                DateTime?sendTime = DateTime.Parse("2016-01-07 08:20:00");

                if (entity.CustomerName == null || string.IsNullOrEmpty(entity.CustomerName))
                {
                    entity.CustomerName = "开卷日历大客户";
                }

                if (entity.CreateTime < sendTime) // 测试 求反
                {
                    entity.SendTime = sendTime;
                    BCtrl_ExhibitionEmail.Instance.ExhibitionEmail_Insert(entity);
                }
                else
                {
                    entity.SendTime = entity.CreateTime;
                    SendEmailEntity sendEntity = new SendEmailEntity();
                    BCtrl_UserMail  bllMail    = new BCtrl_UserMail();
                    List <CompanyEmailAccountEntity> mailList = bllMail.QueryCoEmailAccountList();
                    Random rd = new Random();
                    if (mailList == null || mailList.Count == 0)
                    {
                        return(JsonObj <JsonMessageBase <bool> > .ToJson(new JsonMessageBase <bool>() { Status = 0, Msg = "邮箱服务器地址库为空!!", Value = false }));
                    }
                    //随机找出一个服务器地址
                    int num = rd.Next(0, mailList.Count - 1);
                    #region 发送邮件固定参数
                    CompanyEmailAccountEntity cea = mailList[num];
                    sendEntity.FromEmail    = cea.EmailName;
                    sendEntity.FromSendName = "开卷网络";
                    sendEntity.FromPassword = cea.EmailPassword;
                    sendEntity.ToSendName   = entity.CustomerName;
                    sendEntity.ToEmail      = entity.CustomerEmail;
                    sendEntity.Subject      = "2016年北京图书订货会电子书目——由北京开卷收集整理";
                    sendEntity.Body         = "基于2016年图书订货会,这是开卷搜集并整理订货会参展商的电子书目。";
                    sendEntity.Body        += "<span style='font-family: Arial; line-height: 23.8px; color: rgb(255, 255, 255); background-color: rgb(255, 0, 0);'>【此文件大小超过3G,请务必使用电脑进行下载】</span> <br />";
                    sendEntity.Body        += "下载链接: http://pan.baidu.com/s/1bpjF5c ";
                    sendEntity.Body        += "密码: ijex   <br />";
                    sendEntity.Body        += "开卷日历APP——网络书业人和事。<br />";
                    sendEntity.Body        += "<img src='http://7xkwie.com2.z0.glb.qiniucdn.com/20151201/e3834448-e386-45b8-93cc-01a92744e5e8.jpg' alt='扫一扫' ></img>";
                    #endregion
                    bool state = SendEmail.Send(sendEntity);
                    if (state)
                    {
                        //单条发送时,发送后改变发送状态
                        entity.SendTypeID = 1;
                        BCtrl_ExhibitionEmail.Instance.ExhibitionEmail_Insert(entity);
                    }
                }
                return(JsonObj <JsonMessageBase <bool> > .ToJson(new JsonMessageBase <bool>() { Status = 1, Msg = "数据传输完成!!", Value = true }));
            };
            #endregion
        }
Exemple #6
0
        public CommonModule()
            : base("/Common")
        {
            BCtrl_Common commonobj = new BCtrl_Common();

            //获取服务器时间
            Get["FetchServerTime"] = _ =>
            {
                return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                {
                    Status = 1, Tag = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                }));
            };

            Post["/BindPhone"] = _ =>
            {
                try
                {
                    dynamic data  = FetchFormData();
                    string  phone = data.Phone;
                    string  vcode = data.VCode;
                    string  pwd   = data.Pwd;
                    string  msg   = string.Empty;
                    if (CurrentUser != null && SmsMananger.BindPhone(phone, vcode, CurrentUser.UserID, pwd, out msg))
                    {
                        return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                        {
                            Status = 1, Msg = "绑定成功!!"
                        }));
                    }
                    else
                    {
                        return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                        {
                            Status = 0, Msg = string.IsNullOrEmpty(msg) ? "当前用户无效" : msg
                        }));
                    }
                }
                catch (Exception ex)
                {
                    LogUtil.WriteLog(ex);
                    return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                    {
                        Status = 0, Msg = ex.Message
                    }));
                }
            };

            Post["AddFeedback"] = _ =>
            {
                try
                {
                    FeedbackEntity e = FetchFormData <FeedbackEntity>();
                    e.UserID = CurrentUser.UserID;
                    bool state = commonobj.AddFeedback(e);
                    if (state)
                    {
                        return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                        {
                            Status = 1, Msg = "保存成功"
                        }));
                    }
                    else
                    {
                        return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                        {
                            Status = 0, Msg = "保存失败"
                        }));
                    }
                }
                catch (Exception ex)
                {
                    return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                    {
                        Status = 0, Msg = ex.Message
                    }));
                }
            };


            Post["/BindSns"] = _ =>
            {
                try
                {
                    dynamic           data     = FetchFormData();
                    string            thirdid  = data.ThirdID;       //Request.Form.ThirdID;
                    string            username = data.ThirdUserName; //Request.Form.ThirdUserName;
                    int               type     = data.ThirdType;     //Request.Form.ThirdType;
                    string            picurl   = data.Url;
                    BCtrl_Auth        authobj  = new BCtrl_Auth();
                    UserSessionEntity ue       = authobj.IsThereExistUser(username, thirdid, type, picurl);
                    if (ue != null)
                    {
                        return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                        {
                            Status = 0, Msg = username + " 已是APP用户,无需再次绑定!"
                        }));
                    }

                    bool rt = new BCtrl_Auth().AddSnsBinding(CurrentUser.UserID, username, thirdid, type, picurl);
                    return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                    {
                        Status = rt ? 1 : 0, Msg = rt ? "绑定成功!" : "绑定失败!请稍后重试"
                    }));
                }
                catch (Exception ex)
                {
                    LogUtil.WriteLog(ex);
                    return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                    {
                        Status = 0, Msg = "服务器连接失败,请稍后重试"
                    }));
                }


                //UserSessionEntity ue = authobj.TryLoginX(username, thirdid, type, picurl);
                //if (ue != null)
                //{
                //    string sessionid = SessionCenter.AddSessionIdentity(ue);
                //    if (!string.IsNullOrEmpty(sessionid))
                //    {
                //        ue.SessionID = sessionid;
                //        return JsonObj<JsonMessageBase<UserSessionEntity>>.ToJson(new JsonMessageBase<UserSessionEntity>() { Status = 1, Msg = "登录成功", Value = ue });
                //    }
                //    else
                //    {
                //        return JsonObj<JsonMessageBase<UserSessionEntity>>.ToJson(new JsonMessageBase<UserSessionEntity>() { Status = 0, Msg = "创建登录会话失败,请稍后重试!" });
                //    }
                //}
                //else
                //{
                //    return JsonObj<JsonMessageBase<UserSessionEntity>>.ToJson(new JsonMessageBase<UserSessionEntity>() { Status = 0, Msg = "登录失败" });
                //}
            };

            #region  根据版本号,获取到时候可以打开内容
            Get["/CheckState"] = _ =>
            {
                try
                {
                    dynamic      data      = FetchFormData();
                    string       verCode   = data.VerCode; //Request.Form.ThirdID;
                    BCtrl_Common commonBll = new BCtrl_Common();
                    bool         isCheck   = commonBll.IsVersionCheck(verCode);
                    return(JsonObj <JsonMessageBase <bool> > .ToJson(new JsonMessageBase <bool>() { Status = 1, Msg = "数据传输完成!!", Value = isCheck }));
                }
                catch (Exception ex)
                {
                    LogUtil.WriteLog(ex);
                    return(JsonObj <JsonMessageBase> .ToJson(new JsonMessageBase()
                    {
                        Status = 0, Msg = "服务器连接失败,请稍后重试"
                    }));
                }
            };
            #endregion
        }