Example #1
0
        public void GetDetails()
        {
            List list = new List(auth, ListID);

            try
            {
                ListDetail ld = list.Details();
                Console.WriteLine("List Details:\n-----");
                Console.WriteLine("ListID: {0}", ld.ListID);
                Console.WriteLine("Title: {0}", ld.Title);
                Console.WriteLine("ConfirmedOptIn: {0}", ld.ConfirmedOptIn);
                Console.WriteLine("ConfirmationSuccessPage: {0}", ld.ConfirmationSuccessPage);
                Console.WriteLine("UnsubscribePage: {0}", ld.UnsubscribePage);
                Console.WriteLine("UnsubscribeSetting: {0}", ld.UnsubscribeSetting);
            }
            catch (CreatesendException ex)
            {
                ErrorResult error = (ErrorResult)ex.Data["ErrorResult"];
                Console.WriteLine(error.Code);
                Console.WriteLine(error.Message);
            }
            catch (Exception ex)
            {
                // Handle some other failure
                Console.WriteLine(ex.ToString());
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ListDetail listDetail = db.ListDetails.Find(id);

            db.ListDetails.Remove(listDetail);
            db.SaveChanges();
            return(RedirectToAction("Create"));
        }
Example #3
0
        internal ILazyObservable <FolderListItemCollection> LoadItems(ListDetail listDetail, ContentTypeDetail contentTypeDetail)
        {
            if (contentTypeDetail == null || listDetail == null)
            {
                Fields = null;
                DisposeItems();
                return(null);
            }

            if (this.contentTypeDetail != contentTypeDetail || this.listDetail != listDetail)
            {
                Fields = null;
                DisposeItems();
                this.contentTypeDetail = contentTypeDetail;
                this.listDetail        = listDetail;

                if (ParentFolder.ParentList.BaseType == BaseType.DocumentLibrary)
                {
                    Field fileSizeDisplay = null;
                    int   count           = contentTypeDetail.Fields.Count;
                    if (contentTypeDetail.Fields.TryGetFieldById(BuiltInFields.FileSizeDisplay.ID) == null)
                    {
                        fileSizeDisplay = listDetail.Fields.TryGetFieldById(BuiltInFields.FileSizeDisplay.ID)
                                          ?? BuiltInFields.FileSizeDisplay;
                        count++;
                    }


                    if (count != contentTypeDetail.Fields.Count)
                    {
                        Field[] fields = new Field[count];
                        contentTypeDetail.Fields.CopyTo(fields, 0);
                        count = contentTypeDetail.Fields.Count;
                        if (fileSizeDisplay != null)
                        {
                            fields[count++] = fileSizeDisplay;
                        }
                        Fields = fields;
                    }
                }
                else if (ParentFolder.ParentList.EnableAttachments)
                {
                    Field[] fields = new Field[contentTypeDetail.Fields.Count + 1];
                    fields[0] = listDetail.Fields.TryGetFieldById(BuiltInFields.Attachments.ID);
                    contentTypeDetail.Fields.CopyTo(fields, 1);
                    Fields = fields;
                }

                if (Fields == null)
                {
                    Fields = contentTypeDetail.Fields;
                }

                Refresh();
            }

            return(items);
        }
 public ActionResult Edit([Bind(Include = "ListId,ProductId,StoreId,ListDetailsId")] ListDetail listDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(listDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Create"));
     }
     ViewBag.ListId    = new SelectList(db.Lists, "ListId", "ListId", listDetail.ListId);
     ViewBag.ProductId = new SelectList(db.Products, "ProductId", "ProductName", listDetail.ProductId);
     ViewBag.StoreId   = new SelectList(db.Stores, "StoreId", "StoreName", listDetail.StoreId);
     return(View(listDetail));
 }
        // GET: ListDetails/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ListDetail listDetail = db.ListDetails.Find(id);

            if (listDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(listDetail));
        }
Example #6
0
        public ListDetail Get(ListCriteria criteria)
        {
            var qUserList = View <UserList>().All();

            var userList = qUserList.SingleOrDefault(w => w.ID == criteria.IDToInt);

            if (userList == null)
            {
                return(null);
            }

            var listDetail = new ListDetail();

            MapProperty(userList, listDetail);

            return(listDetail);
        }
        // GET: ListDetails/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ListDetail listDetail = db.ListDetails.Find(id);

            if (listDetail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ListId    = new SelectList(db.Lists, "ListId", "ListId", listDetail.ListId);
            ViewBag.ProductId = new SelectList(db.Products, "ProductId", "ProductName", listDetail.ProductId);
            ViewBag.StoreId   = new SelectList(db.Stores, "StoreId", "StoreName", listDetail.StoreId);
            return(View(listDetail));
        }
Example #8
0
        private ProjectViewModel IPubishedContentToPvm(IPublishedContent cachedProject)
        {
            var iContentProject = new Project(cachedProject);
            var general         = new General(iContentProject.Sort, iContentProject.Title, iContentProject.Teaser, iContentProject.Description.ToHtmlString(), iContentProject.FeaturedImage?.FirstOrDefault().GetCropUrl(600, 413));


            var contentRows = iContentProject.Content.Select(y => new ContentRowViewModel()
            {
                BigHeading      = y.GetValue <string>(nameof(ContentRowViewModel.BigHeading)),
                SmallHeading    = y.GetValue <string>(nameof(ContentRowViewModel.SmallHeading)),
                Icon            = y.GetValue <IPublishedContent>(nameof(ContentRowViewModel.Icon))?.GetCropUrl(),
                TextColumnLeft  = y.GetValue <string>(nameof(ContentRowViewModel.TextColumnLeft)),
                TextColumnRight = y.GetValue <string>(nameof(ContentRowViewModel.TextColumnRight)),
                Image           = y.GetValue <IPublishedContent>((nameof(ContentRowViewModel.Image))).GetCropUrl()
            }).ToList();

            var detail      = new Detail(iContentProject.Hero?.GetCropUrl(4272, 2848), iContentProject.ClientName, iContentProject.Year, iContentProject.Role);
            var permissions = new Permissions(iContentProject.Featured, iContentProject.HideInNavbar);
            var listDetail  = new ListDetail(iContentProject.WebListImage?.GetCropUrl(624, 413),
                                             iContentProject.WebListPlaceholder?.GetCropUrl(624, 413),
                                             iContentProject.MobileListImage?.GetCropUrl(278, 284));

            List <SimilarProject> similarProjects = new List <SimilarProject>();

            if (iContentProject.RelatedProject.Any())
            {
                similarProjects.AddRange(iContentProject.RelatedProject.
                                         Select(related =>
                                                new Project(related))
                                         .Select(proj => new SimilarProject(proj.GetKey(),
                                                                            proj.WebListImage?.GetCropUrl(624, 413),
                                                                            proj.MobileListImage?.GetCropUrl(278, 284),
                                                                            proj.Title, proj.Url)));
            }

            return(new ProjectViewModel(iContentProject.GetKey(),
                                        iContentProject.Url,
                                        general,
                                        detail,
                                        permissions,
                                        listDetail,
                                        contentRows,
                                        similarProjects
                                        ));
        }
Example #9
0
        public Car(int numberWheel, int numberDoor)
        {
            for (int i = 0; i < numberWheel; i++)
            {
                Wheel wheel = new Wheel(i, "Pirelli", this);
                ListDetail.Add(wheel);
            }

            Body body = new Body();

            ListDetail.Add(body);

            for (int i = 0; i < numberDoor; i++)
            {
                Door door = new Door(numberDoor, "ABC", this);
                ListDetail.Add(door);
            }
        }
Example #10
0
        public StringBuilder doConvert(byte[] fileInput)
        {
            //clear the variable Errors
            this.ListErrors      = new List <string>();
            this.ListErrorVendor = new List <string>();
            ListVendorAddress    = new List <VendorInfomation>();

            //stanadard file
            StringBuilder StandardFile = new StringBuilder();

            StandardFile.AppendLine(this.GetHeader());
            StandardFile.AppendLine(this.GetHeaderDetail());

            //count line
            int CountLine = 0;
            //input string line
            string strLine = null;

            using (MemoryStream stream = new MemoryStream(fileInput))
            {
                using (StreamReader reader = new StreamReader(stream))
                {
                    //IList<string> ListPaymentNumber = new List<string>();
                    IList <string> ListPayeeId = new List <string>();
                    IList <PaymentConversionLine> ListDetail = null;
                    PaymentConversionLine         oHeader    = null;
                    while ((strLine = reader.ReadLine()) != null)
                    {
                        //count line;
                        CountLine++;
                        //ignore line is BLANK
                        if (string.IsNullOrEmpty(strLine))
                        {
                            continue;
                        }

                        PaymentConversionLine oTestHeader = new PaymentConversionLine(CountLine, strLine);
                        if (oTestHeader.IsLinePaymentNumber())
                        {
                            //initialize header & detail
                            if (oHeader == null)
                            {
                                oHeader = new PaymentConversionLine();
                            }
                            if (ListDetail == null)
                            {
                                ListDetail = new List <PaymentConversionLine>();
                            }

                            if (oTestHeader.HasErrors)
                            {
                                this.ListErrors.Add(oTestHeader.ErrorMessage);
                            }
                            else
                            {
                                oHeader.PaymentNumber = oTestHeader.PaymentNumber;
                            }

                            //next line is header overflow or not
                            strLine = reader.ReadLine();
                            CountLine++;
                            PaymentConversionLine oTestLine = new PaymentConversionLine(CountLine, strLine);

                            if (oTestLine.IsLinePayeeID())
                            {
                                if (oTestLine.HasErrors)
                                {
                                    this.ListErrors.Add(oTestLine.ErrorMessage);
                                }
                                else
                                {
                                    oHeader.PayeeID = oTestLine.PayeeID;
                                    if (string.IsNullOrEmpty(oHeader.PayeeID))
                                    {
                                        this.ListErrorVendor.Add(string.Format(ERROR_LINE_FIELD_VENDOR, CountLine, "Payee ID"));
                                        oHeader.IsErrortVendor = true;
                                    }
                                }

                                //Line payment date
                                string strLinePaymentDate = reader.ReadLine();
                                CountLine++;
                                PaymentConversionLine oTestLinePaymentDatePaymentAmount = new PaymentConversionLine(CountLine, strLinePaymentDate);
                                if (oTestLinePaymentDatePaymentAmount.IsLinePaymentDatePaymentAmount())
                                {
                                    if (oTestLinePaymentDatePaymentAmount.HasErrors)
                                    {
                                        this.ListErrors.Add(oTestLinePaymentDatePaymentAmount.ErrorMessage);
                                    }
                                    else
                                    {
                                        oHeader.PaymentDate   = oTestLinePaymentDatePaymentAmount.PaymentDate;
                                        oHeader.PaymentAmount = oTestLinePaymentDatePaymentAmount.PaymentAmount;
                                    }
                                }

                                //parse vendor address
                                this.doConvertVendor(reader, ref CountLine, ref oHeader);

                                //build standard file
                                StandardFile.AppendLine(oHeader.GetHeaderDataLine());
                                if (ListDetail != null && ListDetail.Count > 0)
                                {
                                    foreach (PaymentConversionLine oDetailData in ListDetail)
                                    {
                                        StandardFile.AppendLine(oDetailData.GetDetailDataLine());
                                    }
                                    //reset variable
                                    ListDetail = null;
                                }

                                if (!oHeader.IsErrortVendor)
                                {
                                    if (!string.IsNullOrEmpty(oHeader.Address1) || !string.IsNullOrEmpty(oHeader.City) || !string.IsNullOrEmpty(oHeader.StateProvince) || !string.IsNullOrEmpty(oHeader.PostalCode))
                                    {
                                        this.ListVendorAddress.Add(oHeader.ToVendorAddress);
                                    }
                                }
                                ListVendors.Add(oHeader);
                                oHeader = null;
                            }
                            else if (oTestLine.IsLineOverflow())
                            {
                                this.doConvertDetail(reader, ref CountLine, ref ListDetail, ref oHeader, ref StandardFile);
                            }
                            else if (oTestLine.IsLineDetail())
                            {
                                if (oTestLine.HasErrors)
                                {
                                    this.ListErrors.Add(oTestLine.ErrorMessage);
                                }
                                else
                                {
                                    ListDetail.Add(oTestLine);
                                }
                                this.doConvertDetail(reader, ref CountLine, ref ListDetail, ref oHeader, ref StandardFile);
                            } //if (oLineTest.IsLineOverflow())
                        }     //if (oTestHeader.IsLinePaymentNumber() && !ListPaymentNumber.Contains(oTestHeader.PaymentNumber))

                        //TODO List Vendor Address in DB
                    } //loop while
                }
            }

            #region add/update vendor from payment file
            //update vendor
            var error  = string.Empty;
            var module = new CreateVendorsFromPayments(ListVendors);
            if (!module.ProcessCreateVendors(out error))
            {
                throw new Exception(error);
            }
            #endregion

            #region Added logic for Adding Vendor Address information from Data File for Check payments.
            //LOGGER.Info("Begin: Logic for Adding Vendor Address information from Data File for Check payments....");
            //DataSet dsVendor = new DataSet();
            //int BatchSize = 500;
            //int j = 0;
            //DataTable newdbVendor = ListVendorAddress.AsDataTable();

            //#region validate
            //List<string> lstErr = ValidateLogiCreateVendor(ref newdbVendor);
            //#endregion
            //if (newdbVendor.Rows.Count > 0)
            //{
            //    DataTable new_tableSmallVendor = newdbVendor.Clone();
            //    if (newdbVendor.Rows.Count <= BatchSize)
            //    {

            //        new_tableSmallVendor = newdbVendor.Copy();
            //        dsVendor.Tables.Add(new_tableSmallVendor);

            //    }
            //    else
            //    {
            //        for (int i = 0; i < newdbVendor.Rows.Count; i++)
            //        {
            //            new_tableSmallVendor.NewRow();
            //            new_tableSmallVendor.ImportRow(newdbVendor.Rows[i]);
            //            if ((i + 1) == newdbVendor.Rows.Count)
            //            {

            //                dsVendor.Tables.Add(new_tableSmallVendor.Copy());
            //                new_tableSmallVendor.Rows.Clear();
            //            }
            //            else if (++j == BatchSize)
            //            {
            //                dsVendor.Tables.Add(new_tableSmallVendor.Copy());
            //                new_tableSmallVendor.Rows.Clear();
            //                j = 0;
            //            }
            //        }
            //    }


            //    string ResultReturn = string.Empty;
            //    Parallel.For(0, dsVendor.Tables.Count, index =>
            //    {
            //        ResultReturn = CreateVendor(dsVendor.Tables[index]);
            //        if (ResultReturn.Length > 0)
            //        {
            //            lstErr.Add(ResultReturn);
            //        }
            //    });
            //    LOGGER.Info("End: Logic for Adding Vendor Address information from Data File for Check payments....");
            //}
            #endregion

            return(StandardFile);
        }