示例#1
0
        public override bool Update(We7.Model.Core.PanelContext data)
        {
            string id     = GetValue <string>(data, "ID");
            Advice advice = AdviceHelper.GetAdvice(id);

            if (advice == null)
            {
                Insert(data);
            }
            else
            {
                advice.Title   = GetValue <string>(data, "Title");
                advice.UserID  = GetValue <string>(data, "UserID");
                advice.Content = GetValue <string>(data, "Content");
                advice.Updated = DateTime.Now;
                advice.Name    = GetValue <string>(data, "Name");
                advice.Email   = GetValue <string>(data, "Email");
                advice.Address = GetValue <string>(data, "Address");
                advice.Phone   = GetValue <string>(data, "Phone");
                advice.Fax     = GetValue <string>(data, "Fax");

                int isshow;
                Int32.TryParse(GetValue <string>(data, "IsShow"), out isshow);
                string stateStr = StateMgr.StateProcess(advice.EnumState, EnumLibrary.Business.AdviceDisplay, isshow);
                advice.IsShow    = isshow;
                advice.EnumState = stateStr;

                advice.Display1 = GetValue <string>(data, "Display1");
                advice.Display2 = GetValue <string>(data, "Display2");
                advice.Display3 = GetValue <string>(data, "Display3");

                //下面是添加模型信息
                string config, schema;
                advice.ModelXml    = GetModelDataXml(data, advice.ModelXml, out schema, out config);//获取模型数据
                advice.ModelConfig = config;
                advice.ModelName   = data.ModelName;
                advice.ModelSchema = schema;
                advice.TypeID      = data.Objects["AdviceTypeID"] as string;

                List <string> udpatedFields = new List <string>()
                {
                    "ModelXml", "ModelName", "ModelSchema", "TypeID", "Title", "UserID", "Content", "Updated", "Name", "Email", "Phone", "Address", "Fax", "Display1", "Display2", "Display3"
                };
                if (!String.IsNullOrEmpty(GetValue <string>(data, "IsShow")))
                {
                    udpatedFields.Add("IsShow");
                }

                AdviceHelper.UpdateAdvice(advice, udpatedFields.ToArray());
                SetValue(data, "ID", advice.ID);
            }
            return(true);
        }
示例#2
0
        protected void SaveSiteButton_Click(object sender, EventArgs e)
        {
            try
            {
                //获取当前站点siteID与channelID
                SiteConfigInfo si = SiteConfigs.GetConfig();

                string fromSiteID      = si.SiteID;
                string fromChannelID   = ChannelID;
                string fromChannelName = ChannelHelper.GetFullPath(fromChannelID);

                //从前台页面获取关联站点ID及栏目ID
                string[] IDs   = ListValue.Text.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
                string[] Names = ListText.Text.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);

                //构造所需传递的状态码字串
                string strEnum = StateMgr.StateInitialize();

                if (IfAutoSharingCHK.Checked)
                {
                    strEnum = StateMgr.StateProcess(strEnum,
                                                    EnumLibrary.Business.SiteSyncType, (int)EnumLibrary.SiteSyncType.AutoSync);
                }
                else
                {
                    strEnum = StateMgr.StateProcess(strEnum,
                                                    EnumLibrary.Business.SiteSyncType, (int)EnumLibrary.SiteSyncType.ManualSync);
                }

                if (IfAutoUseringCHK.Checked)
                {
                    strEnum = StateMgr.StateProcess(strEnum,
                                                    EnumLibrary.Business.SiteAutoUsering, (int)EnumLibrary.SiteAutoUsering.MatchingUser);
                }
                else
                {
                    strEnum = StateMgr.StateProcess(strEnum,
                                                    EnumLibrary.Business.SiteAutoUsering, (int)EnumLibrary.SiteAutoUsering.UnMatchingUser);
                }

                IDHelper.UpdateChannelPartnerships(fromSiteID, fromChannelID, fromChannelName, IDs, Names, strEnum);

                Initilize();

                Messages.ShowMessage("栏目关联关系保存成功!");
            }
            catch (Exception ex)
            {
                Messages.ShowMessage("栏目关联更新失败!出错原因:" + ex.Message);
            }
        }
示例#3
0
        /// <summary>
        /// 栏目类构造函数
        /// </summary>
        public Channel()
        {
            created       = DateTime.Now;
            updated       = DateTime.Now;
            channels      = new List <Channel>();
            securityLevel = 0;
            state         = 1;
            type          = "0";
            isComment     = 0;
            enumState     = StateMgr.StateInitialize();
            int enumValue = (int)EnumLibrary.ChannelContentType.Article;

            enumState = StateMgr.StateProcess(enumState, EnumLibrary.Business.ChannelContentType, enumValue);
        }
示例#4
0
        /// <summary>
        /// 管理员标记为已处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AdminHandButton_Click(object sender, EventArgs e)
        {
            Advice advice = new Advice();

            advice.EnumState    = StateMgr.StateProcess(advice.EnumState, EnumLibrary.Business.AdviceEnum, (int)EnumLibrary.AdviceEnum.AdminHandle);
            advice.State        = (int)AdviceState.Finished;
            advice.Updated      = DateTime.Now;
            advice.ID           = AdviceID;
            advice.AdviceTag    = ddlAdviceTag.SelectedItem.Value;
            advice.ProcessState = ((int)ProcessStates.Finished).ToString();
            string[] fields = new string[] { "ID", "State", "EnumState", "Updated", "AdviceTag", "ProcessState" };
            AdviceHelper.UpdateAdvice(advice, fields);
            actionTable.Visible = false;
            Messages.ShowMessage("反馈已标记为处理。");
        }
示例#5
0
        protected void UnControlDisplayButton_Click(object sender, EventArgs e)
        {
            List <string> adviceIDs = GetIDs();
            int           count     = 0;

            foreach (string adviceID in adviceIDs)
            {
                Advice advice   = AdviceHelper.GetAdvice(adviceID);
                int    state    = (int)EnumLibrary.AdviceDisplay.DefaultDisplay;
                string stateStr = StateMgr.StateProcess(advice.EnumState, EnumLibrary.Business.AdviceDisplay, state);
                advice.EnumState = stateStr;
                string[] fields = new string[] { "EnumState" };
                AdviceHelper.UpdateAdvice(advice, fields);
                count++;
            }
            CurrentQuery = CreateQuery();
            LoadAdvices();
            Messages.ShowMessage(string.Format("您已经成功将{0}条反馈信息追加为 前台显示不控制。", count.ToString()));
        }
示例#6
0
        /// <summary>
        /// 构建Article对象
        /// </summary>
        public Article()
        {
            Created      = DateTime.Now;
            Updated      = DateTime.Now;
            AccountID    = We7Helper.EmptyGUID;
            Overdue      = DateTime.Now.AddMonths(12);
            ContentType  = 2;
            IsDeleted    = 0;
            IsImage      = 0;
            IsShow       = 0;
            State        = 1;
            Clicks       = 0;
            CommentCount = 0;
            EnumState    = StateMgr.StateInitialize();
            int enumValue = (int)EnumLibrary.ArticleType.Article;

            EnumState     = StateMgr.StateProcess(EnumState, EnumLibrary.Business.ArticleType, enumValue);
            ProcessState  = "0";
            ProcessSiteID = SiteConfigs.GetConfig().SiteID;
            ParentID      = We7Helper.EmptyGUID;
            Attachments   = new List <Attachment>();
        }
示例#7
0
        public bool InsertEmailAdvice(We7.Model.Core.PanelContext data)
        {
            Advice advice = new Advice();

            advice.OwnID = Security.CurrentAccountID;
            //advice.TypeID = GetAdviceTypeID(data.ModelName);
            //advice.ID = GetValue<string>(data, "ID");
            advice.Title      = GetValue <string>(data, "Title");
            advice.UserID     = GetValue <string>(data, "UserID");
            advice.Content    = GetValue <string>(data, "Content");
            advice.CreateDate = DateTime.Now;
            advice.Updated    = DateTime.Now;

            advice.Name    = GetValue <string>(data, "Name");
            advice.Email   = GetValue <string>(data, "Email");
            advice.Address = GetValue <string>(data, "Address");
            advice.Phone   = GetValue <string>(data, "Phone");
            advice.Fax     = GetValue <string>(data, "Fax");

            advice.State = (int)AdviceState.WaitAccept;
            advice.SN    = AdviceHelper.CreateArticleSN();
            int isshow;

            Int32.TryParse(GetValue <string>(data, "IsShow"), out isshow);
            string stateStr = StateMgr.StateProcess(advice.EnumState, EnumLibrary.Business.AdviceDisplay, isshow);

            advice.IsShow    = isshow;
            advice.EnumState = stateStr;
            advice.Display1  = GetValue <string>(data, "Display1");
            advice.Display2  = GetValue <string>(data, "Display2");
            advice.Display3  = GetValue <string>(data, "Display3");
            if (advice.SN < 100000)
            {
                advice.SN = advice.SN + 100000;
            }
            advice.MyQueryPwd = We7Helper.CreateNewID().Substring(1, 8);

            //下面是添加模型信息
            string config, schema;

            advice.ModelXml    = GetModelDataXml(data, advice.ModelXml, out schema, out config);//获取模型数据
            advice.ModelConfig = config;
            advice.ModelName   = data.ModelName;
            advice.ModelSchema = schema;
            advice.TypeID      = GetValue <string>(data, "TypeID");
            if (String.IsNullOrEmpty(advice.TypeID))
            {
                AdviceType type = AdviceTypeHelper.GetAdviceTypeByModelName(data.ModelName);
                if (type != null)
                {
                    advice.TypeID = type.ID;
                }
            }

            AdviceHelper.AddAdvice(advice);

            SetValue(data, "ID", advice.ID);
            try
            {
                AdviceHelper.SendNotifyMail(advice.ID);
            }
            catch { }
            finally { }
            return(true);
        }
示例#8
0
        /// <summary>
        /// 获取配置信息
        /// </summary>
        void GetConfigInfo()
        {
            AdviceParticipateMode type       = AdviceParticipateMode.None;
            AdviceType            adviceType = new AdviceType();

            adviceType.EnumState = StateMgr.StateProcess(adviceType.EnumState, EnumLibrary.Business.AdviceMode, Convert.ToInt32(RadlAdviceType.SelectedItem.Value.ToString()));
            //adviceType.ToWhichDepartment = Convert.ToInt32((AdviceToWhichDepartment)int.Parse(ToWhichDepartmentRadioButtonList.SelectedItem.Value.ToString()));
            adviceType.FlowSeries = Convert.ToInt32(FlowSeriesDropDownList.SelectedItem.Value);
            if (EmailCheckBox.Checked && NoteCheckBox.Checked == false)
            {
                type = AdviceParticipateMode.Mail;
            }
            else if (NoteCheckBox.Checked && EmailCheckBox.Checked == false)
            {
                type = AdviceParticipateMode.SMS;
            }
            else if (NoteCheckBox.Checked && EmailCheckBox.Checked)
            {
                type = AdviceParticipateMode.All;
            }

            adviceType.ParticipateMode = Convert.ToInt32(type);

            if (EmailCheckBox.Checked)
            //thehim:仅在邮件参与选中后保存下面数据
            {
                if (FlowInnerDepartCheckBox.Checked)
                {
                    adviceType.FlowInnerDepart = 1;
                }
                else
                {
                    adviceType.FlowInnerDepart = 0;
                }
                string mailMode = "";
                for (int j = 0; j < EmailCheckBoxList.Items.Count; j++)
                {
                    if (EmailCheckBoxList.Items[j].Selected)
                    {
                        mailMode += EmailCheckBoxList.Items[j].Value;
                    }
                }
                adviceType.MailMode       = mailMode;
                adviceType.UseSystemMail  = Convert.ToInt32(UseSystemMailRadioButtonList.SelectedItem.Value.ToString());
                adviceType.MailSMTPServer = SMTPServerTextBox.Text.ToString();
                adviceType.POPServer      = SysPopServerTextBox.Text.ToString();
                adviceType.MailAddress    = EmailAddressTextBox.Text.ToString();
                adviceType.MailUser       = MailUserTextBox.Text.ToString();
                adviceType.MailPassword   = MailPasswordTextBox.Text.ToString();
            }

            if (NoteCheckBox.Checked)
            {
                string noteUser = "";
                for (int i = 0; i < NoteCheckBoxList.Items.Count; i++)
                {
                    if (NoteCheckBoxList.Items[i].Selected)
                    {
                        noteUser += NoteCheckBoxList.Items[i].Value + ",";
                    }
                }
                adviceType.SMSUser = noteUser;
            }
            if (RemindDaysTxtBox.Text.Trim() == "")
            {
                RemindDaysTxtBox.Text = "0";
            }
            adviceType.RemindDays = Convert.ToInt32(RemindDaysTxtBox.Text.Trim());
            adviceType.ID         = AdviceTypeID;
            string[] fields = new string[] { "EnumState", "ToWhichDepartment", "FlowSeries", "ParticipateMode", "FlowInnerDepart", "MailMode", "UseSystemMail", "MailSMTPServer", "POPServer", "MailAddress", "MailUser", "MailPassword", "SMSUser", "RemindDays" };

            AdviceTypeHelper.UpdateAdviceType(adviceType, fields);
            Messages.ShowMessage("模型修改成功!");
        }
示例#9
0
        public override bool Insert(PanelContext data)
        {
            CheckModelData(data);

            Article article = new Article();

            article.ID             = GetValue <string>(data, "ID");
            article.Title          = GetValue <string>(data, "Title");
            article.Description    = GetValue <string>(data, "Description");
            article.SubTitle       = GetValue <string>(data, "SubTitle");
            article.Index          = GetValue <int>(data, "Index");
            article.AllowComments  = GetValue <int>(data, "AllowComments");
            article.Author         = GetValue <string>(data, "Author");
            article.ContentType    = GetValue <int>(data, "ContentType");
            article.ContentUrl     = GetValue <string>(data, "ContentUrl");
            article.Content        = GetValue <string>(data, "Content");
            article.KeyWord        = GetValue <string>(data, "KeyWord");
            article.DescriptionKey = GetValue <string>(data, "DescriptionKey");
            article.Overdue        = GetValue <DateTime>(data, "Overdue");
            article.OwnerID        = GetValue <string>(data, "OwnerID");
            article.Tags           = GetValue <string>(data, "Tags");
            article.PrivacyLevel   = GetValue <int>(data, "PrivacyLevel");
            article.Source         = SiteConfigs.GetConfig().SiteName;
            article.Created        = DateTime.Now;
            article.Updated        = DateTime.Now;
            article.Thumbnail      = GetValue <string>(data, "Thumbnail");
            article.ListKeys       = GetValue <string>(data, "ListKeys");
            article.ListKeys2      = GetValue <string>(data, "ListKeys2");
            article.ListKeys3      = GetValue <string>(data, "ListKeys3");
            article.ListKeys4      = GetValue <string>(data, "ListKeys4");
            article.ListKeys5      = GetValue <string>(data, "ListKeys5");

            string config, schema;

            article.ModelXml    = GetModelDataXml(data, article.ModelXml, out schema, out config);//获取模型数据
            article.ModelConfig = config;
            article.ModelSchema = schema;

            if (article.ModelXml.Length >= MaxCount)
            {
                UIHelper.Message.AppendInfo(MessageType.ERROR, "输入内容过长,请重新输入");
                Logger.WriteLine();
                Logger.WriteDate();
                Logger.Write("输入内容过长");
                Logger.Write(article.ModelXml);
                return(false);
            }

            article.ModelName = data.Model.ModelName;
            article.TableName = data.Table.Name;
            article.State     = GetValue <int>(data, "State");

            if (!String.IsNullOrEmpty(article.OwnerID))
            {
                Channel ch = ChannelHelper.GetChannel(article.OwnerID, null);
                if (ch != null)
                {
                    article.ChannelFullUrl  = ch.FullUrl;
                    article.ChannelName     = ch.FullPath;
                    article.FullChannelPath = ch.FullPath;
                    article.State           = ch.Process != null && ch.Process == "1" ? 2 : article.State;
                }
            }
            int type = 0;

            article.EnumState = StateMgr.StateProcess(article.EnumState, EnumLibrary.Business.ArticleType, type);

            article.AccountID = GetValue <string>(data, "AccountID");
            if (String.IsNullOrEmpty(article.AccountID))
            {
                try
                {
                    article.AccountID = Security.CurrentAccountID;
                }
                catch { }
            }

            ArticleHelper.AddArticle(article);
            ArticleIndexHelper.InsertData(article.ID, 0);
            return(true);
        }
示例#10
0
        public override bool Update(PanelContext data)
        {
            try
            {
                CheckModelData(data);

                Article article = ArticleHelper.GetArticle(GetValue <string>(data, "ID"));
                if (article == null)
                {
                    Insert(data);
                }
                else
                {
                    article.Title          = GetValue <string>(data, "Title");
                    article.Description    = GetValue <string>(data, "Description");
                    article.SubTitle       = GetValue <string>(data, "SubTitle");
                    article.Index          = GetValue <int>(data, "Index");
                    article.AllowComments  = GetValue <int>(data, "AllowComments");
                    article.Author         = GetValue <string>(data, "Author");
                    article.ContentType    = GetValue <int>(data, "ContentType");
                    article.ContentUrl     = GetValue <string>(data, "ContentUrl");
                    article.Content        = GetValue <string>(data, "Content");
                    article.KeyWord        = GetValue <string>(data, "KeyWord");
                    article.DescriptionKey = GetValue <string>(data, "DescriptionKey");
                    article.Overdue        = GetValue <DateTime>(data, "Overdue");
                    article.IsShow         = GetValue <int>(data, "IsShow");
                    article.Tags           = GetValue <string>(data, "Tags");
                    article.OwnerID        = GetValue <string>(data, "OwnerID");
                    article.PrivacyLevel   = GetValue <int>(data, "PrivacyLevel");
                    article.Source         = SiteConfigs.GetConfig().SiteName;
                    article.ListKeys       = GetValue <string>(data, "ListKeys");
                    article.ListKeys2      = GetValue <string>(data, "ListKeys2");
                    article.ListKeys3      = GetValue <string>(data, "ListKeys3");
                    article.ListKeys4      = GetValue <string>(data, "ListKeys4");
                    article.ListKeys5      = GetValue <string>(data, "ListKeys5");

                    article.State = GetValue <int>(data, "State");
                    if (!String.IsNullOrEmpty(article.OwnerID))
                    {
                        Channel ch = ChannelHelper.GetChannel(article.OwnerID, null);
                        if (ch != null)
                        {
                            article.ChannelFullUrl  = ch.FullUrl;
                            article.ChannelName     = ch.FullPath;
                            article.FullChannelPath = ch.FullPath;
                        }
                    }
                    int type = 0;
                    article.EnumState = StateMgr.StateProcess(article.EnumState, EnumLibrary.Business.ArticleType, type);

                    article.Updated = DateTime.Now;

                    string config, schema;
                    article.ModelXml = GetModelDataXml(data, article.ModelXml, out schema, out config);//获取模型数据

                    if (article.ModelXml.Length >= MaxCount)
                    {
                        UIHelper.Message.AppendInfo(MessageType.ERROR, "输入内容过长,请重新输入");
                        Logger.WriteLine();
                        Logger.WriteDate();
                        Logger.Write("输入内容过长");
                        Logger.Write(article.ModelXml);
                        return(false);
                    }
                    article.ModelConfig = config;
                    article.ModelSchema = schema;

                    article.ModelName = data.Model.ModelName;
                    article.TableName = data.Table.Name;
                    string[] updatefields = new string[] { "OwnerID", "ChannelFullUrl", "ChannelName", "FullChannelPath", "Description", "Title", "Content", "ListKeys", "ListKeys2", "ListKeys3", "ListKeys4", "ListKeys5", "Updated", "Index", "EnumState", "Source", "AllowComments", "Author", "State", "IsShow", "SubTitle", "ContentUrl", "ContentType", "Overdue", "Tags", "KeyWord", "DescriptionKey", "ModelXml", "ModelName", "TableName", "ModelConfig", "ModelSchema" };
                    ArticleHelper.UpdateArticle(article, updatefields);

                    // 往全文检索里更新数据
                    ArticleIndexHelper.InsertData(article.ID, 1);
                }
            }
            catch { }

            return(true);
        }