Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
0
        private void cbGroupItem_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cbItem.Items.Clear();

            var cbGroup = (KeyValueModel)cbGroupItem.SelectedItem;

            var datagroup = PrinterService.GetProductListByCategory(cbGroup.Key).ToList();

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

            foreach (var item in datagroup)
            {
                var tempitem = new KeyValueModel();
                tempitem.Key = item.ProductID;
                tempitem.Value = item.ProductNameDesc;
                this.cbItem.Items.Add(tempitem);
            }

            this.cbItem.SelectedIndex = 0;
        }
Ejemplo n.º 3
0
        void addStaffDetail(StaffModel data)
        {
            // pDetail.Controls.Clear();

            if (data.StaffID > 0)
            {
                UCUserListDetail ucUserDetail = new UCUserListDetail();

                if (pDetail.Controls.Count > 0)
                {
                    ucUserDetail = (UCUserListDetail)pDetail.Controls[0];
                }
                else
                {
                    ucUserDetail.Dock = DockStyle.Fill;
                    pDetail.Controls.Add(ucUserDetail);
                }

               // ucUserDetail.Dock = DockStyle.Fill;

                ucUserDetail.lbTitle.Text = data.Fname + " " + data.Lname;

                ucUserDetail.txtFname.Text = data.Fname;

                ucUserDetail.txtLname.Text = data.Lname;

                ucUserDetail.txtUserName.Text = data.UserName;

                ucUserDetail.txtPinCode.Text = StaffModel.Decrypt(data.Password);

                var department = UserService.GetListDepartment().ToList();

                ucUserDetail.cbRole.DisplayMember = "Value";
                ucUserDetail.cbRole.ValueMember = "Key";

                var textDefault = "";

                foreach (var item in department)
                {
                    if (item.DepartmentID == data.DepartmentID)
                    {
                        textDefault = item.DepartmentName;
                    }

                    var temp = new KeyValueModel();
                    temp.Key = item.DepartmentID;
                    temp.Value = item.DepartmentName;
                    ucUserDetail.cbRole.Items.Add(temp);

                }

                if (textDefault != "")
                {
                    ucUserDetail.cbRole.Text = textDefault;
                }
                else
                {
                    ucUserDetail.cbRole.SelectedIndex = 0;
                }

                ucUserDetail.btnSave.Tag = data;
                ucUserDetail.btnSave.Click += btnSaveUser_Click;

                ucUserDetail.btnDelete.Tag = data;
                ucUserDetail.btnDelete.Click += btnDeleteUser_Click;
                ucUserDetail.btnDelete.Show();

            }
        }
Ejemplo n.º 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            pDetail.Controls.Clear();
            Button addNew = (Button)sender;
            int tag = Convert.ToInt32(addNew.Tag);

            switch (tag)
            {
                case 1:
                    UCDepartmentListDetail ucDepartment = new UCDepartmentListDetail();
                    ucDepartment.Dock = DockStyle.Fill;
                    ucDepartment.btnSave.Click += btnSaveDepartment_Click;
                    ucDepartment.btnDelete.Hide();
                    pDetail.Controls.Add(ucDepartment);
                    break;
                case 2:
                    UCUserListDetail ucUser = new UCUserListDetail();
                    ucUser.Dock = DockStyle.Fill;
                    ucUser.btnSave.Click += btnSaveUser_Click;
                    ucUser.btnDelete.Hide();

                    ucUser.cbRole.DisplayMember = "Value";
                    ucUser.cbRole.ValueMember = "Key";
                    var department = UserService.GetListDepartment().ToList();
                    foreach (var item in department)
                    {
                        var temp = new KeyValueModel();
                        temp.Key = item.DepartmentID;
                        temp.Value = item.DepartmentName;
                        ucUser.cbRole.Items.Add(temp);

                    }
                    //ucUser.cbRole.SelectedIndex = 0;
                    pDetail.Controls.Add(ucUser);
                    break;

            }
        }
Ejemplo n.º 5
0
        private void UCPrinterJobDetail_Load(object sender, EventArgs e)
        {
            //LoadPriterMapp();
            this.cbPrintContent.DisplayMember = "Value";
            this.cbPrintContent.ValueMember = "Key";

            var temp = new KeyValueModel();
            temp.Key = 1;
            temp.Value = "All Lines";
            this.cbPrintContent.Items.Add(temp);
        }