예제 #1
0
        public bool UpdateMethodTest(
            [PexAssumeUnderTest] MappingBLL target,
            string idmap,
            string method,
            string p1,
            string p2,
            string p3,
            int per1,
            int per2,
            int per3,
            int des
            )
        {
            bool result = target.UpdateMethod(idmap, method, p1, p2, p3, per1, per2, per3, des);

            return(result);
            // TODO: add assertions to method MappingBLLTest.UpdateMethodTest(MappingBLL, String, String, String, String, String, Int32, Int32, Int32, Int32)
        }
예제 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool   isempty = false;
            bool   isover  = false;
            string temp    = "";
            string method  = rtmethod.Text;
            string part1   = txtpart1.Text;
            string part2   = txtpart2.Text;
            string part3   = txtpart3.Text;
            int    per1    = int.Parse(txtpercent1.Text);
            int    per2    = int.Parse(txtpercent2.Text);
            int    per3    = int.Parse(txtpercent3.Text);
            int    des     = int.Parse(txtdesity.Text);

            if (method == null || method == "")
            {
                temp   += dc.errormethod("method") + "\n";
                isempty = true;
            }
            if (part1 == null || part1 == "")
            {
                temp   += dc.errormethod("part1") + "\n";
                isempty = true;
            }
            if (part2 == null || part2 == "")
            {
                temp   += dc.errormethod("part2") + "\n";
                isempty = true;
            }
            if (part3 == null || part3 == "")
            {
                temp   += dc.errormethod("part3") + "\n";
                isempty = true;
            }
            if (txtpercent1.Text == null || txtpercent1.Text == "")
            {
                temp   += dc.errormethod("per1") + "\n";
                isempty = true;
            }
            if (txtpercent2.Text == null || txtpercent2.Text == "")
            {
                temp   += dc.errormethod("per2") + "\n";
                isempty = true;
            }
            if (txtpercent3.Text == null || txtpercent3.Text == "")
            {
                temp   += dc.errormethod("per3") + "\n";
                isempty = true;
            }
            if (txtdesity.Text == null || txtdesity.Text == "")
            {
                temp   += dc.errormethod("des") + "\n";
                isempty = true;
            }
            int count = 100;

            foreach (Mapping item in map.listmap(ids))
            {
                count -= int.Parse(item.desity.Value.ToString());
            }
            ;

            if (des > count)
            {
                isover = true;
            }
            else
            {
                isover = false;
            }
            if (isempty == false)
            {
                if (isover == false)
                {
                    if (map.UpdateMethod(idmap, method, part1, part2, part3, per1, per2, per3, des) == true)
                    {
                        MessageBox.Show(dc.errormethod("success"));
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(dc.errormethod("else"));
                    }
                }
                else
                {
                    MessageBox.Show(dc.errormethod("over") + "\nVui lòng kiểm tra lại");
                }
            }
            else
            {
                MessageBox.Show(temp + "\nVui lòng kiểm tra lại");
            }
        }