示例#1
0
 private void repositoryItemButtonEditPrintBarcode_ButtonClick(object sender, ButtonPressedEventArgs e)
 {
     try
     {
         if (e.Button.Kind == ButtonPredefines.Glyph)
         {
             // if (MessageBox.Show("طباعة البار كود ؟", currentRow.Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
             {
                 //Set buttons language Czech/English/German/Slovakian/Spanish (default English)
                 InputBox.SetLanguage(InputBox.Language.English);
                 //Save the DialogResult as res
                 DialogResult res = InputBox.ShowDialog("العدد:", "طباعة باركود",                                                //Text message (mandatory), Title (optional)
                                                        InputBox.Icon.Question,                                                  //Set icon type Error/Exclamation/Question/Warning (default info)
                                                        InputBox.Buttons.OkCancel,                                               //Set buttons set OK/OKcancel/YesNo/YesNoCancel (default ok)
                                                        InputBox.Type.TextBox,                                                   //Set type ComboBox/TextBox/Nothing (default nothing)
                                                        new string[] { "Item1", "Item2", "Item3" },                              //Set string field as ComboBox items (default null)
                                                        true,                                                                    //Set visible in taskbar (default false)
                                                        new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Bold)); //Set font (default by system)
                 //Check InputBox result
                 if (res == System.Windows.Forms.DialogResult.OK || res == System.Windows.Forms.DialogResult.Yes)
                 {
                     Int16                          copies      = Convert.ToInt16(InputBox.ResultValue);
                     DataAccess.Item                currentRow  = (DataAccess.Item)gridView1.GetFocusedRow();
                     DataAccess.ItemBarcode         ibc         = db.ItemBarcodes.Where(s => s.SystemBarcode == true && s.ItemID == currentRow.ID).SingleOrDefault();
                     string                         BarcodeText = ibc.BarcodeText;// currentRow.BarcodeText;
                     DataAccess.BarCodeTemplateList list        = new DataAccess.BarCodeTemplateList();
                     if (PrintDetails(BarcodeText, currentRow.Name, currentRow.SalePrice.ToString(), copies))
                     {
                         // ShowMessageInStatusBar("New item printed successfully " + currentRow.Quantity + " Times", 9000);
                     }
                 }
             }
         }
         else
         if (e.Button.Kind == ButtonPredefines.Ellipsis)
         {
             DataAccess.Item currentRow = (DataAccess.Item)gridView1.GetFocusedRow();
             new ItemForm(currentRow).ShowDialog();
         }
         else
         if (e.Button.Kind == ButtonPredefines.Minus)
         {
             DataAccess.Item currentRow = (DataAccess.Item)gridView1.GetFocusedRow();
             currentRow.Hidden = true;
             if (db.SaveChanges() > 0)
             {
             }
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
示例#2
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            //Print all quantities
            if (e.Button.Kind == ButtonPredefines.OK)
            {
                if (MessageBox.Show("Are you sure ?", "Print barcode stickets", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    DataAccess.PurchaseInvoiceDetail currentRow = (DataAccess.PurchaseInvoiceDetail)gridView1.GetFocusedRow();
                    DataAccess.BarCodeTemplateList   list       = new DataAccess.BarCodeTemplateList();
                    for (int i = 0; i < currentRow.Quantity; i++)
                    {
                        list.Add(new DataAccess.BarCodeTemplate {
                            Barcode = currentRow.Item.BarcodeText, Name = currentRow.Item.Name, Price = currentRow.SalePrice.ToString()
                        });
                    }
                    if (PrintDetails(currentRow, Convert.ToInt16(currentRow.Quantity)))
                    {
                        ShowMessageInStatusBar("New item printed successfully " + currentRow.Quantity + " Times", 9000);
                    }
                }
            }
            else
            if (e.Button.Kind == ButtonPredefines.Down)
            {
                DataAccess.PurchaseInvoiceDetail currentRow = (DataAccess.PurchaseInvoiceDetail)gridView1.GetFocusedRow();
                DataAccess.BarCodeTemplateList   list       = new DataAccess.BarCodeTemplateList();
                for (int i = 0; i < currentRow.Quantity; i++)
                {
                    list.Add(new DataAccess.BarCodeTemplate {
                        Barcode = currentRow.Item.BarcodeText, Name = currentRow.Item.Name, Price = currentRow.SalePrice.ToString()
                    });
                }
                if (PrintDetails(currentRow, 1))
                {
                    ShowMessageInStatusBar("New item printed successfully", 9000);
                }
            }
            else
            if (e.Button.Kind == ButtonPredefines.Delete)
            {
                if (MessageBox.Show("تأكيد مسح الصنف من الفاتورة", "مسح الفاتورة", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    DataAccess.PurchaseInvoiceDetail currentRow = (DataAccess.PurchaseInvoiceDetail)gridView1.GetFocusedRow();
                    gridView1.DeleteRow(gridView1.FocusedRowHandle);

                    db.PurchaseInvoiceDetails.Remove(currentRow);

                    if (db.SaveChanges() > 0)
                    {
                        ShowMessageInStatusBar("تم حفظ اليانات", 9000);
                    }
                }
            }
            else
            if (e.Button.Kind == ButtonPredefines.Glyph)
            {
                // if (MessageBox.Show("طباعة البار كود ؟", currentRow.Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    //Set buttons language Czech/English/German/Slovakian/Spanish (default English)
                    InputBox.SetLanguage(InputBox.Language.English);
                    //Save the DialogResult as res
                    DialogResult res = InputBox.ShowDialog("العدد:", "طباعة باركود",                                                //Text message (mandatory), Title (optional)
                                                           InputBox.Icon.Question,                                                  //Set icon type Error/Exclamation/Question/Warning (default info)
                                                           InputBox.Buttons.OkCancel,                                               //Set buttons set OK/OKcancel/YesNo/YesNoCancel (default ok)
                                                           InputBox.Type.TextBox,                                                   //Set type ComboBox/TextBox/Nothing (default nothing)
                                                           new string[] { "Item1", "Item2", "Item3" },                              //Set string field as ComboBox items (default null)
                                                           true,                                                                    //Set visible in taskbar (default false)
                                                           new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Bold)); //Set font (default by system)
                    //Check InputBox result
                    if (((InputBox.ResultValue != "") && (res == System.Windows.Forms.DialogResult.OK || res == System.Windows.Forms.DialogResult.Yes)))
                    {
                        Int16 copies = Convert.ToInt16(InputBox.ResultValue);
                        DataAccess.PurchaseInvoiceDetail currentRow = (DataAccess.PurchaseInvoiceDetail)gridView1.GetFocusedRow();
                        DataAccess.BarCodeTemplateList   list       = new DataAccess.BarCodeTemplateList();
                        if (PrintDetails(currentRow, copies))
                        {
                            // ShowMessageInStatusBar("New item printed successfully " + currentRow.Quantity + " Times", 9000);
                        }
                    }
                }
            }
        }