Пример #1
0
 private void Bind_dtlList()
 {
     List<NewsInfo> list = new CNews(CCommon.LANG).Getlistrelated(Relateditem);
     (new GenericList<NewsInfo>()).Bind_DataList(rptList, null, list, 0);
     pnlList.Visible = list != null && list.Count > 0;
     return;
 }
Пример #2
0
        protected void cmdCopyOk_Click(object sender, EventArgs e)
        {
            try
            {
                string iidstr = txtIidstr.Value;
                int dest_cid = int.Parse(ddlCopycid.SelectedValue);

                lstError = new List<Errorobject>();
                if (CFunctions.IsNullOrEmpty(iidstr) || dest_cid == 0)
                {
                    lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Copy_error, "", null);
                    Master.Form_ShowError(lstError);
                    return;
                }

                CNews BLL = new CNews(CCommon.LANG);
                string[] iidarr = iidstr.Split(',');
                for (int i = 0; i < iidarr.Length; i++)
                {
                    NewsInfo info = BLL.Wcmm_Getinfo(int.Parse(iidarr[i]));
                    this.Copy_Info(info, dest_cid, BLL);
                }

                cmdCopyOk.Enabled = false;
                lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Copy_completed, "", null);
                Master.Form_ShowError(lstError);
            }
            catch (Exception ex)
            {
                CCommon.CatchEx(ex);
            }
        }
Пример #3
0
 public void Set(string relateditem)
 {
     try
     {
         string vlreturn = "<table id=\"RN_listselectedNews\" class=\"RN_listselectedNews\">";
         List<NewsInfo> list = new List<NewsInfo>();
         if (!CFunctions.IsNullOrEmpty(relateditem))
         {
             list = new CNews(CCommon.LANG).Wcmm_Getlist(relateditem);
             if (list != null && list.Count > 0)
             {
                 for (int i = 0; i < list.Count; i++)
                 {
                     NewsInfo info = (NewsInfo)list[i];
                     vlreturn += "<tr id=\"rnrowi" + i + "\" class=\"rnrowi\">"
                         + "<td class=\"rnnote\">" + info.Name + "</td>"
                         + "<td class=\"rnsort\">" + info.Cname + "</td>"
                         + "<td class=\"rncomd\"><a href=\"javascript:RNremove(" + info.Id + "," + i + ");\">x</a></td></tr>";
                 }
             }
         }
         RN_containerNews.InnerHtml = vlreturn + "</table>";
         RN_containerNews.Attributes.Add("title", list == null ? "0" : list.Count.ToString());
         RN_txtRelatedid.Value = relateditem;
         return;
     }
     catch (Exception ex)
     {
         CCommon.CatchEx(ex);
     }
 }
Пример #4
0
        public void ProcessRequest(HttpContext context)
        {
            string cid = context.Request.QueryString["cid"];
            string vlreturn = "";
            if (!CFunctions.IsNullOrEmpty(cid) && cid != "0")
            {
                vlreturn = "{\"newsinfo\":[";
                List<NewsInfo> list = new CNews(CCommon.LANG).Wcmm_Getlist(int.Parse(cid));
                if (list != null && list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        NewsInfo info = (NewsInfo)list[i];
                        vlreturn += "{\"newsname\":\"" + info.Name.Replace("\"", "\\\"") + "\", \"newsid\":\"" + info.Id + "\"}" + (i == list.Count - 1 ? "" : ",");
                    }
                }
                vlreturn += "]}";
            }

            string iid = context.Request.QueryString["iid"];
            if (!CFunctions.IsNullOrEmpty(iid))
            {
                vlreturn = "{\"newsinfo\":[";
                List<NewsInfo> list = new CNews(CCommon.LANG).Wcmm_Getlist(iid);
                if (list != null && list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        NewsInfo info = (NewsInfo)list[i];
                        vlreturn += "{\"newsname\":\"" + info.Name.Replace("\"", "\\\"") + "\", \"newsid\":\"" + info.Id + "\", \"newscategory\":\"" + info.Cname + "\"}" + (i == list.Count - 1 ? "" : ",");
                    }
                }
                vlreturn += "]}";
            }

            context.Response.ContentType = "text/plain";
            context.Response.Write(vlreturn);
        }
Пример #5
0
        public List<CategoryInfo> Getlist(int cid, int pid, ListOptions options, out int numResults)
        {
            try
            {
                List<CategoryInfo> arr = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFOPAGING.Replace(Queryparam.Varstring.VAR_SORTEXPRESSION, CFunctions.Expression_GetSort(options.SortExp, options.SortDir));
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;
                    SQL += options.Markas == (int)CConstants.State.MarkAs.None ? "" : " AND A.markas=" + options.Markas;
                    SQL += cid == 0 ? "" : " AND A.cid=" + cid;
                    SQL += pid == -1 ? "" : " AND A.pid=" + pid;
                    SQL = "SELECT * FROM(" + SQL + ") AS T WHERE id<>0 " + CFunctions.Expression_GetLimit(options.PageIndex, options.PageSize);

                    using (iSqlDataReader dar = HELPER.executeReader(iConn, SQL))
                    {
                        while (dar.Read())
                        {
                            CategoryInfo info = this.getDataReader(dar);
                            if (arr == null)
                                arr = new List<CategoryInfo>();
                            arr.Add(info);
                        }
                        dar.Close();
                    }
                    numResults = this.Getlistcount(iConn, cid, pid);
                    if(arr != null)
                    {
                        foreach (var cate in arr)
                        {
                            if (cate.Pid == 61)
                            {
                                CNews news = new CNews("vn");
                                cate.dictCount = news.GetDictCount(iConn, cate.Id.ToString());
                            }
                        }
                    }

                    iConn.Close();
                }
                return arr;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        public CategoryInfo Getinfo(int id)
        {
            if (id == -1) return null;
            try
            {
                CategoryInfo info = null;
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    string SQL = SQL_GETIFO + " AND A.id=@ID";
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Waitactive;
                    SQL += " AND A.status<>" + (int)CConstants.State.Status.Disabled;

                    iSqlParameter[] parms = new iSqlParameter[]{
                        new iSqlParameter(PARM_ID, iSqlType.Field_tInterger),
                    };
                    int i = -1;
                    parms[++i].Value = id;
                    using (iSqlDataReader dar = HELPER.executeReader(iConn, iCommandType.Text, SQL, parms))
                    {
                        if (dar.Read())
                        {
                            info = this.getDataReader(dar);
                        }
                    }

                    if(info != null)
                    {
                        CNews news = new CNews("vn");
                        info.dictCount = news.GetDictCount(iConn,info.Id.ToString());
                    }
                    iConn.Close();
                }
                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #7
0
        private void Load_Info(int iid)
        {
            CNews DAL = new CNews(CCommon.LANG);
            NewsInfo info = DAL.Getinfo(iid);
            if (info != null)
            {
                if (info.Allowcomment > 0)
                {
                    CommentInfo comment = new CComment(CCommon.LANG).Getinforating(Webcmm.Id.News, info.Id);
                    if (comment != null)
                    {
                        if ((comment.Viewcounter + 1) != info.Allowcomment)
                        {
                            info.Allowcomment = comment.Viewcounter + 1;
                            DAL.Updatenum(info.Id.ToString(), Queryparam.Sqlcolumn.Allowcomment, info.Allowcomment);
                        }
                        info.Rating = comment.Rating / (comment.Viewcounter == 0 ? 1 : comment.Viewcounter);
                    }
                }
                List<NewsInfo> list = new List<NewsInfo>();
                list.Add(info);
                (new GenericList<NewsInfo>()).Bind_DataList(rptInfo, null, list, 0);
                DAL.Updatenum(iid.ToString(), Queryparam.Sqlcolumn.Viewcounter, CConstants.NUM_INCREASE);

                Master.AddMeta_Title(info.Name);
                Master.AddMeta_Description(info.Introduce);
                Master.AddMeta_Keywords(info.Tag);
            }

            pnlListfollow.Visible = pnlInfo.Visible = info != null;
        }
Пример #8
0
        private void Move_Info(NewsInfo source_info, int dest_cid, CNews BLL)
        {
            if (source_info == null) return;

            NewsInfo info_copy = source_info.copy();
            info_copy.Cid = dest_cid;
            info_copy.Status = CCommon.GetStatus_upt();
            info_copy.Username = CCommon.Get_CurrentUsername();
            info_copy.Timeupdate = DateTime.Now;
            BLL.Save(info_copy);
        }
Пример #9
0
        private void Copy_Info(NewsInfo source_info, int dest_cid, CNews BLL)
        {
            if (source_info == null) return;

            NewsInfo info_copy = source_info.copy();
            info_copy.Id = 0;
            info_copy.Cid = dest_cid;
            info_copy.Status = CCommon.GetStatus_upt();
            info_copy.Username = CCommon.Get_CurrentUsername();
            info_copy.Timeupdate = DateTime.Now;
            info_copy.Allowcomment = source_info.Allowcomment > 0 ? 1 : 0;
            info_copy.Orderd = 0;
            BLL.Save(info_copy);
        }
Пример #10
0
        protected void cmdUpdateorder_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                if (grdView.Rows.Count == 0) return;

                CNews BLL = new CNews(CCommon.LANG);
                foreach (GridViewRow row in grdView.Rows)
                {
                    HiddenField txtId = (HiddenField)row.FindControl("txtId");
                    TextBox txtOrderd = (TextBox)row.FindControl("txtOrderd");
                    if (txtId != null && txtOrderd != null)
                    {
                        int id = int.Parse(txtId.Value);
                        int orderd = 0;
                        int.TryParse(txtOrderd.Text, out orderd);
                        BLL.Updatenum(id.ToString(), Queryparam.Sqlcolumn.Orderd, orderd);
                    }
                    lstError = new List<Errorobject>();
                    lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Saveorderd_completed, "", null);
                    Master.Form_ShowError(lstError);
                }
            }
            catch
            {
                lstError = new List<Errorobject>();
                lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Saveorderd_error, "", null);
                Master.Form_ShowError(lstError);
            }
        }
Пример #11
0
        protected void cmdSave_Click(object sender, EventArgs e)
        {
            try
            {
                string iid = CCommon.Get_FormString(Queryparam.Chkcheck);
                if (CFunctions.IsNullOrEmpty(iid)) return;

                int rssId = 0;
                string websiteUrl = "", nodeContent = "", nodeTitle = "", nodeIntroduce = "";
                foreach (RepeaterItem row in rptList.Items)
                {
                    HiddenField txtId = (HiddenField)row.FindControl("txtId");
                    rssId = txtId == null ? 0 : int.Parse(txtId.Value);
                    websiteUrl = ((HiddenField)row.FindControl("txtWebsiteUrl")).Value;
                    nodeContent = ((HiddenField)row.FindControl("txtNodecontent")).Value;
                    nodeTitle = ((HiddenField)row.FindControl("txtNodetitle")).Value;
                    nodeIntroduce = ((HiddenField)row.FindControl("txtNodeintroduce")).Value;
                }

                iid = "," + iid + ",";
                CNews DAL = new CNews(CCommon.LANG);
                foreach (GridViewRow row in grdView.Rows)
                {
                    HiddenField txtId = (HiddenField)row.FindControl("txtId");
                    HiddenField txtTitle = (HiddenField)row.FindControl("txtTitle");
                    HiddenField txtDescription = (HiddenField)row.FindControl("txtDescription");
                    HiddenField txtLink = (HiddenField)row.FindControl("txtLink");
                    if (txtId != null)
                    {
                        string id = txtId.Value;
                        if (iid.IndexOf("," + id + ",") != -1)
                        {
                            NewsInfo info = new NewsInfo();
                            info.Name = txtTitle.Value;
                            info.Code = "";
                            info.Introduce = txtDescription.Value;
                            info.Description = radSavetype.SelectedIndex == 0 ? this.Get_NewsContent(txtLink.Value, websiteUrl, nodeContent, nodeTitle, nodeIntroduce) : "";
                            info.Url = radSavetype.SelectedIndex == 0 ? "" : txtLink.Value;
                            info.Author = websiteUrl.Replace("http://", "");
                            info.Cid = int.Parse(ddlCid.SelectedValue);
                            info.Cname = ddlCid.SelectedItem.Text.Replace("-", "");
                            info.Timeexpire = CFunctions.Get_Datetime(CFunctions.Set_Datetime(DateTime.Now.AddDays(365)));

                            info.Status = CCommon.GetStatus_upt();
                            info.Username = CCommon.Get_CurrentUsername();
                            info.Timeupdate = DateTime.Now;

                            DAL.Save(info);
                        }
                    }
                }
                lstError = new List<Errorobject>();
                lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Save_completed, "", null);
                Master.Form_ShowError(lstError);

                (new CRSSResource(CCommon.LANG)).Updatestr(rssId.ToString(), "timelastestget", DateTime.Now);
            }
            catch
            {
                lstError = new List<Errorobject>();
                lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Save_error, "", null);
                Master.Form_ShowError(lstError);
            }
        }
Пример #12
0
        private void Load_Info(int iid)
        {
            CNews DAL = new CNews(CCommon.LANG);
            NewsInfo info = DAL.Getinfo(iid);
            if (info != null)
            {
                if (info.Allowcomment > 0)
                {
                    CommentInfo comment = new CComment(CCommon.LANG).Getinforating(Webcmm.Id.News, info.Id);
                    if (comment != null)
                    {
                        if ((comment.Viewcounter + 1) != info.Allowcomment)
                        {
                            info.Allowcomment = comment.Viewcounter + 1;
                            DAL.Updatenum(info.Id.ToString(), Queryparam.Sqlcolumn.Allowcomment, info.Allowcomment);
                        }
                        info.Rating = comment.Rating / (comment.Viewcounter == 0 ? 1 : comment.Viewcounter);
                    }
                }
                List<NewsInfo> list = new List<NewsInfo>();
                list.Add(info);
                list = list.OrderBy(m => m.Name).ToList();
                (new GenericList<NewsInfo>()).Bind_DataList(rptInfo, null, list, 0);
                DAL.Updatenum(iid.ToString(), Queryparam.Sqlcolumn.Viewcounter, CConstants.NUM_INCREASE);
                breadcrums += tach;
                string linkCat = "<a href=\"/tu-dien-thuat-ngu-" + Langview + "/" + info.eUrl2 + "\">" + info.Name + "</a>";
                breadcrums += linkCat;
                Master.AddMeta_Title(info.Name);
                Master.AddMeta_Description(info.Introduce);
                Master.AddMeta_Keywords(info.Tag);
            }

            pnlListfollow.Visible = pnlInfo.Visible = info != null;
        }