예제 #1
0
 private void DeleteServiceButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsServiceValidated())
         {
             var confirmResult = MessageBox.Show("Are you sure to delete this item ??",
                                                 "Confirm Delete!!",
                                                 MessageBoxButtons.YesNo);
             if (confirmResult == DialogResult.Yes)
             {
                 var patient = db.simpleService.Find(selectedId);
                 db.simpleService.Remove(patient);
                 db.SaveChanges();
                 MessageBox.Show("Data deleted successfully");
                 LoadService();
                 ServiceNameTextBox.Clear();
                 ServicePriceTextBox.Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
 private void UpdatServiceButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsServiceValidated())
         {
             var service = db.Medicines.Where(x => x.Id == selectedId).FirstOrDefault();
             service.Medicine_Name = ServiceNameTextBox.Text;
             service.Price         = double.Parse(ServicePriceTextBox.Text);
             service.Quantity      = float.Parse(metroTextBoxQuantity.Text);
             service.MagnifiedDate = metroDateTime1.Value;
             service.ExpiryDate    = metroDateTime3.Value;
             service.UpdatedBy     = LoggedInUser.UserName;
             service.UpdatedDate   = DateTime.Now.ToString();
             db.SaveChanges();
             LoadService();
             ServiceNameTextBox.Clear();
             ServicePriceTextBox.Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
 private void AddServiceButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsServiceValidated())
         {
             Medicine service = new Medicine();
             service.Medicine_Name = ServiceNameTextBox.Text;
             service.Price         = Convert.ToDouble(ServicePriceTextBox.Text);
             service.Quantity      = float.Parse(metroTextBoxQuantity.Text);
             service.MagnifiedDate = metroDateTime1.Value;
             service.ExpiryDate    = metroDateTime3.Value;
             service.AddedBy       = LoggedInUser.UserName;
             service.AddedDate     = DateTime.Now;
             db.Medicines.Add(service);
             db.SaveChanges();
             LoadService();
             ServiceNameTextBox.Clear();
             ServicePriceTextBox.Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public void ShowView()
        {
            PopupViewManageEffects.AddBlackOutEffect(_blackoutGrid);

            ContentRendered += (sender, args) =>
            {
                Dispatcher.BeginInvoke(
                    DispatcherPriority.Render,
                    new Action(delegate
                {
                    ServiceNameTextBox.Focus();
                }));
            };
            Closing += WindowClosing;
            ShowDialog();
        }
예제 #5
0
 private void UpdatServiceButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsServiceValidated())
         {
             var service = db.simpleService.Where(x => x.Id == selectedId).FirstOrDefault();
             service.ServiceName = ServiceNameTextBox.Text;
             service.Price       = int.Parse(ServicePriceTextBox.Text);
             service.UpdatedBy   = LoggedInUser.UserName;
             service.UpdatedDate = DateTime.Now.ToString();
             db.SaveChanges();
             LoadService();
             ServiceNameTextBox.Clear();
             ServicePriceTextBox.Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #6
0
 private void AddServiceButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (IsServiceValidated())
         {
             Services s = new Services();
             s.ServiceName = ServiceNameTextBox.Text;
             s.Price       = Convert.ToDouble(ServicePriceTextBox.Text);
             s.AddedDate   = DateTime.Now;
             s.AddedBy     = LoggedInUser.UserName;
             db.simpleService.Add(s);
             db.SaveChanges();
             LoadService();
             ServiceNameTextBox.Clear();
             ServicePriceTextBox.Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }