protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                string   Checkbox_Value       = WebHelper.GetStringParam(Request, "Checkbox", "");
                string[] Checkbox_Value_Array = Checkbox_Value.Split(',');
                Int32    IDX = 0;
                for (int i = 0; i < Checkbox_Value_Array.Length; i++)
                {
                    if (Int32.TryParse(Checkbox_Value_Array[i], out IDX))
                    {
                        DNNGo_PowerForms_Content ContentItem = DNNGo_PowerForms_Content.FindByKeyForEdit(IDX);

                        if (ContentItem != null && ContentItem.ID > 0 && !String.IsNullOrEmpty(ContentItem.ContentValue))
                        {
                            foreach (DNNGo_PowerForms_ContentItem item in Common.Deserialize <List <DNNGo_PowerForms_ContentItem> >(ContentItem.ContentValue))
                            {
                                if (!String.IsNullOrEmpty(item.ContentValue))
                                {
                                    List <String> files = WebHelper.GetList(item.ContentValue, "<|>");
                                    if (files != null && files.Count > 0)
                                    {
                                        foreach (var filename in files)
                                        {
                                            if (!String.IsNullOrEmpty(filename) && filename.IndexOf("Url://") >= 0)
                                            {
                                                try
                                                {
                                                    FileInfo formFile = new FileInfo(MapPath(String.Format("~/Portals/{0}/PowerForms/{1}/{2}", PortalId, ModuleId, filename.Replace("Url://", ""))));
                                                    if (formFile.Exists)
                                                    {
                                                        formFile.Delete();
                                                    }
                                                }
                                                catch
                                                { }
                                            }
                                        }
                                    }
                                }
                            }
                        }


                        if (ContentItem.Delete() > 0)
                        {
                            //删除历史记录成功
                            mTips.IsPostBack = true;
                            mTips.LoadMessage("DeleteHistoryRecordsSuccess", EnumTips.Success, this, new String[] { "" });
                        }
                    }
                }

                BindDataToPage();
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 ArticleStatus = -1;
                DNNGo_PowerForms_Field fieldItem = new DNNGo_PowerForms_Field();
                Int32 SaveResult = SetDataItem(ArticleStatus, out fieldItem);



                if (SaveResult > 0)
                {
                    mTips.LoadMessage("SaveFieldSuccess", EnumTips.Success, this, new String[] { fieldItem.Name });
                    Response.Redirect(xUrl("FieldID", fieldItem.ID.ToString(), "AddNewField"), false);
                }
                else if (SaveResult == -1)
                {
                    mTips.IsPostBack = true;
                    mTips.LoadMessage("AddFieldOverlap", EnumTips.Error, this, new String[] { fieldItem.Name });
                }
                else
                {
                    mTips.IsPostBack = true;
                    mTips.LoadMessage("SaveFieldError", EnumTips.Error, this, new String[] { "" });
                }
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
示例#3
0
        /// <summary>
        /// 列表上的项删除事件
        /// </summary>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

                if (btnRemove != null && !String.IsNullOrEmpty(btnRemove.CommandArgument))
                {
                    mTips.IsPostBack = true;

                    DNNGo_PowerForms_Files Multimedia = DNNGo_PowerForms_Files.FindByKeyForEdit(btnRemove.CommandArgument);

                    if (Multimedia != null && Multimedia.ID > 0)
                    {
                        //if (Multimedia.Status == (Int32)EnumFileStatus.Recycle)
                        //{
                        //要删除实际的文件
                        String DeletePath = Server.MapPath(GetPhotoPath(Multimedia.FilePath));
                        if (Multimedia.Delete() > 0)
                        {
                            //删除文件
                            if (File.Exists(DeletePath))
                            {
                                File.Delete(DeletePath);
                            }

                            //操作成功
                            mTips.LoadMessage("DeleteMediaLibrarySuccess", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        }
                        else
                        {
                            //操作失败
                            mTips.LoadMessage("DeleteMediaLibraryError", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        }
                        //}
                        //else
                        //{
                        //    Multimedia.Status = (Int32)EnumFileStatus.Recycle;
                        //    if (Multimedia.Update() > 0)
                        //    {
                        //        //移动到回收站操作成功
                        //        mTips.LoadMessage("DeleteCommentSuccess", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        //    }
                        //    else
                        //    {
                        //        //移动到回收站操作失败
                        //        mTips.LoadMessage("DeleteCommentError", EnumTips.Success, this, new String[] { Multimedia.FileName });
                        //    }
                        //}
                        BindDataList();
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
示例#4
0
        /// <summary>
        /// 应用效果
        /// </summary>
        protected void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnApply = (LinkButton)sender;


                //要修改默认的主题样式
                String        EffectDirPath = String.Format("{0}Results/{1}/Themes/", Server.MapPath(ModulePath), btnApply.CommandArgument);
                DirectoryInfo EffectDir     = new DirectoryInfo(EffectDirPath);
                if (!EffectDir.Exists)
                {
                    EffectDir.Create();
                }
                DirectoryInfo[] ThemeDirs = EffectDir.GetDirectories();
                if (ThemeDirs != null && ThemeDirs.Length > 0)
                {
                    UpdateModuleSetting("PowerForms_ResultThemeName", ThemeDirs[0].Name);
                }


                UpdateModuleSetting("PowerForms_ResultName", btnApply.CommandArgument);

                mTips.LoadMessage("SaveEffectSuccess", EnumTips.Success, this, new String[] { btnApply.CommandArgument });

                Response.Redirect(xUrl("ResultList"), false);
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        /// <summary>
        /// 更新绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // 设置需要绑定的方案项
                SetDataItem();

                mTips.LoadMessage("UpdateSettingsSuccess", EnumTips.Success, this, new String[] { "" });

                //refresh cache
                SynchronizeModule();

                Response.Redirect(xUrl("Settings"), true);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
示例#6
0
 protected void cmdSynchronizeFiles_Click(object sender, EventArgs e)
 {
     try
     {
         int SynchronizeCount = SynchronizeAllFiles();
         if (SynchronizeCount > 0)
         {
             mTips.LoadMessage("SynchronizeFilesSuccess", EnumTips.Success, this, new object[] { SynchronizeCount });
             Response.Redirect(xUrl("Library"), false);
         }
         else
         {
             mTips.LoadMessage("SynchronizeFilesError", EnumTips.Success, this);
             Response.Redirect(xUrl("Synchronize"), false);
         }
     }
     catch (Exception ex)
     {
         DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
     }
 }
示例#7
0
        /// <summary>
        /// 列表上的项删除事件
        /// </summary>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

                if (btnRemove != null && !String.IsNullOrEmpty(btnRemove.CommandArgument))
                {
                    DNNGo_PowerForms_Field Field = DNNGo_PowerForms_Field.FindByKeyForEdit(btnRemove.CommandArgument);

                    if (Field != null && Field.ID > 0)
                    {
                        mTips.IsPostBack = true;
                        if (Field.Delete() > 0)
                        {
                            //操作成功
                            mTips.LoadMessage("DeleteFieldSuccess", EnumTips.Success, this, new String[] { Field.Alias });
                        }
                        else
                        {
                            //操作失败
                            mTips.LoadMessage("DeleteFieldError", EnumTips.Success, this, new String[] { Field.Alias });
                        }

                        BindDataList();
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        /// <summary>
        /// 更新绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // 设置需要绑定的方案项
                SetDataItem();

                mTips.LoadMessage("SaveStyleSuccess", EnumTips.Success, this, new String[] { "" });

                Response.Redirect(xUrl("ResultStyle"), true);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        /// <summary>
        /// 列表上的项删除事件
        /// </summary>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

                DNNGo_PowerForms_Group item = DNNGo_PowerForms_Group.FindByKeyForEdit(btnRemove.CommandArgument);
                mTips.IsPostBack = true;
                if (item.ID > 0 && item.Delete() > 0)
                {
                    mTips.LoadMessage("DeleteGroupSuccess", EnumTips.Success, this, new String[] { item.Name });
                }
                else
                {
                    mTips.LoadMessage("DeleteGroupError", EnumTips.Success, this, new String[] { item.Name });
                }
                BindDataList();
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
示例#10
0
        /// <summary>
        /// 从XML导入数据
        /// </summary>
        protected void cmdImportFormXml_Click(object sender, EventArgs e)
        {
            try
            {
                HttpPostedFile hpfile = fuImportFormXml.PostedFile;

                if (hpfile.ContentLength > 0)
                {
                    if (Path.GetExtension(hpfile.FileName).IndexOf(".xml", StringComparison.CurrentCultureIgnoreCase) >= 0)
                    {
                        ImportExportHelper ieHelper = new ImportExportHelper();
                        ieHelper.ModuleID = ModuleId;
                        ieHelper.UserId   = UserId;

                        //先清除原有的字段列表
                        QueryParam qp          = new QueryParam();
                        Int32      RecordCount = 0;
                        qp.Where.Add(new SearchParam("ModuleId", ModuleId, SearchType.Equal));
                        List <DNNGo_PowerForms_Field> fieldList = DNNGo_PowerForms_Field.FindAll(qp, out RecordCount);
                        foreach (DNNGo_PowerForms_Field fieldItem in fieldList)
                        {
                            fieldItem.Delete();
                        }

                        //构造需要上传的路径
                        String   XmlFilePath = String.Format("{0}PowerForms\\Import\\{1}_{2}", PortalSettings.HomeDirectoryMapPath, xUserTime.UtcTime().ToString("yyyyMMddHHmmssffff"), fuImportFormXml.FileName);
                        FileInfo XmlFile     = new FileInfo(XmlFilePath);
                        //判断文件夹是否存在
                        if (!XmlFile.Directory.Exists)
                        {
                            XmlFile.Directory.Create();
                        }
                        //保存文件
                        fuImportFormXml.SaveAs(XmlFilePath);

                        XmlFormat xf = new XmlFormat(XmlFilePath);

                        List <FieldEntity> XmlFieldList = xf.ToList <FieldEntity>();


                        Int32 InsertResult = 0;
                        foreach (FieldEntity XmlField in XmlFieldList)
                        {
                            DNNGo_PowerForms_Field FieldItem = ieHelper.XmlToEntity(XmlField);


                            FieldItem.CreateUser = UserId;
                            FieldItem.CreateTime = xUserTime.UtcTime();

                            FieldItem.ModuleId = ModuleId;
                            FieldItem.PortalId = PortalId;

                            FieldItem.LastIP   = WebHelper.UserHost;
                            FieldItem.LastTime = xUserTime.UtcTime();
                            FieldItem.LastUser = UserId;

                            if (FieldItem.Insert() > 0)
                            {
                                InsertResult++;
                            }
                        }

                        //提示
                        mTips.LoadMessage("ImportFieldSuccess", EnumTips.Success, this, new String[] { InsertResult.ToString() });

                        //跳转
                        Response.Redirect(xUrl("FieldList"));
                    }
                    else
                    {
                        //上传文件的后缀名错误
                        mTips.IsPostBack = true;
                        mTips.LoadMessage("UploadFieldExtensionError", EnumTips.Warning, this, new String[] { "xml" });
                    }
                }
                else
                {
                    //为上传任何数据
                    mTips.IsPostBack = true;
                    mTips.LoadMessage("ImportFieldNullError", EnumTips.Success, this, new String[] { "" });
                }
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }