예제 #1
0
 public ActionResult Add(ECommerceContainer model)
 {
     if (Session["UserName"] == null)
     {
         return(RedirectToAction("Index", "Account"));
     }
     ViewBag.ReportTitle = "Add new expense";
     AddECommerceContainer(model);
     return(RedirectToAction("Index"));
 }
예제 #2
0
        public ActionResult Add()
        {
            // add new user
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("Index", "Account"));
            }
            ViewBag.ReportTitle = "Create new container";

            var model = new ECommerceContainer();

            return(View(model));
        }
예제 #3
0
        public void AddECommerceContainer(ECommerceContainer model)
        {
            string sqlInsert = "INSERT tblcontainer (ContainerName, ContainerNumber, ShippedDate, EstimateArrivalDate, ArrivalDate, UnloadDate, MarketDate, UnloadBy, UnloadTimePeriod, Notes) "
                               + "VALUE (@ContainerName, @ContainerNumber, @ShippedDate, @EstimateArrivalDate, @ArrivalDate, @UnloadDate, @MarketDate, @UnloadBy, @UnloadTimePeriod, @Notes)";

            using (MySqlConnection connection = new MySqlConnection(Helpers.Helpers.GetERPConnectionString()))
            {
                try
                {
                    int result = connection.Execute(sqlInsert, model);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }