示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PARENT = this.Get_Parent();
     if (!Page.IsPostBack)
     {
         this.Init_State();
         this.Load_Info(CCommon.Get_QueryNumber(Queryparam.Iid));
     }
 }
示例#2
0
 private bool Saveitem(iSqlTransaction trans, CategoryInfo 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;
     }
 }
示例#3
0
        private CategoryInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                CategoryInfo info = new CategoryInfo();
                info.Code = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Name = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Note = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Url = 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.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.Timeupdate = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(i);
                info.Username = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Pis = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Pid = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Depth = dar.IsDBNull(++i) ? 1 : dar.GetInt32(i);
                info.Customizeid = dar.IsDBNull(++i) ? -1 : dar.GetInt32(i);
                info.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Rownumber = dar.IsDBNull(++i) ? 0 : dar.GetInt64(i);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
 public bool UpdateAliasInfo(CategoryInfo info)
 {
     bool kq = false;
     try
     {
         using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
         {
             string SQL = "UPDATE vndd_category 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;
 }
示例#5
0
        public bool Save(CategoryInfo info)
        {
            try
            {
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    using (iSqlTransaction trans = iConn.BeginTransaction())
                    {
                        try
                        {
                            this.Saveitem(trans, info);

                            trans.Commit();
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            throw ex;
                        }
                    }
                    iConn.Close();
                }
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
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);
                    }
                }
            }
        }
示例#7
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);
                    }
                }
            }
        }
示例#8
0
 private bool Save(CategoryInfo info)
 {
     try
     {
         if (info == null) return false;
         int iid = info.Id;
         if ((new CCategory(CCommon.LANG)).Save(info))
             if (PARENT != null && iid == 0)
                 (new CCategory(CCommon.LANG)).Updatenum(PARENT.Id.ToString(), Queryparam.Sqlcolumn.Pis, CConstants.NUM_INCREASE);
         return true;
     }
     catch
     {
         return false;
     }
 }
 private void Write_Categoryitem(StringBuilder write, CategoryInfo info)
 {
     write.Append("<span class=\"wrap" + (info.Depth == 1 ? " havesub" : "") + "\"><input type=\"checkbox\" name=\"chkcategorymulti\" id=\"chkcategorymulti" + info.Id + "\" value=\"" + info.Id + "\" " + this.Write_Checked(info.Id) + " /> <label for=\"chkcategorymulti" + info.Id + "\">" + info.Name + "</label></span>");
 }
示例#10
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;
        }
示例#11
0
        private void Bind_rptCategory()
        {
            List<CategoryInfo> list = null;
            CategoryInfo cinfo = (new CCategory(CCommon.LANG)).Getinfo(this.Cid);
            if (cinfo != null)
            {
                list = new List<CategoryInfo>();
                list.Add(cinfo);

                if (!pnlInfo.Visible)
                {
                    Master.AddMeta_Title(cinfo.Name);
                    Master.AddMeta_Description(CFunctions.IsNullOrEmpty(cinfo.Note) ? cinfo.Name : cinfo.Note);
                    Master.AddMeta_Keywords(CFunctions.IsNullOrEmpty(cinfo.Note) ? cinfo.Name : cinfo.Note);
                }
            }
            else
            {
                CategorytypeofInfo tinfo = (new CCategorytypeof(CCommon.LANG)).Getinfo(Webcmm.Id.News);
                if (tinfo != null)
                {
                    cinfo = new CategoryInfo();
                    cinfo.Name = tinfo.Name;
                    list = new List<CategoryInfo>();
                    list.Add(cinfo);

                    if (!pnlInfo.Visible)
                    {
                        Master.AddMeta_Title(tinfo.Name);
                        Master.AddMeta_Description(CFunctions.IsNullOrEmpty(tinfo.Note) ? tinfo.Name : tinfo.Note);
                        Master.AddMeta_Keywords(CFunctions.IsNullOrEmpty(tinfo.Note) ? tinfo.Name : tinfo.Note);
                    }
                }
            }
            (new GenericList<CategoryInfo>()).Bind_DataList(rptCategory, null, list, 0);
            pnlCategory.Visible = list != null && list.Count > 0;
            return;
        }
示例#12
0
 private CategoryInfo Take()
 {
     try
     {
         int iid = 0;
         int.TryParse(txtId.Value, out iid);
         CategoryInfo info = (new CCategory(CCommon.LANG)).Wcmm_Getinfo(iid);
         if (info == null)
             info = new CategoryInfo();
         info.Id = iid;
         info.Name = txtName.Text.Trim();
         info.Code = txtCode.Text.Trim();
         info.Url = txtUrl.Text.Trim();
         info.Note = txtNote.Text.Trim();
         info.Cid = int.Parse(ddlCid.SelectedValue);
         info.Pis = chkPis.Checked ? (chkPis.ToolTip == "0" ? 1 : int.Parse(chkPis.ToolTip)) : 0;
         if (PARENT != null)
         {
             info.Pid = PARENT.Id;
             info.Depth = PARENT.Depth + 1;
         }
         else
         {
             info.Depth = info.Pid != 0 ? info.Depth : 1;
         }
         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.Username = CCommon.Get_CurrentUsername();
         info.Timeupdate = DateTime.Now;
         return info;
     }
     catch
     {
         return null;
     }
 }
示例#13
0
        private bool Save_Lang(CategoryInfo 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;

                    CategoryInfo lang_info = info.copy();
                    lang_info.Id = 0;
                    lang_info.Status = (int)CConstants.State.Status.Waitactive;
                    (new CCategory(lang_val)).Save(lang_info);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
示例#14
0
 private void setParameter(iSqlParameter[] parms, CategoryInfo 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.Note);
         parms[++i].Value = CFunctions.SetDBString(info.Url);
         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 = info.Iconex;
         parms[++i].Value = CFunctions.SetDBDatetime(info.Timeupdate);
         parms[++i].Value = CFunctions.SetDBString(info.Username);
         parms[++i].Value = info.Pis;
         parms[++i].Value = info.Pid;
         parms[++i].Value = info.Depth;
         parms[++i].Value = info.Customizeid;
         parms[++i].Value = CFunctions.install_keyword(info.Name) + " " + CFunctions.install_keyword(info.Note);
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PARENT = this.Get_Parent();
     if (!Page.IsPostBack)
     {
         this.Init_State();
         this.Bind_grdView();
     }
 }
示例#16
0
 private void Write_Menuitem(StringBuilder write, MenuInfo menuinfo, CategoryInfo info)
 {
     write.Append("<span class=\"wrap" + (info.Pis > 0 ? " havesub" : "") + "\"><a href=\"" + (this.install_url(menuinfo.Navigateurl, menuinfo.Cataloguetypeofid, info.Id, 0, info.Name)) + "\">" + info.Name + "</a></span>");
 }
示例#17
0
        private bool Load_Info(int iid)
        {
            try
            {
                CategoryInfo info = null;
                if (iid != 0)
                {
                    info = (new CCategory(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 CategoryInfo();
                chkSaveoption_golist.Checked = info.Id != 0;
                chkSaveoption_golang.Checked = info.Id == 0;

                txtId.Value = info.Id.ToString();
                txtName.Text = info.Name;
                txtCode.Text = info.Code;
                txtUrl.Text = info.Url;
                txtNote.Text = info.Note;
                ddlCid.SelectedValue = PARENT != null ? PARENT.Cid.ToString() : (info.Cid != 0 ? info.Cid.ToString() : CCommon.Get_QueryNumber(Queryparam.Cid).ToString());
                chkPis.Checked = info.Pis != 0;
                chkPis.ToolTip = info.Pis.ToString();
                chkPis.Enabled = !(info.Pis > 1);
                chkPis.Text = CCommon.Get_Definephrase(Definephrase.Display_pis).Replace(Queryparam.Varstring.Depth, (PARENT == null ? 2 : PARENT.Depth + 2).ToString());
                Filepreview.Set(info.Filepreview);
                Displaysetting.Set(info.Iconex, info.Status, info.Orderd, info.Markas);

                return true;
            }
            catch
            {
                return false;
            }
        }