public SimpleResultModel FinishRegister(string cardNumber) { if (db.ei_users.Where(u => u.card_number == cardNumber).Count() > 0) { return(new SimpleResultModel() { suc = false, msg = "该用户已经注册,不能重复注册" }); } try { var empInfo = db.GetHREmpInfo(cardNumber).First(); ei_users user = new ei_users() { card_number = cardNumber, name = empInfo.emp_name, email = empInfo.email, id_number = empInfo.id_code, sex = empInfo.sex, phone = empInfo.tp, short_portrait = empInfo.zp == null ? null : MyUtils.MakeThumbnail(MyUtils.BytesToImage(empInfo.zp.ToArray())), salary_no = empInfo.txm, create_date = DateTime.Now, fail_times = 0, forbit_flag = false, password = MyUtils.getMD5("000000") }; db.ei_users.InsertOnSubmit(user); db.SubmitChanges(); } catch (Exception ex) { return(new SimpleResultModel() { suc = false, msg = "注册失败:" + ex.Message }); } return(new SimpleResultModel() { suc = true }); }