예제 #1
0
        private DataTable GetDataTableFromRepeater()
        {
            DataRow   row;
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("FieldName");
            dataTable.Columns.Add("FieldValue");
            dataTable.Columns.Add("FieldType");
            dataTable.Columns.Add("FieldLevel");
            foreach (RepeaterItem item in this.RepModel.Items)
            {
                FieldControl control = (FieldControl)item.FindControl("Field");
                switch (control.ControlType)
                {
                case FieldType.PictureType:
                {
                    PictureType type2 = (PictureType)control.FindControl("EasyOne2007");
                    row = dataTable.NewRow();
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type2.FieldValue;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    if ((control.Settings.Count > 7) && DataConverter.CBoolean(control.Settings[7]))
                    {
                        DataRow row2 = dataTable.NewRow();
                        row2["FieldName"]  = "UploadFiles";
                        row2["FieldValue"] = type2.UploadFiles;
                        row2["FieldType"]  = FieldType.TextType;
                        row2["FieldLevel"] = 0;
                        dataTable.Rows.Add(row2);
                    }
                    continue;
                }

                case FieldType.FileType:
                {
                    FileType type3 = (FileType)control.FindControl("EasyOne2007");
                    row = dataTable.NewRow();
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type3.FieldValue;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    if (DataConverter.CBoolean(control.Settings[3]))
                    {
                        DataRow row3 = dataTable.NewRow();
                        row3["FieldName"]  = control.Settings[4];
                        row3["FieldValue"] = type3.FileSize;
                        row3["FieldType"]  = FieldType.TextType;
                        row3["FieldLevel"] = control.FieldLevel;
                        dataTable.Rows.Add(row3);
                    }
                    continue;
                }

                case FieldType.NodeType:
                {
                    EasyOne.WebSite.Controls.FieldControl.NodeType type5 = (EasyOne.WebSite.Controls.FieldControl.NodeType)control.FindControl("EasyOne2007");
                    row = dataTable.NewRow();
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type5.FieldValue;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    row = dataTable.NewRow();
                    row["FieldName"]  = "infoid";
                    row["FieldValue"] = type5.InfoNodeId;
                    row["FieldType"]  = FieldType.InfoType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    continue;
                }

                case FieldType.InfoType:
                {
                    continue;
                }

                case FieldType.AuthorType:
                {
                    if ((control.Settings.Count > 1) && DataConverter.CBoolean(control.Settings[1]))
                    {
                        this.Session["AuthorValue"] = control.Value;
                    }
                    row = dataTable.NewRow();
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = control.Value;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    continue;
                }

                case FieldType.SourceType:
                {
                    if ((control.Settings.Count > 1) && DataConverter.CBoolean(control.Settings[1]))
                    {
                        this.Session["SourceValue"] = control.Value;
                    }
                    row = dataTable.NewRow();
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = control.Value;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    continue;
                }

                case FieldType.KeywordType:
                {
                    row = dataTable.NewRow();
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = StringHelper.ReplaceChar(control.Value.Trim(), ' ', '|');
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    continue;
                }

                case FieldType.ContentType:
                {
                    ContentType type = (ContentType)control.FindControl("EasyOne2007");
                    row = dataTable.NewRow();
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type.Content;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    if (type.SaveRemotePic)
                    {
                        if (string.IsNullOrEmpty(this.m_ContentFieldName))
                        {
                            break;
                        }
                        this.m_ContentFieldName = this.m_ContentFieldName + "$" + control.FieldName;
                    }
                    continue;
                }

                case FieldType.TitleType:
                {
                    TitleType type6 = (TitleType)control.FindControl("EasyOne2007");
                    row = dataTable.NewRow();
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = control.Value;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    string pinyinTitle = type6.PinyinTitle;
                    if (string.IsNullOrEmpty(pinyinTitle))
                    {
                        pinyinTitle = ChineseSpell.MakeSpellCode(control.Value, SpellOptions.EnableUnicodeLetter);
                    }
                    row = dataTable.NewRow();
                    row["FieldName"]  = "PinyinTitle";
                    row["FieldValue"] = pinyinTitle;
                    row["FieldType"]  = FieldType.TextType;
                    row["FieldLevel"] = 0;
                    dataTable.Rows.Add(row);
                    continue;
                }

                case FieldType.MultiplePhotoType:
                {
                    MultiplePhotoType type4 = (MultiplePhotoType)control.FindControl("EasyOne2007");
                    row = dataTable.NewRow();
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type4.FieldValue;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    dataTable.Rows.Add(row);
                    continue;
                }

                default:
                    goto Label_0773;
                }
                this.m_ContentFieldName = this.m_ContentFieldName + control.FieldName;
                continue;
Label_0773:
                row = dataTable.NewRow();
                row["FieldName"]  = control.FieldName;
                row["FieldValue"] = control.Value;
                row["FieldType"]  = control.ControlType;
                row["FieldLevel"] = control.FieldLevel;
                dataTable.Rows.Add(row);
            }
            if (this.m_Action == "add")
            {
                row = dataTable.NewRow();
                row["FieldName"]  = "Inputer";
                row["FieldValue"] = PEContext.Current.Admin.UserName;
                row["FieldType"]  = FieldType.TextType;
                row["FieldLevel"] = 0;
                dataTable.Rows.Add(row);
            }
            if (GetStatusFromDataTable(dataTable) == 0x63)
            {
                row = dataTable.NewRow();
                row["FieldName"]  = "Editor";
                row["FieldValue"] = PEContext.Current.Admin.AdminName;
                row["FieldType"]  = FieldType.TextType;
                row["FieldLevel"] = 0;
                dataTable.Rows.Add(row);
                row = dataTable.NewRow();
                row["FieldName"]  = "PassedTime";
                row["FieldValue"] = DateTime.Now.ToString("yyyy-MM-dd");
                row["FieldType"]  = FieldType.DateTimeType;
                row["FieldLevel"] = 0;
                dataTable.Rows.Add(row);
            }
            return(dataTable);
        }
예제 #2
0
        private DataTable GetDataTableFromRepeater()
        {
            DataTable table = new DataTable();

            table.Columns.Add("FieldName");
            table.Columns.Add("FieldValue");
            table.Columns.Add("FieldType");
            table.Columns.Add("FieldLevel");
            foreach (RepeaterItem item in this.RepContentForm.Items)
            {
                FieldControl control = (FieldControl)item.FindControl("Field");
                DataRow      row     = table.NewRow();
                switch (control.ControlType)
                {
                case FieldType.PictureType:
                {
                    PictureType type2 = (PictureType)control.FindControl("EasyOne2007");
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type2.FieldValue;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    table.Rows.Add(row);
                    if ((control.Settings.Count > 7) && DataConverter.CBoolean(control.Settings[7]))
                    {
                        DataRow row2 = table.NewRow();
                        row2["FieldName"]  = "UploadFiles";
                        row2["FieldValue"] = type2.UploadFiles;
                        row2["FieldType"]  = FieldType.TextType;
                        row2["FieldLevel"] = 0;
                        table.Rows.Add(row2);
                    }
                    continue;
                }

                case FieldType.FileType:
                {
                    FileType type3 = (FileType)control.FindControl("EasyOne2007");
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type3.FieldValue;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    table.Rows.Add(row);
                    if (DataConverter.CBoolean(control.Settings[3]))
                    {
                        DataRow row3 = table.NewRow();
                        row3["FieldName"]  = control.Settings[4];
                        row3["FieldValue"] = type3.FileSize;
                        row3["FieldType"]  = FieldType.TextType;
                        row3["FieldLevel"] = control.FieldLevel;
                        table.Rows.Add(row3);
                    }
                    continue;
                }

                case FieldType.NodeType:
                {
                    EasyOne.WebSite.Controls.FieldControl.NodeType type7 = (EasyOne.WebSite.Controls.FieldControl.NodeType)control.FindControl("EasyOne2007");
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type7.FieldValue;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    table.Rows.Add(row);
                    DataRow row4 = table.NewRow();
                    row4["FieldName"]  = "infoid";
                    row4["FieldValue"] = type7.InfoNodeId;
                    row4["FieldType"]  = FieldType.InfoType;
                    row4["FieldLevel"] = control.FieldLevel;
                    table.Rows.Add(row4);
                    continue;
                }

                case FieldType.AuthorType:
                {
                    AuthorType type8 = (AuthorType)control.FindControl("EasyOne2007");
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = this.ReplaceQutoChar(type8.FieldValue);
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    table.Rows.Add(row);
                    continue;
                }

                case FieldType.SourceType:
                {
                    SourceType type6 = (SourceType)control.FindControl("EasyOne2007");
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = this.ReplaceQutoChar(type6.FieldValue);
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    table.Rows.Add(row);
                    continue;
                }

                case FieldType.KeywordType:
                {
                    KeywordType type5 = (KeywordType)control.FindControl("EasyOne2007");
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = this.ReplaceQutoChar(StringHelper.ReplaceChar(type5.FieldValue, ' ', '|'));
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    table.Rows.Add(row);
                    continue;
                }

                case FieldType.ContentType:
                {
                    ContentType type = (ContentType)control.FindControl("EasyOne2007");
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type.Content;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    table.Rows.Add(row);
                    continue;
                }

                case FieldType.MultiplePhotoType:
                {
                    MultiplePhotoType type4 = (MultiplePhotoType)control.FindControl("EasyOne2007");
                    row["FieldName"]  = control.FieldName;
                    row["FieldValue"] = type4.FieldValue;
                    row["FieldType"]  = control.ControlType;
                    row["FieldLevel"] = control.FieldLevel;
                    table.Rows.Add(row);
                    continue;
                }
                }
                row["FieldName"]  = control.FieldName;
                row["FieldValue"] = control.Value;
                row["FieldType"]  = control.ControlType;
                row["FieldLevel"] = control.FieldLevel;
                table.Rows.Add(row);
            }
            DataRow row5 = table.NewRow();

            row5["FieldName"]  = "Inputer";
            row5["FieldValue"] = PEContext.Current.User.UserName;
            row5["FieldType"]  = FieldType.TextType;
            row5["FieldLevel"] = 0;
            table.Rows.Add(row5);
            return(table);
        }