public static OpResult RegisterAgain(CompanyAuthorize comp) { comp.SerialNo = ""; comp.MachineSN = Machine.GetMAC; comp.CID = SysCommonRules.CompanyId; if (comp.AppProper != "Y") { comp.AppProper = "N"; } if (comp.StoreProper != "Y") { comp.StoreProper = "N"; } if (comp.PosMinorDisp != "Y") { comp.PosMinorDisp = "N"; } var rt = HttpClient.HttpPost(OmsUrl + "api/outerapi/RegisterAgain", comp.ToJson()); if (rt == "0") { return(OpResult.Fail("连接OMS管理平台失败,请检查网络是否正常!")); } new Pharos.Utility.Config().SetAppSettings(_SerialKey, ""); RemoveCurrentAuth(); return(OpResult.Success()); }
public string GetCompany(string companyId) { var source = new CompanyAuthorize(); //int compid = 0; //if (int.TryParse(companyId, out compid)) // source = CompAuthorService.GetOneByCID(compid); //else //{ // var auth = new Sys.SysAuthorize(); // source = auth.AnalysisSN(companyId); // if(source!=null) // { // //if (!auth.ValidateCompany(source, CompAuthorService.GetOneByCID(source.Code.GetValueOrDefault()))) // source.Code=0; // } //} return(source == null?"":source.ToJson()); }
static OpResult ValidateProperty(CompanyAuthorize source) { var companyId = source.ToJson(); if (source.Way == 1) { var omsurl = OmsUrl + "api/outerapi/GetCompany"; companyId = HttpClient.HttpPost(omsurl, companyId); if (companyId == "404")//在线且返回空时 { RemoveCurrentAuth(); return(OpResult.Fail("连接OMS管理平台失败,请检查网络是否正常!")); } } var company = companyId.ToObject <CompanyAuthorize>(); if (company == null) { return(OpResult.Fail("获取商户信息失败,请确认是否已注册商户!")); } if (company.Status != 1) { return(OpResult.Fail("您处于停用或未审核状态,请联系管理员!")); } if (DateTime.Parse(company.EffectiveDT) > DateTime.Now) { return(OpResult.Fail("未到生效日期暂不能使用!")); } if (DateTime.Parse(company.ExpirationDT) <= DateTime.Now) { return(OpResult.Fail("已过使用期,请联系管理员!")); } if (company.Way == 2 && company.CID == 0) { return(OpResult.Fail("基础信息与注册不一致,请联系管理员!")); } DictRegister[SysCommonRules.CompanyId] = OpResult.Success(); CurrentStoreUser.Company = company; return(DictRegister[SysCommonRules.CompanyId]); }
public static OpResult LoinValidator(int companyId) { if (companyId <= 0) { return(OpResult.Fail("商户号为空!")); } var op = new OpResult(); var omsurl = OmsUrl + "api/outerapi/GetCompany"; if (Pharos.Logic.BLL.UserInfoService.GetUserCount(companyId) <= 0)//首次 { var auth = new CompanyAuthorize() { CID = companyId }; var json = HttpClient.HttpPost(omsurl, auth.ToJson()); if (json == "404") { return(OpResult.Fail("连接OMS管理平台失败,请检查网络是否正常!")); } var obj = json.ToObject <CompanyAuthorize>(); if (obj == null) { string msg = string.Format("<script>if(confirm('商户未注册是否填写注册信息?')) window.location.href='{0}';</script>", Url.GetApplicationPath + "Authorization/outregister?cid=" + companyId); //HttpContext.Current.Response.Write(msg); op.Successed = true; } else if (obj.Way == 2) { string msg = string.Format("<script>if(confirm('商户未激活是否激活?')) window.location.href='{0}';</script>", Url.GetApplicationPath + "Authorization/activate?again=1&cid=" + companyId); HttpContext.Current.Response.Write(msg); } else { return(Activate(null)); } } else//再次 { var company = CurrentStoreUser.Company as CompanyAuthorize; if (company == null) { RemoveCurrentAuth(); } op = HasRegister(); #region 独立方式附加控制 if (op.Successed) { company = CurrentStoreUser.Company as CompanyAuthorize; if (company != null && company.Way == 2) { var key = Pharos.Utility.Config.GetAppSettings(_SerialKey); if (!key.IsNullOrEmpty()) { var apppath = Url.GetApplicationPath; System.Threading.Tasks.Task.Factory.StartNew(() => { omsurl = OmsUrl + "api/outerapi/RegisterAgain"; var sno = ""; if (company.MachineSN.IsNullOrEmpty()) { company.MachineSN = Machine.GetMAC; sno = HttpClient.HttpPost(omsurl, company.ToJson());//更新机器码 } omsurl = OmsUrl + "api/outerapi/GetSerialNo"; sno = HttpClient.HttpPost(omsurl, companyId.ToString()); if (!sno.IsNullOrEmpty()) { sno = sno.Replace("\"", ""); } if (AnalysisSN(sno) != null && sno != key) { new Pharos.Utility.Config(apppath).SetAppSettings(_SerialKey, sno);//更新配置 DictRegister[companyId] = null; } }); } else { string msg = string.Format("<script>if(confirm('商户未激活是否激活?')) window.location.href='{0}';</script>", Url.GetApplicationPath + "Authorization/activate?again=1&cid=" + companyId); HttpContext.Current.Response.Write(msg); RemoveCurrentAuth(); op.Message = "独立方式,注册系列号不能为空,请联系管理员!"; op.Successed = false; } if (!company.MachineSN.IsNullOrEmpty() && company.MachineSN != Machine.GetMAC) { op.Message = "请在注册时的服务器上使用!"; op.Successed = false; } } } #endregion } return(op); }