Пример #1
0
 protected void uiGridViewCustomers_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditR")
     {
         Passenger passenger = new Passenger();
         passenger.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         CurrentCustomer = passenger;
         uiTextBoxFN.Text = passenger.FirstName;
         uiTextBoxLN.Text = passenger.LastName;
         uiTextBoxMail.Text = passenger.Email;
         uiTextBoxMobile.Text = passenger.Mobile;
         uiDropDownListTitle.SelectedValue = passenger.TitleID.ToString();
         uiPanelAll.Visible = false;
         uiPanelEdit.Visible = true;
     }
     else if (e.CommandName == "DeleteR")
     {
         Passenger passenger = new Passenger();
         passenger.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         passenger.MarkAsDeleted();
         passenger.Save();
         LoadAllCustomers();
     }
 }
Пример #2
0
 protected void uiLinkButtonSave_Click(object sender, EventArgs e)
 {
     Passenger customer = new Passenger();
     if (CurrentCustomer == null)
         customer.AddNew();
     else
         customer = CurrentCustomer;
     customer.FirstName = uiTextBoxFN.Text;
     customer.LastName = uiTextBoxLN.Text;
     customer.Email = uiTextBoxMail.Text;
     customer.Mobile = uiTextBoxMobile.Text;
     customer.TitleID = Convert.ToInt32(uiDropDownListTitle.SelectedValue);
     customer.Save();
     LoadAllCustomers();
     uiPanelAll.Visible = true;
     uiPanelEdit.Visible = false;
     ClearFields();
     CurrentCustomer = null;
 }