Esempio n. 1
0
        public void bntCreate_Click(Object sender, EventArgs e)
        {
            var id       = Page.Request.Params["id"];
            var provider = new Providers
            {
                Name            = tbName.Text,
                NamePrefix      = ddlNamePrefix.SelectedValue,
                ContactFIO      = tbContactFIO.Text,
                ContactPhone    = tbContactPhone.Text,
                CityID          = Convert.ToInt32(hfCityID.Value),
                Address         = tbAddress.Text,
                Note            = tbNote.Text,
                TypesOfProducts = tbTypesOfProducts.Text
            };

            if (!string.IsNullOrEmpty(id))
            {
                provider.ID         = Convert.ToInt32(id);
                provider.ChangeDate = DateTime.Now;
                provider.Update();
            }
            else
            {
                provider.CreateDate = DateTime.Now;
                provider.Create();
            }

            Page.Response.Redirect("~/ManagerUI/Menu/Souls/ProvidersView.aspx");
        }