示例#1
0
        public JsonResult Get(int pageIndex, int pageSize, string pageOrder)
        {
            var list = Emails.Get(pageIndex, pageSize, pageOrder);

            int total     = Emails.Count();
            int totalPage = (int)Math.Ceiling((decimal)total / pageSize);

            if (pageSize > total)
            {
                pageSize = total;
            }

            if (list.Count < pageSize)
            {
                pageSize = list.Count;
            }

            JsonResult result = new JsonResult()
            {
                Data = new
                {
                    TotalPages = totalPage,
                    PageIndex  = pageIndex,
                    PageSize   = pageSize,
                    Rows       = list
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };

            return(result);
        }
示例#2
0
        public virtual ActionResult Resend(string id)
        {
            var msg = Emails.Get(id);

            Sender.Send(msg);
            return(this.RedirectToAction(c => c.Display(id)));
        }
示例#3
0
 public virtual ActionResult Display(string id)
 {
     return(View(Emails.Get(id)));
 }
示例#4
0
        public void Get(int contactId)
        {
            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_businessEntity_contact_get_batch");

            sp.Parameters.Add("@contactId", SqlDbType.BigInt);
            sp.Parameters.SetLong("@contactId", contactId);

            SqlDataReaderAccessor reader     = null;
            ArrayList             addressIDs = new ArrayList();

            try
            {
                //
                // net_businessEntity_contact_get_batch will return the objects contained in a business in the following order:
                //
                //	- descriptions
                //	- phones
                //	- emails
                //  - addresses
                reader = sp.ExecuteReader();

                //
                // Read the descriptions
                //
                Descriptions.Read(reader);

                //
                // Read the phones
                //
                if (true == reader.NextResult())
                {
                    Phones.Read(reader);
                }

                //
                // Read the emails
                //
                if (true == reader.NextResult())
                {
                    Emails.Read(reader);
                }

                //
                // Read the addresses
                //
                if (true == reader.NextResult())
                {
                    addressIDs = Addresses.Read(reader);
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            //
            // These calls will make separate sproc calls, so we have to close our reader first.
            //
            Addresses.Populate(addressIDs);

#if never
            //
            // Call get method on sub-objects personName and UseType
            // should have been populate by contacts.get() method;
            //
            Descriptions.Get(contactId, EntityType.Contact);
            Phones.Get(contactId);
            Emails.Get(contactId);
            Addresses.Get(contactId);
#endif
        }