private void InitController() { BCtrl_Exhibition bll = new BCtrl_Exhibition(); DataTable table = bll.GetExhibitionTable(); if (table != null) { foreach (DataRow dr in table.Rows) { this.sel_exhibition.Items.Add(new ListItem(dr["ExhibitionTitle"].ToString(), dr["ExhibitionID"].ToString())); } } }
public string DeleteExhibition(HttpContext context) { int exhibitionID = 0; if (int.TryParse(context.Request.Form["exhibitionid"], out exhibitionID)) { BCtrl_Exhibition bll = new BCtrl_Exhibition(); if (bll.DeleteExhibition(exhibitionID)) { return(string.Format(G.JSON_OK_STATE_STRING, "删除成功")); } else { return(string.Format(G.JSON_ERROR_STATE_STRING, "删除失败")); } } else { return(string.Format(G.JSON_ERROR_STATE_STRING, "获取参数失败")); } }
private void InitExhibition() { BCtrl_Exhibition bll = new BCtrl_Exhibition(); item = bll.GetEntity(id); if (item != null) { this.txt_exhibitionname.Value = item.ExhibitionTitle; this.txt_exhibitionlocation.Value = item.ExhibitionLocation; this.txt_starttime.Value = item.ExhibitionStartTime.ToString("yyyy-MM-dd HH:mm:ss"); this.txt_endTime.Value = item.ExhibitionEndTime.ToString("yyyy-MM-dd HH:mm:ss"); this.txt_exhibitionaddress.Value = item.ExhibitionAddress; this.txt_exhibitiontraffic.Value = item.ExhibitionTraffic; this.txt_exhibitionabstract.Value = item.ExhibitionAbstract; this.txt_exhibitionabout.Value = item.ExhibitionAbout; this.txt_exhibitionbooklistdesc.Value = item.ExhibitionBookListDesc; //this.txt_advertisementtitle.Value = item.AdvertisementList.ToString(); if (item.AdvertisementList != null) { string tmploc = ""; foreach (AdvertisementEntity adv in item.AdvertisementList) { tmploc += adv.AdvertisementTitle + "\n"; } this.txt_advertisementtitle.Value = tmploc; } this.chk_statetype.Checked = item.StateTypeID == 1; this.chk_ispublish.Checked = item.IsPublish; this.chk_isdownloadbooklist.Checked = item.IsDownloadBookList; this.txt_booklistdownloadurl.Value = item.BookListDownloadUrl; this.hid_eid.Value = item.ExhibitionID.ToString(); this.hid_imgurl.Value = item.ExhibitionLogoUrl; } }
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 }
protected void btn_submit_Click(object sender, EventArgs e) { StringBuilder strJs = new StringBuilder(); strJs.Append("<script type='text/javascript'>"); strJs.Append("bootbox.alert('保存失败');"); strJs.Append("</script>"); try { #region 填充 int eid = 0; int.TryParse(this.hid_eid.Value, out eid); ExhibitionEntity item = new ExhibitionEntity() { ExhibitionID = eid, ExhibitionTitle = this.txt_exhibitionname.Value, ExhibitionLocation = this.txt_exhibitionlocation.Value, ExhibitionStartTime = Convert.ToDateTime(this.txt_starttime.Value), ExhibitionEndTime = Convert.ToDateTime(this.txt_endTime.Value), ExhibitionAddress = this.txt_exhibitionaddress.Value, ExhibitionTraffic = this.txt_exhibitiontraffic.Value, ExhibitionAbstract = this.txt_exhibitionabstract.Value, ExhibitionAbout = this.txt_exhibitionabout.Value, ExhibitionBookListDesc = this.txt_exhibitionbooklistdesc.Value, BookListDownloadUrl = this.txt_booklistdownloadurl.Value, CreateTime = DateTime.Now, CreateUserID = this.CurrentAdmin.Sys_UserID, ExhibitionOrder = 1000, StateTypeID = this.chk_statetype.Checked ? 1 : 0, IsPublish = this.chk_ispublish.Checked, IsDownloadBookList = this.chk_isdownloadbooklist.Checked }; item.AdvertisementList = new List <AdvertisementEntity>(); string[] elocs = this.txt_advertisementtitle.Value.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); if (elocs != null) { foreach (string loc in elocs) { AdvertisementEntity locEntity = new AdvertisementEntity() { ExhibitionID = eid, CreateTime = DateTime.Now, CreateUserID = this.CurrentAdmin.Sys_UserID, AdvertisementOrder = 1000, AdvertisementTitle = loc, AdvertisementUrl = "", StateTypeID = this.chk_statetype.Checked ? 1 : 0 }; item.AdvertisementList.Add(locEntity); } } #endregion if (this.txt_imageurl.HasFile) { string fileName = txt_imageurl.FileName; string tempPath = Server.MapPath("~/UploadFile/ExhibitionLogo/"); if (!Directory.Exists(tempPath)) { Directory.CreateDirectory(tempPath); } fileName = System.IO.Path.GetFileName(fileName); //获取文件名(不带路径) string currFileExtension = System.IO.Path.GetExtension(fileName); //获取文件的扩展名 string currFilePath = tempPath + fileName; //获取上传后的文件路径 记录到前面声明的全局变量 this.txt_imageurl.SaveAs(currFilePath); item.ExhibitionLogoUrl = "/UploadFile/ExhibitionLogo/" + fileName; } else { item.ExhibitionLogoUrl = hid_imgurl.Value; } BCtrl_Exhibition bll = new BCtrl_Exhibition(); if (bll.Save(item)) { strJs = strJs.Clear(); strJs.Append("<script type='text/javascript'>"); strJs.Append("bootbox.alert('保存成功', function () {"); strJs.Append(@"if (window.parent != undefined) { window.parent.TObj('tmpExhibitionList')._prmsData.ts = new Date().getTime(); window.parent.TObj('tmpExhibitionList').S(); window.parent.asyncbox.close('exhibition'); } })"); strJs.Append("</script>"); } } catch (Exception ex) { Utils.LogUtil.WriteLog(ex); strJs = strJs.Clear(); strJs.Append("<script type='text/javascript'>"); strJs.Append("bootbox.alert('保存失败');"); strJs.Append("</script>"); } ClientScript.RegisterStartupScript(this.GetType(), "LoadExhibitionScript", strJs.ToString()); }
private void button1_Click(object sender, EventArgs e) { BCtrl_Exhibition bll = new BCtrl_Exhibition(); MessageBox.Show(bll.IsPublished().ToString()); }