예제 #1
0
        /// <summary>
        /// New Item
        /// </summary>
        private void NewItemLending()
        {
            frmEditLending form = new frmEditLending();
            var            res  = form.ShowDialog();        // Show Edit form

            while (res == DialogResult.Yes)                 // If New item request
            {
                form.Dispose();
                form = new frmEditLending();                // New Form
                res  = form.ShowDialog();                   // Show new Edit form
            }
            UpdateLendingOLV();                             // Update Lending OLV
            UpdateConOLV();                                 // Update Contact OLV
            UpdateAllItemsOLV();
        }
예제 #2
0
        /// <summary>
        /// Button Lend
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLend_Click(object sender, EventArgs e)
        {
            // ----- Lend selected -----
            if (olvItem.SelectedObjects.Count > 0)
            {
                changed = true;
                for (int i = olvItem.SelectedObjects.Count - 1; i >= 0; i--)
                {
                    ((Lending)(olvItem.SelectedObjects[i])).Status = (short)LendStatus.Lended;
                    ((Lending)(olvItem.SelectedObjects[i])).To     = DateTime.Now.AddMonths(1);
                }
                UpdateOLV();
                olvItem.SelectedIndex = -1;
            }
            // ----- Lend new -----
            else
            {
                // ----- Check changes -----
                if (changed)
                {
                    if (Dialogs.ShowQuest(Lng.Get("saveChangesBeforeLending", "Before lending new items you must save changes to database. Save changes?"), Lng.Get("SaveChanges", "Save changes?")) == DialogResult.No)
                    {
                        return;
                    }
                }

                // ----- Close Barcode reader connection -----
                com.Close();

                // ----- Save changes to DB -----
                SaveChanges();

                // ----- Show Lending Dialog -----
                frmEditLending form = new frmEditLending();
                form.ShowPersonDialog(PersonID);

                RefreshItems();

                // ----- Start Barcode reader Connection -----
                try
                {
                    com.ConnectSP(Properties.Settings.Default.scanCOM);
                }
                catch { }
            }
        }
예제 #3
0
 /// <summary>
 /// Edit Item
 /// </summary>
 private void EditItemLending()
 {
     if (olvLending.SelectedIndex >= 0)               // If selected Item
     {
         frmEditLending form  = new frmEditLending(); // Show Edit form
         List <Guid>    gList = new List <Guid>();
         gList.Add(((Lending)olvLending.SelectedObject).ID);
         var res = form.ShowDialog(gList);
         while (res == DialogResult.Yes)                 // If New item request
         {
             form.Dispose();
             form = new frmEditLending();              // New Form
             res  = form.ShowDialog();                 // Show new Edit form
         }
         UpdateLendingOLV();                           // Update Lending OLV
         UpdateConOLV();                               // Update Contact OLV
         UpdateAllItemsOLV();
     }
 }