コード例 #1
0
 private void validityIndicationState(MedicineBatchUpdateControl controlName)
 {
     if (vISsafeModeOn)
     {
         string ts = controlName.medName == null ? "" : controlName.medName;
         if (ts.Length == 0)
         {
             controlName.validColor = EMPTY_FIELD_COLOR;
         }
         else if (vItemSourceList.Contains(ts))
         {
             if (controlName.nowHold != "0")
             {
                 controlName.validColor = FIELD_IS_OK;
             }
             else
             {
                 controlName.validColor = FIELD_OK_BUT_NOWHOLD_ZERO;
             }
         }
         else if (!vItemSourceList.Contains(ts))
         {
             controlName.validColor = FIELD_IS_NOT_OK;
         }
     }
 }
コード例 #2
0
        private void RemoveItemsFromList(string eleName)
        {
            MedicineBatchUpdateControl childControl = (MedicineBatchUpdateControl)ControlsHolderPanel.FindName(eleName);

            if (vControlHashSet.Contains(childControl) != false)
            {
                vControlHashSet.Remove(childControl);
                ControlsHolderPanel.Children.Remove(childControl);
                UnregisterName(eleName);
                UpdateAllCounters();
            }
        }
コード例 #3
0
        private void N_Click(object sender, RoutedEventArgs e)
        {
            MedicineBatchUpdateControl newMedicineUpdateControl = new MedicineBatchUpdateControl();

            RegisterName(newMedicineUpdateControl.Name, newMedicineUpdateControl); // Register this control on this window by Name (!important)
            AttachFields(newMedicineUpdateControl);                                //Attcah fields
            AttachEvents(newMedicineUpdateControl);                                //Attach events
            ControlsHolderPanel.Children.Add(newMedicineUpdateControl);            //add control to the parent panel (a stackPan)
            newMedicineUpdateControl.HorizontalAlignment = HorizontalAlignment.Left;
            vControlHashSet.Add(newMedicineUpdateControl);                         //add this control to the hashset;
            UpdateAllCounters();
        }
コード例 #4
0
        /*THIS FUNCTION WILL TRIGGER EVERYTIME TEXT OF COMBOX IS CHNAGED*/
        private void CheckValidityAndChangeAccordingly(string eleName)
        {
            MedicineBatchUpdateControl childControl = (MedicineBatchUpdateControl)ControlsHolderPanel.FindName(eleName);
            MedicineDetails            medDClass    = new MedicineDetails(childControl.medName);

            validityIndicationState(childControl);
            childControl.cuurtBatc = medDClass.MED_CUR_BATCH();
            childControl.onHold    = medDClass.MED_CUR_HOLD();
            childControl.expDate   = DateTime.Now.Date.AddMonths(medDClass.MED_EXP_MONTH_DURATION());
            childControl.manfName  = medDClass.MED_MANUF_NAME();
            childControl.price     = medDClass.MED_CUR_PRICE();
            UpdateAllCounters();
        }
コード例 #5
0
 private void AttachFields(MedicineBatchUpdateControl md)
 {
     //this will be deafult date. don't change it.
     md.entryDate = DateTime.Now.Date.ToShortDateString();
     if (vISsafeModeOn)
     {
         md.validColor = EMPTY_FIELD_COLOR;
     }
     else
     {
         md.validColor = FIELD_IS_SUSPENDED;
     }
     md.ItemSoureceForComboBox = vItemSourceList;
 }
コード例 #6
0
 private void btnMergeDuplicate_Click(object sender, RoutedEventArgs e)
 {
     MergeDuplicate();
     DeleteAllField();
     foreach (var newEntry in vDuplicateRecord)
     {
         MedicineBatchUpdateControl newMedicineUpdateControl = new MedicineBatchUpdateControl();
         RegisterName(newMedicineUpdateControl.Name, newMedicineUpdateControl); // Register this control on this window by Name (!important)
         AttachFields(newMedicineUpdateControl);                                //Attcah fields
         AttachEvents(newMedicineUpdateControl);                                //Attach events
         newMedicineUpdateControl.medName = newEntry.Key;
         newMedicineUpdateControl.nowHold = newEntry.Value.ToString();
         ControlsHolderPanel.Children.Add(newMedicineUpdateControl); //add control to the parent panel (a stackPan)
         newMedicineUpdateControl.HorizontalAlignment = HorizontalAlignment.Left;
         vControlHashSet.Add(newMedicineUpdateControl);              //add this control to the hashset;
     }
     UpdateAllCounters();
 }
コード例 #7
0
        private void SaveItemCurrentlyOnControl(string eleName)
        {
            MedicineBatchUpdateControl childControl = (MedicineBatchUpdateControl)ControlsHolderPanel.FindName(eleName);
            MySqlMedicineBatchEntry    msmbe        = new MySqlMedicineBatchEntry(childControl.medName, int.Parse(childControl.nowHold), childControl.price);

            Console.WriteLine(childControl.price);

            try
            {
                bool isOk = msmbe.SaveAndCommit(); //caution this can throw exception

                if (isOk)
                {
                    childControl.IsSaveButtonEanble = false;
                    //ControlsHolderPanel.Children.Remove(childControl);
                    MessageBox.Show("Medcine Updated!", "Medicine Update Alert", MessageBoxButton.OK, MessageBoxImage.Information);
                    lblSaved.Text = (Convert.ToInt16(lblSaved.Text) + 1).ToString();
                }
            }
            catch (NonRegisterNameException e)
            {
                MessageBox.Show(e.StackTrace);
            }
        }
コード例 #8
0
 /*
  * THIS FUCNTION WILL ASSIGN DEFAULT VALUES, AND EVENT HANDELERS AT THE
  * TIME OF CREATION
  */
 private void AttachEvents(MedicineBatchUpdateControl md)
 {
     md.thisControlRemoveEvent      = RemoveItemsFromList;
     md.thisControlSaveButtonEvent  = SaveItemCurrentlyOnControl;
     md.thisComboBoxItemChangeEvent = CheckValidityAndChangeAccordingly;
 }