예제 #1
0
        void CreateEdtiForm(LvAttr attr, bool isNew)
        {
            List <string> attrName = new List <string>(3);

            attrName.Add("");
            attrName.Add("");
            attrName.Add("");
            var frmAttrEdit = new LvAttrEdit(attr, _depositor.Id, attrName);
            int rowIdx;

            frmAttrEdit.ShowDialog();
            if (frmAttrEdit.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            if (isNew)
            {
                _context.LvAttrs.Add(attr);
                rowIdx = tblAttrShipment.Rows.Add();
            }
            else
            {
                rowIdx = tblAttrShipment.CurrentRow.Index;
            }

            tblAttrShipment.Rows[rowIdx].Cells["Id"].Value         = attr.Id;
            tblAttrShipment.Rows[rowIdx].Cells["LVAttrName"].Value = attrName[0];
            tblAttrShipment.Rows[rowIdx].Cells["PLField"].Value    = attrName[1];
            tblAttrShipment.Rows[rowIdx].Cells["LvType"].Value     = attrName[2];
        }
예제 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            LvAttr attr = new LvAttr();

            CreateEdtiForm(attr, true);
            //PopulateAttr();
        }
예제 #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            LvAttr attr = _context.LvAttrs.Find(tblAttrShipment.Rows[tblAttrShipment.CurrentCell.RowIndex].Cells["Id"].Value);

            CreateEdtiForm(attr, false);
            // PopulateAttr();
        }
예제 #4
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Удалить запись?", "Подтверждение удаления", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         LvAttr attr = _context.LvAttrs.Find(tblAttrShipment.Rows[tblAttrShipment.CurrentCell.RowIndex].Cells["Id"].Value);
         _context.LvAttrs.Remove(attr);
         PopulateAttr();
     }
 }
예제 #5
0
 public LvAttrEdit(LvAttr attr, int DepId, List <string> attrName)
 {
     InitializeComponent();
     _attr     = attr;
     _depId    = DepId;
     _context  = DataService.context;
     _attrName = attrName;
     cmbAttrType.SelectedIndex = _attr.LvaIn == false ? 0 : 1;
 }