Exemple #1
0
 public void UpdateMenu(sys_menu dto, string funcs)
 {
     if (!string.IsNullOrEmpty(dto.menu_url))
     {
         dto.menu_type = 1;
     }
     if (dto.parent_id == 0)
     {
         dto.menu_level = 1;
     }
     else
     {
         dto.menu_level = Sqldb.Queryable <sys_menu>().Where(s => s.id == dto.parent_id).Select(s => s.menu_level).First() + 1;
     }
     Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.create_person }).ExecuteCommand();
     Sqldb.Deleteable <sys_menu_ref_operate>().Where(s => s.menu_id == dto.id).ExecuteCommand();
     if (!string.IsNullOrEmpty(funcs))
     {
         var funcArray = funcs.Split(',');
         if (funcArray.Length > 0)
         {
             var list = new List <sys_menu_ref_operate>();
             foreach (var func in funcArray)
             {
                 var funcModel = new sys_menu_ref_operate();
                 funcModel.menu_id    = dto.id;
                 funcModel.operate_id = func.ToInt64();
                 list.Add(funcModel);
             }
             Sqldb.Insertable(list).ExecuteCommand();
         }
     }
 }
Exemple #2
0
 public void UpdateProfile(sys_user dto)
 {
     dto.fax          = dto.fax ?? string.Empty;
     dto.email        = dto.email ?? string.Empty;
     dto.mobile_phone = dto.mobile_phone ?? string.Empty;
     Sqldb.Updateable(dto).UpdateColumns(s => new { s.real_name, s.pass_word, s.mobile_phone, s.email }).ExecuteCommand();
 }
Exemple #3
0
 public void UpdateData(sys_user dto)
 {
     dto.fax          = dto.fax ?? string.Empty;
     dto.email        = dto.email ?? string.Empty;
     dto.mobile_phone = dto.mobile_phone ?? string.Empty;
     Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_person, s.create_time, s.account_name }).ExecuteCommand();
 }
Exemple #4
0
 public void UpdateUserPwd(long id, string pwd)
 {
     pwd = Encrypt.DesDecrypt(pwd);
     Sqldb.Updateable <sys_user>().UpdateColumns(s => new sys_user {
         pass_word = pwd
     }).Where(s => s.id == id).ExecuteCommand();
 }
Exemple #5
0
 public void UpdateData(demo dto)
 {
     dto.name   = dto.name ?? string.Empty;
     dto.sex    = dto.sex ?? string.Empty;
     dto.age    = dto.age;
     dto.remark = dto.remark ?? string.Empty;
     Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_person, s.create_time }).ExecuteCommand();
 }
        /// <summary>
        /// 更新字典
        /// </summary>
        /// <param name="dto"></param>
        public void UpdateDicData(sys_dictionary dto)
        {
            if (dto.parent_id != 0)
            {
                var dicCode =
                    Sqldb.Queryable <sys_dictionary>().Where(s => s.id == dto.parent_id).Select(s => s.dic_code).First();

                dto.dic_code = dicCode;
            }
            Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_person, s.create_time }).ExecuteCommand();
        }
Exemple #7
0
 public void SaveRoleData(sys_role dto)
 {
     if (string.IsNullOrEmpty(dto.id))
     {
         dto.id          = Guid.NewGuid().ToString("N");
         dto.creator     = "admin";
         dto.create_time = DateTime.Now;
         Sqldb.Insertable(dto).ExecuteCommand();
     }
     else
     {
         Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.creator }).ExecuteCommand();
     }
 }
Exemple #8
0
        public void UpdateData(sys_citys dto)
        {
            //if (dto.parent_id == 0)
            //{
            //    dto.parent_name = string.Empty;
            //}
            //else
            //{
            //    var parea = Sqldb.Queryable<sys_citys>().Where(s => s.id == dto.parent_id).First();

            //    dto.area_Level = parea.area_Level + 1;
            //}
            //dto.lat_lng = dto.lat_lng ?? string.Empty;
            Sqldb.Updateable(dto).ExecuteCommand();
        }
Exemple #9
0
        public void SaveData(sys_func dto)
        {
            if (dto.id == 0)
            {
                dto.id          = NewLongId();
                dto.create_time = DateTime.Now;
                dto.creator     = "admin";

                Sqldb.Insertable(dto).ExecuteCommand();
            }
            else
            {
                Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.creator }).ExecuteCommand();
            }
        }
Exemple #10
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="dto"></param>
        public void UpdateMenu(sys_menu dto, string funcs)
        {
            if (!string.IsNullOrEmpty(dto.menu_url))
            {
                dto.menu_type = 1;
            }
            if (dto.parent_id == 0)
            {
                dto.menu_level = 1;
            }
            else
            {
                dto.menu_level = Sqldb.Queryable <sys_menu>().Where(s => s.id == dto.parent_id).Select(s => s.menu_level)
                                 .First() + 1;
            }
            Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.create_person }).ExecuteCommand();

            //设置菜单下按钮
            Sqldb.Deleteable <sys_operate>().Where(s => s.menu_id == dto.id).ExecuteCommand();
            if (dto.menu_type == 1 && !string.IsNullOrEmpty(funcs))
            {
                var funcArray = funcs.ToObject <List <SysFuncDto> >();
                var list      = new List <sys_operate>();
                foreach (var func in funcArray)
                {
                    var funcModel = new sys_operate();
                    funcModel.menu_id    = dto.id;
                    funcModel.func_cname = func.title;
                    funcModel.func_name  = func.funcname;
                    funcModel.func_icon  = func.icon;
                    funcModel.func_url   = func.url;
                    funcModel.in_table   = func.intable;
                    funcModel.func_sort  = func.funcSort;
                    funcModel.id         = func.id > 0 ? func.id : IdWorkerHelper.NewId();
                    list.Add(funcModel);
                }
                Sqldb.Insertable(list).ExecuteCommand();
            }
        }
Exemple #11
0
 public void UpdateRoleData(sys_role dto)
 {
     dto.role_code = dto.role_code ?? string.Empty;
     Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_person, s.create_time }).ExecuteCommand();
 }
Exemple #12
0
 public void UpdateFunc(sys_operate dto)
 {
     dto.func_icon  = dto.func_icon ?? "tag";
     dto.func_class = dto.func_class ?? "btn-blue";
     Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.create_person }).ExecuteCommand();
 }
Exemple #13
0
 public void UpdateAreaData(sys_area dto)
 {
     dto.name = dto.name ?? string.Empty;
     Sqldb.Updateable(dto).IgnoreColumns(s => new { s.zipcode, s.province_code, s.city_code, s.city_level }).ExecuteCommand();
 }
Exemple #14
0
 public void UpdateMenu(sys_menu dto)
 {
     Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.creator, s.menu_type }).ExecuteCommand();
 }