コード例 #1
0
        void ucPList_Click(object sender, EventArgs e)
        {
            UCPrinterList ucP    = (UCPrinterList)sender;
            PrinterModel  priter = (PrinterModel)ucP.Tag;

            PrinterMain = priter;
            PriterID    = priter.ID;
            //flag = Convert.ToInt32(ucP.Tag);
            foreach (Control ctr in flpPrintList.Controls)
            {
                if (ctr.BackColor == Color.FromArgb(0, 153, 51))
                {
                    ctr.BackColor = Color.FromArgb(255, 255, 255);
                    ctr.ForeColor = Color.FromArgb(51, 51, 51);
                }
            }
            ucP.BackColor = Color.FromArgb(0, 153, 51);
            ucP.ForeColor = Color.FromArgb(255, 255, 255);
            if (priter.PrinterType == 1)
            {
                LoadCategory();
            }
            else
            {
                flpGroup.Controls.Clear();
                flpItem.Controls.Clear();
            }
        }
コード例 #2
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            int PrinterModelID;

            PrinterModelID = Convert.ToInt32(IDLB.Text);

            using (ContextModel db = new ContextModel())
            {
                if (PrinterModelID == 0)
                {
                    PrinterModel printerModels = new PrinterModel
                    {
                        PrinterModelName = PrinterModelNameTB.Text.Trim(),
                        PrinterFirmID    = Convert.ToInt32(PrinterFirmCB.SelectedValue)
                    };
                    db.PrinterModels.Add(printerModels);
                }
                else
                {
                    var mpToUpdate = db.PrinterModels.SingleOrDefault(pm => pm.PrinterModelID == PrinterModelID);
                    if (mpToUpdate != null)
                    {
                        mpToUpdate.PrinterModelName = PrinterModelNameTB.Text;
                        mpToUpdate.PrinterFirmID    = Convert.ToInt32(PrinterFirmCB.SelectedValue);
                    }
                }
                db.SaveChanges();
            }
            clearPrinterModel();
            load();
        }
コード例 #3
0
        public CorneringModel(PrinterModel PrinterModel, PrintModel PrintModel, ParametersModel ParametersModel)
        {
            _printerModel = PrinterModel;
            _printModel   = PrintModel;

            _parametersModel = ParametersModel;
        }
コード例 #4
0
        public PrintModel(PrinterModel PrinterModel)
        {
            _printerModel = PrinterModel;

            //One material by default.
            AddMaterial();
        }
コード例 #5
0
 public PrinterModelInfo(PrinterModel printerModel, string displayName, int maxWidth, int maxHeight)
 {
     this.printerModel = printerModel;
     this.displayName  = displayName;
     this.maxWidth     = maxWidth;
     this.maxHeight    = maxHeight;
 }
コード例 #6
0
        public ActionResult Printers(PrinterModel model)
        {
            int pageIndex = model.Page ?? 1;

            using (EquipmentsEntities data = new EquipmentsEntities())
            {
                model.PrinterSearch = (from c in data.TB_Printers.Where(p => p.KayitDurum == "Active" && (String.IsNullOrEmpty(model.SerialNumber) || p.SerialNumber.Contains(model.SerialNumber))).OrderByDescending(p => p.ID)
                                       select new PrinterListModel
                {
                    BasicFeatures = c.BasicFeatures,
                    SerialNumber = c.SerialNumber,
                    Brand = c.Brand,
                    InventoryNumber = c.InventoryNumber,
                    InvoiceContract = c.InvoiceContract,
                    IP = c.IP,
                    Location = c.Location,
                    NetworkName = c.NetworkName,
                    PurchaseDate = c.PurchaseDate,
                    Status = c.Status,
                    UserCode = c.UserCode
                }).ToPagedList(pageIndex, 15);
                if (Request.IsAjaxRequest())
                {
                    return(PartialView("_Printer", model));
                }
                else
                {
                    return(View(model));
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Creates a PrinterViewModel with one X Axis ViewModel, one Y Axis ViewModel, one Z Axis ViewModel, and one PrintheadViewModel.
        /// </summary>
        /// <param name="PrinterModel"></param>
        public PrinterViewModel(PrinterModel PrinterModel, SerialCommunicationCommandSetsModel SerialCommunicationCommandSetsModel)
        {
            _printerModel = PrinterModel;
            _serialCommunicationCommandSetsModel = SerialCommunicationCommandSetsModel;
            _gPIOPinListsViewModel = new GPIOPinListsViewModel();

            _microcontrollerViewModel = new MicrocontrollerViewModel(_printerModel.MicroControllerModel, _gPIOPinListsViewModel);

            //Populates the Axis ViewModel lists with their Axis Model counterparts.
            foreach (AxisModel axisModel in _printerModel.AxisModelList)
            {
                AxisViewModel newAxisViewModel = new AxisViewModel(axisModel, _gPIOPinListsViewModel);

                _axisViewModelList.Add(newAxisViewModel);
                if (newAxisViewModel.Name.Contains('Z'))
                {
                    _zAxisViewModelList.Add(newAxisViewModel);
                }
            }

            //Populates the Printhead ViewModel lists with their Printhead Model counterparts.
            foreach (PrintheadModel printheadModel in _printerModel.PrintheadModelList)
            {
                _printheadViewModelList.Add(new PrintheadViewModel(printheadModel, _gPIOPinListsViewModel));
            }

            //Populates the empty PrintheadViewModel list with an empty Printhead.
            _emptyPrintheadViewModelList.Add(new PrintheadViewModel(new PrintheadModel(""), _gPIOPinListsViewModel));

            //Subscribe to events.
            SerialCommunicationCommandSetsModel.RealTimeStatusDataModel.RecordLimitExecuted += new RecordLimitExecutedEventHandler(UpdateMinMaxPositions);
            SerialCommunicationCommandSetsModel.CommandSetMinMaxPositionChanged             += new CommandSetMinMaxPositionChangedEventHandler(UpdateMinMaxPositions);
        }
コード例 #8
0
 public void Print(OrderDateModel _OrderMain, PrinterModel data)
 {
     posPrinter.SetPrinterName(data.PrinterName);
     posPrinter.printDocument.PrintPage += printDocument_PrintPage;
     if (OrderMain.IsLoadFromData && OrderMain.PrintType != this.PRINTBILL)
     {
         if (OrderMain.IsPrePrint)
         {
             posPrinter.Print();
         }
         else
         {
             if (checkOrderChange(_OrderMain))
             {
                 posPrinter.Print();
             }
             if (checkOrderChangeRemove(_OrderMain))
             {
                 posPrinter.Print();
             }
             if (_OrderMain.PrintType == this.pRINTReceipt)
             {
                 posPrinter.Print();
             }
         }
     }
     else
     {
         posPrinter.Print();
     }
 }
コード例 #9
0
        /// <summary>
        /// Prints specfied document to fiscal printer.
        /// </summary>
        /// <param name="xml">Input xml.</param>
        /// <param name="output">Output stream, not used.</param>
        /// <remarks>
        /// xml should containt information from printed document and configuration for printer.
        /// </remarks>
        public static void Generate(string xml, Stream output)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xml);


            XmlNode      configuration = GetConfiguration(xmlDocument);
            PrinterModel printerModel  = GetPrinterModel(configuration);

            using (IFiscalPrinterDriver printer = FiscalPrinterDriverFactory.CreateDriver(printerModel, configuration))
            {
                string documentType = GetDocumentType(xmlDocument);
                switch (documentType)
                {
                case "bill": printer.PrintBill(xmlDocument);
                    break;

                case "dailyReport": printer.PrintDailyReport(xmlDocument);
                    break;

                case "display": printer.Display(xmlDocument);
                    break;

                default:
                    break;
                }
            }
        }
コード例 #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            PrinterModel item = new PrinterModel();

            item.PrinterName    = cbPrinter.SelectedItem.ToString();
            item.PrintName      = txtPrintName.Text;
            item.Header         = txtHeader.Text;
            item.PrinterType    = cbPrintType.SelectedIndex;
            item.NumberOfTicket = Convert.ToInt32(txtNumberOfTicket.Text);

            if (PrinterMain.ID == 0)
            {
                int result = PrintService.InsertPrinter(item);
                if (result == 1)
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
            }
            else
            {
                item.ID     = PrinterMain.ID;
                item.Status = PrinterMain.Status;
                int result = PrintService.UpdatePrinter(item);
                if (result == 1)
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MakoPrintFiscal"/> class.
        /// </summary>
        /// <param name="printer">The printer model.</param>
        /// <param name="configuration">The printer configuration.</param>
        public MakoPrintFiscal(PrinterModel printer, string configuration)
        {
            XmlDocument xd = new XmlDocument();

            xd.LoadXml(configuration);
            printerDriver = FiscalPrinterDriverFactory.CreateDriver(printer, xd.DocumentElement);
        }
コード例 #12
0
        static void Main(string[] args)
        {
            OctoPrintConnection api = new OctoPrintConnection("http://octopi.local/", "009FDBC4E3764AC79177C5C43C34A36F");

            Console.WriteLine("Press enter to exit....");

            Task.Run(() =>
            {
                while (true)
                {
                    PrinterModel printer = api.GetPrinter();
                    if (printer == null)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Printer not connected");
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    else
                    {
                        string test = $"Tool Temp: {printer.Temperature.Tool0.Actual:N}/{printer.Temperature.Tool0.Target:N} |  Bed Temp: {printer.Temperature.Bed.Actual:N}/{printer.Temperature.Bed.Target:N}";

                        Console.WriteLine(test);
                    }

                    Task.Delay(1000);
                }
            });

            Console.ReadKey();
        }
コード例 #13
0
        public static int GetSettableUSBSerialNumberLength(PrinterModel model, string portName)
        {
            PrinterInfo printerInfo = GetPrinterInfo(model);

            int length = printerInfo.SettableUSBSerialNumberLength;

            if (model == PrinterModel.TSP100)
            {
                if (!IsUSBPrinterClassPort(portName) &&
                    !IsUSBVendorClassPort(portName)) // Not USB interface
                {
                    length = 0;
                }
                else if (IsTSP100IIIU(portName))
                {
                    length = 16; // TSP100IIIU supported 16digits USB-ID.
                }
                else
                {
                    length = 8; // TSP100U, TSP100GT, TSP100IIU
                }
            }

            if (model == PrinterModel.BSC10)
            {
                if (IsTCPPort(portName)) // BSC10 LAN model
                {
                    length = 0;
                }
            }

            return(length);
        }
コード例 #14
0
        public void CreateUpdate()
        {
            int ID = Convert.ToInt32(PrinterModelID);

            using (ContextModel db = new ContextModel())
            {
                if (ID == 0)
                {
                    PrinterModel printerModels = new PrinterModel
                    {
                        PrinterModelName = PrinterModelName,
                        PrinterFirmID    = Convert.ToInt32(PrinterFirmCb.SelectedValue)
                    };
                    db.PrinterModel.Add(printerModels);
                }
                else
                {
                    var mpToUpdate = db.PrinterModel.SingleOrDefault(pm => pm.PrinterModelID == ID);
                    if (mpToUpdate != null)
                    {
                        mpToUpdate.PrinterModelName = PrinterModelName;
                        mpToUpdate.PrinterFirmID    = Convert.ToInt32(PrinterFirmCb.SelectedValue);
                    }
                }
                db.SaveChanges();
                Load();
            }
        }
コード例 #15
0
ファイル: PrinterSettingServer.cs プロジェクト: pcthanh/POS
        public int UpdatePrinter(PrinterModel Printer)
        {
            int result = 0;

            try
            {
                if (Printer != null)
                {
                    var item = _context.PRINTERs.Find(Printer.ID);
                    if (item != null)
                    {
                        item.ID             = Printer.ID;
                        item.PrinterName    = Printer.PrinterName;
                        item.PrintName      = Printer.PrintName;
                        item.PrinterType    = Printer.PrinterType;
                        item.Status         = Printer.Status;
                        item.Header         = Printer.Header;
                        item.NumberOfTicket = Printer.NumberOfTicket;
                        //item.CreateBy = Printer.CreateBy ?? 0;
                        //item.CreateDate = DateTime.Now;
                        item.UpdateBy              = Printer.UpdateBy ?? 0;
                        item.UpdateDate            = DateTime.Now;
                        _context.Entry(item).State = System.Data.Entity.EntityState.Modified;
                        _context.SaveChanges();
                        result = 1;
                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("PrinterSettingServer::::::::::::::InsertPrinter:::::::::::::::::::" + ex.Message);
            }
            return(result);
        }
コード例 #16
0
        /// <summary>
        /// Takes in distance values in units of mm.
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="Z"></param>
        /// <param name="E"></param>
        /// <param name="GCodeIndex"></param>
        /// <param name="MaterialModel"></param>
        public MovementModel(double X, double Y, double Z, double E, int GCodeIndex, MaterialModel MaterialModel, PrinterModel PrinterModel)
        {
            _materialModel = MaterialModel;
            _printerModel  = PrinterModel;

            //Record movement distances in steps.
            _x = X / _printerModel.AxisModelList[0].MmPerStep;
            _y = Y / _printerModel.AxisModelList[1].MmPerStep;
            _z = Z / _materialModel.PrintheadModel.AttachedZAxisModel.MmPerStep;
            if (_materialModel.PrintheadModel.PrintheadType == PrintheadType.Motorized)
            {
                MotorizedPrintheadTypeModel motorizedPrintheadTypeModel = (MotorizedPrintheadTypeModel)MaterialModel.PrintheadModel.PrintheadTypeModel;
                _e = E / motorizedPrintheadTypeModel.MmPerStep;
            }
            else
            {
                _e = 0;
            }

            _gCodeIndex = GCodeIndex;

            //Calculate total distance and speeds for this movement in steps / s.
            _totalDistance = Math.Sqrt(Math.Pow(_x, 2) + Math.Pow(_y, 2) + Math.Pow(_z, 2) + Math.Pow(_e, 2));
            CalculateSpeeds(MaterialModel);
        }
コード例 #17
0
ファイル: frmPrinterSetting.cs プロジェクト: pcthanh/POSEZ2U
        void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                Button       btntag = (Button)sender;
                PrinterModel item   = (PrinterModel)btntag.Tag;
                item.Status     = 0;
                item.UpdateBy   = userid;
                item.UpdateDate = DateTime.Now;
                int result = PrinterService.UpdatePrinter(item);

                var messenger = "Delete " + item.PrintName + " fail. ";
                if (result == 1)
                {
                    messenger = "Delete " + item.PrintName + " successful. ";
                    LoadDataOfPrinter();
                    pDetail.Controls.Clear();
                }
                frmMessager frm = new frmMessager("Messenger", messenger);
                frmOpacity.ShowDialog(this, frm);
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmPrinterSetting:::::::::::::::::::btnRemove_Click::::::::::::::::" + ex.Message);
            }
        }
コード例 #18
0
        public void createPrinterModel(MetroLabel printerModelIDLab, MetroTextBox modelName, MetroComboBox printerFirm)
        {
            PrinterModelID = Convert.ToInt32(printerModelIDLab.Text);

            using (ContextModel db = new ContextModel())
            {
                if (PrinterModelID == 0)
                {
                    PrinterModel printerModels = new PrinterModel
                    {
                        PrinterModelName = modelName.Text.Trim(),
                        PrinterFirmID    = Convert.ToInt32(printerFirm.SelectedValue)
                    };
                    db.PrinterModel.Add(printerModels);
                }
                else
                {
                    var mpToUpdate = db.PrinterModel.SingleOrDefault(pm => pm.PrinterModelID == PrinterModelID);
                    if (mpToUpdate != null)
                    {
                        mpToUpdate.PrinterModelName = modelName.Text;
                        mpToUpdate.PrinterFirmID    = Convert.ToInt32(printerFirm.SelectedValue);
                    }
                }
                db.SaveChanges();
            }
        }
コード例 #19
0
 public EditViewModel(PrinterModel printerModel)
 {
     Id            = printerModel.Id;
     Name          = printerModel.Name;
     SuppliesCount = printerModel.SuppliesCount;
     Comment       = printerModel.Comment;
 }
コード例 #20
0
        public static bool GetSetUSBSerialNumberIsEnabled(PrinterModel model, string portName)
        {
            PrinterInfo printerInfo = GetPrinterInfo(model);

            bool isEnabled = GetSettableUSBSerialNumberLength(model, portName) != 0;

            return(isEnabled);
        }
コード例 #21
0
        private bool ShowModelConfirmWindow(PrinterModel model)
        {
            ModelInformation modelInformation = new ModelInformation(model);

            MessageBoxResult result = MessageBox.Show("Is your printer " + modelInformation.SimpleModelName + "?", "Confirm", MessageBoxButton.YesNo);

            return(result == MessageBoxResult.Yes);
        }
コード例 #22
0
 public Item(PrinterModel printerModel)
 {
     Id            = printerModel.Id;
     Name          = printerModel.Name;
     SuppliesCount = printerModel.SuppliesCount;
     Comment       = printerModel.Comment;
     PrintersCount = printerModel.Printers.Count();
 }
コード例 #23
0
        public GCodeConverterModel(PrinterModel PrinterModel, PrintModel PrintModel, RealTimeStatusDataModel RealTimeStatusDataModel, ErrorListViewModel ErrorListViewModel)
        {
            _printerModel            = PrinterModel;
            _printModel              = PrintModel;
            _realTimeStatusDataModel = RealTimeStatusDataModel;
            _errorListViewModel      = ErrorListViewModel;

            InstantiateGCodeConverterClasses();
        }
コード例 #24
0
ファイル: frmSettingPrint.cs プロジェクト: pcthanh/POSEZ2U
 private void btnAddPrinter_Click(object sender, EventArgs e)
 {
     PrinterMain = new PrinterModel();
     frmAddPrinter frm = new frmAddPrinter(PrinterMain);
     if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         LoadDataOfPrinter();
     }
 }
コード例 #25
0
        private void btnAddPrinter_Click(object sender, EventArgs e)
        {
            PrinterMain = new PrinterModel();
            frmAddPrinter frm = new frmAddPrinter(PrinterMain);

            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                LoadDataOfPrinter();
            }
        }
コード例 #26
0
        public static bool OrderToner(PrinterModel printer, string staffName, List <TonerOrderDetailsModel> orderDetails)
        {
            if (!orderDetails.Any())
            {
                return(false);
            }

            var orders = RebuildProperties(orderDetails);

            try
            {
                var client = new SmtpClient();

                //todo - jay: get email type from the db
                var body = new StringBuilder();

                body.Append("Dear Supplier");
                body.Append("\n This is an automated system requesting toner for the following printer please:");
                body.Append("\n Serial No\t: " + printer.SerialNumber);
                body.Append("\n Cartridge Colours:");

                orders.ForEach(m => body.Append(String.Format("\t{0}\n", m.PropertyDescription)));

                body.Append("\n Should you have any queries, please use the contact details below");
                body.Append("\n");
                body.Append("\n Kind regards");
                body.Append("\n NVestholdings Information Technology Division");
                body.Append(String.Format("\n Email \t: {0}", CcAddress));
                body.Append(String.Format("\n Tel\t:{0}", TellNumber));

                var mailMessenger = new MailMessage(new MailAddress(FromEmail),
                                                    new MailAddress(printer.PrinterProvider.ProviderEmail))
                {
                    Subject =
                        String.Format("Toner order date {0} from {1}", DateTime.Now.ToString("dd/MM/yyy"), staffName),
                    Body = body.ToString()
                };

                client.Send(mailMessenger);

                return(true);
            }
            catch (SmtpException exception)
            {
                //log 4 net will come in handy on here

                return(false);
            }
            catch (Exception exception)
            {
                //log 4 net will come in handy on here

                return(false);
            }
        }
コード例 #27
0
 public PrinterModel GetPrinter()
 {
     try
     {
         return(PrinterModel.FromJson(HTMLGet($"{_baseURL}api/printer")));
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #28
0
        public RealTimeStatusSerialInterpreterModel(SerialCommunicationMainModel SerialCommunicationMainModel, PrinterModel PrinterModel, PrinterViewModel PrinterViewModel,
                                                    RealTimeStatusDataModel RealTimeStatusDataModel, ErrorListViewModel ErrorListViewModel)
        {
            _serialCommunicationMainModel = SerialCommunicationMainModel;
            _printerModel            = PrinterModel;
            _printerViewModel        = PrinterViewModel;
            _realTimeStatusDataModel = RealTimeStatusDataModel;
            _errorListViewModel      = ErrorListViewModel;

            _serialCommunicationMainModel.SerialCommunicationMessageReceived += new SerialCommunicationMessageReceivedEventHandler(SerialCommunicationMessageReceived);
        }
コード例 #29
0
        public ProcessTCommandModel(PrintModel PrintModel, PrinterModel PrinterModel, RealTimeStatusDataModel RealTimeStatusDataModel, ParametersModel ParametersModel)
        {
            _printModel              = PrintModel;
            _printerModel            = PrinterModel;
            _realTimeStatusDataModel = RealTimeStatusDataModel;

            _parametersModel = ParametersModel;

            _setWritePrintheadModel = new SetWritePrintheadModel(_parametersModel);
            _writeSetAxisModel      = new WriteSetAxisModel(_parametersModel);
        }
コード例 #30
0
        /// <summary>
        /// Gets the printer model from printer configuration.
        /// </summary>
        /// <param name="configuration">The printer configuration.</param>
        /// <returns></returns>
        internal PrinterModel GetPrinterModel(XmlNode configuration)
        {
            PrinterModel printerModel;

            try
            {
                printerModel = (PrinterModel)Enum.Parse(typeof(PrinterModel), configuration.Attributes["printerModel"].Value);
            }
            catch (ArgumentException) { throw new TextPrinterException(TextExceptionId.UnknownPrinterModel); }

            return(printerModel);
        }
コード例 #31
0
        private void LoadPeripheralsInfo()
        {
            int             pos         = -1;
            PrinterSettings settings    = new PrinterSettings();
            string          printerName = settings.PrinterName;

            string query = string.Format("SELECT * from Win32_Printer WHERE Name LIKE '%{0}'", printerName.Replace("\\", "\\\\"));
            ManagementObjectSearcher   searcher = new ManagementObjectSearcher(query);
            ManagementObjectCollection coll     = searcher.Get();

            try
            {
                foreach (ManagementObject printer in coll)
                {
                    IsPrinterConnected = !printer["WorkOffline"].ToString().ToLowerInvariant().Equals("true");
                    ManagementObjectSearcher sr =
                        new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_PrinterDrive");
                }

                DriversMonitor DrvMonitor = DriversMonitor.Instance;
                DriverData     drd        = DrvMonitor.GetPrinterDriverInfoA();

                PrinterDriver = drd.driver_file_version;
                PrinterModel  = settings.PrinterName;
                if (drd.mnf_name != null)
                {
                    PrinterProducer = drd.mnf_name;
                }
                else
                {
                    if (drd.device_name != null)
                    {
                        pos = drd.device_name.IndexOf("Microsoft");
                        if (pos != -1)
                        {
                            PrinterProducer = "Microsoft";
                        }
                    }
                    if ((pos == -1) && (PrinterModel != null))
                    {
                        pos = PrinterModel.IndexOf(' ');
                        if (pos != -1)
                        {
                            PrinterProducer = PrinterModel.Substring(0, pos);
                        }
                    }
                }
            }
            catch
            {
                IsPrinterConnected = false;
            }
        }
コード例 #32
0
ファイル: frmAddPrinter.cs プロジェクト: pcthanh/POSEZ2U
        private void btnOK_Click(object sender, EventArgs e)
        {
            PrinterModel item = new PrinterModel();
            item.PrinterName = cbPrinter.SelectedItem.ToString();
            item.PrintName = txtPrintName.Text;
            item.Header = txtHeader.Text;
            item.PrinterType = cbPrintType.SelectedIndex;
            item.NumberOfTicket = Convert.ToInt32(txtNumberOfTicket.Text);

            if (PrinterMain.ID==0)
            {
                int result = PrintService.InsertPrinter(item);
                if (result == 1)
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                item.ID = PrinterMain.ID;
                item.Status = PrinterMain.Status;
                int result = PrintService.UpdatePrinter(item);
                if (result == 1)
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }
コード例 #33
0
ファイル: frmPrinterSetting.cs プロジェクト: pcthanh/POSEZ2U
        void btnSaveInforPrinter_Click(object sender, EventArgs e)
        {
            try
            {

                Button btntag = (Button)sender;
                PrinterModel item = (PrinterModel)btntag.Tag;

                UCPrinter uc = (UCPrinter)pDetail.Controls[0];

                if (item != null && item.ID > 0)
                {
                    item.PrintName = uc.txtPrintName.Text ?? "";
                    item.PrinterName = uc.cbSharePrint.Text ?? "";
                    item.PrinterType = uc.cbPrintType.SelectedIndex;
                    item.Status = 1;
                    item.UpdateBy = userid;
                    item.UpdateDate = DateTime.Now;
                    var messenger = "";

                    if (item.PrintName == "")
                    {
                        messenger = messenger + "Printer Name isn't empty. ";
                    }
                    if (item.PrinterName == "")
                    {
                        messenger = messenger + "Shared Printer / Port  isn't empty. ";
                    }
                    if (item.PrinterType < 0)
                    {
                        messenger = messenger + "Printer Type isn't empty. ";
                    }

                    if (messenger == "")
                    {
                        int result = PrinterService.UpdatePrinter(item);

                        messenger = "Update " + item.PrintName + " fail. ";
                        if (result == 1)
                        {
                            messenger = "Update " + item.PrintName + " successful. ";
                            LoadDataOfPrinter();
                        }
                        frmMessager frm = new frmMessager("Messenger", messenger);
                        frmOpacity.ShowDialog(this, frm);
                    }
                    else
                    {
                        frmMessager frm = new frmMessager("Messenger", messenger + "Please input data.");
                        frmOpacity.ShowDialog(this, frm);
                    }

                }
                else
                {
                    item = new PrinterModel();
                    item.PrintName = uc.txtPrintName.Text ?? "";
                    item.PrinterName = uc.cbSharePrint.Text ?? "";
                    item.PrinterType = uc.cbPrintType.SelectedIndex;
                    item.Status = 1;
                    item.CreateBy = userid;
                    item.CreateDate = DateTime.Now;
                    int result = PrinterService.InsertPrinter(item);
                    var messenger = "";

                    if (item.PrintName == "")
                    {
                        messenger = messenger + "Printer Name isn't empty. ";
                    }
                    if (item.PrinterName == "")
                    {
                        messenger = messenger + "Shared Printer / Port  isn't empty. ";
                    }
                    if (item.PrinterType == 0)
                    {
                        messenger = messenger + "Printer Type isn't empty. ";
                    }

                    if (messenger == "")
                    {
                        messenger = "Add new " + item.PrintName + " fail. ";

                        if (result == 1)
                        {
                            messenger = "Add new " + item.PrintName + " successful. ";
                            LoadDataOfPrinter();
                            pDetail.Controls.Clear();

                        }
                        frmMessager frm = new frmMessager("Messenger", messenger);
                        frmOpacity.ShowDialog(this, frm);
                    }
                    else
                    {
                        frmMessager frm = new frmMessager("Messenger", messenger + "Please input data.");
                        frmOpacity.ShowDialog(this, frm);
                    }
                }

            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmPrinterSetting:::::::::::::::::::btnSaveInforPrinter_Click::::::::::::::::" + ex.Message);
            }
        }
コード例 #34
0
ファイル: PrinterServer.cs プロジェクト: pcthanh/POSEZ2U
        public void Print(OrderDateModel _OrderMain,PrinterModel data)
        {
            posPrinter.SetPrinterName(data.PrinterName);
               posPrinter.printDocument.PrintPage += printDocument_PrintPage;
               if (OrderMain.IsLoadFromData && OrderMain.PrintType!=this.PRINTBILL)
               {
               if (OrderMain.IsPrePrint)
               {
                   posPrinter.Print();
               }
               else
               {
                   if (checkOrderChange(_OrderMain))
                   {
                       posPrinter.Print();
                   }
                   if (checkOrderChangeRemove(_OrderMain))
                   {
                       posPrinter.Print();
                   }
                   if(_OrderMain.PrintType==this.pRINTReceipt)
                   {
                       posPrinter.Print();
                   }

               }
               }
               else
               {
               posPrinter.Print();
               }
        }
コード例 #35
0
ファイル: PrinterService.cs プロジェクト: pcthanh/POSEZ2U
 public int UpdatePrinter(PrinterModel Printer)
 {
     int result = 0;
     try
     {
         if (Printer != null)
         {
             var item = _context.PRINTERs.Find(Printer.ID);
             if (item != null)
             {
                 item.ID = Printer.ID;
                 item.PrinterName = Printer.PrinterName;
                 item.PrintName = Printer.PrintName;
                 item.PrinterType = Printer.PrinterType;
                 item.Status = Printer.Status;
                 //item.CreateBy = Printer.CreateBy ?? 0;
                 //item.CreateDate = DateTime.Now;
                 item.UpdateBy = Printer.UpdateBy ?? 0;
                 item.UpdateDate = DateTime.Now;
                 _context.Entry(item).State = System.Data.Entity.EntityState.Modified;
                 _context.SaveChanges();
                 result = 1;
             }
         }
     }
     catch (Exception ex)
     {
         LogPOS.WriteLog(className+"InsertPrinter:::::::::::::::::::;;"+ ex.Message);
     }
     return result;
 }
コード例 #36
0
ファイル: frmSettingPrint.cs プロジェクト: pcthanh/POSEZ2U
 void ucPList_Click(object sender, EventArgs e)
 {
     UCPrinterList ucP = (UCPrinterList)sender;
     PrinterModel priter = (PrinterModel)ucP.Tag;
     PrinterMain = priter;
     PriterID = priter.ID;
     //flag = Convert.ToInt32(ucP.Tag);
     foreach (Control ctr in flpPrintList.Controls)
     {
         if (ctr.BackColor == Color.FromArgb(0, 153, 51))
         {
             ctr.BackColor = Color.FromArgb(255, 255, 255);
             ctr.ForeColor = Color.FromArgb(51, 51, 51);
         }
     }
     ucP.BackColor = Color.FromArgb(0, 153, 51);
     ucP.ForeColor = Color.FromArgb(255, 255, 255);
     if (priter.PrinterType == 1)
         LoadCategory();
     else
     {
         flpGroup.Controls.Clear();
         flpItem.Controls.Clear();
     }
 }
コード例 #37
0
ファイル: frmAddPrinter.cs プロジェクト: pcthanh/POSEZ2U
 /// <summary>
 /// PrintType
 /// 0.In ra may in tong khi SendOrder
 /// 1.In ra tung may in khi lay SendOrder
 /// 2.In khi Jointable
 /// 3.In khi TransferTable
 /// 4.In khi Tinh tien Order
 /// 5.In Report
 /// </summary>
 public frmAddPrinter(PrinterModel _PrinterMain)
 {
     InitializeComponent();
     PrinterMain = _PrinterMain;
 }
コード例 #38
0
ファイル: frmTransferTable.cs プロジェクト: pcthanh/POSEZ2U
 private void GetListPrinter()
 {
     PrintData.Clear();
     var listPrinter = PrintService.GetListPrinterTransferTable();
     foreach (PrinterModel item in listPrinter)
     {
         PrinterModel print = new PrinterModel();
         print.PrinterName = item.PrinterName;
         print.PrintName = item.PrintName;
         print.PrinterType = item.PrinterType;
         print.Header = item.Header;
         print.ID = item.ID;
         PrintData.Add(print);
     }
 }
コード例 #39
0
 public int InsertPrinter(PrinterModel Printer)
 {
     int result = 0;
     using (var trans = _context.Database.BeginTransaction())
     {
         PRINTER printer = new PRINTER();
         printer.PrinterName = Printer.PrinterName;
         printer.PrintName = Printer.PrintName;
         printer.PrinterType = Printer.PrinterType;
         printer.Status = 1;
         printer.Header = Printer.Header;
         printer.NumberOfTicket = Printer.NumberOfTicket;
         printer.CreateBy = Printer.CreateBy ?? 0;
         printer.CreateDate = DateTime.Now;
         _context.Entry(printer).State = System.Data.Entity.EntityState.Added;
         _context.SaveChanges();
         trans.Commit();
         result = 1;
     }
     return result;
 }