private void btnAdd_wo_material_Click_1(object sender, EventArgs e) { WorkOrderAttrSetting woas = new WorkOrderAttrSetting(); woas.sType = "workparams"; DataTable dt01 = gcWoAttr.DataSource as DataTable; DataTable dtTemp = dt01.Clone(); DataRow[] drs = dt01.Select(string.Format(@"ATTRIBUTE_TYPE='1'")); foreach (DataRow dr in drs) { dtTemp.ImportRow(dr); } woas.dtCommon = dtTemp; //((DataView)gvWoAttr.DataSource).Table; if (DialogResult.OK == woas.ShowDialog()) { DataTable dtAttr = gcWoAttr.DataSource as DataTable; DataRow drNew = dtAttr.NewRow(); drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_ATTRIBUTE_KEY] = woas.drCommon[BASE_PARAMETER_FIELDS.FIELD_PARAM_KEY]; drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_ATTRIBUTE_NAME] = woas.drCommon[BASE_PARAMETER_FIELDS.FIELD_PARAM_NAME]; drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_WORK_ORDER_ATTR_KEY] = CommonUtils.GenerateNewKey(0); drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_ATTRIBUTE_TYPE] = "1"; dtAttr.Rows.Add(drNew); SortGvData(dtAttr); } }
private void btnAdd_wo_attr_Click(object sender, EventArgs e) { WorkOrderAttrSetting woas = new WorkOrderAttrSetting(); woas.sType = "workattr"; DataTable dt01 = gcWoAttr.DataSource as DataTable; DataTable dtTemp = dt01.Clone(); DataRow[] drs = dt01.Select(string.Format(@"ATTRIBUTE_TYPE='0'")); foreach (DataRow dr in drs) { dtTemp.ImportRow(dr); } woas.dtCommon = dtTemp; //((DataView)gvWoAttr.DataSource).Table; if (DialogResult.OK == woas.ShowDialog()) { string attribute_name = string.Empty; DataTable dtAttr = gcWoAttr.DataSource as DataTable; DataRow drNew = dtAttr.NewRow(); attribute_name = Convert.ToString(woas.drCommon[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_NAME]); drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_ATTRIBUTE_KEY] = woas.drCommon[BASE_ATTRIBUTE_FIELDS.FIELDS_ATTRIBUTE_KEY]; drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_ATTRIBUTE_NAME] = attribute_name; drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_WORK_ORDER_ATTR_KEY] = CommonUtils.GenerateNewKey(0); if (attribute_name.Equals(WORKORDER_SETTING_ATTRIBUTE.IsMustInputModuleColorByCleanOpt)) { drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_ATTRIBUTE_VALUE] = "true"; } if (attribute_name.Equals(WORKORDER_SETTING_ATTRIBUTE.IsReceiveMixWosByPackage)) { drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_ATTRIBUTE_VALUE] = "false"; } if (attribute_name.Equals(WORKORDER_SETTING_ATTRIBUTE.IsExperimentWo)) { drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_ATTRIBUTE_VALUE] = "true"; } drNew[POR_WORK_ORDER_ATTR_FIELDS.FIELDS_ATTRIBUTE_TYPE] = "0"; dtAttr.Rows.Add(drNew); SortGvData(dtAttr); } }