//新建 private void ToolStripMenuItemCreate_Click(object sender, EventArgs e) { MaterialCreateForm mf = new MaterialCreateForm(); mf.ShowDialog(this); closeDispose(); }
//编辑 private void ToolStripMenuItemEdit_Click(object sender, EventArgs e) { if (superGridControlMaterial.GetSelectedRows().Count > 0) { Model.Material material = new Model.Material(); SelectedElementCollection col = superGridControlMaterial.GetSelectedRows(); if (col.Count > 0) { GridRow gridRow = col[0] as GridRow; material.Ma_Barcode = gridRow.Cells["Ma_Barcode"].Value.ToString(); material.Ma_Clear = 1; material.Ma_Code = gridRow.Cells["Ma_Code"].Value.ToString(); if (gridRow.Cells["Ma_CreateDate"].Value == null || gridRow.Cells["Ma_InDate"].Value == DBNull.Value) { material.Ma_CreateDate = null; } else { material.Ma_CreateDate = Convert. ToDateTime(gridRow.Cells["Ma_CreateDate"].Value); } material.Ma_Enable = Convert.ToInt32(gridRow.Cells["Ma_Enable"].Value); material.Ma_ID = Convert.ToInt32(gridRow.Cells["Ma_ID"].Value); if (gridRow.Cells["Ma_InDate"].Value == null || gridRow.Cells["Ma_InDate"].Value == DBNull.Value) { material.Ma_InDate = null; } else { material.Ma_InDate = Convert.ToDateTime(gridRow.Cells["Ma_InDate"].Value); } material.Ma_InPrice = gridRow.Cells["Ma_InPrice"].Value.ToString(); material.Ma_Model = gridRow.Cells["Ma_Model"].Value.ToString(); material.Ma_Name = gridRow.Cells["Ma_Name"].Value.ToString(); material.Ma_PicName = gridRow.Cells["Ma_PicName"].Value.ToString(); material.Ma_Price = gridRow.Cells["Ma_Price"].Value.ToString(); material.Ma_PriceA = gridRow.Cells["Ma_PriceA"].Value.ToString(); material.Ma_PriceB = gridRow.Cells["Ma_PriceB"].Value.ToString(); material.Ma_PriceC = gridRow.Cells["Ma_PriceC"].Value.ToString(); material.Ma_PriceD = gridRow.Cells["Ma_PriceD"].Value.ToString(); material.Ma_PriceE = ""; material.Ma_Remark = gridRow.Cells["Ma_Remark"].Value.ToString(); material.Ma_RFID = gridRow.Cells["Ma_RFID"].Value.ToString(); material.Ma_Safetytwo = ""; material.Ma_Safeyone = ""; material.Ma_SupID = gridRow.Cells["Ma_SupID"].Value.ToString(); material.Ma_Supplier = gridRow.Cells["Ma_Supplier"].Value.ToString(); material.Ma_TypeID = gridRow.Cells["Ma_TypeID"].Value.ToString(); material.Ma_TypeName = gridRow.Cells["Ma_TypeName"].Value.ToString(); material.Ma_Unit = gridRow.Cells["Ma_Unit"].Value.ToString(); material.Ma_zhujima = gridRow.Cells["Ma_zhujima"].Value.ToString(); } MaterialCreateForm mcf = new MaterialCreateForm(); mcf.Material = material; mcf.ShowDialog(this); closeDispose(); } else { MessageBox.Show("请选择要修改的行"); } }