public async Task <string> Insert(Payment valPayment) { string vResult = string.Empty; try { ResponseGateway vProccessPayGateway = await InsertPaymentGateway(valPayment); GatewayService vGatewayService = new GatewayService(); if (vProccessPayGateway != null && vProccessPayGateway.transactionResponse.state == "APPROVED") { valPayment.IdTransaction = vProccessPayGateway.transactionResponse.transactionId; valPayment.GatewayJsonData = JsonConvert.SerializeObject(vProccessPayGateway); SQLToolsLibrary vSqlTools = new SQLToolsLibrary(); List <SqlParameter> vParameterList = new List <SqlParameter> { new SqlParameter("@Id", valPayment.Id), new SqlParameter("@IdTransaction", !(valPayment.IdTransaction == Guid.Empty) ? valPayment.IdTransaction : Guid.Empty), new SqlParameter("@GatewayJsonGata", !string.IsNullOrEmpty(valPayment.GatewayJsonData) ? valPayment.GatewayJsonData : "{}"), new SqlParameter("@IdUser", valPayment.IdUser != Guid.Empty ? valPayment.IdUser : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@IdActivity", valPayment.IdActivity != Guid.Empty ? valPayment.IdActivity : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@Mount", valPayment.Mount), new SqlParameter("@IdCurrency", valPayment.IdCurrency != Guid.Empty ? valPayment.IdCurrency : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@FirstName", !string.IsNullOrEmpty(valPayment.FirstName) ? valPayment.FirstName : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@LastName", !string.IsNullOrEmpty(valPayment.LastName) ? valPayment.LastName : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@TypeNumberDocument", !string.IsNullOrEmpty(valPayment.TypeNumberDocument) ? valPayment.TypeNumberDocument : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@NumberDocument", !string.IsNullOrEmpty(valPayment.NumberDocument) ? valPayment.NumberDocument : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@Email", !string.IsNullOrEmpty(valPayment.Email) ? valPayment.Email : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@Phone", !string.IsNullOrEmpty(valPayment.Phone) ? valPayment.Phone : throw new Exception(GlobalValues.vTextExceptionParameterNull)), new SqlParameter("@Persons", valPayment.Persons), new SqlParameter("@DateReserve", valPayment.DateReserve), new SqlParameter("@State", valPayment.State), new SqlParameter("@UserCreate", !string.IsNullOrEmpty(valPayment.UserCreate) ? valPayment.UserCreate : string.Empty), new SqlParameter("@DateCreate", valPayment.DateCreate) }; bool vInsert = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Insert_Payment", vConnection); if (vInsert) { SenderMail vSenderMail = new SenderMail(); await vSenderMail.SendEmailWithPayment(valPayment); await vSenderMail.SendEmailToCompanies(valPayment); vResult = "1"; vResult = "1"; } else { vResult = "3"; } } else { vResult = GatewayUtils.ProccessingResponseGateway(vProccessPayGateway.transactionResponse.state); } } catch (Exception vEx) { string vMessage = vEx.Message; vResult = "4"; } return(vResult); }
public void CheckDeniedAccessWithHalfDataTodelInRoomPage() { SenderMail SenderMail = new SenderMail(); RoomPage Page = new RoomPage(); SenderMail.PosName = "Менеджер"; bool Predict = false; bool result = Page.CheckForDel(2); Assert.AreEqual(Predict, result); }
public void CheckGrantedAccessTodelInRoomPage() { SenderMail SenderMail = new SenderMail(); RoomPage Page = new RoomPage(); SenderMail.PosName = "Администратор"; bool Predict = true; bool result = Page.CheckForDel(2); Assert.AreEqual(Predict, result); }
public void CheckDeniedAccessTodelInWorkersPageHalfData() { SenderMail SenderMail = new SenderMail(); WorkersS Page = new WorkersS(); SenderMail.PosName = "Администратор"; bool Predict = false; bool result = Page.CheckForDel(0); Assert.AreEqual(Predict, result); }
public void CheckDeniedAccessTodelInConsumablePagealfData() { SenderMail SenderMail = new SenderMail(); ConsumablePage Page = new ConsumablePage(); SenderMail.PosName = "Администратор"; bool Predict = false; bool result = Page.CheckForDel(0); Assert.AreEqual(Predict, result); }
public void CheckDeniedAccessTodelInConsumablePage() { SenderMail SenderMail = new SenderMail(); ConsumablePage Page = new ConsumablePage(); SenderMail.PosName = "Менеджер"; bool Predict = false; bool result = Page.CheckForDel(-2); Assert.AreEqual(Predict, result); }
public void CheckDeniedAccessTodelInOrderInWarehouseHalfData() { SenderMail SenderMail = new SenderMail(); OrderInWarehouse Page = new OrderInWarehouse(); SenderMail.PosName = "Администратор"; bool Predict = false; bool result = Page.CheckForDel(0); Assert.AreEqual(Predict, result); }
public void CheckDeniedAccessTodelInOrderInWarehouse() { SenderMail SenderMail = new SenderMail(); OrderInWarehouse Page = new OrderInWarehouse(); SenderMail.PosName = "Менеджер"; bool Predict = false; bool result = Page.CheckForDel(-2); Assert.AreEqual(Predict, result); }
public async Task <ActionResult> UpdateJob(int key, string values) { var newValue = await _MyDbContext.Jobs.Include(j => j.Message).FirstOrDefaultAsync(j => j.ID == key); JsonConvert.PopulateObject(values, newValue); SenderMail a = new SenderMail(); a.Start(newValue); _MyDbContext.Jobs.Update(newValue); await _MyDbContext.SaveChangesAsync(); return(Ok()); }
public async Task <string> CancelAndRefund(Payment valPayment) { string vResult = string.Empty; try { ResponseGatewayRefund vProccessPayGateway = await Refund(valPayment); GatewayService vGatewayService = new GatewayService(); // if (vProccessPayGateway != null && vProccessPayGateway.transactionResponse.state == "PENDING" && vProccessPayGateway.code != "ERROR") { valPayment.GatewayJsonData = JsonConvert.SerializeObject(vProccessPayGateway); SQLToolsLibrary vSqlTools = new SQLToolsLibrary(); List <SqlParameter> vParameterList = new List <SqlParameter> { new SqlParameter("@Id", valPayment.Id), new SqlParameter("@GatewayJsonData", !string.IsNullOrEmpty(valPayment.GatewayJsonData) ? valPayment.GatewayJsonData : "{}"), new SqlParameter("@UserUpdate", valPayment.UserUpdate), new SqlParameter("@DateUpdate", valPayment.DateUpdate) }; bool vUpdate = vSqlTools.ExecuteIUWithStoreProcedure(vParameterList, "sp_Cancel_Payment", vConnection); if (vUpdate) { SenderMail vSenderMail = new SenderMail(); Payment vPaymenNew = SelectById(valPayment.Id, valPayment.IdLanguage); vPaymenNew.LanguageInitials = valPayment.LanguageInitials; await vSenderMail.SendEmailClientWithCancelAndRefund(vPaymenNew); ICompanyData vCompanyData = new CompanyData(); Company vCompany = vCompanyData.SelectCompanyByPayment(valPayment.Id); vPaymenNew.EmailCompany1 = vCompany.Email1; vPaymenNew.EmailCompany2 = vCompany.Email2; await vSenderMail.SendEmailCompaniesWithCancelAndRefund(vPaymenNew); vResult = "1"; } else { vResult = "3"; } //} else { // vResult = GatewayUtils.ProccessingResponseGateway(vProccessPayGateway.transactionResponse.state); //} } catch (Exception vEx) { string vMessage = vEx.Message; vResult = "4"; } return(vResult); }
public async Task <ActionResult> InsertJob(string values) { var newJob = new MyJob(); JsonConvert.PopulateObject(values, newJob); await _MyDbContext.Jobs.AddAsync(newJob); await _MyDbContext.Messages.AddAsync(newJob.Message); await _MyDbContext.SaveChangesAsync(); SenderMail a = new SenderMail(); a.Start(newJob); return(Ok()); }
//Share Template public static void ShareTemplate(string sendermailid) { log4net.Config.XmlConfigurator.Configure(); ILog logger = LogManager.GetLogger(typeof(ShareTemplatePage)); try { Wait.WaitForPageToLoad(); Wait.WaitVisible(SenderMail, 30); SenderMail.Type(sendermailid); Wait.WaitVisible(Send, 10); Clicks.ScrollToViewElement(Send); Send.Click(); string msg = ConfirmationMsgPopup.GetText(); Console.WriteLine("Message is " + msg); } catch (Exception e) { logger.Error("Share Template is failed due to: " + e); //**Closing browser Driver.Quit(); throw e; } }