public string AddCirculationRecord(string barCode, string sOperator, string currentPosition, string reason, string accessToKen) { try { if (!ToKenHelper.CheckAccessToKen(accessToKen)) { return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = commonErrorMsg })); } InstrumentModel instrumentModel = ServiceProvider.InstrumentService.GetByBarCode(barCode); if (instrumentModel == null) { return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = "不存在该设备!" })); } Global.Common.Models.UserModel user = Global.Business.ServiceProvider.UserService.GetByLoginName(sOperator); if (user == null) { return("用户不存在!"); } InstrumentFlowModel model = new InstrumentFlowModel(); model.Creator = user.UserName; model.Flow_Type = 1; model.InstrumentId = instrumentModel.InstrumentId; model.Place = currentPosition; model.Reason = reason; ServiceProvider.InstrumentFlowService.Save(model); return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = "OK" })); } catch (Exception ex) { log.Error(ex); return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = ex.Message })); } }
public string AppLogin(string JobNo, string loginPwd, string authorCode) { try { string errMsg = "OK"; bool IsSSOLogin = Convert.ToBoolean(WebUtils.GetSettingsValue("IsSSOLogin")); //单点登录 if (IsSSOLogin) { errMsg = GRGTCommonUtils.WSProvider.HRProvider.Login(JobNo, loginPwd, string.Empty); } Global.Common.Models.UserModel user = Global.Business.ServiceProvider.UserService.GetByLoginName(JobNo); if (user == null) { errMsg = "用户不存在!"; } if (!IsSSOLogin && user != null) { if (user.LoginPwd != ToolsLib.Utility.StrUtils.Encrypt(loginPwd, ToolsLib.LibConst.EncryptFormat.SHA1)) { errMsg = "密码错误!"; } } if (errMsg != "OK") { return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = errMsg })); } else { string AccessToKen = ToKenHelper.CreateToKen(JobNo); ///判断是否有送检权限 bool hasRoleSend = false; for (int i = 0; i < user.roleList.Count; i++) { IList <PermissionModel> list = user.roleList[i].permissionList.Where(c => !string.IsNullOrEmpty(c.PermissionResource)).ToList(); if (list.Where(c => c.PermissionResource.ToLower().Contains("/SendInstrument/SendInstrument".ToLower())).Count() > 0) { hasRoleSend = true; } } string VesionCode = Global.Common.GlobalConstants.VesionCode; return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = errMsg, Data = new { RoleInstrumenSend = hasRoleSend, Url = "", AccessToKen = AccessToKen } })); } } catch (Exception ex) { log.Error(ex); object msg = new { Msg = ex.Message }; return(ToolsLib.Utility.CommonUtils.JsonSerialize(msg)); } }
public string InternalLogin(string json) { try { string errMsg = "OK"; bool IsSSOLogin = Convert.ToBoolean(WebUtils.GetSettingsValue("IsSSOLogin")); var jObject = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(json); string JobNo = jObject.Property("JobNo").Value.ToString(); Global.Common.Models.UserModel user = Global.Business.ServiceProvider.UserService.GetByLoginName(JobNo); if (user == null) { errMsg = "用户不存在!"; } if (errMsg != "OK") { return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = errMsg })); } else { string AccessToKen = ToKenHelper.CreateToKen(JobNo); return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = errMsg, Data = new { AccessToKen = AccessToKen } })); } } catch (Exception ex) { log.Error(ex); object msg = new { Msg = ex.Message }; return(ToolsLib.Utility.CommonUtils.JsonSerialize(msg)); } }