예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //declare SQL DB context var
            SmartSocialdbDataContext smartsocialDB = new SmartSocialdbDataContext();
            ServiceSubscription      newServiceSubscriptionsRow = new ServiceSubscription();

            try
            {
                //update selected record in ServiceSubscription table
                var subscriptionRow = smartsocialDB.ServiceSubscription.GetByKey(int.Parse(txtID.Text));
                subscriptionRow.SubscriptionName = txtName.Text;
                subscriptionRow.StartDate        = startDate.Value;
                subscriptionRow.EndDate          = endDate.Value;
                subscriptionRow.IsActive         = isActive.Checked;
                smartsocialDB.SubmitChanges();
                smartsocialDB.Connection.Close();
                //close this window
                this.Close();
            }

            catch (Exception ex)
            {
                //show any error message returned by the database
                MessageBox.Show(ex.Message);
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            //declare SQL DB context var
            SmartSocialdbDataContext smartsocialDB         = new SmartSocialdbDataContext();
            ServiceDelivery          newServiceDeliveryRow = new ServiceDelivery();

            try
            {
                //update selected record in ServiceSubscription table
                var deliveryRow = smartsocialDB.ServiceDelivery.GetByKey(int.Parse(txtID.Text));
                deliveryRow.DateDelivered         = startDate.Value;
                deliveryRow.IdServiceSubscription = int.Parse(cmb_subscription.SelectedValue.ToString());
                smartsocialDB.SubmitChanges();
                smartsocialDB.Connection.Close();
                //close this window
                this.Close();
            }

            catch (Exception ex)
            {
                //show any error message returned by the database
                MessageBox.Show(ex.Message);
            }
        }