Exemplo n.º 1
0
        public void bntCreate_Click(Object sender, EventArgs e)
        {
            var id            = Page.Request.Params["id"];
            var userInSession = (Users)Session["userinsession"];
            var warehouse     = new Warehouses()
            {
                Name            = tbName.Text.Trim(),
                StreetPrefix    = ddlStreetPrefix.SelectedValue,
                StreetName      = tbStreetName.Text.Trim(),
                StreetNumber    = tbStreetNumber.Text.Trim(),
                Housing         = tbHousing.Text.Trim(),
                ApartmentNumber = tbApartmentNumber.Text.Trim(),
                CityID          = Convert.ToInt32(hfCityID.Value)
            };

            if (id == null)
            {
                warehouse.CreateDate = DateTime.Now;
                warehouse.Create();
            }
            else
            {
                warehouse.ID         = Convert.ToInt32(id);
                warehouse.ChangeDate = DateTime.Now;
                warehouse.Update(userInSession.ID, OtherMethods.GetIPAddress(), "WarehouseEdit");
            }
            Page.Response.Redirect("~/ManagerUI/Menu/Souls/WarehousesView.aspx");
        }