示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         breadcrums = tach;
         int cid = CCommon.Get_QueryNumber(Queryparam.Cid);
         int iid = CCommon.Get_QueryNumber(Queryparam.Iid);
         string cate = HttpContext.Current.Request.QueryString["cate"];
         string alias = HttpContext.Current.Request.QueryString[Queryparam.Iid];
         if (cate != null && cate != "index")
         {
             cate = cate.Replace(".aspx", "");
             CCategory DAL = new CCategory();
             CategoryInfo cat = DAL.GetCategoryInfo(cate,61);
             if (cat != null)
             {
                 cid = cat.Id;
                 lk = cat.Id.ToString();
                 //Cidroot = cat.Id;
                 breadcrums += "<a href=\"/tu-dien-thuat-ngu-abc-vn-at-.aspx\">Từ điển thuật ngữ</a>";
                 breadcrums += tach;
                 string linkCat = "<a href=\"/tu-dien-thuat-ngu-" + Langview + "/" + CFunctions.install_urlname(cat.Name) + "\">" + cat.Name + "</a>";
                 breadcrums += linkCat;
             }
         }
         if (iid > 0)
         {
             Load_Info(iid);
         }
         else
         {
             Load_Info(alias);
         }
         Bind_Categoryinfo();
         if (pnlInfo.Visible)
         {
             if (CFunctions.GetViewSetting(Webcmm.Id.News, ViewSetting.ListFollowed))
                 this.Bind_rptListfollow(cid);
             else
                 pnlListfollow.Visible = false;
         }
         else
         {
             this.Bind_rptList();
         }
         if (breadcrums.Equals(tach))
         {
             breadcrums += "<a href=\"/tu-dien-thuat-ngu-abc-vn-at-.aspx\">Từ điển thuật ngữ</a>";
         }
     }
 }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                /*int cid = CCommon.Get_QueryNumber(Queryparam.Cid);
                int iid = CCommon.Get_QueryNumber(Queryparam.Iid);*/
                int cid = 0;
                string cate = HttpContext.Current.Request.QueryString[Queryparam.Cid];
                string alias = HttpContext.Current.Request.QueryString[Queryparam.Iid];

                this.Load_Info(alias);
                if(cate != null && cate != "index" )
                {
                    cate = cate.Replace(".aspx", "");
                    CCategory DAL = new CCategory();
                    CategoryInfo cat = DAL.GetCategoryInfo(cate);
                    if (cat != null)
                    {
                        cid = cat.Id;
                    }
                }
                this.Cid = cid;
                if (pnlInfo.Visible)
                {
                    this.Bind_rptCategory();
                    if (CFunctions.GetViewSetting(Webcmm.Id.News, ViewSetting.ListVisibled))
                    {
                        this.Bind_rptListByCategory();
                    }
                    else
                    {
                        pnlListByCategory.Visible = false;
                    }
                    if (CFunctions.GetViewSetting(Webcmm.Id.News, ViewSetting.ListFollowed))
                        this.Bind_rptListfollow();
                    else
                        pnlListfollow.Visible = false;
                }
                else
                {
                    if (!CFunctions.GetViewSetting(Webcmm.Id.News, ViewSetting.ListByCategory))
                        this.Bind_rptCategory();
                    this.Bind_rptListByCategory();
                }

            }
        }
示例#3
0
        protected void cmdCopyOk_Click(object sender, EventArgs e)
        {
            try
            {
                string iidstr = txtIidstr.Value;
                int dest_cid = int.Parse(ddlCopycid.SelectedValue);
                int dest_pid = int.Parse(ddlCopypid.SelectedValue);
                bool getchild = chkCopyoption_getchild.Checked;

                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;
                }

                CCategory BLL = new CCategory(CCommon.LANG);
                CategoryInfo parent_info = BLL.Wcmm_Getinfo(dest_pid);
                int dest_depth = parent_info == null ? 1 : parent_info.Depth;
                string[] iidarr = iidstr.Split(',');
                bool isDup = false;
                for (int i = 0; i < iidarr.Length; i++)
                {
                    CategoryInfo info = BLL.Wcmm_Getinfo(int.Parse(iidarr[i]));
                    if (info.Id != dest_pid)
                        this.Copy_Info(info, dest_cid, dest_pid, dest_depth, getchild, BLL);
                    else
                        isDup = true;
                }
                if (parent_info != null)
                {
                    int pis = parent_info.Pis == 0 ? iidarr.Length + 1 : iidarr.Length + parent_info.Pis;
                    if (isDup) pis--;
                    BLL.Updatenum(dest_pid.ToString(), Queryparam.Sqlcolumn.Pis, pis);
                }

                cmdCopyOk.Enabled = false;
                lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Copy_completed, "", null);
                Master.Form_ShowError(lstError);
            }
            catch (Exception ex)
            {
                CCommon.CatchEx(ex);
            }
        }
示例#4
0
        private void Move_Info(CategoryInfo source_info, int dest_cid, int dest_pid, int dest_depth, bool getchild, CCategory BLL)
        {
            if (source_info == null) return;
            int offset_depth = source_info.Depth - (dest_depth + 1);

            CategoryInfo info_copy = source_info.copy();
            info_copy.Cid = dest_cid;
            info_copy.Pid = dest_pid;
            info_copy.Depth = dest_depth + 1;
            info_copy.Status = CCommon.GetStatus_upt();
            info_copy.Username = CCommon.Get_CurrentUsername();
            info_copy.Timeupdate = DateTime.Now;
            if (BLL.Save(info_copy))
            {
                //BLL.Updatenum(dest_pid.ToString(), Queryparam.Sqlcolumn.Pis, 1);

                List<CategoryInfo> listin = null;
                List<CategoryInfo> listsub = BLL.Wcmm_Getlist_sub(source_info.Id, listin);
                if (listsub != null && listsub.Count > 0)
                {
                    foreach (CategoryInfo info_sub in listsub)
                    {
                        info_sub.Cid = getchild ? dest_cid : source_info.Cid;
                        info_sub.Pid = getchild ? info_sub.Pid : (info_sub.Pid == source_info.Id ? source_info.Pid : info_sub.Pid);
                        info_sub.Depth = getchild ? info_sub.Depth + offset_depth : info_sub.Depth - 1;
                        info_sub.Status = CCommon.GetStatus_upt();
                        info_sub.Username = CCommon.Get_CurrentUsername();
                        info_sub.Timeupdate = DateTime.Now;
                        BLL.Save(info_sub);
                    }
                }
            }
        }
示例#5
0
        private void Copy_Info(CategoryInfo source_info, int dest_cid, int dest_pid, int dest_depth, bool getchild, CCategory BLL)
        {
            if (source_info == null) return;

            CategoryInfo info_copy = source_info.copy();
            info_copy.Id = 0;
            info_copy.Cid = dest_cid;
            info_copy.Pid = dest_pid;
            info_copy.Depth = dest_depth + 1;
            info_copy.Status = CCommon.GetStatus_upt();
            info_copy.Username = CCommon.Get_CurrentUsername();
            info_copy.Timeupdate = DateTime.Now;
            info_copy.Orderd = 0;
            info_copy.Pis = getchild ? info_copy.Pis : (info_copy.Pis > 0 ? 1 : 0);
            if (BLL.Save(info_copy))
            {
                //BLL.Updatenum(dest_pid.ToString(), Queryparam.Sqlcolumn.Pis, 1);
                if (getchild)
                {
                    List<CategoryInfo> listsub = BLL.Wcmm_Getlist(source_info.Cid, source_info.Id, Get_ListOptionsNoPaging());
                    if (listsub == null || listsub.Count == 0) return;
                    foreach (CategoryInfo info_sub in listsub)
                    {
                        this.Copy_Info(info_sub, dest_cid, info_copy.Id, info_copy.Depth, getchild, BLL);
                    }
                }
            }
        }
示例#6
0
        protected void cmdUpdateorder_Click(object sender, EventArgs e)
        {
            try
            {
                if (grdView.Rows.Count == 0) return;

                CCategory BLL = new CCategory(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);
            }
        }
示例#7
0
        private void Bind_rptListByCategory()
        {
            CCategory DAL = new CCategory(CCommon.LANG);
            List<CategoryInfo> list = null;
            if (!CFunctions.GetViewSetting(Webcmm.Id.News, ViewSetting.ListWhenCategoryBrowse))
            {
                int numResults = 0;
                list = DAL.Getlist(Webcmm.Id.News, this.Cid, Get_ListOptions(), out numResults);
                if (list != null && list.Count > 0) return;
            }

            if (CFunctions.GetViewSetting(Webcmm.Id.News, ViewSetting.ListByCategory))
            {
                int numResults = 0;
                list = DAL.Getlist(Webcmm.Id.News, this.Cid, Get_ListOptions(), out numResults);
            }
            if (list == null || list.Count == 0 || !CFunctions.GetViewSetting(Webcmm.Id.News, ViewSetting.ListByCategory))
            {
                CategoryInfo cinfo = DAL.Getinfo(this.Cid);
                if (cinfo == null)
                    cinfo = new CategoryInfo();
                list = new List<CategoryInfo>();
                list.Add(cinfo);
            }

            (new GenericList<CategoryInfo>()).Bind_DataList(rptListByCategory, null, list, 0);
            pnlListByCategory.Visible = list != null && list.Count > 0;
            return;
        }