예제 #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.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
                log.Manager = Manager.Code;
                log.Message = Manager.RealName  +"修改了新闻:" + tb_Title.Text;
                log.Save();
                lb_err.Text = "修改成功";
            }
            catch (Exception ex)
            {
                lb_err.Text = ex.Message;
            }
        }
예제 #2
0
 protected void btn_Save_Click(object sender, EventArgs e)
 {
     lb_err.Text = "";
     try
     {
         Web_News news = new Web_News();
         news.Module_Code = ddl_Module.SelectedValue;
         news.News_Content = Server.HtmlEncode(tb_Content.Value.Trim());
         news.News_Title = tb_Title.Text;
         news.News_PubDate = DateTime.Now;
         news.Manager_Code = Session["ManagerCode"].ToString();
         news.Save();
         CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
         log.Manager = Manager.Code;
         log.Message = Manager.RealName + "添加了新闻:" + tb_Title.Text;
         log.Save();
         tb_Content.Value = "";
         tb_Title.Text = "";
         WriteBackScript("alert('添加成功!')");
     }
     catch (Exception ex)
     {
         lb_err.Text = ex.Message;
     }
 }
예제 #3
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.HotelBooking.Core.Business.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.HotelBooking.Core.Business.Manager.Load(id);
             try
             {
                 managerOther.DeleteOnSave();
                 managerOther.Save();
                 CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
                 log.Manager = Manager.Code;
                 log.Message = Manager.RealName + "删除了管理员:" + managerOther.Code;
                 log.Save();
                 success = true;
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         }
     }
     if (success == true)
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('删除管理员信息成功!');</script>");
         Bind();
     }
 }
예제 #4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string code = textmanagerID.Text.Trim();
            string pass = textpass.Text.Trim();
            pass = CY.HotelBooking.Core.Business.PasswordEncrypt.DESEncryptMethod(pass);
            CY.HotelBooking.Core.Business.Manager manager = new CY.HotelBooking.Core.Business.Manager();
            IList<CY.HotelBooking.Core.Business.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].Pass)
            {
                Session["ManagerId"] = list[0].Id;//自增标识符:ID
                Session["ManagerCode"] = list[0].Code;//用户名
                Session["Manager"] = list[0];
                CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();

                log.Manager = list[0].Code;
                log.Message = list[0].RealName + "登录了系统";
                log.Save();
                Response.Redirect("/Struct/Mine.aspx");//成功,页面跳转
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('密码输入不正确!');</script>");
            }
        }
예제 #5
0
        protected void btn_Del_Click(object sender, EventArgs e)
        {
            CheckBox cb;
            CY.HotelBooking.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.HotelBooking.Core.Business.Web_News.Load(iID);
                    if (news != null)
                    {
                        news.DeleteOnSave();

                        news.Save();

                        CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
                        log.Manager = Manager.Code;
                        log.Message = Manager.RealName + "删除了新闻:" + news.News_Title;
                        log.Save();
                    }
                }

            }
            BindData();
        }
예제 #6
0
 private void Bind()
 {
     try
     {
         CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
         IList<CY.HotelBooking.Core.Business.Log> list = CY.HotelBooking.Core.Business.Log.GetAllLogs();
         gv_LogList.DataSource = list;
         gv_LogList.DataBind();
     }
     catch (Exception ex)
     {
         lb_err.Text = ex.Message;
     }
 }
예제 #7
0
        protected void searchLog_Click(object sender, EventArgs e)
        {
            lb_err.Text = "";
            try
            {
                CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
                string strDateStart = tb_DateStart.Text.Trim();
                string strDateEnd = tb_DateEnd.Text.Trim();
                IList<CY.HotelBooking.Core.Business.Log> list = CY.HotelBooking.Core.Business.Log.FillLogsByCondition(ddl_Manager.SelectedValue.ToString(), strDateStart, strDateEnd); ;

                gv_LogList.DataSource = list;
                gv_LogList.DataBind();
            }
            catch (Exception ex)
            {
                lb_err.Text = ex.Message;
            }
        }
예제 #8
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            int id = int.Parse(Request.QueryString["ManagerId"]);
            CY.HotelBooking.Core.Business.Manager managerother = CY.HotelBooking.Core.Business.Manager.Load(id);
            managerother.RealName = TextManage_RealName.Text.Trim();//真实姓名
            managerother.Role = ddlRole.SelectedValue;//角色类型
            try
            {
                managerother.Save();
                CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
                log.Manager = Manager.Code;
                log.Message = Manager.RealName + "修改了管理员:" + managerother.Code;

                log.Save();
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('更新管理员信息成功!');window.location.href='ManagePreview.aspx?ManagerId=" + id + "'</script>");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #9
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            //if (TextManage_Pass.Text.Trim() != TextManage_Pass2.Text.Trim())
            //{
            //    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('两次密码不相同');</script>");
            //    TextManage_Pass.Focus();
            //}
            CY.HotelBooking.Core.Business.Manager manager = new CY.HotelBooking.Core.Business.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.Code = TextManager_Code.Text.Trim();//管理员编号
                manager.Pass = "******"; //默认密码888888       // TextManage_Pass.Text.Trim();//密码
                manager.Pass = CY.HotelBooking.Core.Business.PasswordEncrypt.DESEncryptMethod(manager.Pass);//加密
                manager.RealName = TextManage_RealName.Text.Trim();//真实姓名
                manager.AddDate = DateTime.Now;//添加日期
                manager.Role = ddlRole.SelectedValue;//角色类型
                try
                {
                    manager.Save();

                    CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
                    log.Manager = Manager.Code;
                    log.Message = Manager.RealName +"添加了管理员:" + manager.Code;
                    log.Save();

                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('增加管理员信息成功!');</script>");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     //int id = int.Parse(Request.QueryString["ManagerId"]);
     // int id = int.Parse(Session["ManagerId"].ToString());
     int id = base.Manager.Id;
     string oldPass = TextOldpass.Text.Trim();
     string newPass = TextNewpass.Text.Trim();
     string newPass2 = TextNew2pass.Text.Trim();
     try
     {
         CY.HotelBooking.Core.Business.Manager.ChangePass(id, oldPass, newPass, newPass2);
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('密码更改成功');</script>");
         CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
         log.Manager = Manager.Code;
         log.Message = Manager.RealName +"修改了密码";
         log.Save();
         //跳转页面
     }
     catch(Exception ex)
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('"+ex.Message+"');</script>");
     }
 }
예제 #11
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.HotelBooking.Core.Business.Web_Module module = CY.HotelBooking.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.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
                log.Manager = Manager.Code;
                log.Message = Manager.RealName + "修改了模块:" + module.Module_Name;
                log.Save();
            }
            catch (Exception ex)
            {
                lb_err.Text = ex.Message;
            }
            gvModule.EditIndex = -1;
            gvBind();
        }