Beispiel #1
0
        public NModel.WebPager <NModel.DB_Area> LoadData(string ipAddress, string pagename)
        {
            BLL.DB_WebConfig bllwebcfg = new BLL.DB_WebConfig();

            BLL.DB_Area         bllArea     = new BLL.DB_Area();
            NModel.DB_WebConfig modelwebcfg = bllwebcfg.GetCodeModel(pagename);
            NModel.WebPager <NModel.DB_Area> model_pager = new NModel.WebPager <NModel.DB_Area>();
            // model_pager.OutStr = Tool.NWeb.GetAddresByIp(ipAddress);
            string gocityName = Tool.NTool.GetCookieValue("gocityName");

            if (!string.IsNullOrEmpty(gocityName))
            {
                model_pager.OutStr = this.Server.UrlDecode(gocityName);
            }
            if (string.IsNullOrEmpty(model_pager.OutStr))
            {
                model_pager.OutStr = "广州";
            }
            // model_pager.OutObj = bllArea.GetListByName(model_pager.OutStr + "%");

            model_pager.OutWebConfig = modelwebcfg != null ? modelwebcfg : new NModel.DB_WebConfig();
            BLL.DB_Link            bll_link  = new BLL.DB_Link();
            IList <NModel.DB_Link> List_link = bll_link.GetListByNumAndTop("1", 20);

            model_pager.IDictLink.Add("招聘友情链接", List_link);

            bll_link.Close();
            bllArea.Close();
            bllwebcfg.Close();
            return(model_pager);
        }
Beispiel #2
0
        public ActionResult Edit_DB_WebConfig()
        {
            this.Response.ContentType = "text/plain";

            NModel.DB_WebConfig model = new NModel.DB_WebConfig();
            BLL.DB_WebConfig    dal   = new BLL.DB_WebConfig();

            String JsonStr = "";

            bool isGet = Tool.NStr.PostForSetVal <NModel.DB_WebConfig>(ref model, ref JsonStr, "");

            // 下面代码编写
            if (isGet &&

                //&& !string.IsNullOrEmpty(model.WebConfig_Code) &&
                //    !string.IsNullOrEmpty(model.WebConfig_Title) && !
                //    string.IsNullOrEmpty(model.WebConfig_Keywords) &&
                //    !string.IsNullOrEmpty(model.WebConfig_Description) &&
                //// !string.IsNullOrEmpty(model.File_Category_Size)&&
                (model.WebConfig_ID > 0)

                )
            {
                //取默认值

                model.WebConfig_EditTime = DateTime.Parse(DateTime.Now.ToString("s"));

                bool isEdit = dal.EditFree(model, (long)model.WebConfig_ID) > 0 ? true : false;

                string msg = dal.ErrorMsg;
                if (!string.IsNullOrEmpty(msg))
                {
                    msg = "原因:" + msg;
                }

                if (isEdit)
                {
                    this.Response.Write(Tool.NMsg.SetMsg("修改成功", "1"));
                    this.Response.End();
                }
                else
                {
                    this.Response.Write(Tool.NMsg.SetMsg("修改失败" + msg, "0"));
                    this.Response.End();
                }

                dal.Close();
            }
            else
            {
                this.Response.Write(Tool.NMsg.SetMsg("提交失败", "0"));
                this.Response.End();
            }

            return(View());
        }
Beispiel #3
0
        public ActionResult SendToEMailCode()
        {
            NCaptcha.Generate(NModel.EnObject.UserCodeSessionName);

            DateTime?dt = (DateTime?)NModel.EnObject.GetTimeValue;

            try
            {
                DateTime?dt1 = DateTime.Now;
                TimeSpan?ts  = dt1 - dt;

                double s = 0;
                if (ts != null)
                {
                    s = ts.Value.TotalSeconds;
                }

                if (s >= 62 || ts == null)
                {
                    string toEmail = this.Server.UrlDecode(this.Request["to"]);
                    string code    = NModel.EnObject.GetCodeValue;

                    BLL.DB_WebConfig bll_WebConfig = new BLL.DB_WebConfig();

                    NModel.DB_WebConfig model_WebConfig = bll_WebConfig.GetModel((long?)4);

                    model_WebConfig = model_WebConfig != null ? model_WebConfig : new NModel.DB_WebConfig();
                    bll_WebConfig.Close();
                    bool isOk = Tool.NEmail.SendTo(model_WebConfig.WebConfig_ServerAdrress, model_WebConfig.WebConfig_SendEmail,
                                                   model_WebConfig.WebConfig_SendPw, model_WebConfig.WebConfig_SendName + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff"), toEmail, model_WebConfig.WebConfig_ToName,
                                                   model_WebConfig.WebConfig_SubContent + "验证码:" + code, model_WebConfig.WebConfig_SubTitle + "" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff"));
                    if (isOk)
                    {
                        NModel.EnObject.SetEmailValue = toEmail;

                        NModel.EnObject.SetTimeValue = DateTime.Now;
                        this.Response.Write("{ \"info\":\"已发送到邮箱,请查看验证码 邮箱->" + toEmail + "\" , \"status\":\"y\" }");
                    }
                    else
                    {
                        this.Response.Write("{ \"info\":\"发送失败\", \"status\":\"n\" }");
                    }
                }
                else
                {
                    this.Response.Write("{ \"info\":\"发送时间没到" + s + "秒\", \"status\":\"n\" }");
                }
            }
            catch (Exception ex)
            {
            }

            return(View());
        }
Beispiel #4
0
        //end

        public ActionResult Add_DB_WebConfig()
        {
            this.Response.ContentType = "text/plain";
            NModel.DB_WebConfig model = new NModel.DB_WebConfig();
            BLL.DB_WebConfig    dal   = new BLL.DB_WebConfig();

            String JsonStr = "";

            bool isGet = Tool.NStr.PostForSetVal <NModel.DB_WebConfig>(ref model, ref JsonStr, "");

            // 下面代码编写
            if (isGet
                //&& !string.IsNullOrEmpty(model.WebConfig_Code) &&
                //    !string.IsNullOrEmpty(model.WebConfig_Description)
                // &&!string.IsNullOrEmpty(model.WebConfig_Title)
                //&&!string.IsNullOrEmpty(model.WebConfig_Keywords

                )
            {
                {
                    model.WebConfig_EditTime = DateTime.Parse(DateTime.Now.ToString("s"));
                    model.WebConfig_AddTime  = DateTime.Parse(DateTime.Now.ToString("s"));
                    //
                    bool isAdd = dal.AddFree(model) > 0 ? true : false;

                    if (isAdd)
                    {
                        this.Response.Write(Tool.NMsg.SetMsg("增加成功", "1"));
                        this.Response.End();
                    }
                    else
                    {
                        this.Response.Write(Tool.NMsg.SetMsg("增加失败" + dal.ErrorMsg, "1"));
                        this.Response.End();
                    }
                }
            }
            else
            {
                this.Response.Write(Tool.NMsg.SetMsg("提交失败", "0"));
            }

            dal.Close();

            return(View());
        }
Beispiel #5
0
        public ActionResult Del_All_DB_WebConfig()
        {
            BLL.DB_WebConfig bll       = new BLL.DB_WebConfig();
            long             delNumber = bll.DelAll();

            if (delNumber > 0)
            {
                this.Response.Write(Tool.NMsg.SetMsg("删除成功", "1"));
                this.Response.End();
            }
            else
            {
                this.Response.Write(Tool.NMsg.SetMsg("删除失败", "0"));
                this.Response.End();
            }
            bll.Close();
            return(View());
        }
Beispiel #6
0
        public ActionResult Del_DB_WebConfig()
        {
            this.Response.ContentType = "text/plain";

            string delList = this.Request.Form["delList[]"];

            if (!string.IsNullOrEmpty(delList))
            {
                string[] arrStr = delList.Split(',');

                int[] delIntArr = Tool.NTool.ArrayToAll <int, string>(arrStr);

                if (Tool.NTool.IsArrNULL <int>(delIntArr))
                {
                    BLL.DB_WebConfig dal         = new BLL.DB_WebConfig();
                    long             long_Result = dal.DelList(delIntArr);

                    if (long_Result > 0)
                    {
                        this.Response.Write(Tool.NMsg.SetMsg(string.Format("删除成功!总共删除{0}条", long_Result), "1"));
                        this.Response.End();
                    }
                    else
                    {
                        this.Response.Write(Tool.NMsg.SetMsg("删除失败!", "0"));
                        this.Response.End();
                    }

                    dal.Close();
                }
                else
                {
                    this.Response.Write(Tool.NMsg.SetMsg("提交失败/填写数据不完整!", "0"));
                    this.Response.End();
                }
            }
            else
            {
                this.Response.Write(Tool.NMsg.SetMsg("提交失败/填写数据不完整!", "0"));
                this.Response.End();
            }

            return(View());
        }
Beispiel #7
0
        public ActionResult Item_db_webconfig()
        {
            BLL.DB_WebConfig dal = new BLL.DB_WebConfig();

            string pagenum    = this.Request.Form["pagenum"];
            string numPerPage = this.Request.Form["numPerPage"];

            string dbwebconfigdate = this.Request.Form["dbwebconfigdate"];
            string dbwebconfigurl  = this.Request.Form["dbwebconfigurl"];

            string where = "", order = "webconfig_addtime desc";

            if (string.IsNullOrEmpty(numPerPage))
            {
                numPerPage = "20";
            }
            if (string.IsNullOrEmpty(pagenum))
            {
                pagenum = "1";
            }

            where += " 1=1 ";

            if (!string.IsNullOrEmpty(dbwebconfigdate))
            {
                where += string.Format(" and ( CONVERT(varchar(100), webconfig_addtime, 23)=''{0}''  )", dbwebconfigdate);
            }
            if (!string.IsNullOrEmpty(dbwebconfigurl))
            {
                where += string.Format(" and WebConfig_Code like ''%{0}%''", dbwebconfigurl);
            }

            NModel.PageData <NModel.DB_WebConfig> PD = new NModel.PageData <NModel.DB_WebConfig>()
            {
                NumPerPage = numPerPage,
                PageNum    = pagenum,
                TotalPage  = dal.GetWhereListTotal(where),
                Where      = where,
                OrderField = order
            };
            dal.Close();
            return(View(PD));
        }
Beispiel #8
0
        public NModel.NewsPager LoadConfig(string pagename, string linknum = "1", string linkdictName = "友情链接")
        {
            BLL.DB_WebConfig bllwebcfg = new BLL.DB_WebConfig();

            NModel.DB_WebConfig modelwebcfg = bllwebcfg.GetCodeModel(pagename);
            NModel.NewsPager    model_pager = new NModel.NewsPager();

            bllwebcfg.Close();

            model_pager.OutWebConfig = modelwebcfg != null ? modelwebcfg : new NModel.DB_WebConfig();
            BLL.DB_Link bll_link = new BLL.DB_Link();

            IList <NModel.DB_Link> List_link = bll_link.GetListByNumAndTop(linknum, 20);

            model_pager.IDictLink.Add(linkdictName, List_link);

            bll_link.Close();
            return(model_pager);
        }
Beispiel #9
0
        public ActionResult Data_DB_WebConfig()
        {
            string[] keys = this.Request.Form.AllKeys;
            string   page = this.Request.Form["page"];
            string   rows = this.Request.Form["rows"];

            string where = this.Request.Form["where"];
            string order = this.Request.Form["order"];

            //   where = Server.UrlDecode(where);
            //1=1  and file_name like &#39;%va%&#39;

            int _page = 0, _rows = 0;

            int.TryParse(page, out _page);
            int.TryParse(rows, out _rows);
            if (_page == 0)
            {
                _page = 1;
            }
            if (_rows == 0)
            {
                _rows = 20;
            }

            BLL.DB_WebConfig           dal = new BLL.DB_WebConfig();
            List <NModel.DB_WebConfig> inModel = new List <NModel.DB_WebConfig>();

            inModel = dal.GetSortAndWherePagerList(_page, _rows, order, where);

            NModel.PageData <NModel.DB_WebConfig> outModel = BLL.Fun.SetJsonData <NModel.DB_WebConfig>(inModel);

            dal.Close();

            return(View(outModel));
        }