Example #1
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                NewID = (int)Session["NewID"];
                Web_News news = Web_News.Load(NewID);

                news.News_Content = Server.HtmlEncode(tb_Content.Value.Trim());
                news.News_Title = tb_Title.Text;
                news.Module_Code = ddl_Module.SelectedValue;

                news.News_PubDate = DateTime.Now;
                news.Manager_Code = "zhujianjie";
                news.Save();
                CY.CYWebsite.Core.Business.Web_Log log = new CY.CYWebsite.Core.Business.Web_Log();
                log.ManagerCode = Manager.Manager_Code;
                log.Log_Message = Manager.Manage_RealName + "修改了新闻:" + tb_Title.Text;
                log.Log_DateCreated = DateTime.Now;
                log.Save();
                lb_err.Text = "修改成功";
            }
            catch (Exception ex)
            {
                lb_err.Text = ex.Message;
            }
        }
Example #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string code = textmanagerID.Text.Trim();
            string pass = textpass.Text.Trim();
            pass = CY.CYWebsite.Core.Business.PasswordEncrypt.DESEncryptMethod(pass);
            CY.CYWebsite.Core.Business.Web_Manager manager = new CY.CYWebsite.Core.Business.Web_Manager();
            IList<CY.CYWebsite.Core.Business.Web_Manager> list = manager.GetListByName(code);
            if (list.Count == 0 || list == null)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('该管理员信息不存在!');</script>");
                textmanagerID.Text = string.Empty;
                textmanagerID.Focus();
            }
            else if (pass == list[0].Manage_Pass)
            {
                Session["ManagerId"] = list[0].Id;//自增标识符:ID
                Session["ManagerCode"] = list[0].Manager_Code;//用户名
                Session["Manager"] = list[0];
                CY.CYWebsite.Core.Business.Web_Log log = new CY.CYWebsite.Core.Business.Web_Log();

                log.ManagerCode = list[0].Manager_Code;
                log.Log_Message = list[0].Manage_RealName + "登录了系统";
                log.Log_DateCreated = DateTime.Now;
                log.Save();
                Response.Redirect("/Struct/Mine.aspx");//成功,页面跳转
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('密码输入不正确!');</script>");
            }
        }
Example #3
0
        protected void btn_Del_Click(object sender, EventArgs e)
        {
            CheckBox cb;
            CY.CYWebsite.Core.Business.Web_News news;
            for (int i = 0; i < gv_NewsList.Rows.Count; i++)
            {
                cb = (CheckBox)gv_NewsList.Rows[i].FindControl("CBSelect");
                if (cb.Checked)
                {
                    int iID = int.Parse(gv_NewsList.DataKeys[i].Value.ToString());
                    news = CY.CYWebsite.Core.Business.Web_News.Load(iID);
                    if (news != null)
                    {
                        news.DeleteOnSave();

                        news.Save();

                        CY.CYWebsite.Core.Business.Web_Log log = new CY.CYWebsite.Core.Business.Web_Log();
                        log.ManagerCode = Manager.Manager_Code;
                        log.Log_Message = Manager.Manage_RealName + "删除了新闻:" + news.News_Title;
                        log.Log_DateCreated = DateTime.Now;
                        log.Save();
                    }
                }

            }
            BindData();
        }
Example #4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            CY.CYWebsite.Core.Business.Web_Manager manager = new CY.CYWebsite.Core.Business.Web_Manager();
            if (!manager.IsExistCode(TextManager_Code.Text.Trim()))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('此管理员编号已经存在');</script>");
                TextManager_Code.Text = string.Empty;
                TextManager_Code.Focus();
            }
            else
            {
                manager.Manager_Code = TextManager_Code.Text.Trim();//管理员编号
                manager.Manage_Pass = "******"; //默认密码888888       // TextManage_Pass.Text.Trim();//密码
                manager.Manage_Pass = CY.CYWebsite.Core.Business.PasswordEncrypt.DESEncryptMethod(manager.Manage_Pass);//加密
                manager.Manage_RealName = TextManage_RealName.Text.Trim();//真实姓名
                manager.Manager_AddDate = DateTime.Now;//添加日期
                try
                {
                    manager.Save();

                    CY.CYWebsite.Core.Business.Web_Log log = new CY.CYWebsite.Core.Business.Web_Log();
                    log.ManagerCode = Manager.Manager_Code;
                    log.Log_Message = Manager.Manage_RealName +"添加了管理员:" + manager.Manager_Code;
                    log.Log_DateCreated = DateTime.Now;
                    log.Save();

                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('增加管理员信息成功!');</script>");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Example #5
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void cancleManager_Click(object sender, EventArgs e)
 {
     CheckBox chk;
     bool success = false;
     CY.CYWebsite.Core.Business.Web_Manager managerOther;
     for (int i = 0; i < gvManager.Rows.Count; i++)
     {
         chk =(CheckBox)gvManager.Rows[i].FindControl("chk");
         if (chk.Checked)
         {
             int id =int.Parse(gvManager.DataKeys[i].Value.ToString());
             managerOther = CY.CYWebsite.Core.Business.Web_Manager.Load(id);
             try
             {
                 managerOther.DeleteOnSave();
                 managerOther.Save();
                 CY.CYWebsite.Core.Business.Web_Log log = new CY.CYWebsite.Core.Business.Web_Log();
                 log.ManagerCode = Manager.Manager_Code;
                 log.Log_Message = Manager.Manage_RealName + "删除了管理员:" + managerOther.Manager_Code;
                 log.Log_DateCreated = DateTime.Now;
                 log.Save();
                 success = true;
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         }
     }
     if (success == true)
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('删除管理员信息成功!');</script>");
         Bind();
     }
 }
Example #6
0
        public IList<CY.CYWebsite.Core.Business.Web_Log> FillLogsByCondition(string managerCode, string dateStart, string dateEnd)
        {
            String SqlSelect =
            "SELECT [Log_ID],[Log_Message],[Log_DateCreated],[ManagerCode] FROM [Web_Log] where ";
            SqlServerUtility db = new SqlServerUtility();
            IList<CY.CYWebsite.Core.Business.Web_Log> results = new List<CY.CYWebsite.Core.Business.Web_Log>();
            if (managerCode != "")
            {
                SqlSelect += " [ManagerCode]=@ManagerCode and  ";
                db.AddParameter("@ManagerCode", SqlDbType.NVarChar, managerCode);
            }
            DateTime dtTemp = new DateTime();

            if (dateStart != "" && DateTime.TryParse(dateStart, out dtTemp))
            {
                SqlSelect += " [Log_DateCreated]>@Log_DateStart and  ";
                db.AddParameter("@Log_DateStart", SqlDbType.DateTime, dateStart);

            }

            if (dateEnd != "" && DateTime.TryParse(dateEnd, out dtTemp))
            {
                dtTemp = dtTemp.AddDays(1);
                SqlSelect += " [Log_DateCreated]<@Log_DateEnd and  ";
                db.AddParameter("@Log_DateEnd", SqlDbType.DateTime, dtTemp.ToLongDateString());

            }
            SqlSelect += " 1=1 ";
            SqlSelect += SqlOrder;

            SqlDataReader reader = db.ExecuteSqlReader(SqlSelect);

            if (reader != null)
            {
                while (reader.Read())
                {
                    CY.CYWebsite.Core.Business.Web_Log log = new CY.CYWebsite.Core.Business.Web_Log();
                    if (!reader.IsDBNull(0)) log.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) log.Log_Message = reader.GetString(1);
                    if (!reader.IsDBNull(2)) log.Log_DateCreated = reader.GetDateTime(2);
                    if (!reader.IsDBNull(3)) log.ManagerCode = reader.GetString(3);
                    results.Add(log);
                }

                reader.Close();
            }
            return results;
        }
Example #7
0
        protected void searchLog_Click(object sender, EventArgs e)
        {
            lb_err.Text = "";
            try
            {
                CY.CYWebsite.Core.Business.Web_Log log = new CY.CYWebsite.Core.Business.Web_Log();
                string strDateStart = tb_DateStart.Text.Trim();
                string strDateEnd = tb_DateEnd.Text.Trim();
                IList<CY.CYWebsite.Core.Business.Web_Log> list = CY.CYWebsite.Core.Business.Web_Log.FillLogsByCondition(ddl_Manager.SelectedValue.ToString(), strDateStart, strDateEnd); ;

                gv_LogList.DataSource = list;
                gv_LogList.DataBind();
            }
            catch (Exception ex)
            {
                lb_err.Text = ex.Message;
            }
        }
Example #8
0
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     int id = int.Parse(Request.QueryString["ManagerId"]);
     CY.CYWebsite.Core.Business.Web_Manager managerother = CY.CYWebsite.Core.Business.Web_Manager.Load(id);
     managerother.Manage_RealName = TextManage_RealName.Text.Trim();//真实姓名
     try
     {
         managerother.Save();
         CY.CYWebsite.Core.Business.Web_Log log = new CY.CYWebsite.Core.Business.Web_Log();
         log.ManagerCode = Manager.Manager_Code;
         log.Log_Message = Manager.Manage_RealName + "修改了管理员:" + managerother.Manager_Code;
         log.Log_DateCreated = DateTime.Now;
         log.Save();
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('更新管理员信息成功!');window.location.href='ManagePreview.aspx?ManagerId=" + id + "'</script>");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #9
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvModule_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            lb_err.Text = "";
            int id = int.Parse(gvModule.DataKeys[e.RowIndex].Value.ToString());
            CY.CYWebsite.Core.Business.Web_Module module = CY.CYWebsite.Core.Business.Web_Module.Load(id);
            module.Module_Code = (gvModule.Rows[e.RowIndex].Cells[0].Controls[0] as TextBox).Text.Trim();
            module.Module_Name = (gvModule.Rows[e.RowIndex].Cells[1].Controls[0] as TextBox).Text.Trim();
            try
            {
                module.Save();

                lb_err.Text = "修改成功";

                CY.CYWebsite.Core.Business.Web_Log log = new CY.CYWebsite.Core.Business.Web_Log();
                log.ManagerCode = Manager.Manager_Code;
                log.Log_Message = Manager.Manage_RealName + "修改了模块:" + module.Module_Name;
                log.Log_DateCreated = DateTime.Now;
                log.Save();
            }
            catch (Exception ex)
            {
                lb_err.Text = ex.Message;
            }
            gvModule.EditIndex = -1;
            gvBind();
        }