Esempio n. 1
0
        public HttpResponseMessage AssignHearingOfficer(int cID, int HearingOfficerUserID)
        {
            HttpStatusCode      ReturnCode  = HttpStatusCode.OK;
            TranInfo <bool>     transaction = new TranInfo <bool>();
            ReturnResult <bool> result      = new ReturnResult <bool>();

            try
            {
                result = _service.AssignHearingOfficer(cID, HearingOfficerUserID);

                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = result.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }

            return(Request.CreateResponse <TranInfo <bool> >(ReturnCode, transaction));
        }
Esempio n. 2
0
        public HttpResponseMessage GetCustomEmailNotification(int cID, int AnalystUserID, int NotificationID)
        {
            HttpStatusCode              ReturnCode  = HttpStatusCode.OK;
            TranInfo <CustomEmailM>     transaction = new TranInfo <CustomEmailM>();
            ReturnResult <CustomEmailM> result      = new ReturnResult <CustomEmailM>();

            try
            {
                result = _service.GetCustomEmailNotification(cID, AnalystUserID, NotificationID);

                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = result.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }

            return(Request.CreateResponse <TranInfo <CustomEmailM> >(ReturnCode, transaction));
        }
        public HttpResponseMessage GetNotes(int ReqID)
        {
            HttpStatusCode           ReturnCode  = HttpStatusCode.OK;
            TranInfo <List <Notes> > transaction = new TranInfo <List <Notes> >();

            try
            {
                ExtractClaimDetails();

                transaction.data   = service.GetNotes(ReqID, Username);
                transaction.status = true;
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode = HttpStatusCode.InternalServerError;

                if (ex.InnerException != null)
                {
                    InnerExceptionMessage = ex.InnerException.Message;
                }
                LogHelper.Instance.Error(service.CorrelationId, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <List <Notes> > >(ReturnCode, transaction));
        }
        public HttpResponseMessage GetCustomer()
        {
            HttpStatusCode              ReturnCode  = HttpStatusCode.OK;
            TranInfo <CustomerInfo>     transaction = new TranInfo <CustomerInfo>();
            ReturnResult <CustomerInfo> result      = new ReturnResult <CustomerInfo>();

            try
            {
                CustomerInfo obj;
                obj = new CustomerInfo();

                transaction.data   = obj;
                transaction.status = true;
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);

                //  LogHelper.Instance.Error(service.CorrelationId, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <CustomerInfo> >(ReturnCode, transaction));
        }
        // [ValidateModelState]
        public HttpResponseMessage SaveOTRequest([FromBody] Header objHeader, [FromUri] int?ReqID = null)
        {
            HttpStatusCode       ReturnCode  = HttpStatusCode.OK;
            TranInfo <OTRequest> transaction = new TranInfo <OTRequest>();

            try
            {
                ExtractClaimDetails();

                IList <string> Warnings;
                int            reqid = service.SaveOTRequest(ReqID, objHeader, Username, out Warnings);
                //transaction.data = reqid;
                transaction.data     = service.GetOTRequest(reqid, null, Username);
                transaction.warnings = Warnings;
                transaction.status   = true;
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode = HttpStatusCode.InternalServerError;

                if (ex.InnerException != null)
                {
                    InnerExceptionMessage = ex.InnerException.Message;
                }
                LogHelper.Instance.Error(service.CorrelationId, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <OTRequest> >(ReturnCode, transaction));
        }
        public HttpResponseMessage DeleteCityUser([FromUri] int UserID)
        {
            System.Diagnostics.EventLog.WriteEntry("Application", "Controller Delete Customer started");
            AccountManagementService accService  = new AccountManagementService();
            HttpStatusCode           ReturnCode  = HttpStatusCode.OK;
            TranInfo <bool>          transaction = new TranInfo <bool>();
            ReturnResult <bool>      result      = new ReturnResult <bool>();

            try
            {
                result = accService.DeleteCityUser(UserID);
                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }
            return(Request.CreateResponse <TranInfo <bool> >(ReturnCode, transaction));
        }
Esempio n. 7
0
        /// <summary>
        /// The key of the dictionary is a BranchID.FinPeriodID key.
        /// </summary>
        private Dictionary <string, List <TranInfo> > GetTransByBranchAndFinPeriod(PMRegister doc)
        {
            Dictionary <string, List <TranInfo> > transByFinPeriod = new Dictionary <string, List <TranInfo> >();

            PXSelectBase <PMTran> select = new PXSelectJoin <PMTran,
                                                             LeftJoin <Account, On <PMTran.accountID, Equal <Account.accountID> >,
                                                                       InnerJoin <PMProject, On <PMProject.contractID, Equal <PMTran.projectID> >,
                                                                                  LeftJoin <PMTask, On <PMTask.projectID, Equal <PMTran.projectID>, And <PMTask.taskID, Equal <PMTran.taskID> > >,
                                                                                            LeftJoin <OffsetAccount, On <PMTran.offsetAccountID, Equal <OffsetAccount.accountID> >,
                                                                                                      LeftJoin <PMAccountGroup, On <PMAccountGroup.groupID, Equal <PMTran.accountGroupID> >,
                                                                                                                LeftJoin <OffsetPMAccountGroup, On <OffsetPMAccountGroup.groupID, Equal <OffsetAccount.accountGroupID> > > > > > > >,
                                                             Where <PMTran.tranType, Equal <Required <PMTran.tranType> >,
                                                                    And <PMTran.refNbr, Equal <Required <PMTran.refNbr> > > > >(this);

            foreach (PXResult <PMTran, Account, PMProject, PMTask, OffsetAccount, PMAccountGroup, OffsetPMAccountGroup> res in select.Select(doc.Module, doc.RefNbr))
            {
                TranInfo tran = new TranInfo(res);
                string   key  = string.Format("{0}.{1}.{2}", tran.Tran.BranchID.GetValueOrDefault(), tran.Tran.FinPeriodID, tran.Tran.TranCuryID);

                if (transByFinPeriod.ContainsKey(key))
                {
                    transByFinPeriod[key].Add(tran);
                }
                else
                {
                    List <TranInfo> list = new List <TranInfo>();
                    list.Add(tran);
                    transByFinPeriod.Add(key, list);
                }
            }

            return(transByFinPeriod);
        }
Esempio n. 8
0
        public HttpResponseMessage GetStatus(int?activityid = null)
        {
            HttpStatusCode ReturnCode = HttpStatusCode.OK;
            TranInfo <List <Status_M> >     transaction = new TranInfo <List <Status_M> >();
            ReturnResult <List <Status_M> > result      = new ReturnResult <List <Status_M> >();

            try
            {
                result = _service.GetStatus((int)activityid);

                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = result.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);

                //  LogHelper.Instance.Error(service.CorrelationId, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <List <Status_M> > >(ReturnCode, transaction));
        }
        public HttpResponseMessage CreateCityUserAccount([FromBody] CityUserAccount_M cityUserModel)
        {
            System.Diagnostics.EventLog.WriteEntry("Application", "Controller Save Customer started");
            AccountManagementService         accService   = new AccountManagementService();
            IEmailService                    emailService = new EmailService();
            HttpStatusCode                   ReturnCode   = HttpStatusCode.OK;
            TranInfo <CityUserAccount_M>     transaction  = new TranInfo <CityUserAccount_M>();
            ReturnResult <CityUserAccount_M> result       = new ReturnResult <CityUserAccount_M>();

            try
            {
                result = accService.CreateCityUserAccount(cityUserModel);
                if (result.status.Status == StatusEnum.Success)
                {
                    //emailService.SendEmail(getRegisterCustomerEmailModel(result.result));
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }
            return(Request.CreateResponse <TranInfo <CityUserAccount_M> >(ReturnCode, transaction));
        }
        public HttpResponseMessage SaveTranslationServiceInfo([FromBody] TranslationServiceInfoM model)
        {
            AccountManagementService accService  = new AccountManagementService();
            HttpStatusCode           ReturnCode  = HttpStatusCode.OK;
            TranInfo <Boolean>       transaction = new TranInfo <Boolean>();
            ReturnResult <Boolean>   result      = new ReturnResult <Boolean>();

            try
            {
                result = accService.SaveTranslationServiceInfo(model);
                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }
            return(Request.CreateResponse <TranInfo <Boolean> >(ReturnCode, transaction));
        }
        public HttpResponseMessage Invite([FromBody] CustomerInfo custModel)
        {
            HttpStatusCode  ReturnCode  = HttpStatusCode.OK;
            TranInfo <bool> transaction = new TranInfo <bool>();

            MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**");

            SmtpClient client = new SmtpClient();

            client.Credentials           = new NetworkCredential("", "");
            client.Port                  = 587;
            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Host                  = "smtp.gmail.com";
            mail.Subject                 = "this is a test email.";
            mail.Body = "this is my test email body";
            try
            {
                client.Send(mail);
            }
            catch (Exception ex)
            {
                transaction.status = false;
            }
            transaction.data = true;

            return(Request.CreateResponse <TranInfo <bool> >(ReturnCode, transaction));
        }
Esempio n. 12
0
        public HttpResponseMessage GetActivity()
        {
            HttpStatusCode ReturnCode = HttpStatusCode.OK;
            TranInfo <List <Activity_M> >     transaction = new TranInfo <List <Activity_M> >();
            ReturnResult <List <Activity_M> > result      = new ReturnResult <List <Activity_M> >();

            try
            {
                result = _service.GetActivity();

                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = result.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }

            return(Request.CreateResponse <TranInfo <List <Activity_M> > >(ReturnCode, transaction));
        }
Esempio n. 13
0
        public HttpResponseMessage SubmitMail([FromBody] MailM model)
        {
            HttpStatusCode       ReturnCode  = HttpStatusCode.OK;
            TranInfo <MailM>     transaction = new TranInfo <MailM>();
            ReturnResult <MailM> result      = new ReturnResult <MailM>();

            try
            {
                var dbResult = _service.SubmitMail(model);
                if (dbResult.status.Status == StatusEnum.Success)
                {
                    transaction.data   = dbResult.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(dbResult.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }
            return(Request.CreateResponse <TranInfo <MailM> >(ReturnCode, transaction));
        }
        public HttpResponseMessage RemoveThirdPartyInfo([FromBody] ThirdPartyInfoM model)
        {
            System.Diagnostics.EventLog.WriteEntry("Application", "Controller Remove Third Party started");
            AccountManagementService       accService  = new AccountManagementService();
            HttpStatusCode                 ReturnCode  = HttpStatusCode.OK;
            TranInfo <ThirdPartyInfoM>     transaction = new TranInfo <ThirdPartyInfoM>();
            ReturnResult <ThirdPartyInfoM> result      = new ReturnResult <ThirdPartyInfoM>();

            try
            {
                result = accService.RemoveThirdPartyInfo(model);
                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }
            return(Request.CreateResponse <TranInfo <ThirdPartyInfoM> >(ReturnCode, transaction));
        }
        public HttpResponseMessage GetAccountSearch([FromBody] AccountSearch accountSearch)
        {
            AccountManagementService    accService  = new AccountManagementService();
            HttpStatusCode              ReturnCode  = HttpStatusCode.OK;
            TranInfo <SearchResult>     transaction = new TranInfo <SearchResult>();
            ReturnResult <SearchResult> result      = new ReturnResult <SearchResult>();

            try
            {
                result = accService.GetAccountSearch(accountSearch);
                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = result.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }
            return(Request.CreateResponse <TranInfo <SearchResult> >(ReturnCode, transaction));
        }
 public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
 {
     if (!actionContext.ModelState.IsValid)
     {
         TranInfo <Dictionary <string, string[]> > transactionInformation = new TranInfo <Dictionary <string, string[]> >();
         transactionInformation.errors = actionContext.ModelState.Errors();
         transactionInformation.status = false;
         actionContext.Response        = actionContext.Request.CreateResponse <TranInfo <Dictionary <string, string[]> > >(HttpStatusCode.BadRequest, transactionInformation);
     }
 }
        public HttpResponseMessage ForgetPwd([FromBody] CustomerInfo customerInfo)
        {
            //System.Diagnostics.EventLog.WriteEntry("Application", "LoginCust started");
            AccountManagementService accService  = new AccountManagementService();
            HttpStatusCode           ReturnCode  = HttpStatusCode.OK;
            TranInfo <bool>          transaction = new TranInfo <bool>();
            ReturnResult <bool>      result      = new ReturnResult <bool>();

            try
            {
                if (customerInfo == null || customerInfo.email == null || customerInfo.email == "")
                {
                    transaction.status = false;
                    transaction.AddException("Please enter email address");
                }
                else
                {
                    result = accService.ForgetPwd(customerInfo.email);
                    if (result.status.Status == StatusEnum.Success)
                    {
                        transaction.data   = result.result;
                        transaction.status = true;
                    }
                    else
                    {
                        // transaction.warnings.Add(result.status.StatusMessage);

                        transaction.status = false;
                        transaction.AddException(result.status.StatusMessage);

                        //_commonService.LogError(result.status.StatusCode, result.status.StatusMessage, result.status.StatusDetails, 0, "LoginCust");
                    }
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
                // transaction.AddException(ex.Message);
                //ReturnCode = HttpStatusCode.InternalServerError;

                //if (ex.InnerException != null) { InnerExceptionMessage = ex.InnerException.Message; }
                //LogHelper.Instance.Error(CorrelationID, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <bool> >(ReturnCode, transaction));
        }
        public HttpResponseMessage GetEmptyAccountSearchModel()
        {
            HttpStatusCode               ReturnCode  = HttpStatusCode.OK;
            TranInfo <AccountSearch>     transaction = new TranInfo <AccountSearch>();
            ReturnResult <AccountSearch> result      = new ReturnResult <AccountSearch>();

            try
            {
                transaction.data   = new AccountSearch();
                transaction.status = true;
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }

            return(Request.CreateResponse <TranInfo <AccountSearch> >(ReturnCode, transaction));
        }
        public HttpResponseMessage GetAuthorizedUsers(int?custID = null)
        {
            AccountManagementService           accService  = new AccountManagementService();
            HttpStatusCode                     ReturnCode  = HttpStatusCode.OK;
            TranInfo <CollaboratorAccessM>     transaction = new TranInfo <CollaboratorAccessM>();
            ReturnResult <CollaboratorAccessM> result      = new ReturnResult <CollaboratorAccessM>();

            try
            {
                transaction.data   = new CollaboratorAccessM();
                transaction.status = true;
                //result = accService.GetAuthorizedUsers((int)custID);
                //if (result.status.Status == StatusEnum.Success)
                //{
                //    transaction.data = result.result;
                //    transaction.status = true;
                //}
                //else
                //{
                //    transaction.status = false;
                //    transaction.AddException(result.status.StatusMessage);
                //    //_commonService.LogError(result.status.StatusCode, result.status.StatusMessage, result.status.StatusDetails, 23, "GetAuthorizedUsers");
                //}
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
                //ReturnCode = HttpStatusCode.InternalServerError;

                //if (ex.InnerException != null) { InnerExceptionMessage = ex.InnerException.Message; }
                //LogHelper.Instance.Error(CorrelationID, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <CollaboratorAccessM> >(ReturnCode, transaction));
        }
Esempio n. 20
0
        public HttpResponseMessage SaveNewActivityStatus(ActivityStatus_M activityStatus, int CID)
        {
            ExtractClaimDetails();
            //Appl accService = new AccountManagementService();
            HttpStatusCode      ReturnCode  = HttpStatusCode.OK;
            TranInfo <bool>     transaction = new TranInfo <bool>();
            ReturnResult <bool> result      = new ReturnResult <bool>();

            try
            {
                result = _service.SaveNewActivityStatus(activityStatus, CID);

                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = result.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);

                //if (ex.InnerException != null) { InnerExceptionMessage = ex.InnerException.Message; }
                //LogHelper.Instance.Error(CorrelationID, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <bool> >(ReturnCode, transaction));
        }
        public HttpResponseMessage AuthorizeCollaborator([FromBody] CollaboratorAccessM access)
        {
            AccountManagementService accService  = new AccountManagementService();
            HttpStatusCode           ReturnCode  = HttpStatusCode.OK;
            TranInfo <bool>          transaction = new TranInfo <bool>();
            ReturnResult <bool>      result      = new ReturnResult <bool>();

            try
            {
                result = accService.AuthorizeCollaborator(access);
                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = (bool)result.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
                // transaction.AddException(ex.Message);
                //ReturnCode = HttpStatusCode.InternalServerError;

                //if (ex.InnerException != null) { InnerExceptionMessage = ex.InnerException.Message; }
                //LogHelper.Instance.Error(CorrelationID, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <bool> >(ReturnCode, transaction));
        }
        public HttpResponseMessage GetCustomer(int custID)
        {
            AccountManagementService    accService  = new AccountManagementService();
            HttpStatusCode              ReturnCode  = HttpStatusCode.OK;
            TranInfo <CustomerInfo>     transaction = new TranInfo <CustomerInfo>();
            ReturnResult <CustomerInfo> result      = new ReturnResult <CustomerInfo>();

            try
            {
                result = accService.GetCustomer(custID);
                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = result.result;
                    transaction.status = true;
                }
                else
                {
                    // transaction.warnings.Add(result.status.StatusMessage);

                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);

                    //_commonService.LogError(result.status.StatusCode, result.status.StatusMessage, result.status.StatusDetails, 0, "LoginCust");
                }
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);

                //  LogHelper.Instance.Error(service.CorrelationId, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <CustomerInfo> >(ReturnCode, transaction));
        }
        public HttpResponseMessage RemoveThirdParty([FromBody] ThirdPartyDetails thirdpartyInfo, int?custid = null)
        {
            AccountManagementService accService  = new AccountManagementService();
            HttpStatusCode           ReturnCode  = HttpStatusCode.OK;
            TranInfo <bool>          transaction = new TranInfo <bool>();
            ReturnResult <bool>      result      = new ReturnResult <bool>();

            try
            {
                result = accService.RemoveThirdParty((int)custid, thirdpartyInfo.ThirdPartyRepresentationID);
                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);

                // transaction.AddException(ex.Message);
                //ReturnCode = HttpStatusCode.InternalServerError;

                //if (ex.InnerException != null) { InnerExceptionMessage = ex.InnerException.Message; }
                //LogHelper.Instance.Error(CorrelationID, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <bool> >(ReturnCode, transaction));
        }
        public HttpResponseMessage GetOTRequest(int?reqid = null, int?fy = null)
        {
            HttpStatusCode       ReturnCode  = HttpStatusCode.OK;
            TranInfo <OTRequest> transaction = new TranInfo <OTRequest>();

            try
            {
                ExtractClaimDetails();

                OTRequest obj;
                if (reqid.HasValue)
                {
                    obj = service.GetOTRequest((int)reqid, fy, Username);
                }
                else
                {
                    obj = new OTRequest();
                }

                transaction.data   = obj;
                transaction.status = true;
            }
            catch (Exception ex)
            {
                transaction.AddException(ex.Message);
                ReturnCode = HttpStatusCode.InternalServerError;

                if (ex.InnerException != null)
                {
                    InnerExceptionMessage = ex.InnerException.Message;
                }
                LogHelper.Instance.Error(service.CorrelationId, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <OTRequest> >(ReturnCode, transaction));
        }
Esempio n. 25
0
        /// <summary>
        /// 获取交易重量信息
        /// </summary>
        /// <param name="_"></param>
        /// <returns></returns>
        public string GetTranInfo(dynamic _)
        {
            var recdata = this.GetResquetData <TranInfo>();

            try
            {
                bool flag = DataValidation(recdata.Date, recdata.Random, recdata.Staffid);
                if (!flag)
                {
                    return(this.WriteValidationLog("EnterModule", recdata.Mac));
                }
                //判断令牌是否过期
                bool flag2 = TokenValidation(recdata.SessionId, recdata.Token);
                if (!flag2)
                {
                    return(this.SendTokenValidation());
                }

                PDAEnterBusiness bl = new PDAEnterBusiness();

                TranInfo EnterInfos = bl.GetTranWeightInfo(recdata.data.userId, recdata.data.compId);

                if (EnterInfos.surplusWeight <= 0)
                {
                    EnterInfos = bl.GetTranWeightInfo(recdata.data.userId, null);
                }

                WriteInfoLog("EnterModule", recdata.data.userName, recdata.Mac, "获取交易重量成功!" + Json.ToJson(recdata));

                return(this.SendData <TranInfo>(EnterInfos, "获取重量成功!", ResponseType.Success));
            }
            catch (Exception ex)
            {
                return(this.WriteExceptionLog("EnterModule", recdata.data.userName, recdata.Mac, "获取企业信息异常:" + Json.ToJson(recdata) + "[异常信息:" + ex.Message + "]", "获取重量异常:" + ex.Message));
            }
        }
Esempio n. 26
0
        public HttpResponseMessage GetCaseswithNoAnalyst([FromBody] CaseSearch caseSearch, [FromUri] int UserID)
        {
            //Appl accService = new AccountManagementService();
            HttpStatusCode ReturnCode = HttpStatusCode.OK;
            TranInfo <SearchCaseResult>     transaction = new TranInfo <SearchCaseResult>();
            ReturnResult <SearchCaseResult> result      = new ReturnResult <SearchCaseResult>();

            try
            {
                result = _service.GetCaseswithNoAnalyst(caseSearch, UserID);

                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = result.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);

                //if (ex.InnerException != null) { InnerExceptionMessage = ex.InnerException.Message; }
                //LogHelper.Instance.Error(CorrelationID, Username, Request.GetRequestContext().VirtualPathRoot, ex.Message, InnerExceptionMessage, 0, ex);
            }

            return(Request.CreateResponse <TranInfo <SearchCaseResult> >(ReturnCode, transaction));
        }