Exemplo n.º 1
0
 private void SetDataToForm(DTO.LIST_DAInfo obj)
 {
     txtCode.Text        = obj.DAG_ID;
     txtIE.Text          = obj.EI;
     txtDescription.Text = obj.NAME;
     BUS.LIST_DAOGControl ctr = new BUS.LIST_DAOGControl();
     _dt = ctr.GetAll(obj.DAG_ID, ref _sErr);
     dgvData.DataSource = _dt;
 }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //string sErr = "";

            DTO.LIST_DAInfo inf = new DTO.LIST_DAInfo();

            if (_processStatus == "C")
            {
                if (!ctr.IsExist(txtCode.Text))
                {
                    ctr.Add(GetDataFromForm(inf), ref _sErr);
                    if (_sErr == "")
                    {
                        BUS.LIST_DAOGControl ctrDAOG = new BUS.LIST_DAOGControl();
                        foreach (DataRow row in _dt.Rows)
                        {
                            _sErr = ctrDAOG.InsertUpdate(new DTO.LIST_DAOGInfo(row));
                        }
                    }
                }
                else
                {
                    _sErr = txtCode.Text.Trim() + " is exist!";
                }
            }
            else if (_processStatus == "A")
            {
                _sErr = ctr.InsertUpdate(GetDataFromForm(inf));
                BUS.LIST_DAOGControl ctrDAOG = new BUS.LIST_DAOGControl();
                if (ctrDAOG.Deletes(txtCode.Text) == "")
                {
                    foreach (DataRow row in _dt.Rows)
                    {
                        _sErr = ctrDAOG.InsertUpdate(new DTO.LIST_DAOGInfo(row));
                    }
                }
            }
            if (_sErr == "")
            {
                _processStatus = "V";
                EnabledForm(false);
            }
            else
            {
                lbErr.Text = _sErr;
            }
        }