Exemplo n.º 1
0
 private void setParameter(iSqlParameter[] parms, NewsInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = CFunctions.SetDBString(info.Code);
         parms[++i].Value = CFunctions.SetDBString(info.Name);
         parms[++i].Value = CFunctions.SetDBString(info.Introduce);
         parms[++i].Value = CFunctions.SetDBString(info.Description);
         parms[++i].Value = CFunctions.SetDBString(info.Tag);
         parms[++i].Value = CFunctions.SetDBString(info.Filepreview);
         parms[++i].Value = info.Cid;
         parms[++i].Value = info.Orderd == 0 ? info.Id : info.Orderd;
         parms[++i].Value = info.Status;
         parms[++i].Value = info.Markas;
         parms[++i].Value = CFunctions.SetDBString(info.Iconex);
         parms[++i].Value = CFunctions.SetDBDatetime(info.Timecreate);
         parms[++i].Value = CFunctions.SetDBDatetime(info.Timeupdate);
         parms[++i].Value = CFunctions.SetDBString(info.Username);
         parms[++i].Value = info.Allowcomment;
         parms[++i].Value = CFunctions.SetDBString(info.Author);
         parms[++i].Value = CFunctions.SetDBDatetime(info.Timeexpire);
         parms[++i].Value = info.Viewcounter;
         parms[++i].Value = CFunctions.SetDBString(info.Url);
         parms[++i].Value = CFunctions.SetDBString(info.Relateditem);
         parms[++i].Value = CFunctions.install_keyword(info.Name) + " " + CFunctions.install_keyword(info.Introduce) + " " + CFunctions.install_keyword(info.Description) + " " + CFunctions.install_keyword(info.Tag) + " " + CFunctions.install_keyword(info.Author) + " " + CFunctions.install_keyword(info.Url);
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
        private NewsInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                NewsInfo info = new NewsInfo();
                info.Code = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Name = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Introduce = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Description = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Tag = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Filepreview = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Cid = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Cname = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Orderd = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Status = dar.IsDBNull(++i) ? (int)CConstants.State.Status.Waitactive : dar.GetInt32(i);
                info.Markas = dar.IsDBNull(++i) ? (int)CConstants.State.MarkAs.None : dar.GetInt32(i);
                info.Iconex = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Timecreate = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(i);
                info.Timeupdate = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(i);
                info.Username = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Allowcomment = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Author = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Timeexpire = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(i);
                info.Viewcounter = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Url = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Relateditem = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Rownumber = dar.IsDBNull(++i) ? 0 : dar.GetInt64(i);

                info.lCategory = (new CCategory(LANG)).Wcmm_Getlist_ofiid(info.Id, Webcmm.Id.News);
                info.lCategoryattr = (new CCategoryattr(LANG)).Wcmm_Getlist_ofiid(info.Id, Webcmm.Id.News);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
 private bool Saveitem(iSqlTransaction trans, NewsInfo info)
 {
     try
     {
         if (trans == null || info == null) return false;
         string SQL = string.Empty;
         if (info.Id == 0)
         {
             SQL = SQL_INSERT;
             info.Id = (int)HELPER.getNewID(trans, TABLENAME);
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         else if (HELPER.isExist(trans, TABLENAME, info.Id))
         {
             SQL = SQL_UPDATE;
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         else
         {
             SQL = SQL_INSERT;
             info.Id = (int)HELPER.getNewID(trans, TABLENAME);
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         return true ;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        public bool Save(NewsInfo info)
        {
            try
            {
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    using (iSqlTransaction trans = iConn.BeginTransaction())
                    {
                        try
                        {
                            if (this.Saveitem(trans, info))
                            {
                                new CItemcategory(LANG).Save(info.Id, Webcmm.Id.News, info.Categoryid);
                                new CItemcategoryattr(LANG).Save(info.Id, Webcmm.Id.News, info.Categoryattrid);
                            }

                            trans.Commit();
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            throw ex;
                        }
                    }
                    iConn.Close();
                }

                return true; ;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
 public bool UpdateAliasInfo(NewsInfo info)
 {
     bool kq = false;
     try
     {
         using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
         {
             string SQL = "UPDATE vndd_news SET alias = '";
             SQL += CFunctions.install_urlname(info.Name).Replace(".aspx", "")+"'";
             SQL += " Where id = " + info.Id;
             HELPER.executeNonQuery(iConn, SQL);
             iConn.Close();
         }
         kq = true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return kq;
 }
Exemplo n.º 6
0
        private bool Save_Lang(NewsInfo info)
        {
            try
            {
                if (!CFunctions.IsMultiLanguage() || !chkSaveoption_golang.Checked) return false;

                int lang_num = CConstants.LANG_NUM;
                for (int i = 0; i < lang_num; i++)
                {
                    string lang_val = ConfigurationSettings.AppSettings["LANG_" + i];
                    if (lang_val == CCommon.LANG) continue;

                    NewsInfo lang_info = info.copy();
                    lang_info.Id = 0;
                    lang_info.Status = (int)CConstants.State.Status.Waitactive;
                    (new CNews(lang_val)).Save(lang_info);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
Exemplo n.º 7
0
        private NewsInfo Take()
        {
            try
            {
                int iid = 0;
                int.TryParse(txtId.Value, out iid);
                NewsInfo info = (new CNews(CCommon.LANG)).Wcmm_Getinfo(iid);
                if (info == null)
                    info = new NewsInfo();
                info.Id = iid;
                info.Name = txtName.Text.Trim();
                info.Introduce = txtIntroduce.Text.Trim();
                info.Description = txtDescription.Text.Trim();
                info.Tag = txtTag.Text.Trim();
                info.Author = txtAuthor.Text.Trim();
                info.Url = txtUrl.Text.Trim();
                info.Timeexpire = CFunctions.IsNullOrEmpty(txtTimeexpire.Text.Trim()) ? CFunctions.Get_Datetime(CFunctions.Set_Datetime(DateTime.Now.AddDays(365))) : CFunctions.Get_Datetime(txtTimeexpire.Text.Trim());
                info.Allowcomment = chkAllowcomment.Checked ? (info.Allowcomment > 1 ? info.Allowcomment : 1) : 0;
                info.Filepreview = Filepreview.Get();
                info.Iconex = Displaysetting.Get_Icon();
                info.Status = Displaysetting.Get_Status();
                info.Orderd = Displaysetting.Get_Orderd();
                info.Markas = Displaysetting.Get_Markas();
                info.Relateditem = Relatednews.Get();
                info.Username = Assigntouser.Get_User();
                if (info.Id == 0)
                    info.Timecreate = DateTime.Now;
                info.Timeupdate = DateTime.Now;

                info.Cid = int.Parse(ddlCid.SelectedValue);
                string categoryid = CCommon.Get_FormString(Queryparam.Chkcategorymulti);
                if (CFunctions.IsNullOrEmpty(categoryid))
                    info.lCategory = null;
                info.Categoryid = categoryid;
                string categoryattrid = CCommon.Get_FormString(Queryparam.Chkcategoryattr);
                if (CFunctions.IsNullOrEmpty(categoryattrid))
                    info.lCategoryattr = null;
                info.Categoryattrid = categoryattrid;

                return info;
            }
            catch
            {
                return null;
            }
        }
Exemplo n.º 8
0
 private bool Save(NewsInfo info)
 {
     try
     {
         if (info == null) return false;
         (new CNews(CCommon.LANG)).Save(info);
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemplo n.º 9
0
        private bool Load_Info(int iid)
        {
            try
            {
                NewsInfo info = null;
                if (iid != 0)
                {
                    info = (new CNews(CCommon.LANG)).Wcmm_Getinfo(iid);
                    if (info != null)
                    {
                        lstError = new List<Errorobject>();
                        lstError = Form_GetError(lstError, Errortype.Notice, Definephrase.Save_notice, "[" + info.Id + "] " + info.Name, null);
                        Master.Form_ShowError(lstError);
                    }
                }
                if (info == null)
                    info = new NewsInfo();
                chkSaveoption_golist.Checked = info.Id != 0;
                chkSaveoption_golang.Checked = info.Id == 0;

                txtId.Value = info.Id.ToString();
                txtName.Text = info.Name;
                txtIntroduce.Text = info.Introduce;
                txtDescription.Text = info.Description;
                txtTag.Text = info.Tag;
                txtAuthor.Text = info.Author;
                txtUrl.Text = info.Url;
                txtTimeexpire.Text = info.Timeexpire.Equals(new DateTime(0)) ? CFunctions.Set_Datetime(DateTime.Now.AddDays(365)) : CFunctions.Set_Datetime(info.Timeexpire);
                chkAllowcomment.Checked = info.Allowcomment > 0 ? true : false;
                Filepreview.Set(info.Filepreview);
                Displaysetting.Set(info.Iconex, info.Status, info.Orderd, info.Markas);
                Relatednews.Set(info.Relateditem);
                Assigntouser.Set_User(info.Username);

                ddlCid.SelectedValue = info.Cid != 0 ? info.Cid.ToString() : CCommon.Get_QueryNumber(Queryparam.Cid).ToString();
                Categorymulti.Build_Categorymulti(Webcmm.Id.News, 0, info.Categoryid);
                Categoryattr.Build_Categoryattr(Webcmm.Id.News, 0, info.Categoryattrid);
                return true;
            }
            catch
            {
                return false;
            }
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
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);
            }
        }