Ejemplo n.º 1
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (gvPowerSet.FocusedRowHandle < 0 || gvPowerSet.RowCount < 1)
            {
                MessageService.ShowMessage("请选择删除的数据!", "提示");
                return;
            }

            if (MessageService.AskQuestion("确认删除数据么?", "提示"))
            {
                //删除处理
                DataSet   dsPowerSet     = new DataSet();
                DataTable dtDelPowerSet  = ((DataView)gvPowerSet.DataSource).Table;
                string    pk             = gvPowerSet.GetRowCellValue(gvPowerSet.FocusedRowHandle, BASE_POWERSET.FIELDS_POWERSET_KEY).ToString();
                DataRow[] drDtlPowerSets = dtDelPowerSet.Select(string.Format(BASE_POWERSET.FIELDS_POWERSET_KEY + "='{0}'", pk));
                DataTable dtDel          = dtDelPowerSet.Clone();
                DataRow   drDel          = drDtlPowerSets[0];
                drDel[BASE_POWERSET.FIELDS_ISFLAG] = 0;
                dtDel.ImportRow(drDel);
                dtDel.TableName = BASE_POWERSET.DATABASE_TABLE_FORUPDATE;
                dsPowerSet.Merge(dtDel, true, MissingSchemaAction.Add);
                bool bl_bak = _powerSetEntity.SavePowerSetData(dsPowerSet);
                if (!bl_bak)
                {
                    MessageService.ShowMessage("删除失败!");
                }
                else
                {
                    MessageService.ShowMessage("删除成功!");
                    InitDataBind();
                }
            }
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataSet dsPowerSetDtlColor = new DataSet();

            drCommon[BASE_POWERSET_COLORATCNO.FIELDS_COLOR_CODE]  = Convert.ToString(lueColor.EditValue);
            drCommon[BASE_POWERSET_COLORATCNO.FIELDS_ARTICNO]     = txtArticleNo.Text.Trim();
            drCommon[BASE_POWERSET_COLORATCNO.FIELDS_DESCRIPTION] = meDescription.Text.Trim();
            drCommon[BASE_POWERSET_COLORATCNO.FIELDS_COLOR_NAME]  = lueColor.Text.Trim();

            if (isEdit)
            {
                drCommon[BASE_POWERSET_COLORATCNO.FIELDS_EDITER] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
            }
            else
            {
                drCommon[BASE_POWERSET_COLORATCNO.FIELDS_CREATER] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
            }

            DataTable dtSave = drCommon.Table.Clone();

            dtSave.Rows.Add(drCommon.ItemArray);
            if (isEdit)
            {
                dtSave.TableName = BASE_POWERSET_COLORATCNO.DATABASE_TABLE_FORUPDATE;
            }
            else
            {
                dtSave.TableName = BASE_POWERSET_COLORATCNO.DATABASE_TABLE_FORINSERT;

                bool bl = _basePowerSetEntity.IsExistPowerDtlColorData(dtSave);
                if (!bl && !string.IsNullOrEmpty(_basePowerSetEntity.ErrorMsg))
                {
                    MessageService.ShowError(_basePowerSetEntity.ErrorMsg);
                    this.txtArticleNo.Focus();
                    this.txtArticleNo.SelectAll();
                    return;
                }
            }

            dsPowerSetDtlColor.Merge(dtSave, true, MissingSchemaAction.Add);
            // 判断数据是否重复
            bool bl_bak = _basePowerSetEntity.SavePowerSetData(dsPowerSetDtlColor);

            if (!bl_bak)
            {
                MessageService.ShowMessage(_basePowerSetEntity.ErrorMsg);
            }
            else
            {
                MessageService.ShowMessage("保存成功!");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataSet dsPowerLevelDtl = new DataSet();

            drCommon[BASE_POWERSET_DETAIL.FIELDS_PS_DTL_SUBCODE] = txtDtlSubcode.Text.Trim();
            drCommon[BASE_POWERSET_DETAIL.FIELDS_POWERLEVEL]     = txtPowerLevel.Text.Trim();
            drCommon[BASE_POWERSET_DETAIL.FIELDS_P_DTL_MIN]      = txtPdtlmin.Text.Trim();
            drCommon[BASE_POWERSET_DETAIL.FIELDS_P_DTL_MAX]      = txtPdtlmax.Text.Trim();

            if (isEdit)
            {
                drCommon[BASE_POWERSET_DETAIL.FIELDS_EDITER] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
            }
            else
            {
                drCommon[BASE_POWERSET_DETAIL.FIELDS_CREATER] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
            }

            DataTable dtSave = drCommon.Table.Clone();

            dtSave.Rows.Add(drCommon.ItemArray);
            if (isEdit)
            {
                dtSave.TableName = BASE_POWERSET_DETAIL.DATABASE_TABLE_FORUPDATE;
            }
            else
            {
                dtSave.TableName = BASE_POWERSET_DETAIL.DATABASE_TABLE_FORINSERT;
                bool bl = _basePowerSetEntity.IsExistPowerDtlData(dtSave);
                if (!bl && !string.IsNullOrEmpty(_basePowerSetEntity.ErrorMsg))
                {
                    MessageService.ShowError(_basePowerSetEntity.ErrorMsg);
                    this.txtDtlSubcode.Focus();
                    this.txtDtlSubcode.SelectAll();
                    return;
                }
            }

            dsPowerLevelDtl.Merge(dtSave, true, MissingSchemaAction.Add);
            bool bl_bak = _basePowerSetEntity.SavePowerSetData(dsPowerLevelDtl);

            if (!bl_bak)
            {
                MessageService.ShowMessage(_basePowerSetEntity.ErrorMsg);
            }
            else
            {
                MessageService.ShowMessage("保存成功!");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Ejemplo n.º 4
0
        private void SaveForPowerSetData()
        {
            #region 输入条件判断
            if (string.IsNullOrEmpty(txtPs_code.Text.Trim()))
            {
                MessageService.ShowMessage("规则代码不能为空!", "提示");
                this.txtPs_code.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtPs_rule.Text.Trim()))
            {
                MessageService.ShowMessage("名称不能为空!", "提示");
                this.txtPs_rule.Focus();
                return;
            }
            if (lukModelName.EditValue == null)
            {
                MessageService.ShowMessage("档位名称不能为空!", "提示");
                this.lukModelName.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtSeq.Text.Trim()))
            {
                MessageService.ShowMessage("序号不能为空!", "提示");
                this.txtSeq.Focus();
                return;
            }
            if (lueProductModel.EditValue == null || string.IsNullOrEmpty(lueProductModel.EditValue.ToString()))
            {
                MessageService.ShowMessage("产品型号不能为空!", "提示");
                this.lueProductModel.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtPmax.Text.Trim()))
            {
                MessageService.ShowMessage("Pmax不能为空!", "提示");
                this.txtPmax.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtImpp.Text.Trim()))
            {
                MessageService.ShowMessage("Impp不能为空!", "提示");
                this.txtImpp.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtIsc.Text.Trim()))
            {
                MessageService.ShowMessage("Isc不能为空!", "提示");
                this.txtIsc.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtVmpp.Text.Trim()))
            {
                MessageService.ShowMessage("Vmpp不能为空!", "提示");
                this.txtVmpp.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtVoc.Text.Trim()))
            {
                MessageService.ShowMessage("Voc不能为空!", "提示");
                this.txtVoc.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtFuse.Text.Trim()))
            {
                MessageService.ShowMessage("Fuse不能为空!", "提示");
                this.txtFuse.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtP_min.Text.Trim()))
            {
                MessageService.ShowMessage("功率下线不能为空!", "提示");
                this.txtP_min.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtP_max.Text.Trim()))
            {
                MessageService.ShowMessage("功率上线不能为空!", "提示");
                this.txtP_max.Focus();
                return;
            }
            #endregion

            DataSet dsPowerSet = new DataSet();
            drCommon[BASE_POWERSET.FIELDS_PS_CODE]         = txtPs_code.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_PS_RULE]         = txtPs_rule.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_PS_SUBCODE]      = txtPs_subcode.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_PS_SUBCODE_DESC] = txtPs_subcode_desc.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_PROMODEL_KEY]    = lueProductModel.EditValue.ToString();
            drCommon[BASE_POWERSET.FIELDS_MODULE_NAME]     = lukModelName.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_PS_SEQ]          = txtSeq.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_PMAXSTAB]        = txtPmax.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_IMPPSTAB]        = txtImpp.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_ISCSTAB]         = txtIsc.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_VMPPSTAB]        = txtVmpp.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_VOCSTAB]         = txtVoc.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_FUSE]            = txtFuse.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_P_MIN]           = txtP_min.Text.Trim();
            drCommon[BASE_POWERSET.FIELDS_P_MAX]           = txtP_max.Text.Trim();

            if (isEdit)
            {
                drCommon[BASE_POWERSET.FIELDS_EDITOR] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
            }
            else
            {
                drCommon[BASE_POWERSET.FIELDS_CREATER] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
            }

            if (cmbCodeSubWay.EditValue != null)
            {
                drCommon[BASE_POWERSET.FIELDS_SUB_PS_WAY] = cmbCodeSubWay.EditValue.ToString();
            }
            drCommon[BASE_POWERSET.FIELDS_POWER_DIFFERENCE] = txtPowerdifference.Text.Trim();
            DataTable dtSave = drCommon.Table.Clone();
            dtSave.Rows.Add(drCommon.ItemArray);
            if (isEdit)
            {
                dtSave.TableName = BASE_POWERSET.DATABASE_TABLE_FORUPDATE;
            }
            else
            {
                dtSave.TableName = BASE_POWERSET.DATABASE_TABLE_FORINSERT;
                bool bl2 = _basePowerSetEntity.IsExistPowerSetData(dtSave);
                if (!bl2 && !string.IsNullOrEmpty(_basePowerSetEntity.ErrorMsg))
                {
                    MessageService.ShowMessage(_basePowerSetEntity.ErrorMsg);
                    return;
                }
            }

            dsPowerSet.Merge(dtSave, true, MissingSchemaAction.Add);

            bool bl_Bak = _basePowerSetEntity.SavePowerSetData(dsPowerSet);
            if (!bl_Bak)
            {
                MessageService.ShowMessage(_basePowerSetEntity.ErrorMsg);
            }
            else
            {
                MessageService.ShowMessage("保存成功!");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }