private void InitActivity() { BCtrl_Console_Activity bll = new BCtrl_Console_Activity(); item = bll.GetEntity(id); if (item != null) { this.sel_exhibition.Value = item.ExhibitionID.ToString(); //构建单选框 BCtrl_Exhibitor exhibitorBll = new BCtrl_Exhibitor(); List <ExhibitorToCustomerEntity> eList = exhibitorBll.GetExhibitorEntityList(item.ExhibitionID); if (eList != null) { foreach (ExhibitorToCustomerEntity _item in eList) { this.sel_exhibitor.Items.Add(new ListItem(_item.ExhibitorName, _item.ExhibitorID.ToString())); } } this.sel_exhibitor.Value = item.ExhibitorID.ToString(); this.chk_statetype.Checked = item.StateTypeID == 1; this.hid_aid.Value = item.ActivityID.ToString(); this.hid_pid.Value = item.ParentID.ToString(); this.txt_activitytitle.Value = item.ActivityTitle; this.txt_starttime.Value = item.ActivityStartTime.ToString("yyyy-MM-dd HH:mm"); this.txt_endTime.Value = item.ActivityEndTime.ToString("yyyy-MM-dd HH:mm"); this.txt_activitylocation.Value = item.ActivityLocation; this.txt_activityhostunit.Value = item.ActivityHostUnit; this.txt_activityguest.Value = item.ActivityGuest; this.txt_activityabstract.Value = item.ActivityAbstract; this.txt_activityorder.Value = item.ActivityOrder.ToString(); } }
public string ExhibitorList(HttpContext context) { int exhibitionid = 0; int.TryParse(HttpUtility.UrlDecode(context.Request.QueryString["eid"]), out exhibitionid); BCtrl_Exhibitor bll = new BCtrl_Exhibitor(); List <ExhibitorToCustomerEntity> list = bll.GetExhibitorEntityList(exhibitionid); var data = new { state = "1", list = list }; return(Utils.StringUti.ToUnicode(JsonObj <object> .ToJsonString(data))); }
public string DeleteExhibitor(HttpContext context) { int exhibitorID = 0; if (int.TryParse(context.Request.Form["_id"], out exhibitorID)) { BCtrl_Exhibitor bll = new BCtrl_Exhibitor(); if (bll.DeleteExhibitor(exhibitorID)) { 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, "获取参数失败")); } }
public string ChangeExhibitorIsHadBookList(HttpContext context) { int exhibitorID = 0; int isHadBookList = 0; if (int.TryParse(context.Request.Form["_id"], out exhibitorID) && int.TryParse(context.Request.Form["_ishadbooklist"], out isHadBookList)) { BCtrl_Exhibitor bll = new BCtrl_Exhibitor(); if (bll.ChangeExhibitorIsHadBookList(exhibitorID, isHadBookList)) { 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, "获取参数失败")); } }
public string GetExhibitorList(HttpContext context) { string key = HttpUtility.UrlDecode(context.Request.QueryString["key"]); string callback = HttpUtility.UrlDecode(context.Request.QueryString["callback"]); int top = 0; int.TryParse(HttpUtility.UrlDecode(context.Request.QueryString["top"]), out top); int exhibitionid = 0; int.TryParse(HttpUtility.UrlDecode(context.Request.QueryString["exhibitionid"]), out exhibitionid); if (string.IsNullOrEmpty(key)) { return(string.Empty); } StringBuilder sb = new StringBuilder(); BCtrl_Exhibitor bll = new BCtrl_Exhibitor(); List <ExhibitorToCustomerEntity> list = bll.GetExhibitorEntityListUseMyCache(exhibitionid).FindAll(e => e.ExhibitorName.Contains(key.Trim()) || e.ExhibitorPinYin.ToLower().Contains(key.Trim())); int limit = list.Count > top ? top : list.Count; sb.Append(callback + "({\"exhibitors\":["); for (int i = 0; i < limit; i++) { sb.Append("{\"name\":\"" + list[i].ExhibitorName + "\"}"); if (i < limit - 1) { sb.Append(","); } } sb.Append("]})"); return(sb.ToString()); }
private void InitExhibitor() { BCtrl_Exhibitor bll = new BCtrl_Exhibitor(); item = bll.GetExhibitorEntity(id); if (item != null) { this.sel_exhibition.Value = item.ExhibitionID.ToString(); this.txt_exhibitorname.Value = item.ExhibitorName; if (item.ExhibitorLocationList != null) { string tmploc = ""; foreach (ExhibitorLocationEntity loc in item.ExhibitorLocationList) { tmploc += loc.ExhibitorLocation + "\n"; } this.txt_exhibitorlocations.Value = tmploc; } this.chk_ishadbooklist.Checked = item.IsHadBookList; this.chk_statetype.Checked = item.StateTypeID == 1; this.hid_eid.Value = item.ExhibitorID.ToString(); } }
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 { int eid = 0; int.TryParse(this.sel_exhibition.Value, out eid); if (this.file_exhibitor.HasFile) { string fileName = file_exhibitor.FileName; //string tempPath = AppDomain.CurrentDomain.BaseDirectory + "/UploadFile/" + "ExhibitorImport/"; string tempPath = Server.MapPath("~/UploadFile/ExhibitorImport/"); 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.file_exhibitor.SaveAs(currFilePath); using (ExcelHelper excelHelper = new ExcelHelper(currFilePath)) { DataTable table = excelHelper.ExcelToDataTable("Sheet1", true); if (table != null) { BCtrl_Exhibitor bll = new BCtrl_Exhibitor(); if (bll.ImportExhibitors(table, eid, this.CurrentAdmin.Sys_UserID)) { strJs = strJs.Clear(); strJs.Append("<script type='text/javascript'>"); strJs.Append("bootbox.alert('导入成功', function () {"); strJs.Append(@"if (window.parent != undefined) { window.parent.TObj('tmpExhibitorList')._prmsData.ts = new Date().getTime(); window.parent.TObj('tmpExhibitorList').S(); window.parent.asyncbox.close('exhibitorimport'); } })"); strJs.Append("</script>"); } } } if (File.Exists(currFilePath)) { //如果存在则删除 File.Delete(currFilePath); } } } 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(), "LoadPicScript", strJs.ToString()); }
public string ExhibitorEdit(HttpContext context) { int id = 0; int eid = 0; string ename = ""; string eloc = ""; bool ebook = false; bool estate = false; //De(context.Request.Form["rdate"]) if (int.TryParse(context.Request.Form["eid"], out eid) && !string.IsNullOrEmpty(context.Request.Form["ename"])) { int.TryParse(context.Request.Form["id"], out id); bool.TryParse(context.Request.Form["ebook"], out ebook); bool.TryParse(context.Request.Form["estate"], out estate); ename = De(context.Request.Form["ename"]); eloc = De(context.Request.Form["eloc"]); BCtrl_Exhibitor bll = new BCtrl_Exhibitor(); ExhibitorEntity item = new ExhibitorEntity() { ExhibitionID = eid, ExhibitorName = ename, ExhibitorPinYin = Utils.Hz2Py.GetWholePinyin(ename), IsHadBookList = ebook, OBCustomerID = 0, OBCustomerTypeID = 0, rowId = 0, StateTypeID = estate ? 1 : 0, CreateTime = DateTime.Now, CreateUserID = this.CurrentAdmin.Sys_UserID, ExhibitorID = id, ExhibitorLocationList = new List <ExhibitorLocationEntity>() }; string[] elocs = eloc.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); if (elocs != null) { foreach (string loc in elocs) { ExhibitorLocationEntity locEntity = new ExhibitorLocationEntity() { ExhibitorID = id, CreateTime = DateTime.Now, CreateUserID = this.CurrentAdmin.Sys_UserID, ExhibitiorLocationOrder = 1000, ExhibitorLocation = loc, ExhibitorLocationID = 0, StateTypeID = estate ? 1 : 0 }; item.ExhibitorLocationList.Add(locEntity); } } if (id > 0) { if (bll.Update_Exhibitor(item)) { return(string.Format(G.JSON_OK_STATE_STRING, "修改成功")); } else { return(string.Format(G.JSON_ERROR_STATE_STRING, "修改失败")); } } else { if (bll.Add_Exhibitor(item) > 0) { 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, "参数获取失败")); } }