Ejemplo n.º 1
0
    //添加分类
    protected void btnSubAdd_Click(object sender, EventArgs e)
    {
        string category = txtCategory.Text;

        if (category.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (DevelopHelper.checkCategoryNameExit(category))
        {
            JSHelper.ShowAlert("该分类已存在!");
        }
        else
        {
            using (var db = new TeachingCenterEntities())
            {
                var cate = new DevelopCategory();
                cate.DevelopCategory_name = category;
                db.DevelopCategory.Add(cate);
                db.SaveChanges();
                Server.Transfer("DevelopCategoryManage.aspx");
                //                JSHelper.AlertThenRedirect("添加成功!", "DevelopCategoryManage.aspx");
            }
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        // Temporary Development Helpers
        //TODO: remove
        DevelopHelper dev = new DevelopHelper();

        dev.registerKeyBindings();
    }
Ejemplo n.º 3
0
        /**初始化应用**/

        private void initApp()
        {
            Log.info(this, "-initApp() 6、开始初始化模块应用!");
            if (isInit)
            {
                return;         //初始化状态
            }
            isInit      = true;
            AppNet.main = this;
            AppFacde.instance.Init();
//            var binLoadMgr = gameObject.AddComponent<BinLoadMgr>();
//            ResMgr.instance.initBinLoadMgr(binLoadMgr); //注册加载器
            //ResMgr.instance.setTrace(true); //打印日志开关
//            ResMgr.instance.setNumTry(3); //重试次数
//            ResMgr.instance.setNumThread(3); //加载并发数
            Log.info(this, "-initApp() 7、系统模块初始化【OK】");

            Singleton <LoginControl> .Instance.maxdelay = 10;
            Singleton <LoginControl> .Instance.heartGap = 5;

            //mapMode = (AppFacde.instance.getControl(MapControl.NAME).mode as MapMode);
            //LoginControl loginControl = (LoginControl)AppFacde.instance.getControl(LoginControl.NAME);
            //loginControl.openView();
            //Singleton<LoginView>.Instance.OpenView();

            //图集的初始化
            Singleton <AtlasManager> .Instance.Init();

            CommonModelAssetManager.Instance.Init();
            //UI预先加载
            //Singleton<GoodsAnim>.Instance.OpenView();
            //Singleton<BossView>.Instance.OpenView();   //暂作测试
            Singleton <GoGoView> .Instance.OpenView();

            //Singleton<NetworkInfoView>.Instance.OpenView();
            Singleton <ContinueCutView> .Instance.OpenView();

            //新的MVC测试

            //Singleton<LoginView>.Instance.OpenView();
            Log.info(this, "-initApp() 8、登陆UI打开【OK】");
            DevelopHelper.Init();
        }
Ejemplo n.º 4
0
 //修改分类
 protected void btnChange_Click(object sender, EventArgs e)
 {
     if (txtChange.Text.Length == 0)
     {
         JSHelper.ShowAlert("输入不能为空!");
     }
     else if (DevelopHelper.checkCategoryNameExit(txtChange.Text))
     {
         JSHelper.ShowAlert("该分类已存在!");
     }
     else
     {
         using (var db = new TeachingCenterEntities())
         {
             int             id = Convert.ToInt32(lbID.Text);
             DevelopCategory sc = db.DevelopCategory.Single(a => a.DevelopCategory_id == id);
             sc.DevelopCategory_name = txtChange.Text;
             db.SaveChanges();
             //JSHelper.AlertThenRedirect("修改成功!", "DevelopCategoryManage.aspx");
             Server.Transfer("DevelopCategoryManage.aspx");
         }
     }
 }
Ejemplo n.º 5
0
 protected void rptService_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         //绑定序号
         Literal literal = (Literal)e.Item.FindControl("ltNumber");
         literal.Text = (e.Item.ItemIndex + 1).ToString();
         //绑定分类
         try
         {
             literal      = (Literal)e.Item.FindControl("ltCategory");
             literal.Text = DevelopHelper.getCategoryName(Convert.ToInt32(literal.Text));
         }
         catch
         {
             literal.Text = "";
         }
         //绑定内容
         literal = (Literal)e.Item.FindControl("ltContent");
         string content = MyHtmlHelper.RemoveTags(Server.HtmlDecode(literal.Text));
         literal.Text = content.Length > 40 ? content.Substring(0, 40) + "..." : content;
     }
 }
Ejemplo n.º 6
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        string title   = txtTitle.Text;
        string link    = txtLink.Text;
        string content = myEditor11.InnerHtml;
        string arthor  = txtAuthor.Text;
        string summary = TextBox1.Text;

        if (title.Length == 0 || arthor.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (cbxLink.Checked && link.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (!cbxLink.Checked && content.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (summary.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else
        {
            try
            {
                if (fup.PostedFile.FileName == "")
                {
                    lblInfo.Text = "请选择文件!";
                }
                else
                {
                    if (!IsAllowedExtension(fup))
                    {
                        lblInfo.Text = "上传文件格式不正确!";
                    }
                    else
                    {
                        string filepath   = fup.PostedFile.FileName;
                        string filename   = filepath.Substring(filepath.LastIndexOf("\\") + 1);
                        string serverpath = Server.MapPath("picture/") + filename;
                        fup.PostedFile.SaveAs(serverpath);
                        serverpath   = filename;
                        lblInfo.Text = "上传成功!";
                        using (var db = new TeachingCenterEntities())
                        {
                            if (!cbxLink.Checked)
                            {
                                link = "";
                            }
                            Develop dev = new Develop();
                            dev.Develop_title    = title;
                            dev.Develop_author   = arthor;
                            dev.Develop_time     = DateTime.Now;
                            dev.Develop_content  = content;
                            dev.Develop_summary  = summary;
                            dev.Develop_link     = link;
                            dev.Develop_category = DevelopHelper.getCategoryId(dropCategory.SelectedValue);
                            dev.Develop_hit      = 0;
                            dev.Develop_path     = serverpath;
                            dev.Develop_deleted  = 0;
                            db.Develop.Add(dev);
                            db.SaveChanges();
                            //JSHelper.ShowAlert("发布成功!");
                            //JSHelper.Redirect("DevelopManage.aspx");
                            Server.Transfer("DevelopManage.aspx");
                        }
                    }
                }
            }
            catch
            {
            }
        }
    }
Ejemplo n.º 7
0
    //分页
    void DataBindToRepeater(int currentPage)
    {
        using (var db = new TeachingCenterEntities())
        {
            List <Develop> service;
            DateTime       min = new DateTime(1900, 1, 1);
            DateTime       max = new DateTime(2300, 12, 31);
            if (logmin.Value != "")
            {
                min = Convert.ToDateTime(logmin.Value);
            }
            if (logmax.Value != "")
            {
                max = Convert.ToDateTime(logmax.Value).AddDays(1);
            }

            if (txtSearch.Text == "")
            {
                if (dropCategory.SelectedValue != "全部分类")
                {
                    int category = DevelopHelper.getCategoryId(dropCategory.SelectedValue);
                    service = db.Develop.Where(a => a.Develop_deleted == 0 && a.Develop_category == category && a.Develop_time >= min && a.Develop_time <= max).OrderByDescending(a => a.Develop_time).ToList();
                }
                else
                {
                    service = db.Develop.Where(a => a.Develop_deleted == 0 && a.Develop_time >= min && a.Develop_time < max).OrderByDescending(a => a.Develop_time).ToList();
                }
            }
            else
            {
                if (dropCategory.SelectedValue != "全部分类")
                {
                    int category = DevelopHelper.getCategoryId(dropCategory.SelectedValue);
                    service = db.Develop.Where(a => a.Develop_deleted == 0 && a.Develop_category == category && a.Develop_time >= min && a.Develop_time <= max && a.Develop_title.Contains(txtSearch.Text)).OrderByDescending(a => a.Develop_time).ToList();
                }
                else
                {
                    service = db.Develop.Where(a => a.Develop_deleted == 0 && a.Develop_time >= min && a.Develop_time < max && a.Develop_title.Contains(txtSearch.Text)).OrderByDescending(a => a.Develop_time).ToList();
                }
            }

            ltCount.Text = service.Count().ToString();

            PagedDataSource pds = new PagedDataSource();

            pds.AllowPaging = true;

            pds.PageSize = 10;

            pds.DataSource = service.ToList();

            pds.CurrentPageIndex = currentPage - 1;

            rptService.DataSource = pds;

            rptService.DataBind();

            ltTotal.Text = pds.PageCount.ToString();

            if (Convert.ToInt32(ltNow.Text) == 1)
            {
                btnLast.Enabled = false;
            }
            else
            {
                btnLast.Enabled = true;
            }

            if (Convert.ToInt32(ltNow.Text) == pds.PageCount)
            {
                btnNext.Enabled = false;
            }
            else
            {
                btnNext.Enabled = true;
            }
        }
    }
Ejemplo n.º 8
0
    protected void btnSub_Click(object sender, EventArgs e)
    {
        string title   = txtTitle.Text;
        string link    = txtLink.Text;
        string content = myEditor11.InnerHtml;
        string summary = TextBox1.Text;
        string arthor  = txtAuthor.Text;

        if (title.Length == 0 || arthor.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (cbxLink.Checked && link.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (!cbxLink.Checked && content.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else if (summary.Length == 0)
        {
            JSHelper.ShowAlert("输入不能为空!");
        }
        else
        {
            int id = 1;
            try
            {
                string teacher = Session["AdminID"].ToString();
                id = Convert.ToInt32(Request.QueryString["id"].ToString());
                //using (var db = new TeachingCenterEntities())
                //{
                //    var cate = from it in db.DevelopCategory select it;

                //    dropCategory.DataSource = cate.ToList();

                //    dropCategory.DataTextField = "DevelopCategory_name";

                //    dropCategory.DataBind();

                //    Develop dev = db.Develop.Single(a => a.Develop_id == id);
                //    txtTitle.Text = dev.Develop_title;
                //    TextBox1.Text = dev.Develop_summary;
                //    txtLink.Text = dev.Develop_link;
                //    txtAuthor.Text = dev.Develop_author;
                //    myEditor11.InnerHtml = Server.HtmlDecode(dev.Develop_content);
                //}


                using (var db = new TeachingCenterEntities())
                {
                    Develop dev = db.Develop.Single(a => a.Develop_id == id);

                    dev.Develop_title   = title;
                    dev.Develop_author  = arthor;
                    dev.Develop_time    = DateTime.Now;
                    dev.Develop_content = content;
                    dev.Develop_link    = link;
                    if (!cbxLink.Checked)
                    {
                        link = "";
                    }
                    dev.Develop_summary  = summary;
                    dev.Develop_category = DevelopHelper.getCategoryId(dropCategory.SelectedValue);
                    dev.Develop_hit      = 0;
                    dev.Develop_deleted  = 0;
                    dev.Develop_time     = Convert.ToDateTime(pushlishTime.Value.ToString());
                    //db.Develop.Add(dev);
                    db.SaveChanges();
                    //JSHelper.ShowAlert("修改成功!");
                    //JSHelper.Redirect("DevelopManage.aspx");
                    Server.Transfer("DevelopManage.aspx");
                }
            }
            catch
            {
            }
        }
    }