public ActionResult Login(string tempKey, string tempKeySignature, string[] certInfo) { bool res = true; IDSLogin.IDSLoginservice loginClient = new IDSLogin.IDSLoginservice(); IDSLogin.TUserData userData=new IDSLogin.TUserData(); userData.ClientLocalIP = Request.ServerVariables["REMOTE_ADDR"]; //!TODO change this userData.ClientHardwareID = "6B50564A9446D655BF6BC077F866E9B4"; userData.ClientSoftwareGUID = "{1234806C-6DB0-4E27-B85E-990DCAFA8E4A}"; userData.ClientSoftwareVersion = "1.0.0.0"; CertInfo cert = new CertInfo(); cert.CNOwner = certInfo[0]; cert.OrganizationOwner = certInfo[1]; cert.CountryOwner = certInfo[2]; cert.Area = certInfo[3]; cert.LocalityOwner = certInfo[4]; cert.StreetOwner = certInfo[5]; cert.Post = certInfo[6]; cert.SurnameOwner = certInfo[7]; cert.NameAndMiddleName = certInfo[8]; cert.CNPublisher = certInfo[9]; cert.OrganizationPublisher = certInfo[10]; cert.CountryPublisher = certInfo[11]; cert.SectionPublisher = certInfo[12]; cert.LocalityPublisher = certInfo[13]; cert.StreetPublisher = certInfo[14]; cert.EmailPublisher = certInfo[15]; cert.IDKey = certInfo[16]; cert.BasicLimits = certInfo[17]; cert.Key4Use = certInfo[18]; cert.IDKeySubject = certInfo[19]; cert.ImprovedKey = certInfo[20]; cert.UNP = certInfo[21]; cert.DurationPublicKey = certInfo[22]; cert.PassportData = certInfo[23]; cert.PublicKey = certInfo[24]; Session["certInfo"] = cert; //эти данные будут нужны для "тихой" повторной авторизации Session["tempKey"] = tempKey; Session["tempKeySignature"] = tempKeySignature; string sessionKey = null; string sessisonID = null; Session["Acred"] = false; try { sessisonID = loginClient.LogInWeb(tempKey, tempKeySignature, ref userData, out sessionKey); } catch (SoapException ex) { Session["hasLogged"] = false; string errtext = ex.Message; string[] sep = { "\n" }; string[] sepdata = { "\t" }; string[] strarray = errtext.Split(sep, StringSplitOptions.None); string errCritical = strarray[0]; string errCode = strarray[1]; string errData = strarray[2]; string errMessage = ""; for (int i = 3; i < strarray.Length; i++ ) { errMessage += strarray[i]; } if (errCritical == "0") { Session["errCode"] = errCode; switch (errCode) { case c_Err_MmbrNoFnd_UsrNoFnd: { Session["Acred"] = true; res = false; ErrorMessage errorMessage; errorMessage.message = errMessage; errorMessage.result = res; return Json(errorMessage); } case c_Err_MmbrFnd_UsrNoFnd: { string[] strData = errData.Split(sepdata, StringSplitOptions.None); Hashtable ht = new Hashtable(); for (int i = 0; i < strData.Length; i++) { ht.Add(strData[i].Split('=')[0], strData[i].Split('=')[1]); } Session["Acred"] = true; res = false; ErrorMessage errorMessage; errorMessage.message = errMessage; errorMessage.result = res; return Json(errorMessage); } case c_Err_MmbrFnd_UsrFnd_NoReg: { Session["Acred"] = true; res = false; ErrorMessage errorMessage; errorMessage.message = errMessage; errorMessage.result = res; return Json(errorMessage); } default: { Session["Acred"] = true; res = false; ErrorMessage errorMessage; errorMessage.message = errMessage; errorMessage.result = res; return Json(errorMessage); } } } else if (errCritical == "1") { //throw new Exception("Ошибка сервера"); throw new Exception(errMessage); } } Session["sessionID"] = sessisonID; Session["sessionKey"] = sessionKey; Session["hasLogged"] = true; Session["Acred"] = true; Session["MemberStatus"] = userData.MemberStatus; Session["PersonStatus"] = userData.PersonStatus; TAuthHeader header = new TAuthHeader(); header.SessionID = (String)Session["sessionID"]; header.SessionKey = (String)Session["sessionKey"]; client.TAuthHeaderValue = header; TAuthUserInfo userInfo = new TAuthUserInfo(); client.GetUserInfo(ref userInfo); Session["personName"] = userInfo.PersonName; return Json(res); }
public ActionResult Index() { //IGvPurchSrvservice client = new IGvPurchSrvservice(); //client.GetSrvTime(); //TViewSummary view = new TViewSummary(); //TNews[] news=new TNews[0]; /*TAuctionesListRec[] list=new TAuctionesListRec[0]; client.GetAuctionesList(1,1,"",ref view,ref list);*/ //client.GetExchangeSettings(); //client.GetNews(1,ref view,ref news); //!TODO remove /*Dictionary<String, Dictionary<String, String>[]> dict = new Dictionary<string, Dictionary<string, string>[]>(); Dictionary<String, String>[] v = new Dictionary<string, string>[2]; v[0] = new Dictionary<string, string>(); v[1] = new Dictionary<string, string>(); v[0].Add("lotNumber", "1"); v[0].Add("lotShortName", "bla"); v[0].Add("lotOKRB", "12.3.45.3"); v[0].Add("lotDescr", "bla-bla-bla"); v[0].Add("lotValue", "25 kg"); v[0].Add("lotCalc", "-"); v[0].Add("lotDeliveryPlace", "Mogilev"); v[0].Add("lotDeliveryTime", "01.01.2012"); v[0].Add("lotPrice", "100"); v[0].Add("lotCurrency", "$"); v[0].Add("lotOther", "none"); v[0].Add("offerExpirationDate", "02.02.2012"); v[0].Add("correction", "2%"); v[0].Add("foundingCorrection", "smths"); v[1].Add("lotNumber", "2"); v[1].Add("lotShortName", "bla"); v[1].Add("lotOKRB", "12.3.45.3"); v[1].Add("lotDescr", "bla-bla-bla"); v[1].Add("lotValue", "25 kg"); v[1].Add("lotCalc", "-"); v[1].Add("lotDeliveryPlace", "Mogilev"); v[1].Add("lotDeliveryTime", "01.01.2012"); v[1].Add("lotPrice", "100"); v[1].Add("lotCurrency", "$"); v[1].Add("lotOther", "none"); v[1].Add("offerExpirationDate", "02.02.2012"); v[1].Add("correction", "2%"); v[1].Add("foundingCorrection", "smth"); dict.Add("repeatingUnitLot", v); Dictionary<String, String>[] v2 = new Dictionary<string, string>[2]; v2[0] = new Dictionary<string, string>(); v2[1] = new Dictionary<string, string>(); v2[0].Add("securityView", "qwerty"); v2[0].Add("docNumber", "1"); v2[0].Add("docDate", "01.03.2012"); v2[0].Add("securityValue", "100 000"); v2[0].Add("securityPeriod", "10 дней"); v2[1].Add("securityView", "asd"); v2[1].Add("docNumber", "2"); v2[1].Add("docDate", "01.03.2012"); v2[1].Add("securityValue", "100 000"); v2[1].Add("securityPeriod", "10 дней"); dict.Add("repeatingUnitSecurity", v2); Dictionary<String, String>[] v3 = new Dictionary<string, string>[2]; v3[0] = new Dictionary<string, string>(); v3[1] = new Dictionary<string, string>(); v3[0].Add("docName", "1.doc"); v3[1].Add("docName", "2.doc"); dict.Add("repeatingUnitDoc", v3); Dictionary<String, String>[] v4 = new Dictionary<string, string>[1]; v4[0] = new Dictionary<string, string>(); v4[0].Add("offerNumber", "123456789"); v4[0].Add("siteAddress", "www.test.ru"); v4[0].Add("regNumber", "987654321"); v4[0].Add("shortName", "short name"); v4[0].Add("budgetOrg", "yes"); v4[0].Add("securityValue", "2%"); dict.Add("other", v4); TemplatesUtils.generateDocument(Server.MapPath("~") + "Content/static/templates/Offer Prt 1_19032012.html", dict);*/ //!TODO remove this Session["sessionID"] = "260"; Session["sessionKey"] = "{4D1DE906-EC71-470F-BCFE-6E9A09C90271}"; //Session["sessionID"] = "251"; //Session["sessionKey"] = "{C0FD8976-F2F9-4001-8004-B3D7E6A1EFAE}"; Session["hasLogged"] = true; Session["Acred"] = true; TAuthHeader header = new TAuthHeader(); header.SessionID = (String)Session["sessionID"]; header.SessionKey = (String)Session["sessionKey"]; client.TAuthHeaderValue = header; TAuthUserInfo userInfo = new TAuthUserInfo(); client.GetUserInfo(ref userInfo); Session["personName"] = userInfo.PersonName; return View(); //return RedirectToAction("Index", "News"); }
/// <remarks/> public void GetUserInfoAsync(TAuthUserInfo UserInfo) { this.GetUserInfoAsync(UserInfo, null); }
/// <remarks/> public void GetUserInfoAsync(TAuthUserInfo UserInfo, object userState) { if ((this.GetUserInfoOperationCompleted == null)) { this.GetUserInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetUserInfoOperationCompleted); } this.InvokeAsync("GetUserInfo", new object[] { UserInfo}, this.GetUserInfoOperationCompleted, userState); }
public bool GetUserInfo(ref TAuthUserInfo UserInfo) { object[] results = this.Invoke("GetUserInfo", new object[] { UserInfo}); UserInfo = ((TAuthUserInfo)(results[1])); return ((bool)(results[0])); }