Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!txtOldPassword.Text.Equals(LoginUser.LoginUserPassword))
            {
                AlertMessage("请输入正确密码!");
                return;
            }
            if (txtNewPassword.Text != txtAgain.Text)
            {
                AlertMessage("二次输入密码不一致!");
                return;
            }
            DirModel dml = new DirModel();

            dml.Add("@user_password", txtAgain.Text);
            dml.Add("@user_no", LoginUser.LoginUser);
            UserLogic pageLogic = new UserLogic();

            if (pageLogic.ChangeUserPassword(dml))
            {
                if (Request.Cookies["xsCookie"] != null)
                {
                    HttpCookie c*k = Request.Cookies["xsCookie"];
                    TimeSpan   ts  = new TimeSpan(-1, 0, 0, 0);
                    c*k.Expires = DateTime.Now.Add(ts);//删除整个Cookie,只要把过期时间设置为现在
                }
                AlertMessage("密码修改成功,需要重新登录才能生效.");
            }
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DirModel dml = new DirModel();
            //新增页面
            string strid = "G" + DateTime.Now.ToString("yyyyMMddHHssmmm");

            dml.Add("@group_id", strid);
            dml.Add("@group_name", txtgroupName.Text.Trim());
            if (!pageLogic.ExistGroup(dml))
            {
                dml.Add("@group_remark", txtgroupRemark.Text.Trim());
                if (pageLogic.AddGroup(dml))
                {
                    AlertMessageAndGoTo("新增群组成功!", "/Page/P_System/Group.aspx");
                }
                else
                {
                    AlertMessageAndGoTo("新增群组失败!", "/Page/P_System/Group.aspx");
                }
            }
            else
            {
                AlertMessage("群组已经存在!");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 新增动态
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool InsertNew(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"insert into dbo.xs_new([new_title]
                          ,[new_content]
                          ,[create_time]
                          ,[create_user]
                          ,[update_user]
                          ,[update_time]
                          ,[new_type_id]
                          ,[new_sort])
                          values
                          (@new_title
                          ,@new_content
                          ,GETDATE()
                          ,@create_user
                          ,@create_user
                          ,getdate()
                          ,@new_type_id
                          ,@new_sort)";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 根据user绑定菜单
        /// </summary>
        private void BindFunction()
        {
            MenuLogic logic = new MenuLogic();
            DirModel  dml   = new DirModel();

            dml.Add("@user_no", LoginUser.LoginUser);
            DataTable     dtMenu  = logic.QueryMenu(dml);
            StringBuilder strMenu = new StringBuilder();

            DataRow[] drLevelones = dtMenu.Select("function_level=1", "function_sort asc");
            foreach (DataRow drLevelone in drLevelones)
            {
                strMenu.Append(@"<li> <h4>" + drLevelone["function_name"].ToString() + @"</h4>");
                DataRow[] drLeveltwos = dtMenu.Select("function_level=2 and function_parent_id='" + drLevelone["function_id"].ToString() + "'", "function_sort asc");
                if (drLeveltwos.Length > 0)
                {
                    strMenu.Append(@"<div class=""list-item none"">");
                    foreach (DataRow drLeveltwo in drLeveltwos)
                    {
                        strMenu.Append(@"  <p> <a href=""" + drLeveltwo["function_url"].ToString() + @""" onclick="" return setUrl('" + drLeveltwo["function_url"].ToString() + @"')"">" + drLeveltwo["function_name"].ToString() + @"</a></p>");
                    }
                    strMenu.Append(@" </div>");
                }
                strMenu.Append(@" </li>");
            }

            J_navlist.InnerHtml = strMenu.ToString();
        }
Ejemplo n.º 5
0
        private static DirContents FromDatabase(Credentials cr, MachineIdentity mid,
                                                DirIdentity did, bool downloadFilesContents = false)
        {
            List <FileContents> files = new List <FileContents>();
            var      c = cr.ToLib();
            var      m = mid.ToLib();
            DirModel d = did.ToLib();

            try {
                FileManipulator.GetFileList(c, m, d);

                foreach (FileModel f in d.Files)
                {
                    if (downloadFilesContents)
                    {
                        //adding contents to 'f'
                        FileManipulator.GetFileContent(c, m, d, f);
                    }
                    //adding new gui object to list
                    files.Add(new FileContents(f));
                }
            } catch (ActionException ex) {
                throw new ActionException("Unable to download directory contents.\n\n"
                                          + ex.Message + ".", ActionType.Directory, MemeType.Fuuuuu, ex);
            } catch (Exception ex) {
                throw new ActionException("Error while downloading directory contents.",
                                          ActionType.Directory, MemeType.Fuuuuu, ex);
            }

            //does not add local files, because this is supposed to happen in the constructor that
            // launches this static private method
            return(new DirContents(did, files, false));
        }
 DataTable dtHasAction = new DataTable(); //当前群组所拥有的群组
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request["id"] != null)
         {
             string   strGroupID = Request["id"].ToString();
             DirModel dml        = new DirModel();
             dml.Add("@group_id", strGroupID);
             DataTable dt = pageLogic.QueryGroupByID(dml);
             if (dt.Rows.Count > 0)
             {
                 lblName.Text     = dt.Rows[0]["group_name"].ToString();
                 lblRemark.Text   = dt.Rows[0]["group_remark"].ToString();
                 hidGroupID.Value = strGroupID;
                 BindGrid();
             }
             else
             {
                 AlertMessageAndGoTo("页面错误", "/Page/P_System/Group.aspx");
             }
         }
         else
         {
             AlertMessageAndGoTo("页面错误", "/Page/P_System/Group.aspx");
         }
     }
 }
Ejemplo n.º 7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DirModel dml = new DirModel();

            dml.Add("@new_type_name", txtName.Text);
            dml.Add("@new_type_remark", txtRemark.Text);
            if (string.IsNullOrEmpty(ddlType.SelectedValue))
            {
                //新增
                dml.Add("@new_type_id", "NT" + DateTime.Now.ToString("yyyyMMddHHmmssfff"));
                if (pageLogic.InsertNewType(dml))
                {
                    AlertMessage("新增" + txtName.Text + "成功");
                }
                else
                {
                    AlertMessage("新增" + txtName.Text + "失败," + txtName.Text + "可能已经存在.");
                }
            }
            else
            {
                //维护
                dml.Add("@new_type_id", ddlType.SelectedValue);
                if (pageLogic.UpdateNewType(dml))
                {
                    AlertMessage("更新" + txtName.Text + "成功");
                }
                else
                {
                    AlertMessage("更新" + txtName.Text + "失败");
                }
            }
            BindType();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 通过id查询所有信息
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public DataTable QueryGroupByID(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"select * from  [dbo].[xs_group] where [group_id]=@group_id";
            return(SqlHelper.GetDataTable(sqlpara));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 是否存在群组名称
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool ExistGroup(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"select * from  [dbo].[xs_group] where [group_id]<>@group_id and [group_name]=@group_name";
            return(SqlHelper.Exist(sqlpara));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 判断用户存在
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool ExistUser(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"select * from [dbo].[xs_users] where [user_no]=@userid";
            return(SqlHelper.Exist(sqlpara));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 招聘删除
        /// </summary>
        /// <returns></returns>
        public bool DeleteHire(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"delete from [xs_hire] where [hire_id]=@hire_id";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 更新群组
        /// </summary>
        /// <returns></returns>
        public bool UpdateGroup(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"update [xs_group] set [group_name]=@group_name,[group_remark]=@group_remark where [group_id]=@group_id";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 新增群组
        /// </summary>
        /// <returns></returns>
        public bool AddGroup(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"insert into [xs_group]([group_id],[group_name],[group_remark])values(@group_id,@group_name,@group_remark)";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 删除产品类别
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool DeleteProduct(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"delete from [dbo].[xs_product] where product_id=@product_id";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 更新招聘模板
        /// </summary>
        /// <returns></returns>
        public bool UpdateHireTemplate(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"update [xs_hire_template] set [hire_template_name]=@hire_template_name,[hire_template_content]=@hire_template_content
                            where hire_template_id=@hire_template_id";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool UpdateUser(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"update [xs_users] set [user_name]=@userName where [user_no]=@userid
                            update [xs_group_user] set [group_id]=@usergroup where [user_no]=@userid";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 是否匹配账号密码
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public DataTable QueryUser(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"select u.user_no,u.user_name,u.[user_password],gu.group_id,g.group_name from xs_users u
                            left join dbo.xs_group_user gu  on gu.user_no=u.user_no
                            left join dbo.xs_group g on g.group_id=gu.group_id where u.user_no=@user_no and u.user_password=@user_password";
            return(SqlHelper.GetDataTable(sqlpara));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 新增招聘模板
        /// </summary>
        /// <returns></returns>
        public bool AddHireTemplate(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"insert into [xs_hire_template]([hire_template_name],[hire_template_content])
                            values(@hire_template_name,@hire_template_content)";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool DeleteUser(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"delete from [xs_users]where [user_no]=@userid
                            delete from [xs_group_user] where  [user_no]=@userid";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 更新招聘
        /// </summary>
        /// <returns></returns>
        public bool UpdateHire(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"update [xs_hire] set [hire_name]=@hire_name,[hire_count]=@hire_count,[hire_place]=@hire_place
                            ,[hire_remark]=@hire_remark where [hire_id]=@hire_id";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 新增招聘
        /// </summary>
        /// <returns></returns>
        public bool AddHire(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"insert into [dbo].[xs_hire]([hire_id],[hire_name],[hire_count],[hire_place],[hire_remark])
                            values (@hire_id ,@hire_name,@hire_count,@hire_place,@hire_remark)";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 新增产品类别
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool InsertProductType(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"insert into xs_product_type([product_type_id],[product_type_name],[product_type_remark])
                                values(@producttype_id,@producttype_name,@producttype_remark)";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 更新产品类别
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool UpdateProductType(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"update xs_product_type set [product_type_name]=@producttype_name,[product_type_remark]=@producttype_remark
                            where [product_type_id]=@producttype_id";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 24
0
        protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            DirModel dml = new DirModel();

            dml.Add("@product_id", (sender as LinkButton).CommandArgument);
            if (pageLogic.DeleteProduct(dml))
            {
                AlertMessage("删除成功.");
                xsPage.RefreshPage();
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 删除动态类别
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool DeleteNewType(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"delete from  dbo.xs_new_type  where [new_type_id]=@new_type_id
                            delete from dbo.xs_new where [new_type_id]=@new_type_id";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 更新招聘
        /// </summary>
        /// <returns></returns>
        public bool UpdateMain(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"update [xs_main] set [main_content]=@main_content,updateuser=@updateuser
                            where [main_id]=@main_id ";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 判断用户存在
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool ChangeUserPassword(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"update dbo.xs_users
                            set user_password=@user_password
                            where user_no=@user_no";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 删除群组
        /// </summary>
        /// <returns></returns>
        public bool DeleteGroup(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"update [dbo].[xs_group_user] set [group_id]='G000' where [group_id]=@group_id
                            delete from [xs_group] where [group_id]=@group_id
                            delete from dbo.xs_group_user where [group_id]=@group_id
                            delete from dbo.xs_group_function  where [group_id]=@group_id   ";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 29
0
        public ActionResult Browse()
        {
            string pathName = Request["PathName"];

            string decodedPathName = MonoHelper.DecodeName(pathName);

            var root = new DirModel(decodedPathName);

            root.LoadSubDirs();
            root.LoadFiles();
            ViewData ["RootDir"] = root;
            return(View());
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="dml"></param>
        /// <returns></returns>
        public bool AddUser(DirModel dml)
        {
            xsSqlParameter sqlpara = new xsSqlParameter();

            sqlpara.AddSqlParameter(dml);
            sqlpara.SqlConnectString = GlabalString.DBString;
            sqlpara.SQL = @"delete from [dbo].[xs_users] where [user_no]=@userid
                            insert into [xs_users]([user_no],[user_name],[user_password]) values(@userid,@userName,@userpassword)
                            delete from [dbo].[xs_group_user] where [user_no]=@userid
                            insert into [xs_group_user]([group_id],[user_no]) values(@usergroup,@userid)";
            SqlHelper.Execute(sqlpara);
            return(true);
        }
Ejemplo n.º 31
0
        private void GenerateRandomNestedDirs()
        {
            #region 1st level
            for (int i = 0; i < 6; i++)
            {
                this.myDir = DirModel.GetDir("Dir", 1000);
                this.dirs.Add(this.myDir);
            }
            #endregion

            #region 2nd level
            foreach (DirModel dir in this.dirs)
            {
                for (int i = 0; i < 2; i++)
                {
                    this.myDir = DirModel.GetDir("Sub-Dir", 1000);
                    dir.SubDirs.Add(this.myDir);
                }
            }
            #endregion

            #region 3rd level
            foreach (DirModel dir in this.dirs)
            {
                foreach (DirModel subDir in dir.SubDirs)
                {
                    for (int i = 0; i < 2; i++)
                    {
                        this.myDir = DirModel.GetDir("Sub-sub-Dir", 1000);
                        subDir.SubDirs.Add(this.myDir);
                    }
                }
            }
            #endregion

            #region 4th level
            foreach (DirModel dir in this.dirs)
            {
                foreach (DirModel subDir in dir.SubDirs)
                {
                    foreach (DirModel subSubDir in subDir.SubDirs)
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            this.myDir = DirModel.GetDir("Sub-sub-sub-Dir", 1000);
                            subSubDir.SubDirs.Add(this.myDir);
                        }
                    }
                }
            }
            #endregion
        }
Ejemplo n.º 32
0
 private void MoveThisDir(DirModel d)
 {
     if (d.IsSelected == true)
     {
         if (d.Parent == null)
         {
             this.dirs.Remove(d);
             this.processDirs.Add(d);
         }
         else
         {
             DirModel parent = d.Parent;
             parent.SubDirs.Remove(d);
             this.processDirs.Add(d);
         }
     }
     else if (d.IsSelected == null)
     {
         MessageBox.Show(d.DirDescription + " has sub-Dir not selected");
     }
     else
     {
         MessageBox.Show("Please explicitly select " + d.DirDescription);
     }
 }