/// <summary> /// 导出表格 /// </summary> /// <param name="SchedulerItem"></param> /// <returns></returns> public String ExportExcel(DNNGo_PowerForms_Scheduler SchedulerItem, Int32 index) { String Attachment = String.Empty; List <DNNGo_PowerForms_Content> DataList = DNNGo_PowerForms_Content.FindAllByModuleId(SchedulerItem.ModuleId); List <DNNGo_PowerForms_Field> FieldList = DNNGo_PowerForms_Field.FindAllByModuleId(SchedulerItem.ModuleId); if (DataList != null && DataList.Count > 0) { if (FieldList != null && FieldList.Count > 0) { String FileName = SchedulerItem.ExcelName; FileName = Common.ReplaceNoCase(FileName, "{yyyy}", DateTime.Now.ToString("yyyy")); FileName = Common.ReplaceNoCase(FileName, "{mm}", DateTime.Now.ToString("MM")); FileName = Common.ReplaceNoCase(FileName, "{dd}", DateTime.Now.ToString("dd")); FileName = Common.ReplaceNoCase(FileName, "{time}", DateTime.Now.ToString("HHmmss")); FileName = Common.ReplaceNoCase(FileName, "{ModuleID}", SchedulerItem.ModuleId.ToString()); Attachment = String.Format("{0}temp\\PowerForms\\{1}.xls", HttpRuntime.AppDomainAppPath, FileName); try { CsvHelper.SaveAsToFile(FieldList, DataList, Attachment, false); } catch (Exception exc) { this.ScheduleHistoryItem.AddLogNote(exc.Source); } } else { this.ScheduleHistoryItem.AddLogNote(String.Format("task {0},field list is empty,Has ignored. time:{1}<br />", index, DateTime.Now.ToString())); } } else { this.ScheduleHistoryItem.AddLogNote(String.Format("task {0},History records is empty,Has ignored. time:{1}<br />", index, DateTime.Now.ToString())); } return(Attachment); }
/// <summary> /// 绑定方案项 /// </summary> private void BindDataItem() { //取出当前的方案实体,并绑定到相应的控件上 DNNGo_PowerForms_Field fieldItem = FieldItem; if (fieldItem == null) { fieldItem = new DNNGo_PowerForms_Field(); } if (fieldItem.ID > 0) { //更新方案 //需要将几个控件设置为不可操作状态 txtName.Enabled = false; ddlControlType.Enabled = false; } else { //新增方案 } //绑定字段类型 //BindFieldTypeView(fieldItem.FieldType); EffectDB EffectDB = Setting_EffectDB; divGroup.Visible = EffectDB.Group; if (EffectDB.Group) { BindTreeGroups(fieldItem); } //增加权限用户 DotNetNuke.Security.Roles.RoleController rc = new DotNetNuke.Security.Roles.RoleController(); WebHelper.BindList(cblPermissionsRoles, rc.GetPortalRoles(PortalId), "RoleName", "RoleName"); WebHelper.SelectedListMultiByValue(cblPermissionsRoles, fieldItem.Per_Roles); cbPermissionsAllUsers.Checked = fieldItem.Per_AllUsers == 0 ? true : false; WebHelper.BindList(ddlControlType, typeof(EnumViewControlType)); WebHelper.SelectedListByValue(ddlControlType, fieldItem.FieldType); WebHelper.BindList(ddlVerification, typeof(EnumVerification)); WebHelper.SelectedListByValue(ddlVerification, fieldItem.Verification); WebHelper.BindList(rblFTDirection, typeof(EnumControlDirection)); WebHelper.SelectedListByValue(rblFTDirection, fieldItem.Direction); List <DNNGo_PowerForms_Field> FieldControls = DNNGo_PowerForms_Field.FindAllByModuleId(ModuleId); WebHelper.BindList <DNNGo_PowerForms_Field>(ddlFTEqualsControl, FieldControls, "Name", "ID"); WebHelper.BindItem(ddlFTEqualsControl, ViewResourceText("lblDDRSelect", "==Please select=="), "0"); WebHelper.SelectedListByValue(ddlFTEqualsControl, fieldItem.EqualsControl); WebHelper.BindList <DNNGo_PowerForms_Field>(ddlFTAssociatedControl, FieldControls.FindAll(r => r.FieldType == (Int32)EnumViewControlType.DropDownList_Country), "Name", "ID"); WebHelper.BindItem(ddlFTAssociatedControl, ViewResourceText("lblDDRSelect", "==Please select=="), "0"); WebHelper.SelectedListByValue(ddlFTAssociatedControl, fieldItem.AssociatedControl); txtName.Text = fieldItem.Name; txtDescription.Text = fieldItem.Description; txtAlias.Text = fieldItem.Alias; txtToolTip.Text = fieldItem.ToolTip; txtFTDefaultValue.Text = fieldItem.DefaultValue; txtTinymceDefaultValue.Text = fieldItem.DefaultValue; txtFTListCollection.Text = fieldItem.FiledList; txtFTRows.Text = fieldItem.Rows.ToString(); WebHelper.SelectedListByValue(rblFTDirection, fieldItem.Direction); txtFTListColumn.Text = fieldItem.ListColumn.ToString(); txtFTInputLength.Text = fieldItem.InputLength.ToString(); txtFTWidth.Text = fieldItem.Width.ToString(); WebHelper.BindList(ddlFTWidth, typeof(EnumWidthSuffix)); WebHelper.SelectedListByValue(ddlFTWidth, fieldItem.WidthSuffix); //文章状态 cbStatus.Checked = fieldItem.Status == (Int32)EnumStatus.Activation; //是否必填 cbRequired.Checked = fieldItem.Required == 1; //发布时间和结束时间 if (FieldID > 0 && fieldItem != null && fieldItem.ID > 0) { liStartDateTime.Text = fieldItem.StartTime.ToString("MM/dd/yyyy hh:mm tt", new CultureInfo("en-US", false)); //Thread.CurrentThread.CurrentCulture liDisableDateTime.Text = fieldItem.EndTime.ToString("MM/dd/yyyy hh:mm tt", new CultureInfo("en-US", false)); //Thread.CurrentThread.CurrentCulture } txtStartDate.Text = fieldItem.StartTime.ToString("MM/dd/yyyy", new CultureInfo("en-US", false)); txtStartTime.Text = fieldItem.StartTime.ToString("hh:mm tt", new CultureInfo("en-US", false)); txtDisableDate.Text = fieldItem.EndTime.ToString("MM/dd/yyyy", new CultureInfo("en-US", false)); txtDisableTime.Text = fieldItem.EndTime.ToString("hh:mm tt", new CultureInfo("en-US", false)); }