示例#1
0
        private void FillProductGroup()
        {
            var coll = ProductGroupController.GetAllProudctGroups();

            coll.Insert(0, new ProductGroup
            {
                ProductGroupCode = 0,
                ProductGroupName = "--ทั้งหมด--"
            });
            comboxProductGroup.ValueMember   = "ProductGroupCode";
            comboxProductGroup.DisplayMember = "ProductGroupName";
            comboxProductGroup.DataSource    = coll;
        }
示例#2
0
 private void Form_ProductGroupAddEdit_Load(object sender, System.EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.productGroupCode))
     {
         var productgroup = ProductGroupController.GetProductGroup(this.productGroupCode);
         if (productgroup != null)
         {
             txtProductGroupCode.Text    = productgroup.ProductGroupCode.ToString();
             txtProductGroupCode.Enabled = false;
             txtProductGroupName.Text    = productgroup.ProductGroupName;
             chkActive.Checked           = productgroup.Active;
         }
     }
 }
示例#3
0
        private void Populate()
        {
            var coll = ProductGroupController.GetAllProudctGroups(TxtFilter.Text.Trim());

            gv.DataSource = coll;

            gv.Columns[1].HeaderText = "รหัสกลุ่มสินค้า";
            gv.Columns[2].HeaderText = "ชื่อกลุ่มสินค้า";
            gv.Columns[3].HeaderText = "ใช้งาน";
            gv.Columns[4].HeaderText = "วันเวลาสร้าง";
            gv.Columns[5].HeaderText = "ผู้สร้าง";
            gv.Columns[6].HeaderText = "วันเวลาแก้ไข";
            gv.Columns[7].HeaderText = "ผู้แก้ไข";

            gv.Columns[ConstColumns.CreateAt].DefaultCellStyle.Format   = "dd/MM/yyyy HH:mm:ss";
            gv.Columns[ConstColumns.ModifiedAt].DefaultCellStyle.Format = "dd/MM/yyyy HH:mm:ss";
        }
        private void FillProductGroup()
        {
            //bool showSelectAllflag = true;
            //comboxProductGroup.DataSource = ProductGroupController.GetAllProudctGroups(showSelectAllflag);
            //comboxProductGroup.ValueMember = "ProductGroupCode";
            //comboxProductGroup.DisplayMember = "ProductGroupName";
            var coll = ProductGroupController.GetAllProudctGroups();

            coll.Insert(0, new ProductGroup
            {
                ProductGroupCode = 0,
                ProductGroupName = "--ทั้งหมด--"
            });
            comboxProductGroup.ValueMember   = "ProductGroupCode";
            comboxProductGroup.DisplayMember = "ProductGroupName";
            comboxProductGroup.DataSource    = coll;
        }
示例#5
0
        private void BtnSave_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(this.productGroupCode))
                {
                    var productgroup = new ProductGroup
                    {
                        //UnitCode = Convert.ToInt32(txtUnitCode.Text),
                        ProductGroupName = txtProductGroupName.Text.Trim(),
                        Active           = chkActive.Checked,
                        CreateBy         = "system",
                    };
                    ProductGroupController.Insert(productgroup);
                    MessageBox.Show("บันทึกข้อมูลเรียบร้อย.", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    var productgroup = new ProductGroup
                    {
                        ProductGroupCode = Convert.ToInt32(txtProductGroupCode.Text),
                        ProductGroupName = txtProductGroupName.Text.Trim(),
                        Active           = chkActive.Checked,
                        ModifiedBy       = "system",
                    };
                    ProductGroupController.Update(productgroup);
                    MessageBox.Show("บันทึกข้อมูลเรียบร้อย.", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#6
0
        private void BtnSaveAndNew_Click(object sender, System.EventArgs e)
        {
            try
            {
                var productgroup = new ProductGroup
                {
                    //UnitCode = Convert.ToInt32(txtUnitCode.Text),
                    ProductGroupName = txtProductGroupName.Text.Trim(),
                    Active           = chkActive.Checked,
                    CreateBy         = "system",
                };
                ProductGroupController.Insert(productgroup);
                MessageBox.Show("บันทึกข้อมูลเรียบร้อย.", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);

                txtProductGroupCode.Text = "";
                txtProductGroupCode.Focus();
                txtProductGroupName.Text = "";
                chkActive.Checked        = true;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#7
0
        public void IndexExceptionCase()
        {
            #region
            mockProductGroupRepository = new Mock <IProductGroupRepository>();

            // Prepare the return data for GetAllQuotation() method.
            var productgroupList = new List <ProductGroup>();
            productgroupList.Add(new ProductGroup {
                Product_Group_Id = 4, Product_Group_Name = "Camera", Level = 15
            });

            // Mock up the GetAllQuotation() repository method with expected return values.
            mockProductGroupRepository.Setup(m => m.GetAllProductGroup()).Returns(productgroupList);

            productgroupcontroller = new ProductGroupController(mockProductGroupRepository.Object);
            #endregion

            // Now invoke the Index action.
            var actionResult = productgroupcontroller.Index("test", "test") as ViewResult;

            // Validate the expected result.
            ViewResult expectedResult = new ViewResult();
            Assert.IsNotNull("Error", actionResult.ViewName);
        }
 private void FillProductGroup()
 {
     comboxProductGroup.DataSource    = ProductGroupController.GetAllProudctGroups();
     comboxProductGroup.ValueMember   = "ProductGroupCode";
     comboxProductGroup.DisplayMember = "ProductGroupName";
 }
示例#9
0
 public void CleanUp()
 {
     productgroupcontroller.Dispose();
     productgroupcontroller = null;
 }
示例#10
0
        public void Setup()
        {
            mockProductGroupRepository = new Mock <IProductGroupRepository>();

            productgroupcontroller = new ProductGroupController(mockProductGroupRepository.Object);
        }