Beispiel #1
0
        private void LoadItemOfCategory(int CategoryID)
        {
            try
            {
                flpItem.Controls.Clear();
                LstPrinterJob.Clear();
                var lst = ProductService.GetProdutcByCategoryPrint(CategoryID);
                var lstPrintJob = PrintService.GetItem(CategoryID,PriterID);
                foreach (PrinteJobDetailModel joblst in lstPrintJob)
                {
                    PrintJobDetailModel itemjob = new PrintJobDetailModel();
                    itemjob.CategoryID = joblst.CategoryID;
                    itemjob.ProductID = joblst.ProductID;
                    itemjob.PrinterID = joblst.PrinterID;
                    LstPrinterJob.Add(itemjob);
                }
                foreach (ProductionModel item in lst)
                {
                    UCItemOfCategoryPrint ucItem = new UCItemOfCategoryPrint();

                        ucItem.lblItemName.Text = item.ProductNameSort;
                        ucItem.Tag = item;
                        ucItem.BackColor = Color.FromArgb(228, 228, 228);
                        ucItem.Click += ucItem_Click;

                    flpItem.Controls.Add(ucItem);
                }
                foreach (PrinteJobDetailModel joblst in lstPrintJob)
                {
                    foreach (Control ctr in flpItem.Controls)
                    {
                        ProductionModel pro = (ProductionModel)ctr.Tag;
                        if (joblst.ProductID == pro.ProductID)
                        {
                            ctr.BackColor = Color.FromArgb(0, 153, 51);
                            ctr.ForeColor = Color.FromArgb(255, 255, 255);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogPOS.WriteLog("frmSettingPrint::::::::::::::::LoadItemOfCategory:::::::::::::::" + ex.Message);
            }
        }
Beispiel #2
0
        public void getInnitData()
        {
            var data = new PrintJobDetailModel();

            data.ID = 0;
            data.PrinteJobID = 0;
            data.CategoryID = 0;
            data.ProductID = 0;
            data.PrinterID = 0;
            data.TemplatesID = 0;

            this.Tag = data;

            // get cbTemplate
            this.cbTemplate.DisplayMember = "Value";
            this.cbTemplate.ValueMember = "Key";

            var temp = new KeyValueModel();
            temp.Key = 1;
            temp.Value = "Template";
            this.cbTemplate.Items.Add(temp);
            this.cbTemplate.SelectedIndex = 0;

            // get cbPrinter
            this.cbPrinter.DisplayMember = "Value";
            this.cbPrinter.ValueMember = "Key";

            var dataPrinter = PrinterService.GetListPrinter().ToList();
            foreach (var item in dataPrinter)
            {
                var tempprint = new KeyValueModel();
                tempprint.Key = item.ID;
                tempprint.Value = item.PrintName;
                this.cbPrinter.Items.Add(tempprint);
            }

            this.cbPrinter.SelectedIndex = 0;

            // get Group

            this.cbGroupItem.DisplayMember = "Value";
            this.cbGroupItem.ValueMember = "Key";

            var datagroup = PrinterService.GetCategoryList().ToList();

            var tempgroup1 = new KeyValueModel();
            tempgroup1.Key = 0;
            tempgroup1.Value = "-- All --";
            this.cbGroupItem.Items.Add(tempgroup1);

            foreach (var itemgroup in datagroup)
            {
                var tempgroup = new KeyValueModel();
                tempgroup.Key = itemgroup.CategoryID;
                tempgroup.Value = itemgroup.CategoryName;
                this.cbGroupItem.Items.Add(tempgroup);
            }

            this.cbGroupItem.SelectedIndex = 0;

            // get Item

            this.cbItem.DisplayMember = "Value";
            this.cbItem.ValueMember = "Key";

            this.cbItem.Items.Add(tempgroup1);
            this.cbItem.SelectedIndex = 0;
        }
Beispiel #3
0
        void btnSaveInforPrinterJob_Click(object sender, EventArgs e)
        {
            try
            {
                Button btntag = (Button)sender;
                PrintJobModel item = (PrintJobModel)btntag.Tag;

                if (item == null)
                    item = new PrintJobModel();

                UCPrinterJobDetail ucJob = (UCPrinterJobDetail)pDetail.Controls[0];

                item.PrintJobName = ucJob.txtPrintJobName.Text ?? "";
                item.PrintContent = ((KeyValueModel)ucJob.cbPrintContent.SelectedItem).Value ?? "";

                item.CreateBy = userid;
                item.UpdateBy = userid;

                if (item.dataDetail==null)
                    item.dataDetail= new List<PrintJobDetailModel>();

                foreach (UCPrinterMapping mapPrinter in ucJob.flpPriterMap.Controls)
                {
                    PrintJobDetailModel temp = (PrintJobDetailModel)mapPrinter.Tag;

                    if (temp==null)
                        temp= new PrintJobDetailModel();

                    temp.CategoryID = ((KeyValueModel)mapPrinter.cbGroupItem.SelectedItem).Key;

                    temp.ProductID = ((KeyValueModel)mapPrinter.cbItem.SelectedItem).Key;

                    temp.PrinterID = ((KeyValueModel)mapPrinter.cbPrinter.SelectedItem).Key;

                    temp.TemplatesID = ((KeyValueModel)mapPrinter.cbTemplate.SelectedItem).Key;

                    temp.CreateBy = userid;
                    temp.UpdateBy = userid;

                    item.dataDetail.Add(temp);

                }

                var messenger = "";
                if (item.PrintJobName == "")
                    messenger = messenger + "Print Job Name isn't empty. ";
                if (item.PrintContent == "")
                    messenger = messenger + "Print Content isn't empty. ";

                if (messenger == "")
                {
                    var result = PrinterService.SaveDataPrinterJob(item);
                    messenger = "Save data infor printe job fail. ";
                    if (result > 0)
                    {
                        messenger = "Save data infor printe job successful. ";
                        LoadPriterJob();
                        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)
            {
                frmMessager frm = new frmMessager("Messenger", "Please save again.");
                frmOpacity.ShowDialog(this, frm);
                LogPOS.WriteLog("frmPrinterSetting:::::::::::::::::::btnSaveInforPrinterJob_Click::::::::::::::::" + ex.Message);
            }
        }