RookeyFrame 搭建OA系统 (东莞黄江)【自带 工作流 自定义表单 表单设计器 权限组织架构 移动端 C# MVC】二 自定义控制器修改员工或者用户个人信息

公司员工非常多 ,经常需要更新个人通讯信息

比如 私人手机号码 短号 邮箱

步骤分为两部
第一步获取 员工信息 并以表单页面 形式 发给前端

在 UserController 下面 添加 一个获取 员工 的短号 邮箱 手机 这些
public ActionResult GetInfo( )
{
string errMsg;
errMsg = string.Empty;

        // var cc=  GetCurrentUser(_Request);
        // Sys_User user = CommonOperate.GetEntity<Sys_User>(x => x.Id == userId && !x.IsDeleted && x.IsValid && x.IsActivated, string.Empty, out errMsg);
        var code = Request.Cookies["UserName"].Value.ToString(); //_Request.Cookies["UserName"].ToString();
                                                           //通过Cookies 获取用户名
        string  officephone=string.Empty;
        string mobile = string.Empty;
        string shortcode = string.Empty;
        string email = string.Empty;
        var emp = CommonOperate.GetEntity<OrgM_Emp>(x => x.Code==code,string.Empty ,out errMsg);
        if (emp == null)
        {
            ViewBag.error = "您的账号非员工账户,只能修改密码";
            return  RedirectToAction("error");
        }
        if (emp.OfficePhone == null)
        {
            officephone = string.Empty;
        }
        else
        {
            officephone = emp.OfficePhone.ToString();
        }
        if (emp.Mobile == null)
        {
            mobile= string.Empty;
        }
    
        else
        {
            mobile = emp.Mobile.ToString();

        }
    
        if (emp.ShortCode == null)
        {
        shortcode = string.Empty;
        }
        else
        {
            shortcode = emp.ShortCode.ToString();
        }
         
        if (emp.Email == null)
        {
            email = string.Empty;
        }
        else
        {
        email = emp.Email.ToString();
        }

     
      
       
     
        ViewBag.data = emp;

        return View();

    }

第 二步 在UserController 下 添加一次 一个 处理 前端 提交过来的信息

public JsonResult ChangeInfo()
{
string code1 = Request[“Code”].ObjToStr();
string email1= Request[“Email”].ObjToStr();
string Mobile1 = Request[“Mobile”].ObjToStr();
string ShortCode1 = Request[“ShortCode”].ObjToStr();
string OfficePhone1 = Request[“OfficePhone”].ObjToStr();
string errMsg = string.Empty;
var rst = CommonOperate.UpdateRecordsByExpression<OrgM_Emp>(new { OfficePhone = OfficePhone1 ,email=email1, Mobile= Mobile1, ShortCode=ShortCode1 },p=>p.Code==code1,out errMsg);

        if (rst)
        {

            return Json(new ReturnResult() { Success = true, Message = "更新失败!" });

        }
        else {

            return Json(new ReturnResult() { Success = string.IsNullOrEmpty(errMsg), Message = errMsg });

        }

     

    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lisuyan0

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值