Ejemplo n.º 1
0
 /// <summary>
 /// 设置初始界面
 /// </summary>
 private void fill()
 {
     try
     {
         Song.Entities.UserGroup mm;
         if (id != 0)
         {
             mm = Business.Do <IUser>().GetGroupSingle(id);
         }
         else
         {
             //如果是新增
             mm            = new Song.Entities.UserGroup();
             mm.UGrp_IsUse = true;
         }
         tbName.Text = mm.UGrp_Name;
         //是否显示
         cbIsUse.Checked = mm.UGrp_IsUse;
         //说明
         tbIntro.Text = mm.UGrp_Intro;
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Ejemplo n.º 2
0
        private void fill()
        {
            try
            {
                Song.Entities.User ea;
                if (id != 0)
                {
                    ea = Business.Do <IUser>().GetUserSingle(id);
                    //所属的组
                    Song.Entities.UserGroup egs = Business.Do <IUser>().GetGroup4User(id);
                    ListItem li = this.ddlGroup.Items.FindByValue(egs.UGrp_Id.ToString());
                    if (li != null)
                    {
                        li.Selected = true;
                    }

                    //性别
                    string   sex   = ea.User_Sex.ToString().ToLower();
                    ListItem liSex = rbSex.Items.FindByValue(sex);
                    if (liSex != null)
                    {
                        liSex.Selected = true;
                    }
                }
                else
                {
                    ea = new Song.Entities.User();
                    ea.User_RegTime = DateTime.Now;
                    ea.User_IsUse   = true;
                }
                //员工帐号
                this.tbAccName.Text = ea.User_AccName;
                //员工名称
                this.tbName.Text = ea.User_Name;
                //员工登录密码,为空
                //邮箱
                this.tbEmail.Text = ea.User_Email;
                //是否在职
                this.cbIsUse.Checked = ea.User_IsUse;
                //联系方式
                tbTel.Text      = ea.User_Tel;
                tbMobleTel.Text = ea.User_MobileTel;
                tbQQ.Text       = ea.User_QQ;
                tbMsn.Text      = ea.User_Msn;
            }
            catch (Exception ex)
            {
                Message.ExceptionShow(ex);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 修改是否显示的状态
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void sbShow_Click(object sender, EventArgs e)
 {
     try
     {
         StateButton ub    = (StateButton)sender;
         int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
         int         id    = int.Parse(this.GridView1.DataKeys[index].Value.ToString());
         //
         Song.Entities.UserGroup entity = Business.Do <IUser>().GetGroupSingle(id);
         entity.UGrp_IsUse = !entity.UGrp_IsUse;
         Business.Do <IUser>().SaveGroup(entity);
         BindData(null, null);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Ejemplo n.º 4
0
        public bool GroupRemoveDown(int id)
        {
            //当前对象
            Song.Entities.UserGroup current = this.GetGroupSingle(id);
            //当前对象排序号
            int orderValue = (int)current.UGrp_Tax;

            //下一个对象,即弟弟对象;
            Song.Entities.UserGroup down = Gateway.Default.From <UserGroup>().Where(UserGroup._.UGrp_Tax < orderValue).OrderBy(UserGroup._.UGrp_Tax.Desc).ToFirst <UserGroup>();
            if (down == null)
            {
                //如果弟对象不存在,则表示当前节点在兄弟中是老幺;即是最底端;
                return(false);
            }
            //交换排序号
            current.UGrp_Tax = down.UGrp_Tax;
            down.UGrp_Tax    = orderValue;
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Save <UserGroup>(current);
                    tran.Save <UserGroup>(down);
                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
                finally
                {
                    tran.Close();
                }
            }
            return(true);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     try
     {
         Song.Entities.UserGroup mm;
         if (id != 0)
         {
             mm = Business.Do <IUser>().GetGroupSingle(id);
         }
         else
         {
             //如果是新增
             mm            = new Song.Entities.UserGroup();
             mm.UGrp_IsUse = true;
         }
         //属性
         mm.UGrp_Name  = tbName.Text;
         mm.UGrp_IsUse = cbIsUse.Checked;
         //说明
         mm.UGrp_Intro = tbIntro.Text;
         //确定操作
         if (id == 0)
         {
             Business.Do <IUser>().AddGroup(mm);
         }
         else
         {
             Business.Do <IUser>().SaveGroup(mm);
         }
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
Ejemplo n.º 6
0
        public bool GroupRemoveUp(int id)
        {
            Song.Entities.UserGroup current = this.GetGroupSingle(id);
            //当前对象排序号
            int orderValue = (int)current.UGrp_Tax;

            //上一个对象,即兄长对象;存在当前优先级
            Song.Entities.UserGroup up = Gateway.Default.From <UserGroup>().Where(UserGroup._.UGrp_Tax > orderValue).OrderBy(UserGroup._.UGrp_Tax.Asc).ToFirst <UserGroup>();
            if (up == null)
            {
                //如果兄长对象不存在,则表示当前节点在兄弟中是老大;即是最顶点;
                return(false);
            }
            //交换排序号
            current.UGrp_Tax = up.UGrp_Tax;
            up.UGrp_Tax      = orderValue;
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Save <UserGroup>(current);
                    tran.Save <UserGroup>(up);
                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
                finally
                {
                    tran.Close();
                }
            }
            return(true);
        }