Esempio n. 1
0
        public IActionResult SearchFuncAdd_Submit(M_Search model)
        {
            M_Search shMod = new M_Search();

            if (Mid > 0)
            {
                shMod = shBll.GetSearchById(Mid);
            }
            shMod.Name     = model.Name;
            shMod.FlieUrl  = model.FlieUrl;
            shMod.Ico      = GetParam("ItemIcon_T");
            shMod.Mobile   = model.Mobile;
            shMod.Size     = model.Size;
            shMod.OpenType = model.OpenType;
            shMod.BKColor  = model.BKColor;
            if (Mid > 0)
            {
                shBll.UpdateByID(shMod);
            }
            else
            {
                shMod.AdminID   = adminMod.AdminId;
                shMod.LinkState = 2;
                shMod.OrderID   = shBll.SelMaxOrder() + 1;
                shBll.insert(shMod);
            }
            string pageUrl = shMod.Type == 1 ? "SearchFunc?EliteLevel=" + shMod.EliteLevel : "SearchFunc";

            return(WriteOK("操作成功", pageUrl));
        }
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            b_search = new B_Search();
            M_Search search = new M_Search();

            search.Name = txtName.Text;
            //search.Type = DataConverter.CLng(rdoType.SelectedValue);
            search.FlieUrl = txtFileUrl.Text.Trim();
            string pic = ItemIcon_T.Text;

            if (pic != "")
            {
                search.Ico = pic;
            }
            search.Mobile   = Convert.ToInt32(SupportMobile.SelectedValue);
            search.Size     = Convert.ToInt32(MotroSize.SelectedValue);
            search.OpenType = DataConverter.CLng(rdoOpenType.SelectedValue);
            search.AdminID  = badmin.GetAdminLogin().AdminId;

            search.Type      = 2;
            search.UserGroup = "";
            if (!string.IsNullOrEmpty(Request.Form["selGroup"]))
            {
                search.UserGroup = Request.Form["selGroup"];//用户组权限
            }
            ///search.LinkType =DataConverter.CLng(rdoLinkType.SelectedValue);

            search.State      = 1;
            search.LinkState  = 2;
            search.EliteLevel = IsEliteLevel.Checked == true ? 1 : 0;
            if (Mid > 0)
            {
                search.Id      = Mid;
                search.OrderID = Convert.ToInt32(txtOrderID.Value);
                bool res = b_search.UpdateByID(search);
                if (res)
                {
                    function.WriteSuccessMsg("修改成功!", "UserFunc.aspx?EliteLevel=2");
                }
                else
                {
                    function.WriteErrMsg("修改失败!");
                }
            }
            else
            {
                search.OrderID = b_search.SelMaxOrder() + 1;
                int res = b_search.insert(search);
                function.WriteSuccessMsg("添加成功!", "UserFunc.aspx?EliteLevel=2");
            }
        }
        //添加搜索信息
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            b_search = new B_Search();
            M_Search search = new M_Search();

            search.Name = txtName.Text;
            //search.Type = DataConverter.CLng(rdoType.SelectedValue);
            search.FlieUrl = txtFileUrl.Text.Trim();
            string pic = ItemIcon_T.Text;

            if (pic != "")
            {
                search.Ico = pic;
            }
            search.Mobile   = Convert.ToInt32(SupportMobile.SelectedValue);
            search.Size     = Convert.ToInt32(MotroSize.SelectedValue);
            search.OpenType = DataConverter.CLng(rdoOpenType.SelectedValue);
            search.AdminID  = badmin.GetAdminLogin().AdminId;
            Regex regexObj = new Regex(@"\b(?:(?:https?|ftp|file)://|www\.|ftp\.)[-A-Z0-9+&@#/%=~_|$?!:,.]*[A-Z0-9+&@#/%=~_|$]", RegexOptions.IgnoreCase);

            //try
            //{
            //    if (regexObj.IsMatch(txtFileUrl.Text.Trim()))
            //    {
            //        // Successful match// 链接类型:1为站内链接,2为站外链接
            //        search.LinkType = 2;
            //    }
            //    else
            //    {
            //        // Match attempt failed
            //        search.LinkType = 1;
            //    }
            //}
            //catch
            //{
            //    search.LinkType = 1;
            //    // Syntax error in the regular expression
            //}
            ///search.LinkType =DataConverter.CLng(rdoLinkType.SelectedValue);
            //if (search.LinkType == 1)  //如果为站内链接就判断是否存在文件
            //{
            //    if (File.Exists(txtFileUrl.Text.Trim().Substring(1)))
            //    {
            //        search.Time = File.GetLastWriteTime(txtFileUrl.Text.Trim());
            //        search.LinkState = 1;
            //        search.State = 1;
            //    }
            //    else
            //    {
            //        search.Time = DateTime.Now;
            //        search.State = 1;
            //        search.LinkState = 2;
            //    }
            //}
            //else
            //{
            //    search.State = 1;
            //    search.LinkState = 2;
            //    //search.Time = DataConverter.CDate("1755-1-1");
            //}
            search.State      = 1;
            search.LinkState  = 2;
            search.EliteLevel = 0;
            search.Type       = 1;
            string pageUrl = search.Type == 1 ? "SearchFunc.aspx?EliteLevel=" + search.EliteLevel : "SearchFunc.aspx";

            if (Mid > 0)
            {
                search.Id      = Mid;
                search.OrderID = Convert.ToInt32(txtOrderID.Value);
                bool res = b_search.UpdateByID(search);
                if (res)
                {
                    function.WriteSuccessMsg("修改成功!", pageUrl);
                }
                else
                {
                    function.WriteErrMsg("修改失败!");
                }
            }
            else
            {
                search.OrderID = b_search.SelMaxOrder() + 1;
                int res = b_search.insert(search);
                function.WriteSuccessMsg("添加成功!", pageUrl);
            }
        }