public IActionResult Create(RecipientModel recipient1, RecipientModel conditionalRecipient1, RecipientModel conditionalRecipient2)
        {
            // Check the token with minimal buffer time.
            bool tokenOk = CheckToken(3);

            if (!tokenOk)
            {
                // We could store the parameters of the requested operation
                // so it could be restarted automatically.
                // But since it should be rare to have a token issue here,
                // we'll make the user re-enter the form data after
                // authentication.
                RequestItemsService.EgName = EgName;
                return(Redirect("/ds/mustAuthenticate"));
            }

            string basePath = RequestItemsService.Session.BasePath + "/restapi";

            // Step 1. Obtain your OAuth token
            string accessToken = RequestItemsService.User.AccessToken;
            string accountId   = RequestItemsService.Session.AccountId;

            // Step 2. Construct your API headers
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
            var envelopesApi = new EnvelopesApi(apiClient);

            // Step 3. Construct request body
            var             envelope = CreateEnvelope(recipient1, conditionalRecipient1, conditionalRecipient2);
            EnvelopeSummary results;

            try
            {
                // Step 4. Call the eSignature API
                results = envelopesApi.CreateEnvelope(accountId, envelope);
            }
            catch (ApiException apiException)
            {
                ViewBag.errorCode = apiException.ErrorCode;

                if (apiException.Message.Contains("WORKFLOW_UPDATE_RECIPIENTROUTING_NOT_ALLOWED"))
                {
                    ViewBag.errorMessage     = "Update to the workflow with recipient routing is not allowed for your account!";
                    ViewBag.errorInformation = "Please contact with our <a href='https://developers.docusign.com/support/' target='_blank'>support team</a> to resolve this issue.";
                }
                else
                {
                    ViewBag.errorMessage = apiException.Message;
                }

                return(View("Error"));
            }

            // Process results
            ViewBag.h1          = "The envelope was created successfully!";
            ViewBag.message     = "Results from the Envelopes::create method:";
            ViewBag.Locals.Json = JsonConvert.SerializeObject(results, Formatting.Indented);
            return(View("example_done"));
        }
Esempio n. 2
0
        public void Get_all_past_hops_should_return_HopArrivalModel()
        {
            // Arrange
            RecipientModel recipient = new RecipientModel
            {
                FirstName  = "Rudi",
                LastName   = "Recipient",
                Street     = "Poststraße",
                PostalCode = "A-1070",
                City       = "Poststadt"
            };
            ParcelModel parcel = new ParcelModel {
                Recipient = recipient, Weight = 1.0f
            };

            var hops = new List <HopArrivalDTO>();

            hopMock.Setup(input => input.GetPrevHopsForParcel(It.IsAny <string>())).Returns(hops);

            // Act
            var result = tracking.GetAllPastHops(parcel);

            // Assert
            Assert.IsInstanceOfType(result, typeof(IList <HopArrivalModel>));
        }
        public void Get_all_future_hops_should_return_HopArrivalModel_list()
        {
            // Arrange
            HopArrivalModel latest = new HopArrivalModel()
            {
            };
            TruckModel closestTruck = new TruckModel()
            {
            };
            RecipientModel recipient = new RecipientModel
            {
                FirstName  = "Rudi",
                LastName   = "Recipient",
                Street     = "Poststraße",
                PostalCode = "A-1070",
                City       = "Poststadt"
            };
            ParcelModel parcel = new ParcelModel {
                Recipient = recipient, Weight = 1.0f
            };

            // Act
            var result = warehouse.GetAllFutureHops(latest, closestTruck, parcel);

            // Assert
            Assert.IsInstanceOfType(result, typeof(IList <HopArrivalModel>));
        }
        public IActionResult Create(RecipientModel recipient1, RecipientModel recipient2)
        {
            // Check the token with minimal buffer time.
            bool tokenOk = CheckToken(3);

            if (!tokenOk)
            {
                // We could store the parameters of the requested operation
                // so it could be restarted automatically.
                // But since it should be rare to have a token issue here,
                // we'll make the user re-enter the form data after
                // authentication.
                RequestItemsService.EgName = EgName;
                return(Redirect("/ds/mustAuthenticate"));
            }

            string basePath = RequestItemsService.Session.BasePath + "/restapi";

            // Obtain your OAuth token
            string accessToken = RequestItemsService.User.AccessToken;
            string accountId   = RequestItemsService.Session.AccountId;

            // Call the Examples API method to pause the workflow of signature
            var results = PauseSignatureWorkflow.PauseWorkflow(recipient1.Email, recipient1.Name, recipient2.Email, recipient2.Name, accessToken, basePath, accountId);

            // Process results
            RequestItemsService.PausedEnvelopeId = results.EnvelopeId;
            ViewBag.h1          = "The envelope was created successfully!";
            ViewBag.message     = "Results from the Envelopes::create method:";
            ViewBag.Locals.Json = JsonConvert.SerializeObject(results, Formatting.Indented);
            return(View("example_done"));
        }
Esempio n. 5
0
        public void Track_Parcel_should_return_TrackingInformationModel()
        {
            var recipient = new RecipientModel
            {
                FirstName  = "Rudi",
                LastName   = "Recipient",
                Street     = "Poststraße",
                PostalCode = "A-1070",
                City       = "Poststadt"
            };
            var parcel = new ParcelModel {
                Recipient = recipient, Weight = 1.0f
            };

            var hops   = new List <HopArrivalModel>();
            var trucks = new List <TruckModel>();

            tracking.Setup(input => input.GetParcelByCode(It.IsAny <string>())).Returns(parcel);
            tracking.Setup(input => input.ValidateParcel(It.IsAny <ParcelModel>())).Returns(true);
            tracking.Setup(input => input.GetAllPastHops(It.IsAny <ParcelModel>())).Returns(hops);
            warehouse.Setup(input =>
                            input.GetAllFutureHops(It.IsAny <HopArrivalModel>(), It.IsAny <TruckModel>(),
                                                   It.IsAny <ParcelModel>()))
            .Returns(hops);
            warehouse.Setup(input => input.GetAllTrucks()).Returns(trucks);

            var result = _business.TrackParcel("12345ABC");

            // Assert
            Assert.IsInstanceOfType(result, typeof(TrackingInformationModel));
        }
Esempio n. 6
0
        protected override void Execute()
        {
            if (DataBag.LastRun != null)
            {
                IEnumerable <FileInfo> crashLogs = _crashService.GetCrashsSince(DataBag.LastRun);

                string rawRecipients = _config.Settings.CrashReportsRecipents;

                RecipientModel recipientModel = new RecipientModel();
                foreach (var r in rawRecipients.Split(';').Where(r => r.Length > 0).Select(ParseRecipient))
                {
                    recipientModel.Recipients.Add(r);
                }

                if (crashLogs.Any())
                {
                    _mailer.SendMail(new CrashReportModel(crashLogs, DataBag.LastRun), new RazorMailTemplateKey("CrashReport"), recipientModel);
                }
                else
                {
                    _mailer.SendMail(new CrashReportModel(DataBag.LastRun), new RazorMailTemplateKey("CrashReportEmpty"), recipientModel);
                }
            }

            DataBag.LastRun = DateTime.Today;

            // next run set to next monday morning
            DateTime today           = DateTime.Today;
            int      daysUntilMonday = ((int)DayOfWeek.Monday - (int)today.DayOfWeek + 7) % 7;
            DateTime nextMonday      = today.AddDays(daysUntilMonday);

            SetNextRunDate(today.AddDays(daysUntilMonday).AddHours(8.5));
            SaveDataBag();
        }
Esempio n. 7
0
        public async Task EditAsync(int recipientId, RecipientModel model)
        {
            var recipient = await _dbContext.Recipients.FirstOrDefaultAsync(item => item.Id == recipientId);

            if (recipient is null)
            {
                throw new RecordNotFoundException($"Recipient {recipientId} not found");
            }

            var hasDuplicate = _dbContext.Recipients.Any(item =>
                                                         item.Id != recipient.Id && item.DistributionGroup == recipient.DistributionGroup &&
                                                         item.Email == model.Email);

            if (hasDuplicate)
            {
                throw new DuplicateRecordException(
                          $"The email {model.Email} already exist in {recipient.DistributionGroup}");
            }

            recipient.Email     = model.Email;
            recipient.FirstName = model.FirstName;
            recipient.LastName  = model.LastName;

            _dbContext.Update(recipient);
            await _dbContext.SaveChangesAsync();
        }
Esempio n. 8
0
        public void Get_Parcel_By_Code_should_return_Parcel()
        {
            var recipient = new RecipientModel
            {
                FirstName  = "Rudi",
                LastName   = "Recipient",
                Street     = "Poststraße",
                PostalCode = "A-1070",
                City       = "Poststadt"
            };
            var parcel = new ParcelModel {
                Recipient = recipient, Weight = 1.0f
            };


            tracking.Setup(input => input.GetParcelByCode(It.IsAny <string>())).Returns(parcel);
            // Arrange
            // -- Nothing to do

            // Act
            var result = _business.GetParcelByCode("MOCKCODE");

            // Assert
            Assert.IsInstanceOfType(result, typeof(ParcelModel));
        }
Esempio n. 9
0
        public ActionResult AddEditRecipient(int RecipientID)
        {
            BloodDonorDBEntities db        = new BloodDonorDBEntities();
            List <Donor>         donorlist = db.Donors.ToList();

            ViewBag.DonorList = new SelectList(donorlist.Where(x => x.DonorIsDeleted == false), "DonorID", "DonorFullName");

            List <Donation> list = db.Donations.ToList();

            ViewBag.DonationList = new SelectList(list.Where(x => x.IsDeleted == false), "DonationID", "DonationType");



            RecipientModel model = new RecipientModel();

            if (RecipientID > 0)
            {
                Recipient rec = db.Recipients.SingleOrDefault(x => x.RecipientID == RecipientID && x.RecipientIsDeleted == false);
                model.RecipientID        = rec.RecipientID;
                model.DonorID            = rec.DonorID;
                model.DonationID         = rec.DonationID;
                model.RecipientCodedName = rec.RecipientCodedName;
                model.DateOfUse          = rec.DateOfUse;
                model.RelatedCondition   = rec.RelatedCondition;
            }

            return(PartialView("AddEditRecipient", model));
        }
Esempio n. 10
0
        public void ParcelTrackingIdGet_Returns_Parcel_When_Valid()
        {
            var recipient = new RecipientModel
            {
                FirstName  = "Rudi",
                LastName   = "Recipient",
                Street     = "Poststraße",
                PostalCode = "A-1070",
                City       = "Poststadt"
            };
            var parcel = new ParcelModel
            {
                Recipient    = recipient,
                Weight       = 1.0f,
                TrackingCode = "12345568"
            };

            _bl.Setup(input => input.GetParcelByCode(It.IsAny <string>())).Returns(parcel);
            _bl.Setup(input => input.TrackParcel(It.IsAny <string>())).Returns(new TrackingInformationModel());

            var result = controller.ParcelTrackingIdGet("1234");
            var obj    = result as ObjectResult;
            var val    = JsonConvert.DeserializeObject <TrackingInformation>(obj.Value.ToString());

            Assert.IsInstanceOfType(result, typeof(ObjectResult));
            Assert.AreEqual(StatusCodes.Status200OK, obj.StatusCode);
            Assert.IsInstanceOfType(val, typeof(TrackingInformation));
        }
Esempio n. 11
0
    public static int RecipientUpdateInfo(int id, string ClearPName, string Telephone, string Address, string Remarks)
    {
        RecipientModel rm = new RecipientModel();
        int            a  = rm.UpdateRecipientInfo(id, ClearPName, Telephone, Address, Remarks);

        return(a);
    }
Esempio n. 12
0
        public virtual MailMessage GetMailMessageToSend(MessageType messageType, string subject, object model, RecipientModel recipientModel)
        {
            var mailMessage = new MailMessage{Subject = subject};
            var mailAddress = new MailAddress(recipientModel.Email, recipientModel.FullName);
            mailMessage.To.Add(mailAddress);

            this.ViewData = new ViewDataDictionary(model);
            PopulateBody(mailMessage, viewName: messageType.ToString());

            return mailMessage;
        }
Esempio n. 13
0
    public static bool deleteRecipientById(string strRowIds)
    {
        string[] strRows1Id = strRowIds.Split(',');
        for (int i = 0; i < strRows1Id.Length; i++)
        {
            RecipientModel rm = new RecipientModel();
            rm.deleteRPInfoByid(Convert.ToInt16(strRowIds));
        }

        return(true);
    }
        public IActionResult Create(RecipientModel recipient1, RecipientModel conditionalRecipient1, RecipientModel conditionalRecipient2)
        {
            // Check the token with minimal buffer time.
            bool tokenOk = CheckToken(3);

            if (!tokenOk)
            {
                // We could store the parameters of the requested operation
                // so it could be restarted automatically.
                // But since it should be rare to have a token issue here,
                // we'll make the user re-enter the form data after
                // authentication.
                RequestItemsService.EgName = EgName;
                return(Redirect("/ds/mustAuthenticate"));
            }

            string basePath = RequestItemsService.Session.BasePath + "/restapi";

            // Obtain your OAuth token
            string accessToken = RequestItemsService.User.AccessToken;
            string accountId   = RequestItemsService.Session.AccountId;

            EnvelopeSummary results;

            try
            {
                // Call the eSignature API
                results = ConditionalRecipientsWorkflow.SendEnvelope(accessToken, basePath, accountId, recipient1.Email,
                                                                     recipient1.Name, conditionalRecipient1.Email, conditionalRecipient1.Name,
                                                                     conditionalRecipient2.Email, conditionalRecipient2.Name);
            }
            catch (ApiException apiException)
            {
                ViewBag.errorCode = apiException.ErrorCode;

                if (apiException.Message.Contains("WORKFLOW_UPDATE_RECIPIENTROUTING_NOT_ALLOWED"))
                {
                    ViewBag.errorMessage     = "Update to the workflow with recipient routing is not allowed for your account!";
                    ViewBag.errorInformation = "Please contact with our <a href='https://developers.docusign.com/support/' target='_blank'>support team</a> to resolve this issue.";
                }
                else
                {
                    ViewBag.errorMessage = apiException.Message;
                }

                return(View("Error"));
            }

            // Process results
            ViewBag.h1      = "Use conditional recipients";
            ViewBag.message = $"Envelope ID {results.EnvelopeId} with conditional routing criteria has been created and sent to the first recipient!";
            return(View("example_done"));
        }
Esempio n. 15
0
        public ParcelModel GetParcelByCode(string ParcelID)
        {
            var recipient = new RecipientModel()
            {
                City = "MockCity", FirstName = "MockMartin", LastName = "MockMuster", PostalCode = "A-0000", Street = "Mockstraße 1337"
            };

            return(new ParcelModel()
            {
                Recipient = recipient, Latitude = 48.2166205m, Longitude = 16.3958889m, TrackingCode = "MOCKMOCK", Weight = 0.5f
            });
        }
Esempio n. 16
0
 public Model(Guid expenseId, byte expenseType, decimal value, DateTime expenseDate, RecipientModel expenseRecipient, CategoryModel expenseCategory, Guid?expenseSourceId, string expenseRecipientDetailCode, string details1, string details2)
 {
     ExpenseId                  = expenseId;
     ExpenseType                = expenseType;
     Value                      = value;
     ExpenseDate                = expenseDate;
     ExpenseRecipient           = expenseRecipient;
     ExpenseCategory            = expenseCategory;
     ExpenseSourceId            = expenseSourceId;
     ExpenseRecipientDetailCode = expenseRecipientDetailCode;
     Details1                   = details1;
     Details2                   = details2;
 }
Esempio n. 17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null)
     {
         int id = Convert.ToInt16(Request.QueryString["id"]);
         idnum1.Value = Request.QueryString["id"].ToString();
         RecipientModel rm = new RecipientModel();
         DataTable      dt = rm.finRecipienallinfoByid(id);
         ClearPName1.Value = dt.Rows[0]["ClearPName"].ToString();
         Telephone.Value   = dt.Rows[0]["Telephone"].ToString();
         Remarks.Value     = dt.Rows[0]["Remarks"].ToString();
         Address.Value     = dt.Rows[0]["Address"].ToString();
     }
 }
Esempio n. 18
0
        public ActionResult Recipients(RecipientModel model)
        {
            try
            {
                BloodDonorDBEntities db   = new BloodDonorDBEntities();
                List <Donation>      list = db.Donations.ToList();
                ViewBag.DonationList = new SelectList(list.Where(x => x.IsDeleted == false), "DonationID", "DonationType");

                List <Donor> donorlist = db.Donors.ToList();
                ViewBag.DonorList = new SelectList(donorlist.Where(x => x.DonorIsDeleted == false), "DonorID", "DonorFullName");

                if (model.RecipientID > 0)
                {
                    //Update a recipient
                    Recipient rec = db.Recipients.SingleOrDefault(x => x.RecipientID == model.RecipientID && x.RecipientIsDeleted == false);

                    rec.DonorID            = model.DonorID;
                    rec.DonationID         = model.DonationID;
                    rec.RecipientCodedName = model.RecipientCodedName;
                    rec.DateOfUse          = model.DateOfUse;
                    rec.RelatedCondition   = model.RelatedCondition;

                    db.SaveChanges();
                }
                else
                {
                    //Insert a recipient in database
                    Recipient rec = new Recipient();
                    rec.DateOfUse          = model.DateOfUse;
                    rec.RelatedCondition   = model.RelatedCondition;
                    rec.RecipientCodedName = model.RecipientCodedName;
                    rec.DonationID         = model.DonationID;
                    rec.DonorID            = model.DonorID;
                    rec.RecipientIsDeleted = false;

                    db.Recipients.Add(rec);
                    db.SaveChanges();

                    int latestRecipientID = rec.RecipientID;
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Esempio n. 19
0
    public dotNetFlexGrid.DataHandlerResult FlexGridClearingpartyDataHandler(dotNetFlexGrid.DataHandlerParams p)
    {
        dotNetFlexGrid.DataHandlerResult result = new dotNetFlexGrid.DataHandlerResult();
        result.page  = p.page; //设定当前返回的页号
        result.total = 100;    //总计的数据条数,此处用100进行模拟,查询和筛选时需要根据实际
        RecipientModel rm         = new RecipientModel();
        string         ClearPName = "0";

        if (p.extParam.ContainsKey("ClearPName"))
        {
            ClearPName = p.extParam["ClearPName"];
        }
        result.table = rm.finRecipientInfo(ClearPName);


        return(result);
    }
Esempio n. 20
0
        public async Task <JsonResult> UnBlock([FromBody] RecipientModel recipient, [FromHeader] JwtBody jwt)
        {
            User user = await userRepository.GetById(jwt.id);

            if (user == null)
            {
                return(Json(new BaseResponse(false, "User does not exist")));
            }

            if (!user.blockedIds.Contains(recipient.recipientId))
            {
                return(Json(new BaseResponse(false, "User not blocked")));
            }

            user.blockedIds.Remove(recipient.recipientId);
            return(Json(new BaseResponse(true)));
        }
 private BulkSendingList MakeBulkSendList(RecipientModel signer1, RecipientModel carbonCopy1, RecipientModel signer2, RecipientModel carbonCopy2)
 {
     return(new BulkSendingList
     {
         BulkCopies = new List <BulkSendingCopy> {
             new BulkSendingCopy
             {
                 Recipients = new List <BulkSendingCopyRecipient>
                 {
                     new BulkSendingCopyRecipient
                     {
                         Name = signer1.Name,
                         Email = signer1.Email,
                         RoleName = "signer"
                     },
                     new BulkSendingCopyRecipient
                     {
                         Name = carbonCopy1.Name,
                         Email = carbonCopy1.Email,
                         RoleName = "cc"
                     }
                 }
             },
             new BulkSendingCopy
             {
                 Recipients = new List <BulkSendingCopyRecipient>
                 {
                     new BulkSendingCopyRecipient
                     {
                         Name = signer2.Name,
                         Email = signer2.Email,
                         RoleName = "signer"
                     },
                     new BulkSendingCopyRecipient
                     {
                         Name = carbonCopy2.Name,
                         Email = carbonCopy2.Email,
                         RoleName = "cc"
                     }
                 }
             }
         },
         Name = "sample.csv"
     });
 }
        public IActionResult SetProfile(RecipientModel signer1, RecipientModel carbonCopy1, RecipientModel signer2, RecipientModel carbonCopy2)
        {
            // Check the minimal buffer time.
            bool tokenOk = CheckToken(3);

            if (!tokenOk)
            {
                // We could store the parameters of the requested operation so it could be
                // restarted automatically. But since it should be rare to have a token issue
                // here, we'll make the user re-enter the form data after authentication.
                RequestItemsService.EgName = EgName;
                return(Redirect("/ds/mustAuthenticate"));
            }

            var basePath = RequestItemsService.Session.BasePath + "/restapi";

            // Obtain your OAuth token
            var accessToken = RequestItemsService.User.AccessToken;  // Represents your {ACCESS_TOKEN}
            var accountId   = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID}

            try
            {
                // Confirm successful batch send
                var envelopeIdStamping = "true";
                var emailSubject       = "Please sign this document sent from the C# SDK";
                var status             = SendBulkEnvelopes.GetStatus(signer1.Name, signer1.Email, carbonCopy1.Name,
                                                                     carbonCopy1.Email, signer2.Name, signer2.Email, carbonCopy2.Name, carbonCopy2.Email, accessToken,
                                                                     basePath, accountId, Config.docPdf, envelopeIdStamping, emailSubject);

                ViewBag.h1          = "Bulk send envelopes";
                ViewBag.message     = "Results from BulkSend:getBulkSendBatchStatus method:";
                ViewBag.Locals.Json = JsonConvert.SerializeObject(status, Formatting.Indented);
            }
            catch (Exception ex)
            {
                ViewBag.h1      = "Bulk send envelope failed.";
                ViewBag.message = $@"Bulk request failed to send. Reason: {ex}.";
            }

            return(View("example_done"));
        }
Esempio n. 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RecipientModel rm = new RecipientModel();
            SqlDataReader  sd = rm.finRecipienallinfo();
            ClearPName.Items.Add(new ListItem("全部", "0"));
            if (sd != null)
            {
                while (sd.Read())
                {
                    this.ClearPName.Items.Add(new ListItem(sd["ClearPName"].ToString()));
                }
            }
        }


        this.FlexGridRecipient.InitConfig(
            new string[] {
            "title=收件人信息",          //标题
            "striped=true",         //是否显示行交替色
            "selectedonclick=true", //是否点击行自动选中checkbox
            "usepager=false",       //使用分页器
            "showcheckbox=true",    //显示复选框
            "height=300",           //高度,可为auto或具体px值
            "width=505"             //宽度,可为auto或具体px值
        },
            new dotNetFlexGrid.FieldConfig[] {
            new dotNetFlexGrid.FieldConfig("ClearPName", "收件人名称", 80, true, dotNetFlexGrid.FieldConfigAlign.Center),
            new dotNetFlexGrid.FieldConfig("Telephone", "联系电话", 80, true, dotNetFlexGrid.FieldConfigAlign.Center),

            new dotNetFlexGrid.FieldConfig("Address", "地址", 170, true, dotNetFlexGrid.FieldConfigAlign.Center),

            new dotNetFlexGrid.FieldConfig("Remarks", "备注", 130, false, dotNetFlexGrid.FieldConfigAlign.Center),
        },
            null
            ,
            null
            );
        this.FlexGridRecipient.DataHandler = new dotNetFlexGrid.DataHandlerDelegate(FlexGridClearingpartyDataHandler); //提供数据的方法
    }
        public IActionResult Create(RecipientModel recipient1, RecipientModel recipient2)
        {
            // Check the token with minimal buffer time.
            bool tokenOk = CheckToken(3);

            if (!tokenOk)
            {
                // We could store the parameters of the requested operation
                // so it could be restarted automatically.
                // But since it should be rare to have a token issue here,
                // we'll make the user re-enter the form data after
                // authentication.
                RequestItemsService.EgName = EgName;
                return(Redirect("/ds/mustAuthenticate"));
            }

            string basePath = RequestItemsService.Session.BasePath + "/restapi";

            // Step 1. Obtain your OAuth token
            string accessToken = RequestItemsService.User.AccessToken;
            string accountId   = RequestItemsService.Session.AccountId;

            // Step 2. Construct your API headers
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
            var envelopesApi = new EnvelopesApi(apiClient);

            // Step 3. Construct request body
            var envelope = CreateEnvelope(recipient1, recipient2);

            // Step 4. Call the eSignature API
            EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, envelope);

            // Process results
            RequestItemsService.PausedEnvelopeId = results.EnvelopeId;
            ViewBag.h1          = "The envelope was created successfully!";
            ViewBag.message     = "Results from the Envelopes::create method:";
            ViewBag.Locals.Json = JsonConvert.SerializeObject(results, Formatting.Indented);
            return(View("example_done"));
        }
Esempio n. 25
0
        public Task AddAsync(string distributionGroup, RecipientModel model)
        {
            var hasDuplicate = _dbContext.Recipients.Any(item =>
                                                         item.DistributionGroup == distributionGroup && item.Email == model.Email);

            if (hasDuplicate)
            {
                throw new DuplicateRecordException($"The email {model.Email} already exist in {distributionGroup}");
            }

            _dbContext.Recipients.Add(new Recipient
            {
                DistributionGroup = distributionGroup,
                Email             = model.Email,
                FirstName         = model.FirstName,
                LastName          = model.LastName,
                CreationDateTime  = DateTime.UtcNow
            });

            return(_dbContext.SaveChangesAsync());
        }
Esempio n. 26
0
    public static string addRecipientinfo(string ClearPName, string Telephone, string Address, string Remarks)
    {
        string result = "";


        //string str2 = str1.TrimStart('0');
        RecipientModel wr = new RecipientModel();

        int sdr = wr.AddRecipient(ClearPName, Telephone, Address, Remarks);

        if (sdr == 0)
        {
            result = "0";
        }
        else
        {
            result = "1";
        }

        return(result);
    }
Esempio n. 27
0
        public async Task <JsonResult> Block([FromBody] RecipientModel recipient, [FromHeader] JwtBody jwt)
        {
            User user = await userRepository.GetById(jwt.id);

            if (user == null)
            {
                return(Json(new BaseResponse(false, "User does not exist")));
            }

            if (user.blockedIds.Contains(recipient.recipientId))
            {
                return(Json(new BaseResponse(false, "User already blocked")));
            }

            user.blockedIds.Add(recipient.recipientId);
            user.invitations.RemoveAll(i => i.senderId == recipient.recipientId);

            await userRepository.Save();

            return(Json(new BaseResponse(true)));
        }
Esempio n. 28
0
        public void ValidateParcel_should_return_true()
        {
            // Arrange
            RecipientModel recipient = new RecipientModel
            {
                FirstName  = "Rudi",
                LastName   = "Recipient",
                Street     = "Poststraße",
                PostalCode = "A-1070",
                City       = "Poststadt"
            };
            ParcelModel parcel = new ParcelModel {
                Recipient = recipient, Weight = 1.0f
            };

            parcel.TrackingCode = "MOCKCODE";
            // Act
            var result = _tl.ValidateParcel(parcel);

            // Assert
            Assert.IsTrue(result);
        }
Esempio n. 29
0
        public void OnBoardParcel_should_return_TrackingId()
        {
            var recipient = new RecipientModel
            {
                FirstName  = "Rudi",
                LastName   = "Recipient",
                Street     = "Poststraße",
                PostalCode = "A-1070",
                City       = "Poststadt"
            };
            var parcel = new ParcelModel {
                Recipient = recipient, Weight = 1.0f
            };

            tracking.Setup(input => input.AddParcel(It.IsAny <ParcelModel>())).Returns(true);
            tracking.Setup(input => input.GenerateTrackingCode()).Returns("12345ABC");
            tracking.Setup(input => input.ValidateParcel(It.IsAny <ParcelModel>())).Returns(true);
            geoencoding.Setup(input => input.EncodeAddress(It.IsAny <string>())).Returns(new GeoPoint(21, 12));

            var result = _business.OnBoardParcel(parcel);

            Assert.AreEqual("12345ABC", result);
        }
Esempio n. 30
0
        public void Add_Parcel_should_return_true()
        {
            // Arrange
            tracking.Setup(input => input.AddParcel(It.IsAny <ParcelModel>())).Returns(true);

            RecipientModel recipient = new RecipientModel
            {
                FirstName  = "Rudi",
                LastName   = "Recipient",
                Street     = "Poststraße",
                PostalCode = "A-1070",
                City       = "Poststadt"
            };
            ParcelModel parcel = new ParcelModel {
                Recipient = recipient, Weight = 1.0f
            };

            // Act
            var result = _business.AddParcel(parcel);

            // Assert
            Assert.IsTrue(result);
        }
Esempio n. 31
0
        public void Add_Parcel_should_return_true()
        {
            // Arrange
            RecipientModel recipient = new RecipientModel
            {
                FirstName  = "Rudi",
                LastName   = "Recipient",
                Street     = "Poststraße",
                PostalCode = "A-1070",
                City       = "Poststadt"
            };
            ParcelModel parcel = new ParcelModel {
                Recipient = recipient, Weight = 1.0f
            };

            parcelMock.Setup(input => input.Create(It.IsAny <ParcelDTO>()));
            parcel.TrackingCode = "MOCKCODE";

            var result = tracking.AddParcel(parcel);

            // Assert
            Assert.IsTrue(result);
        }