コード例 #1
0
 private void AuthorizationLoadAllocationIdWithSoftwareUser(R2CoreStandardSoftwareUserStructure YourNSSSoftwareUser, Int64 YourLoadAllocationId)
 {
     try
     {
         var InstanceLoadAllocation = new R2CoreTransportationAndLoadNotificationInstanceLoadAllocationManager();
         var InstanceTurn           = new R2CoreTransportationAndLoadNotificationInstanceTurnsManager();
         if (InstanceTurn.GetNSSTurn(YourNSSSoftwareUser).nEnterExitId != InstanceLoadAllocation.GetNSSLoadAllocation(YourLoadAllocationId).TurnId)
         {
             throw new LoadAllocationIdNotPairWithDriverException();
         }
     }
     catch (Exception ex)
     { throw ex; }
 }
コード例 #2
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            string ClientIP = null;

            try
            {
                ClientIP = InstancePublicProcedures.GetClientIpAddress(Request);
                InstanceBlackIPs.AuthorizationIP(ClientIP);

                if (Session["_CaptchaWord"].ToString() != TxtCaptcha.Text)
                {
                    throw new CaptchaWordNotCorrectException();
                }
                R2CoreMClassSoftwareUsersManagement.AuthenticationUserbyShenasehPassword(new R2CoreStandardSoftwareUserStructure(0, string.Empty, string.Empty, "", TxtUserShenaseh.Text, TxtUserPassword.Text, string.Empty, "", false, false, Int64.MinValue, string.Empty, string.Empty, string.Empty, new DateTime(), 0, string.Empty, new DateTime(), 0, string.Empty, new DateTime(), string.Empty, false, Int64.MinValue, new DateTime(), null, false, false));
                R2CoreStandardSoftwareUserStructure NSS = R2CoreMClassSoftwareUsersManagement.GetNSSUser(TxtUserShenaseh.Text, TxtUserPassword.Text);
                Session.Add("CurrentUser", NSS);
                Session.Timeout = 20;
                if (InstanceLogging.GetNSSLogType(ATISWebLogTypes.SuccessfulSoftwareUserShenasehPasswordAuthentication).Active)
                {
                    InstanceLogging.LogRegister(new R2CoreStandardLoggingStructure(0, ATISWebLogTypes.SuccessfulSoftwareUserShenasehPasswordAuthentication, InstanceLogging.GetNSSLogType(ATISWebLogTypes.SuccessfulSoftwareUserShenasehPasswordAuthentication).LogTitle, ClientIP, NSS.UserName, string.Empty, string.Empty, string.Empty, InstanceSoftwareUsers.GetNSSSystemUser().UserId, _DateTime.GetCurrentDateTimeMilladi(), null));
                }

                if (DateTime.Compare(_DateTime.GetMilladiDateTimeFromDateShamsiFull(NSS.UserPasswordExpiration, "00:00:00"), _DateTime.GetCurrentDateTimeMilladi()) < 0)
                {
                    Response.Redirect("/LoginManagement/WfChangeSoftwareUserPassword.aspx");
                    return;
                }
                ;

                WcUserAuthenticationSuccessEvent?.Invoke(this, e);
            }
            catch (SqlInjectionException ex)
            { Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + "شناسه یا رمز عبور قابل پذیرش نیست" + "');", true); }
            catch (AuthorizationIPIPIsBlackException ex)
            { Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + ex.Message + "');", true); }
            catch (Exception ex) when(ex is UserIsNotActiveException || ex is UserNotExistException || ex is GetNSSException || ex is CaptchaWordNotCorrectException)
            {
                if (InstanceLogging.GetNSSLogType(ATISWebLogTypes.UnSuccessfulSoftwareUserShenasehPasswordAuthentication).Active)
                {
                    InstanceLogging.LogRegister(new R2CoreStandardLoggingStructure(0, ATISWebLogTypes.UnSuccessfulSoftwareUserShenasehPasswordAuthentication, InstanceLogging.GetNSSLogType(ATISWebLogTypes.UnSuccessfulSoftwareUserShenasehPasswordAuthentication).LogTitle, ClientIP, string.Empty, string.Empty, string.Empty, string.Empty, InstanceSoftwareUsers.GetNSSSystemUser().UserId, _DateTime.GetCurrentDateTimeMilladi(), null));
                }
                Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + ex.Message + "');", true);
            }
            catch (Exception ex)
            { Page.ClientScript.RegisterStartupScript(GetType(), "WcViewAlert", "WcViewAlert('1','" + MethodBase.GetCurrentMethod().ReflectedType.FullName + "." + MethodBase.GetCurrentMethod().Name + "." + ex.Message + "');", true); }
            FillCaptcha();
        }