示例#1
0
        /// <summary>
        /// 添加一条投票及选项(进行统计)
        /// </summary>
        /// <param name="vote"></param>
        /// <param name="listEntrys"></param>
        #region bool AddVote(Vote vote, List<VoteEntry> listEntrys)
        public bool AddVote(Vote vote, List <VoteEntry> listEntrys)
        {
            if (vote == null || listEntrys == null)
            {
                return(false);
            }
            if (listEntrys.Count == 0)
            {
                return(false);
            }

            try
            {
                vote.ID          = We7Helper.CreateNewID();
                vote.VotePeoples = 0;
                vote.AddDate     = DateTime.Now;
                Assistant.Insert(vote);

                for (int i = 0; i < listEntrys.Count; i++)
                {
                    listEntrys[i].VoteID = vote.ID;
                    Assistant.Insert(listEntrys[i]);
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 创建文件路径
        /// </summary>
        /// <param name="ext">文件扩展名</param>
        /// <returns>文件的绝地路径</returns>
        string GetFileFolder()
        {
            Article article = new Article();

            article.ID = We7Helper.CreateNewID();
            return(article.AttachmentUrlPath.TrimEnd("/".ToCharArray()) + "/Thumbnail");
        }
 /// <summary>
 /// 添加一个部门信息
 /// </summary>
 /// <param name="dpt">一个部门信息</param>
 /// <returns>返回这个部门的信息</returns>
 public Department AddDepartment(Department dpt)
 {
     dpt.ID      = We7Helper.CreateNewID();
     dpt.Created = DateTime.Now;
     Assistant.Insert(dpt);
     return(dpt);
 }
示例#4
0
        protected void bttnNew_Click(object sender, EventArgs e)
        {
            string url = "~/admin/addins/ModelEditor.aspx?notiframe={2}&model={0}&ID={1}";

            url = String.Format(url, PanelContext.Model.ModelName, We7Helper.CreateNewID(), Request["notiframe"]);
            Response.Redirect(url);
        }
示例#5
0
 /// <summary>
 /// 新增一个回复
 /// </summary>
 /// <param name="ar"></param>
 public void AddAdviceReply(AdviceReply ar)
 {
     ar.ID         = We7Helper.CreateNewID();
     ar.CreateDate = DateTime.Now;
     Assistant.Insert(ar);
     UpdateAdviceCount(ar.AdviceID);
 }
示例#6
0
        /// <summary>
        /// 保存一条点击量数据记录,有则更新,无则插入
        /// </summary>
        /// <param name="cr">点击量数据</param>
        #region void SaveClickRecord(ClickRecords cr)
        public void SaveClickRecord(ClickRecords cr)
        {
            ClickRecords clickRecord = GetClickRecordByDate(cr.ObjectType, cr.ObjectID, cr.VisitDate);

            if (clickRecord == null)
            {
                lock (syncRoot)
                {
                    clickRecord = GetClickRecordByDate(cr.ObjectType, cr.ObjectID, cr.VisitDate);
                    if (clickRecord == null)
                    {
                        //插入逻辑
                        cr.ID     = We7Helper.CreateNewID();
                        cr.Clicks = 1;
                        Assistant.Insert(cr);
                    }
                    else
                    {
                        //更新逻辑
                        clickRecord.Clicks += 1;
                        Assistant.Update(clickRecord, new string[] { "Clicks" });
                    }
                }
            }
            else
            {
                //更新逻辑
                clickRecord.Clicks += 1;
                Assistant.Update(clickRecord, new string[] { "Clicks" });
            }
        }
示例#7
0
        /// <summary>
        /// 更新回答选项统计()
        /// </summary>
        /// <param name="voteID"></param>
        /// <param name="voteEntryID"></param>
        /// <param name="voteEntryText"></param>
        /// <param name="sum">加几票</param>
        #region bool UpdateVoteAnswerStat(string voteID,string voteEntryID,string voteEntryText,int sum)
        protected bool UpdateVoteAnswerStat(string voteID, string voteEntryID, string voteEntryText, int sum)
        {
            try
            {
                Criteria criteria = new Criteria(CriteriaType.Equals, "VoteID", voteID);
                criteria.Add(CriteriaType.Equals, "VoteEntryID", voteEntryID);
                List <VoteAnswerStat> listAnswerStats = Assistant.List <VoteAnswerStat>(criteria, null);

                VoteEntry entry = GetVoteEntryByEntryID(voteEntryID);

                if (listAnswerStats != null && listAnswerStats.Count > 0)
                {
                    //进行更新
                    listAnswerStats[0].VoteEntrySum += sum;
                    Assistant.Update(listAnswerStats[0]);
                }
                else
                {
                    //新增一个
                    VoteAnswerStat voteAnswerStat = new VoteAnswerStat();
                    voteAnswerStat.ID            = We7Helper.CreateNewID();
                    voteAnswerStat.VoteEntryID   = voteEntryID;
                    voteAnswerStat.VoteID        = voteID;
                    voteAnswerStat.VoteEntrySum  = sum;
                    voteAnswerStat.VoteEntryText = voteEntryText;
                    voteAnswerStat.OrderID       = entry.OrderID;
                    Assistant.Insert(voteAnswerStat);
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
示例#8
0
 /// <summary>
 /// 添加一个附件
 /// </summary>
 /// <param name="a">附件记录</param>
 public void AddAttachment(Attachment a)
 {
     a.ID         = We7Helper.CreateNewID();
     a.UploadDate = DateTime.Now;
     a.Created    = a.Updated = DateTime.Now;
     Assistant.Insert(a);
 }
示例#9
0
 /// <summary>
 /// 添加积分
 /// </summary>
 /// <param name="point"></param>
 public void AddPoint(Point point)
 {
     if (String.IsNullOrEmpty(point.ID))
     {
         point.ID = We7Helper.CreateNewID();
     }
     Assistant.Insert(point);
 }
示例#10
0
 /// <summary>
 /// 添加收藏
 /// </summary>
 /// <param name="favorite"></param>
 public void AddFavorite(Favorite favorite)
 {
     if (String.IsNullOrEmpty(favorite.FavoriteID))
     {
         favorite.FavoriteID = We7Helper.CreateNewID();
     }
     Assistant.Insert(favorite);
 }
示例#11
0
 protected override void InitModelData()
 {
     if (!(FormPanel != null && FormPanel.Visible == false))
     {
         base.InitModelData();
         PanelContext.Row["ID"] = We7Helper.CreateNewID();
     }
 }
示例#12
0
        public void CreateModule(ColumnModule module)
        {
            module.ID = We7Helper.CreateNewID();
            ColumnModuleCollection cols = LoadModules();

            cols.Add(module);
            SaveModules(cols);
        }
示例#13
0
        /// <summary>
        /// 根据此邮件创建新的反馈信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AdviceBtnCreate_Click(object sender, EventArgs e)
        {
            //Advice advice = new Advice();
            //advice.OwnID = Security.CurrentAccountID;
            //advice.TypeID = AdviceTypeDropDownList.SelectedValue;
            ////advice.ID = GetValue<string>(data, "ID");
            //advice.Title = EmailTitleLabel.Text;
            //advice.UserID = "";
            //advice.Content = ReplayContent.InnerHtml;
            //advice.CreateDate = DateTime.Now;
            //advice.Updated = DateTime.Now;

            //advice.Name = "";
            //advice.Email = UserLabel.Text;
            //advice.Address = "";
            //advice.Phone = "";
            //advice.Fax = "";

            //advice.State = (int)AdviceState.WaitAccept;
            //advice.SN = AdviceHelper.CreateArticleSN();
            //int isshow = 1;
            //string stateStr = StateMgr.StateProcess(advice.EnumState, EnumLibrary.Business.AdviceDisplay, isshow);
            //advice.IsShow = isshow;
            //advice.EnumState = "00000000000000000000";
            //advice.Display1 = "";
            //advice.Display2 = "";
            //advice.Display3 = "";
            //if (advice.SN < 100000)
            //{
            //    advice.SN = advice.SN + 100000;
            //}
            //advice.MyQueryPwd = We7Helper.CreateNewID().Substring(1, 8);
            //下面是添加模型信息
            //string config, schema;
            AdviceDataProvider provider = new AdviceDataProvider();
            PanelContext       ctx      = ModelHelper.GetPanelContext("Advice.EmailAdvice", "edit");

            ctx.Row["ID"]      = We7Helper.CreateNewID();
            ctx.Row["Title"]   = EmailTitleLabel.Text;
            ctx.Row["Email"]   = UserLabel.Text;
            ctx.Row["Content"] = ReplayContent.InnerHtml;
            ctx.Row["TypeID"]  = AdviceTypeDropDownList.SelectedValue;


            //advice.ModelXml = ""; //GetModelDataXml(data, advice.ModelXml, out schema, out config);//获取模型数据
            //advice.ModelConfig =""; //config;
            //advice.ModelName = "";// data.ModelName;
            //advice.ModelSchema = "";// schema;
            //advice = AdviceHelper.AddAdvice(advice);
            //AdviceHelper.SendNotifyMail(advice.ID);
            //string adviceID = AdviceIDTextBox.Text;
            if (provider.InsertEmailAdvice(ctx))
            {
                Messages.ShowMessage("您已成功创建新的反馈信息。");
            }
        }
示例#14
0
        /// <summary>
        /// 例子数据
        /// </summary>
        /// <returns></returns>
        private Article GetExampleData()
        {
            Article temp = new Article();

            temp.ID       = We7Helper.CreateNewID();
            temp.Title    = "测试新闻详细标题";
            temp.SubTitle = "测试新闻详细副标题";
            temp.Content  = "核心提示:国家发改委昨天宣布,《商品房销售明码标价规定》已于日前发布,规定要求,从今年5月1日起,商品房销售实行“一套一标价”,并要明确公示代收代办收费和物业服务收费,商品房经营者不得在标价之外加收任何未标明的费用。";
            return(temp);
        }
示例#15
0
 /// <summary>
 /// 新增一条统计信息
 /// </summary>
 /// <param name="s"></param>
 /// <param name="type"></param>
 public void AddPageVisitor(PageVisitor s)
 {
     s.ID         = We7Helper.CreateNewID();
     s.VisitDate  = DateTime.Now;
     s.LogoutDate = DateTime.Now;
     s.OnlineTime = DateTime.Now;
     s.Updated    = DateTime.Now;
     s.Created    = DateTime.Now;
     Assistant.Insert(s);
 }
示例#16
0
        public void CreateMapping(string channelID, string moduleID, string parameter)
        {
            ChannelModuleMapping mapping = new ChannelModuleMapping();

            mapping.ID        = We7Helper.CreateNewID();
            mapping.ChannelID = channelID;
            mapping.ModuleID  = moduleID;
            mapping.Parameter = parameter;
            Assistant.Insert(mapping);
        }
示例#17
0
        /// <summary>
        /// 增加一条评论
        /// </summary>
        /// <param name="c"></param>
        public void AddComments(Comments c)
        {
            HttpContext             Context = HttpContext.Current;
            HttpBrowserCapabilities bc      = Context.Request.Browser;

            c.Created = DateTime.Now;
            c.Updated = c.Created;
            c.ID      = We7Helper.CreateNewID();
            c.IP      = Context.Request.ServerVariables["REMOTE_ADDR"];
            Assistant.Insert(c);
        }
示例#18
0
 public override object GetValue()
 {
     if (CheckParentIsFiledControl(this.Parent) && hfValue.Value == ArticleID)
     {
         return(We7Helper.CreateNewID());
     }
     else
     {
         return(We7Helper.FilterHtmlChars(hfValue.Value));
     }
 }
示例#19
0
        /// <summary>
        /// 得到例子数据
        /// </summary>
        /// <returns></returns>
        private List <Article> GetExampleData()
        {
            List <Article> lsResult = new List <Article>();

            for (int i = 0; i < PageSize; i++)
            {
                Article temp = new Article();
                temp.ID    = We7Helper.CreateNewID();
                temp.Title = "测试新闻" + (i + 1);
                lsResult.Add(temp);
            }
            return(lsResult);
        }
示例#20
0
        public void InsertAdviceProcessHistory(ProcessHistory aph)
        {
            if (aph.ID == null)
            {
                aph.ID = We7Helper.CreateNewID();
            }
            Advice a = AdviceHelper.GetAdvice(aph.ObjectID);
            List <ProcessHistory> list = StrToList(a.FlowXml);

            aph.ItemNum = list.Count;
            list.Add(aph);
            a.FlowXml = ListToStr(list);
            AdviceHelper.UpdateAdvice(a, new string[] { "FlowXml" });
        }
示例#21
0
 /// <summary>
 /// 添加类别
 /// </summary>
 /// <param name="cat"></param>
 public void AddCategory(Category cat)
 {
     if (cat == null)
     {
         throw new Exception("添加类别不能为空");
     }
     if (We7Helper.IsEmptyID(cat.ID))
     {
         cat.ID         = We7Helper.CreateNewID();
         cat.CreateDate = DateTime.Now;
     }
     Assistant.Insert(cat);
     CacheRecord.Release();
 }
示例#22
0
 /// <summary>
 /// 添加一条投票
 /// </summary>
 /// <param name="vote"></param>
 #region bool AddVote(Vote vote)
 public bool AddVote(Vote vote)
 {
     try
     {
         vote.ID      = We7Helper.CreateNewID();
         vote.AddDate = DateTime.Now;
         Assistant.Insert(vote);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#23
0
        /// <summary>
        /// 新增文章处理审核历史记录
        /// </summary>
        /// <param name="aph"></param>
        /// <param name="article"></param>
        public void InsertArticleProcessHistory(ProcessHistory aph, Article article)
        {
            if (aph.ID == null)
            {
                aph.ID = We7Helper.CreateNewID();
            }

            List <ProcessHistory> list = StrToList(article.FlowXml);

            aph.ItemNum = list.Count;
            list.Add(aph);
            article.FlowXml = ListToStr(list);
            ArticleHelper.UpdateArticle(article, new string[] { "FlowXml" });
        }
示例#24
0
 /// <summary>
 /// 添加一条投票选项
 /// </summary>
 /// <param name="voteEntry"></param>
 #region bool AddVoteEntry(VoteEntry voteEntry)
 public bool AddVoteEntry(VoteEntry voteEntry)
 {
     try
     {
         List <VoteEntry> listEntrys = GetVoteEntrysByID(voteEntry.VoteID);
         voteEntry.ID      = We7Helper.CreateNewID();
         voteEntry.OrderID = (listEntrys == null ? 1 : listEntrys.Count + 1);
         Assistant.Insert(voteEntry);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#25
0
        /// <summary>
        /// 例子数据
        /// </summary>
        /// <returns></returns>
        private List <Link> GetExampleData()
        {
            List <Link> lsResult = new List <Link>();

            for (int i = 0; i < 8; i++)
            {
                Link model = new Link();
                model.ID          = We7Helper.CreateNewID();
                model.OrderNumber = i;
                model.Title       = "测试友情链接" + i + 1;
                model.Url         = "#";
                lsResult.Add(model);
            }
            return(lsResult);
        }
 /// <summary>
 /// 添加一个权限记录
 /// </summary>
 /// <param name="ownerType">所有者类型</param>
 /// <param name="ownerID">用户ID</param>
 /// <param name="objectID">菜单ID或栏目ID</param>
 /// <param name="contents">权限列表</param>
 public void AddPermission(int ownerType, string ownerID, string objectID, string[] contents)
 {
     if (contents == null || contents.Length == 0)
     {
         return;
     }
     foreach (string c in contents)
     {
         Permission p = new Permission();
         p.Content   = c;
         p.ObjectID  = objectID;
         p.OwnerID   = ownerID;
         p.OwnerType = ownerType;
         p.ID        = We7Helper.CreateNewID();
         Assistant.Insert(p);
     }
 }
示例#27
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            AdviceType adviceType = new AdviceType();

            adviceType.CreateDate = DateTime.Now;
            int index;

            if (int.TryParse(SortNumber.Text, out index))
            {
                adviceType.Index = index;
            }
            adviceType.Title       = AdviceNameText.Text.Trim();
            adviceType.Description = RemarkText.Text.Trim();

            if (string.IsNullOrEmpty(adviceType.Title))
            {
                Messages.ShowError("模型名称不能为空");
                return;
            }

            if (AdviceTypeID == null || AdviceTypeID == "")             // 新建
            {
                adviceType.AccountID = AccountID;
                string adviceTypeID = We7Helper.CreateNewID();
                adviceType.ID = adviceTypeID;
                AdviceTypeHelper.AddAdviceType(adviceType);
            }
            else                // 修改
            {
                adviceType.ID = AdviceTypeID;
                AdviceTypeHelper.UpdateAdviceType(adviceType);
                Messages.ShowMessage("" + AdviceNameText.Text + " 模型修改成功!!");
            }
            //记录日志
            string content = string.Format("编辑了模型“{0}”的信息", adviceType.Title);

            AddLog("编辑反馈模型", content);

            if (AdviceTypeID == null || AdviceTypeID == "")
            {
                string rawurl = We7Helper.AddParamToUrl(Request.RawUrl, "saved", "1");
                rawurl = We7Helper.RemoveParamFromUrl(rawurl, "adviceTypeID");
                rawurl = We7Helper.AddParamToUrl(rawurl, "adviceTypeID", We7Helper.GUIDToFormatString(adviceType.ID));
                Response.Redirect(rawurl);
            }
        }
示例#28
0
        void SingleTableLinkTo(PanelContext data, We7DataTable dt, string id)
        {
            DataTable datatables = DbHelper.Query(String.Format("SELECT * FROM [{0}] WHERE [ID]='{1}'", data.Table.Name, id));

            if (datatables.Rows.Count > 0)
            {
                DataRow       row = datatables.Rows[0];
                We7DataColumn dc1 = dt.Columns.IndexOfMappingField("ContentUrl");
                We7DataColumn dc2 = data.Table.Columns.IndexOfMappingField("OwnerID");
                if (dc1 != null && dc2 != null)
                {
                    StringBuilder sbFields = new StringBuilder();
                    StringBuilder sbValues = new StringBuilder();
                    sbFields.Append("[ID],");
                    sbValues.Append("'" + We7Helper.CreateNewID() + "',");

                    Channel ch = HelperFactory.Instance.GetHelper <ChannelHelper>().GetChannel(row[dc2.Name].ToString(), null);
                    sbFields.AppendFormat("[{0}],", dc1.Name);
                    sbValues.AppendFormat("{0},", String.Format("{0}{1}.{2}", ch.FullUrl, We7Helper.GUIDToFormatString(row["ID"].ToString()), GeneralConfigs.GetConfig().UrlFormat));

                    dc1 = dt.Columns.IndexOfMappingField("Title");
                    dc2 = data.Table.Columns.IndexOfMappingField("Title");
                    if (dc1 != null && dc2 != null)
                    {
                        sbFields.AppendFormat("[{0}],", dc1.Name);
                        sbValues.AppendFormat("'{0}',", row[dc2.Name]);
                    }

                    dc1 = dt.Columns.IndexOfMappingField("ContentType");
                    dc2 = data.Table.Columns.IndexOfMappingField("ContentType");
                    if (dc1 != null && dc2 != null)
                    {
                        sbFields.AppendFormat("[{0}],", dc1.Name);
                        sbValues.AppendFormat("{0},", (int)TypeOfArticle.LinkArticle);
                    }

                    Utils.TrimEndStringBuilder(sbFields, ",");
                    Utils.TrimEndStringBuilder(sbValues, ",");
                    string sql = String.Format("INSERT INTO [{0}]({1}) VALUES({2})", dt.Name, sbFields, sbValues);
                    if (DbHelper.CheckTableExits(data.Table.Name))
                    {
                        DbHelper.ExecuteSql(sql);
                    }
                }
            }
        }
示例#29
0
        public override bool Insert(We7.Model.Core.PanelContext data)
        {
            AdviceInfo advice = new AdviceInfo();

            advice.Title      = GetValue <string>(data, "Title");
            advice.UserID     = GetValue <string>(data, "UserID");
            advice.Content    = GetValue <string>(data, "Content");
            advice.Created    = 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.RelationID = GetValue <string>(data, "RelationID");
            advice.State      = 0; //待受理
            int isshow;

            Int32.TryParse(GetValue <string>(data, "IsShow"), out isshow);
            advice.IsShow     = isshow;
            advice.Display1   = GetValue <string>(data, "Display1");
            advice.Display2   = GetValue <string>(data, "Display2");
            advice.Display3   = GetValue <string>(data, "Display3");
            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      = data.Objects["AdviceTypeID"] as string;
            advice.Public      = GetValue <int>(data, "Public");
            AdviceFactory.Create().AddAdvice(advice);
            SetValue(data, "ID", advice.ID);

            try
            {
                AdviceHelper.SendNotifyMail(advice.ID);
            }
            catch { }
            finally { }
            return(true);
        }
示例#30
0
 private List <Article> GetExampleData()
 {
     if (Articles.Count > 0)
     {
         return(articles);
     }
     else
     {
         List <Article> lsResult = new List <Article>();
         for (int i = 0; i < 6; i++)
         {
             Article temp = new Article();
             temp.ID    = We7Helper.CreateNewID();
             temp.Title = "测试新闻" + (i + 1);
             lsResult.Add(temp);
         }
         return(lsResult);
     }
 }