Esempio n. 1
0
    public TRT_AuthUser authenticateUser(string UserId, string UserPwd)
    {
        logger.Debug("Service: authenticateUser() called");
        logger.InfoFormat("Input parameter Id : {0} ", UserId);
        logger.InfoFormat("Input parameter Password : {0} ", UserPwd);

        try
        {
            TRT_AuthUser result = new TRT_AuthUser();
            TRTInterface authUsr_SI = new TRTInterface();
            result = authUsr_SI.authenticateUser_SI(UserId, UserPwd);

            return result;
        }
        catch (Exception ex)
        {
            webServiceExHandling.ExceptionLog(ex);
            //string mailBody = string.Format(SCT_Constants.mail_BodyFormat, System.DateTime.Now.ToString("F"), PReqNo, ex.TargetSite.ToString(), ex.ToString());
            //webServiceExHandling.Send_Email(SCT_Constants.Email_Dic, mailBody);

            TRT_AuthUser Error = new TRT_AuthUser();
            Error.StatusFlag = 1;
            Error.Message = TRT_Constants.Error;

            logger.Error("ErrorCode = " + Error.StatusFlag.ToString());
            logger.Error("ErrorMessage = " + Error.Message);
            logger.Error("Service: authenticateUser() returning error");

            return Error;
        }
    }
Esempio n. 2
0
        //***************************************************************************************************
        public TRT_AuthUser authenticateUser_BAL(string UserId_BAL, string Pwd_BAL)
        {
            try
            {
                logger.Debug("TaxiRequest_BAL: authenticateUser_BAL() called");
                logger.DebugFormat("Input parameter Id : {0} ", UserId_BAL);
                logger.DebugFormat("Input parameter Password : {0} ", Pwd_BAL);

                string[] userIds = { "4400", "8297", "7327", "9308" };
                string[] locIds = { "IN-BLR", "IN-CHN", "IN-GUR" };
                string[] userNames = { "Rajat Gautam", "Harish", "Atul", "Deepak Jain" };

                TRT_AuthUser authResult = new TRT_AuthUser();
                authResult.StatusFlag = 1;
                authResult.Message = TRT_Constants.AuthFailure;

                for (int i = 0; i < userIds.Length; i++)
                {
                    if (UserId_BAL.Equals(userIds[i]) && Pwd_BAL.Equals("password"))
                    {
                        authResult.StatusFlag = 0;
                        authResult.Message = TRT_Constants.AuthSuccess;
                        authResult.Name = userNames[i];

                        string chargeCodeXmlString = TaxiWebService.GetAllocatedChargeCodes(UserId_BAL);
                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.LoadXml(chargeCodeXmlString);

                        //XmlNode root = xmlDoc.DocumentElement;

                        //XmlNode AllocCCode = root.SelectSingleNode("/NewDataSet/Projects");
                        //GeneralInformationNode.SelectSingleNode("ProjectId").InnerText;
                        XmlNode ProjectsNode;
                        ProjectsNode = xmlDoc.SelectSingleNode("/NewDataSet/Projects");
                        if (ProjectsNode == null)
                        {
                            ProjectsNode = xmlDoc.SelectSingleNode("/Projects");
                            authResult.ChargeCode = ProjectsNode.SelectSingleNode("ProjectId").InnerText.ToString();
                        }
                        else
                        {
                            authResult.ChargeCode = ProjectsNode.SelectSingleNode("ProjectID").InnerText.ToString();
                        }

                        //authResult.ChargeCode = AllocCCode["ProjectID"].InnerText;
                        Random _r = new Random();
                        authResult.LocId = locIds[_r.Next(3)];
                        break;
                    }
                }

                logger.InfoFormat("Authentication StatusFlag value : {0}", authResult.StatusFlag);
                logger.InfoFormat("Authentication Message value : {0}", authResult.Message);
                logger.InfoFormat("Employee Location ID returned: {0}", authResult.LocId);
                logger.InfoFormat("Employee Charge Code returned: {0}", authResult.ChargeCode);
                logger.Debug("TaxiRequest_BAL: authenticateUser_BAL() called");

                return authResult;
            }

            catch (Exception ex)
            {
                logger.Error("Exception  At BAL - authenticateUser_BAL  : " + ex.Message.ToString());
                logger.Error("TaxiRequest_BAL: authenticateUser_BAL() called");

                throw ex;
            }
        }