Example #1
0
        public ActionResult AddLocation(string Email)
        {
            ListboxHelper g = new ListboxHelper();
            Location l = new Location();
            l.getAllLocationTypes = g.GetAllLocationType();

            return View(l);
        }
Example #2
0
        private bool AddLocation(Location l)
        {
            int ID = 1;
            bool result = false;
            try
            {
                var client = new Connection().ConnectAmazonDynamoDB(new AmazonDBHelper().AmazonDBConnectionString());

                //Get ID
                List<ListboxHelper.CustomListItem> cli = new ListboxHelper().GetTableID();
                foreach (var li in cli)
                {
                    if (li.text == "Location")
                    {
                        ID = li.value;
                        ID += 1;
                    }
                }

                var table = Table.LoadTable(client, "location");
                var item = new Document();
                item["id"] = ID;

                item["city"] = l.City;
                item["postalcode"] = l.PostalCode;
                item["province"] = l.Province;
                item["street1"] = l.Street1;
                if (l.Street2 != null && l.Street2 != "")
                    item["street2"] = l.Street2;

                item["email"] = l.Email;
                item["locationtypeid"] = l.LocationTypeID;
                item["locname"] = l.LocName;


                if (l.LocFax != null && l.LocFax != "")
                    item["locfax"] = l.LocFax;
                item["locphone"] = l.LocPhoneMain;
              
                table.PutItem(item);

                new CRUD().UpdateItem(new AmazonDBHelper().AmazonDBConnectionString(), "GenerateID", "location", ":i", "ID", "#I", (ID + 1).ToString());
            }
            catch (Exception)
            {

            }
            return result;

        }
Example #3
0
 public ActionResult AddAnother(Location l){
     AddLocation(l);
     return RedirectToAction("AddLocation", "User", new { Email = l.Email });
 }
Example #4
0
 public ActionResult Save(Location l) {
     AddLocation(l);
     return View();
 }