Esempio n. 1
0
        /// <summary>
        /// Keeps track of the running, successful and failed jobs. Check RunManager for further details
        /// </summary>
        /// <param name="jobInfoID"></param>
        /// <param name="processName"></param>
        /// <returns>Whether the job was successful or not</returns>
        protected void runJob(string jobInfoID, string processName)
        {
            dynamic status = RestCalls.GetJobStatus(jobInfoID, processName);

            if (status.status == "COMPLETE")
            {
                m_statsMap["Successful"]++;
                return;
            }

            bool posted = RestCalls.PostRun(jobInfoID, processName);

            if (posted == true)
            {
                m_statsMap["Running"]++;
                while (!isJobComplete(jobInfoID, processName))
                {
                    System.Threading.Thread.Sleep(30000);
                }

                m_statsMap["Running"]--;
            }
            else
            {
                m_statsMap["Failed"]++;
            }
        }
        private APIResult SyncPatientReport(ObservableCollection <PatientReport> reports, int patientId)
        {
            APIResult     result     = new APIResult();
            string        token      = new User().GetToken(Program.UserId());
            string        url        = ConfigurationManager.AppSettings["patientReportAPI"].ToString() + "?token=" + token;
            List <object> reportList = new List <object>();

            foreach (var item in reports)
            {
                object objct = new
                {
                    PatientId  = patientId,
                    Dt         = item.Dt.Ticks,
                    Location   = item.Location,
                    InstallID  = item.InstallID,
                    UniqueID   = item.UniqueID,
                    ReportData = ReportDataObject(item.ReportDatas, patientId)
                };
                reportList.Add(objct);
            }
            var json = new JavaScriptSerializer().Serialize(reportList);

            //try
            //{
            result = RestCalls.SyncReport(url, json, false);
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex.InnerException.Message);
            //    ModernDialog.ShowMessage("An error has occurred on the server", "Alert", MessageBoxButton.OK);
            //}
            return(result);
        }
        public void Insert([FromBody] DocumentToSign pDocumentToSign)
        {
            var loOffer = GetData.GetOfferByAgreementId(pDocumentToSign.erp_id);

            if (loOffer == null)
            {
                return;
            }

            var loAsset = GetData.GetAssetById(loOffer.asset_uuid.ToString());

            loOffer.offer_state_type_system_type_id =
                loAsset.guarantee_amount.HasValue && loAsset.guarantee_amount.Value > 0 ? (int)OfferStateTypes.WaitingGuarantee : (int)OfferStateTypes.WaitingOffer;

            loOffer.row_update_date = DateTime.Now;
            loOffer.row_update_user = Guid.Empty;
            //loOffer.mespact_session_uuid = pDocumentToSign.row_guid;

            Crud <Offer> .Update(loOffer, out _);

            if (loAsset.guarantee_amount.HasValue)
            {
                var loCustomer       = GetData.GetCustomerById(loOffer.owner_uuid.ToString());
                var loMessageContent =
                    string.Format(
                        "Değerli müşterimiz, E-Şartname'yi imzaladığınız için teşekkür ederiz. E-Teklif verebilmek için teminat bedelinizi ({0} TL) GM No: {2} açıklamasıyla  Turk Hava Kurumu Genel Başkanlığı Vakıfbank İban: TR800001500158007312568057 numaralı hesaba yatırınız. Mesaj Tarihi:{1}", loAsset.guarantee_amount.Value.ToString("C0"), DateTime.Now, loAsset.company_prefix + loAsset.asset_no.ToString());

                RestCalls.SendSms(loMessageContent, loCustomer.phone);
            }
        }
Esempio n. 4
0
        private APIResult UpdateInstallation(UserEntity user)
        {
            APIResult result = new APIResult();
            string    url    = ConfigurationManager.AppSettings["installationAPI"].ToString();
            object    objct  = new
            {
                password         = "******",
                email            = "*****@*****.**",
                address          = user.Address,
                location_name    = user.Location,
                location_pincode = user.PinCode,
                install_id       = user.InstallID.ToString()
            };
            var json = new JavaScriptSerializer().Serialize(objct);

            try
            {
                result = RestCalls.SyncReport(url, json, false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException.Message);
                ModernDialog.ShowMessage("An error has occurred on the server", "Alert", MessageBoxButton.OK);
            }
            return(result);
        }
        /// <summary>Call the POS for GetStatus method</summary>
        /// <param name="kiosk">The kiosk id</param>
        public StatusPOSResponse GetStatus(string kiosk)
        {
            StatusPOSResponse response    = new StatusPOSResponse();
            string            responseStr = string.Empty;
            StatusResponse    getResponse;
            RestCalls         restCalls = new RestCalls();

            //check kiosk is valid
            if (string.IsNullOrWhiteSpace(kiosk))
            {
                // the kiosk parameter was not specified
                response.SetPOSError(Errors.KioskNotSpecified);
            }
            else
            {
                // POS Calls - Get the status load the url path
                LoadAPIUrls();

                responseStr = restCalls.GetAsyncRequest(statusUrl + kiosk);

                //Deserialise returned data into a JSon object to return
                getResponse             = JsonConvert.DeserializeObject <StatusResponse>(responseStr);
                response.StatusResponse = getResponse;
            }

            return(response);
        }
Esempio n. 6
0
        public IActionResult Info(string pId)
        {
            var loUser = HttpContext.Session.GetObject <UserDto>("User");

            loUser.session_id = Guid.NewGuid().ToString();
            HttpContext.Session.SetObject("User", loUser);

            if (string.IsNullOrEmpty(pId))
            {
                return(View(new HomeViewModel {
                    User = loUser, AssetPhotos = new List <AssetPhoto>()
                }));
            }

            var loAsset = RestCalls.GetAssetById(pId, loUser.token);
            var loModel = new HomeViewModel()
            {
                User  = loUser,
                Asset = loAsset
            };

            loModel.AssetExplanation   = loModel.Asset.explanation;
            loModel.AssetPhotos        = loModel.Asset.asset_photos ?? new List <AssetPhoto>();
            loModel.Asset.explanation  = "";
            loModel.Asset.asset_photos = new List <AssetPhoto>();
            return(View(loModel));
        }
Esempio n. 7
0
        public IActionResult Login()
        {
            var loPassword = Request.Cookies["password"] ?? "";
            var loUserName = Request.Cookies["phone"] ?? "";

            if (!string.IsNullOrEmpty(loPassword))
            {
                loPassword = Cipher.DecryptString(loPassword);
            }

            if (!string.IsNullOrEmpty(loUserName))
            {
                loUserName = Cipher.DecryptString(loUserName);
            }

            var loUser = new UserDto
            {
                phone    = loUserName,
                password = loPassword
            };

            return(View(new HomeViewModel {
                User = loUser, Token = RestCalls.GetToken()
            }));
        }
        public Customer Save([FromBody] CustomerDto pBank)
        {
            var loUser = HttpContext.Session.GetObject <UserDto>("User");

            var loCustomer = RestCalls.SaveNewCustomer(pBank);

            return(loCustomer);
        }
Esempio n. 9
0
        public UserDto Save([FromBody] UserDto pUser)
        {
            var loUser = HttpContext.Session.GetObject <UserDto>("User");

            var loUserToSave = pUser.id <= 0 ? RestCalls.SaveNewUser(pUser, loUser.token) : RestCalls.UpdateUser(pUser, loUser.token);

            return(loUserToSave);
        }
Esempio n. 10
0
        public IActionResult AssetForOffer()
        {
            HttpContext.Session.Remove("User");
            var loToken = RestCalls.GetToken();

            return(View(new HomeViewModel {
                Token = loToken, Cities = RestCalls.GetCities(loToken)
            }));
        }
Esempio n. 11
0
        public User Validate(UserDto pUser)
        {
            if (pUser.remember_me)
            {
                var loRememberedPassword = Request.Cookies["password"];

                if (string.IsNullOrEmpty(loRememberedPassword) || pUser.password != Cipher.DecryptString(loRememberedPassword))
                {
                    pUser.password = pUser.password.ToUpper();
                }
                else
                {
                    pUser.password = Cipher.DecryptString(loRememberedPassword);
                }
            }
            else
            {
                Response.Cookies.Delete("password");
            }

            var loUser = RestCalls.ValidateUser(pUser);

            if (loUser.id <= 0)
            {
                return(loUser);
            }

            loUser.password   = pUser.password;
            loUser.session_id = Guid.NewGuid().ToString();

            if (loUser.user_type != 3)
            {
                loUser.banks     = RestCalls.GetAllBanks(loUser.token);
                loUser.contracts = RestCalls.GetContractTypes(loUser.token);
            }

            HttpContext.Session.SetObject("User", loUser);

            if (pUser.remember_me)
            {
                var cookie = new CookieOptions
                {
                    Expires = DateTime.Now.AddMonths(1)
                };

                Response.Cookies.Append("phone", Cipher.EncryptString(pUser.phone), cookie);
                Response.Cookies.Append("password", Cipher.EncryptString(pUser.password), cookie);
            }
            else
            {
                Response.Cookies.Delete("phone");
                Response.Cookies.Delete("password");
            }

            return(loUser);
        }
Esempio n. 12
0
        public IActionResult DownloadDocument(string pId)
        {
            var loUser     = HttpContext.Session.GetObject <UserDto>("User");
            var loDocument = RestCalls.GetSignedDocument(pId, loUser.token);

            if (loDocument != null && !string.IsNullOrEmpty(loDocument.pdf_content))
            {
                return(File(Convert.FromBase64String(loDocument.pdf_content), "application/pdf", pId + ".pdf"));
            }

            return(RedirectToAction("Error", "Home"));
        }
Esempio n. 13
0
        public static void SendNewCallBackRecord(CallbackRecord pCallbackRecord)
        {
            var loAsset       = GetData.GetAssetById(pCallbackRecord.asset_uuid.ToString());
            var loMailContent = File.ReadAllText("winvestate_new_cr_mail.html");

            loMailContent = loMailContent.Replace("@CustomerName@", pCallbackRecord.applicant_name + " " + pCallbackRecord.applicant_surname);
            loMailContent = loMailContent.Replace("@CustomerPhone@", pCallbackRecord.applicant_phone);
            loMailContent = loMailContent.Replace("@AssetName@", loAsset.asset_no + " " + loAsset.asset_name);
            loMailContent = loMailContent.Replace("@OperationDate@", pCallbackRecord.row_create_date.Value.ToString("f"));
            loMailContent = loMailContent.Replace("@AssetLink@", "https://e-teklif.winvestate.com/Asset/AssetDetail?pId=" + pCallbackRecord.asset_uuid);

            RestCalls.SendMail(loMailContent, Common.InfoMailList, "Yeni Geri Aranma Talebi");
        }
Esempio n. 14
0
        public IActionResult Dashboard()
        {
            var loUser = HttpContext.Session.GetObject <UserDto>("User");

            if (loUser.user_type < 3 || loUser.user_type == 4)
            {
                loUser.offered_assets = RestCalls.GetOfferedAssets(loUser.token);
            }

            return(View(new HomeViewModel {
                User = loUser, Offers = RestCalls.GetAllOffers(loUser.token), ActiveCallbackRecords = RestCalls.GetNewCallbackRecords(loUser.token)
            }));
        }
Esempio n. 15
0
        public static void SendDocumentToSign(Customer pCustomer, Offer pOffer)
        {
            var loAsset           = GetData.GetAssetById(pOffer.asset_uuid.ToString());
            var loCompany         = GetData.GetBankById(loAsset.bank_guid.ToString());
            var loSendToSignModel = new SendToSign
            {
                document_to_sign = new DocumentToSign
                {
                    participant_guid         = Common.MespactWinvestateUser,
                    document_type_guid       = loCompany.mespact_agreement_uuid.ToString(),
                    erp_id                   = pOffer.agreement_uuid.ToString(),
                    participant_callback_url = Common.CallbackUrl
                },
                document_sign_flows = new List <DocumentSignFlow>()
            };

            var loSignFlow = new DocumentSignFlow
            {
                participant_name    = pCustomer.customer_name,
                participant_surname = pCustomer.customer_surname,
                identity_number     = pCustomer.identity_no,
                mail                     = pCustomer.mail,
                phone_number             = SerializePhone(pCustomer.phone),
                user_type_system_type_id = pCustomer.user_type_system_type_id == 2 ? 1 : 4,
                document_template_key    = ((int)ThkAgreement.ThkSatisSartname.Imzaci).ToString()
            };

            loSendToSignModel.document_sign_flows.Add(loSignFlow);


            if (loCompany.company_prefix == "THK")
            {
                loSendToSignModel.document_templates = GetThkAgreementTemplateValues(loAsset, pCustomer);
            }
            else //if (loCompany.company_prefix == "VST")
            {
                loSendToSignModel.document_templates = GetVstAgreementTemplateValues(loAsset, pCustomer, pOffer);
            }


            var loResult = RestCalls.SendCustomerAgreement(loSendToSignModel);

            if (loResult.Code == 200)
            {
                var loSendToSign    = JsonConvert.DeserializeObject <SendToSign>(loResult.Data.ToString());
                var loOfferToUpdate = GetData.GetOfferById(pOffer.row_guid.ToString());
                loOfferToUpdate.mespact_session_uuid = loSendToSign.document_to_sign.row_guid;
                Crud <Offer> .Update(loOfferToUpdate, out _);
            }
        }
Esempio n. 16
0
        public Bank Save([FromBody] BankDto pBank)
        {
            var loUser = HttpContext.Session.GetObject <UserDto>("User");

            var loBankToSave = pBank.id <= 0 ? RestCalls.SaveNewBank(pBank, loUser.token) : RestCalls.UpdateBank(pBank, loUser.token);

            if (loBankToSave.id > 0)
            {
                loUser.banks = RestCalls.GetAllBanks(loUser.token);
                HttpContext.Session.SetObject("User", loUser);
            }

            return(loBankToSave);
        }
Esempio n. 17
0
        public CallbackRecordDto Callback([FromBody] CallbackRecaptcha pCallback)
        {
            if (ModelState.IsValid)
            {
                var loResult = RestCalls.SaveNewCallback(pCallback);
                return(loResult);
            }

            var loCallbackRecord = new CallbackRecordDto
            {
                id = -2
            };

            return(loCallbackRecord);
        }
Esempio n. 18
0
        /// <summary>Call the POS for Order method</summary>
        /// <param name="request">The request</param>
        public OrderCreatePOSResponse OrderTransaction(OrderCreateRequest request)
        {
            OrderCreatePOSResponse response       = new OrderCreatePOSResponse();
            HttpStatusCode         httpStatusCode = response.HttpStatusCode;
            Order order = response.OrderCreateResponse.Order;

            string    responseStr = string.Empty;
            RestCalls restCalls   = new RestCalls();

            //TODO order time is invalid from test need to check if the kiosk
            //does the same thing
            DateTime orderTime    = DateTime.Now;
            string   orderTimeStr = orderTime.ToString("yyMMddHHmmss");

            request.DOTOrder.OrderTime = orderTimeStr;

            string requestStr = JsonConvert.SerializeObject(request.DOTOrder);

            //POST the JSON to the Server and get the response - load the url path
            LoadAPIUrls();
            //responseStr = restCalls.PostAsyncRequest(orderUrl, requestOrderStr);


            //call the APIs in order
            //Checkbasket

            responseStr = restCalls.PostRestSharpRequest();

            //Deserialize the string to an Object
            OrderCreateResponse jsonOrder = JsonConvert.DeserializeObject <OrderCreateResponse>(responseStr);

            //populate Order with the result from the POS
            response.OrderCreateResponse = jsonOrder;


            if (httpStatusCode == HttpStatusCode.Created)
            {
                Log.Info($"HTTP Status Code Created:{httpStatusCode}");
            }
            else
            {
                Log.Error($"HTTP Status Code:{httpStatusCode}");
            }

            return(response);
        }
Esempio n. 19
0
        public IActionResult AssetDetail(string pId)
        {
            var loToken = RestCalls.GetToken();
            var loAsset = RestCalls.GetAssetById(pId, loToken);

            if (loAsset != null && loAsset.id > 0)
            {
                var loModel = new HomeViewModel {
                    Asset = loAsset, Token = loToken
                };
                loModel.AssetExplanation  = loModel.Asset.explanation;
                loModel.Asset.explanation = "";
                loModel.User = HttpContext.Session.GetObject <UserDto>("User");
                return(View(loModel));
            }

            return(RedirectToAction("Login", "Account"));
        }
Esempio n. 20
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="p_rest_url"></param>
        public RunTester(string p_rest_url, Utils.JobFilter p_params, string p_process)
        {
            RestCalls.m_rest_url = p_rest_url;

            m_jobs      = RestCalls.GetJobs(p_params);
            m_processes = RestCalls.GetProcesses();
            m_process   = p_process;
            if (!m_processes.Contains(m_process))
            {
                m_jobs.Clear();
            }
            m_statsMap = new Dictionary <string, int>();
            m_statsMap.Add("Total", m_jobs.Count);
            m_statsMap.Add("Running", 0);
            m_statsMap.Add("Successful", 0);
            m_statsMap.Add("Failed", 0);
            m_statsMap.Add("Unavailable", 0);
        }
Esempio n. 21
0
        public static void SendNewOfferSmsInformation(Offer pOffer)
        {
            var loAssetOffers = GetData.GetActiveOfferByAssetId(pOffer.asset_uuid.ToString());
            var loCustomer    = GetData.GetCustomerById(pOffer.owner_uuid.ToString());

            foreach (var loAssetOffer in loAssetOffers)
            {
                if (loAssetOffer.customer_phone == loCustomer.phone)
                {
                    continue;
                }

                var loUrlToShorten =
                    Bitly.Shorten("https://e-teklif.winvestate.com/Asset/AssetDetail?pId=" + pOffer.asset_uuid);

                RestCalls.SendSms(
                    "Değerli müşterimiz, teklif vermiş olduğunuz gayrimenkule yeni bir teklif verilmiştir. Yeni teklifi görüntülemek ve teklifinizi yükseltmek için lütfen web sitemizi ziyaret ediniz İlan bağlantısı : " + loUrlToShorten + " . Mesaj Tarihi: " + DateTime.Now,
                    loAssetOffer.customer_phone);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Queries REST STOP to see if the job is completed then updates the status
        /// </summary>
        /// <param name="jobInfoID"></param>
        /// <param name="processName"></param>
        /// <returns>bool saying whether the job is no longer running</returns>
        protected bool isJobComplete(string jobInfoID, string processName)
        {
            dynamic status     = RestCalls.GetJobStatus(jobInfoID, processName);
            string  compStatus = status.status;

            if (compStatus != "QUEUED" && compStatus != "IN_PROGRESS" && compStatus != "LAUNCHING")
            {
                if (compStatus == "COMPLETE")
                {
                    m_statsMap["Successful"]++;
                }
                else
                {
                    m_statsMap["Failed"]++;
                }
                return(true);
            }

            return(false);
        }
Esempio n. 23
0
        public ActionResult <GenericResponseModel> GetUserContracts(string pId)
        {
            var loGenericResponse = new GenericResponseModel
            {
                Code   = -1,
                Status = "Fail"
            };

            var loResult = RestCalls.GetMespactDocumentTypes();

            if (loResult == null || !loResult.Any())
            {
                loGenericResponse.Message = "Kayıtlı doküman bulunamadı";
                return(loGenericResponse);
            }

            loGenericResponse.Code   = 200;
            loGenericResponse.Status = "OK";
            loGenericResponse.Data   = loResult;

            return(loGenericResponse);
        }
Esempio n. 24
0
        public static void SendNewOfferInformation(Guid pId)
        {
            var loOffer = GetData.GetOfferById(pId.ToString());

            SendNewOfferSmsInformation(loOffer);

            var loAsset    = GetData.GetAssetById(loOffer.asset_uuid.ToString());
            var loCustomer = GetData.GetCustomerById(loOffer.owner_uuid.ToString());
            var loCompany  = GetData.GetBankById(loAsset.bank_guid.ToString());

            var loMailContent = File.ReadAllText("winvestate_new_offer.html");

            loMailContent = loMailContent.Replace("@AssetNo@", loAsset.company_prefix + loAsset.asset_no);
            loMailContent = loMailContent.Replace("@AssetName@", loAsset.asset_name);
            loMailContent = loMailContent.Replace("@CustomerName@", loCustomer.user_type_system_type_id == 1 ? loCustomer.customer_name + " " + loCustomer.customer_surname : loCustomer.company_name);
            loMailContent = loMailContent.Replace("@CustomerPhone@", loCustomer.phone);
            loMailContent = loMailContent.Replace("@OperationDate@", loOffer.row_create_date.Value.ToString("f"));
            loMailContent = loMailContent.Replace("@OfferAmount@", loOffer.price.Value.ToString("N0") + " TL");

            var loSender = Common.OfferMail + ";" + loCompany.authorized_mail;

            RestCalls.SendMail(loMailContent, loSender, loCustomer.customer_name + " " + loCustomer.customer_surname + "-" + loAsset.asset_no + " " + "Yeni Teklif");
        }
        private APIResult SyncPatientDetails(PatientEntity patient, ObservableCollection <PatientReport> reports, bool isUpdate)
        {
            APIResult result = new APIResult();
            string    token  = new User().GetToken(Program.UserId());
            string    url    = string.Empty;

            if (isUpdate)
            {
                url = ConfigurationManager.AppSettings["updatePatientAPI"].ToString() + "/" + patient.PatientId + "?token=" + token;
            }
            else
            {
                url = ConfigurationManager.AppSettings["addPatientAPI"].ToString() + "?token=" + token;
            }

            object objct = new
            {
                p_id              = patient.Id,
                name              = patient.Nm,
                pMName            = patient.MNm,
                pLName            = patient.LNm,
                notResident       = patient.NotResident,
                ifResidentOfM     = patient.IfResidentOfM,
                IcNumber          = patient.IcNumber,
                otherOption       = patient.OtherOption,
                othersID          = patient.OthersID,
                doctosName        = patient.DocNm,
                hospitalScreening = patient.HospitalScreening,
                hospitalName      = patient.HospitalNm,
                hospitalID        = patient.HospitalID,
                p_email           = patient.Email,
                marital_status    = patient.MaritalStatus == "Married" ? "Yes" : "No",
                age = patient.Age,
                sex = patient.Sex == "Male" ? "m" : "f",
                permanent_address = patient.PerAdr,
                area                      = patient.Area,
                phone_res                 = patient.ResidentPh,
                mobile                    = patient.Mob,
                occupation                = patient.Occupation,
                working_at                = patient.WorkingAt,
                currentMedications        = patient.CurrentMedications,
                laser_treatment           = patient.LaserTreatment,
                have_cataract             = patient.Cataract,
                have_hypertension         = patient.Hypertension,
                allergy_to_drugs          = patient.AllergyDrugs,
                have_diabetes             = patient.Diabetic,
                additional_info           = patient.Info,
                emg_contact_name          = patient.EmergContactNm,
                emg_phone                 = patient.EmergPh,
                name_of_the_stated_onsent = patient.StatedConsentPerson,
                relation_with_patient     = patient.Relation,
                term_conditation          = patient.TermsCondition,
                collection_id             = patient.CollectionID,
                install_id                = patient.InstallID,
                update_at                 = patient.MDt.Ticks,
                create_at                 = patient.CDt.Ticks,
                UniqueID                  = patient.UniqueID,
                allergy_drugs_details     = patient.AllergyDrugsDtl,
                MedicalInsurance          = patient.MedicalInsurance
            };
            var json = new JavaScriptSerializer().Serialize(objct);

            //try
            //{
            result = RestCalls.SyncReport(url, json, isUpdate);
            if (result.status == "ok")
            {
                if (isUpdate)
                {
                    bool newReport = reports.Any(x => x.Sync == false);
                    if (newReport && reports.Count > 0)
                    {
                        result = SyncPatientReport(reports, patient.PatientId);
                    }
                }
                else
                {
                    patient.PatientId = result.user;
                    new Patient().UpdatePatientId(patient.Id, result.user);
                    if (reports.Count > 0)
                    {
                        SyncPatientReport(reports, result.user);
                    }
                }
            }
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex.InnerException.Message);
            //    ModernDialog.ShowMessage("An error has occurred on the server", "Alert", MessageBoxButton.OK);
            //}
            return(result);
        }
Esempio n. 26
0
 public ActionResult <PdfContent> GetSignedDocument(string pId)
 {
     return(RestCalls.GetSignedDocument(pId));
 }
Esempio n. 27
0
 public ActionResult <GenericResponseModel> ResendAgreementLink([FromBody] OfferDto pOffer)
 {
     return(RestCalls.SendAgreementLinkAgain(pOffer.mespact_session_uuid));
 }
Esempio n. 28
0
        public ActionResult <GenericResponseModel> ConfirmSubmit([FromBody] OfferDto pOffer)
        {
            var loUserId          = HelperMethods.GetApiUserIdFromToken(HttpContext.User.Identity);
            var loGenericResponse = new GenericResponseModel
            {
                Code   = -1,
                Status = "Fail"
            };

            var loResult = GetData.GetOfferById(pOffer.row_guid.ToString());

            if (loResult == null)
            {
                loGenericResponse.Message = "Kayıtlı teklif bulunamadı!";
                return(loGenericResponse);
            }

            var loCustomer = GetData.GetCustomerById(loResult.owner_uuid.ToString());

            if (loCustomer == null)
            {
                loGenericResponse.Message = "Kayıtlı teklif bulunamadı!";
                return(loGenericResponse);
            }

            loResult.offer_state_type_system_type_id = (int)OfferStateTypes.WaitingOffer;
            loResult.row_update_date = DateTime.Now;
            loResult.row_update_user = loUserId;

            //Crud<Offer>.Update(loResult, out _);

            var loPassword       = "";
            var loMessageContent = "";
            var loUserNameType   = loCustomer.user_type_system_type_id == 1 ? "kimlik numaranız" : "vergi numaranız";

            if (string.IsNullOrEmpty(loCustomer.password))
            {
                loPassword       = HelperMethods.RandomOtp();
                loMessageContent =
                    string.Format(
                        "Sayın müşterimiz teklif vermek istediğiniz gayrimenkule ait başvurunuz onaylanmıştır. Teklif vermek için {0} adresini ziyaret edebilirsiniz. Sisteme giriş için kullanıcı adınız: {3}, şifreniz: {1}'dir. Mesaj tarihi: {2}", Common.CustomerUrl, loPassword, DateTime.Now, loUserNameType);

                loCustomer.password        = HelperMethods.Md5OfString(loPassword);
                loCustomer.row_update_date = loResult.row_update_date;
                loCustomer.row_update_user = loUserId;
                Crud <Customer> .Update(loCustomer, out _);
            }
            else
            {
                var loUrl = Bitly.Shorten(Common.CustomerUrl);
                loMessageContent =
                    string.Format(
                        "Sayın müşterimiz teklif vermek istediğiniz gayrimenkule ait başvurunuz onaylanmıştır. Teklif vermek için {0} adresini ziyaret edebilirsiniz. Sisteme giriş için kullanıcı adınız olarak {2} ve daha önce oluşturduğunuz şifreyi kullanabilirsiniz. Mesaj tarihi: {1}", loUrl, DateTime.Now, loUserNameType);
            }

            Crud <Offer> .Update(loResult, out _);

            RestCalls.SendSms(loMessageContent, loCustomer.phone);

            loGenericResponse.Code   = 200;
            loGenericResponse.Status = "OK";
            loGenericResponse.Data   = loResult;

            return(loGenericResponse);
        }
Esempio n. 29
0
        private void OnStartPredictionCommand(object args)
        {
            string prediction = "sushruta";

            if (this.hansanet != "Enable Hansanet")
            {
                prediction = "hansasushruta";
            }

            //System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            //dispatcherTimer.Tick += dispatcherTimer_Tick;
            //dispatcherTimer.Interval = TimeSpan.FromMilliseconds(1000 );
            //ProgressValue = 0;
            //dispatcherTimer.Start();

            //System.Windows.Application.Current.Dispatcher.Invoke((Action)delegate
            //{

            this.IsEnabled        = false;
            this.IsProgressActive = true;
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork += (sender, e) =>
            {
                foreach (var item in PatientReport.OSPosteriorReportDatas)
                {
                    if (item.IsChecked)
                    {
                        string predictionResult = RestCalls.RestPredict(item.ImageUrl, prediction);

                        JavaScriptSerializer serializer = new JavaScriptSerializer();
                        PredictionEntity     obj        = JsonConvert.DeserializeObject <PredictionEntity>(predictionResult);
                        if (obj.result.StartsWith("Bad"))
                        {
                            item.Prediction = obj.result.Replace("(0)", "").Trim();
                            new Patient().UpdateReportData(item.Id, item.Prediction);
                        }
                        else
                        {
                            item.Prediction = obj.result.Replace(" (1). ", "").Replace(" (0). ", "").Trim();
                            new Patient().UpdateReportData(item.Id, item.Prediction);
                        }
                    }
                }
                foreach (var item in PatientReport.ODPosteriorReportDatas)
                {
                    if (item.IsChecked)
                    {
                        //try
                        //{
                        string predictionResult = RestCalls.RestPredict(item.ImageUrl, prediction);

                        JavaScriptSerializer serializer = new JavaScriptSerializer();
                        PredictionEntity     obj        = JsonConvert.DeserializeObject <PredictionEntity>(predictionResult);

                        //PredictionEntity obj = new PredictionEntity();
                        //  obj.result = "Bad Image";
                        if (obj.result.StartsWith("Bad"))
                        {
                            item.Prediction = obj.result.Replace("(0)", "").Trim();
                            new Patient().UpdateReportData(item.Id, item.Prediction);
                        }
                        else
                        {
                            item.Prediction = obj.result.Replace(" (1). ", "").Replace(" (0). ", "").Trim();
                            new Patient().UpdateReportData(item.Id, item.Prediction);
                        }
                        //}
                        //catch
                        //{
                        //    ModernDialog.ShowMessage("Prediction Internal Server Error.", "Prediction", MessageBoxButton.OK);
                        //}
                    }
                }
            };

            bw.RunWorkerCompleted += (sender, e) =>
            {
                if (e.Error != null)
                {
                    ModernDialog.ShowMessage("Prediction Internal Server Error.", "Prediction", MessageBoxButton.OK);
                }
                this.IsEnabled        = true;
                this.IsProgressActive = false;
            };

            bw.RunWorkerAsync();



            //this.IsEnabled = true;
            //dispatcherTimer.Stop();
            //ProgressValue = 0;
            //});
        }
Esempio n. 30
0
        public ActionResult <GenericResponseModel> SendOtp([FromBody] Otp pOtpService)
        {
            var loGenericResponse = new GenericResponseModel();
            //var loParticipant = GetData.GetParticipantWithId(pOtpService.participant_phone);
            var loErrorMessage = "";

            if (string.IsNullOrEmpty(pOtpService.phone) ||
                string.IsNullOrWhiteSpace(pOtpService.phone))
            {
                loGenericResponse.Status  = "Fail";
                loGenericResponse.Code    = -1;
                loGenericResponse.Message = "Lütfen telefon numaranızı doldurunuz";
                return(loGenericResponse);
            }

            pOtpService.phone = HelperMethods.SerializePhone(pOtpService.phone);
            //if (loParticipant == null)
            //{
            //    loGenericResponse.Status = "Fail";
            //    loGenericResponse.Code = -1;
            //    loGenericResponse.Message = "No such participant";
            //    return loGenericResponse;
            //}
            //if (string.IsNullOrEmpty(loParticipant.phone) ||
            //    string.IsNullOrWhiteSpace(loParticipant.phone))
            //{
            //    loGenericResponse.Status = "Fail";
            //    loGenericResponse.Code = -1;
            //    loGenericResponse.Message = "Participant mobile phone can not be empty";
            //    return loGenericResponse;
            //}

            var loValidate = GetData.CheckUserAndWorkorderHaveUnvalidatedOtp(pOtpService);

            if (loValidate?.id > 0 && loValidate.row_create_date != null && (DateTime.Now - (DateTime)loValidate.row_create_date).TotalSeconds < 180)
            {
                var loRemainingTime = 180 - (DateTime.Now - (DateTime)loValidate.row_create_date).Seconds;
                Crud <Otp> .Update(pOtpService, out _);

                loGenericResponse.Status  = "Fail";
                loGenericResponse.Code    = 0;
                loGenericResponse.Data    = loRemainingTime;
                loGenericResponse.Message = "Aktif bekleyen bir şifreniz mevcut, şifrenizi giriniz ya da " + " " + loRemainingTime.ToString() + " saniye sonra tekrar deneyiniz. ";
                return(loGenericResponse);
            }


            pOtpService.row_create_date  = DateTime.Now;
            pOtpService.validation_state = 0;

            var loOtpContent = "123456";

            //#if !PROD


            //            pOtpService.otp_hash = Helper.Md5OfString(loOtpContent);
            //            pOtpService.sms_id = "123456";

            //            var loId = Crud<Otp>.Insert(pOtpService, out _);
            //            pOtpService.id = (int)loId;
            //            loGenericResponse.Data = pOtpService;
            //            loGenericResponse.Status = "Ok";
            //            loGenericResponse.Code = 200;
            //            return loGenericResponse;
            //#endif

            loOtpContent         = HelperMethods.RandomOtp();
            pOtpService.otp_hash = HelperMethods.Md5OfString(loOtpContent).ToUpper();

            var loMessageContent = HelperMethods.GetOtpContent(pOtpService.message_type_system_type_id, loOtpContent);
            var loMessageResult  = RestCalls.SendSms(loMessageContent, pOtpService.phone);

            if (loMessageResult > 0)

            {
                pOtpService.sms_id = loMessageResult.ToString();
                var loMyId = Crud <Otp> .Insert(pOtpService, out _);

                pOtpService.id           = (int)loMyId;
                loGenericResponse.Data   = pOtpService;
                loGenericResponse.Status = "Ok";
                loGenericResponse.Code   = 200;
            }
            else
            {
                loGenericResponse.Status  = "Fail";
                loGenericResponse.Code    = -1;
                loGenericResponse.Message = "İşleminiz esnasında bir problem oluştu lütfen tekrar deneyiniz." + loErrorMessage;
            }

            return(loGenericResponse);
        }