Ejemplo n.º 1
0
        private void btSave_Click(object sender, EventArgs e)
        {
            if (tbName.Text == "")
            {
                //MessageBox.Show("名称未填写,不能保存");
                tbName.Focus();
                return;
            }
            if (txtOTHER_LANGUAGE_DESCR.Text == "")
            {
                //MessageBox.Show("名称未填写,不能保存");
                txtOTHER_LANGUAGE_DESCR.Focus();
                return;
            }
            frmFlow.sPackName = tbName.Text;
            if (frmFlow.iPackNo > 0)
            {
                StringBuilder strBuild = new StringBuilder();
                strBuild.Append("UPDATE DMIS_SYS_PACKTYPE SET ");
                strBuild.Append(" F_NAME='" + ValueToField.StringToField(tbName.Text) + "',");
                strBuild.Append(" F_ISFLOW=" + Convert.ToInt16(cbflow.Checked) + ",");
                strBuild.Append(" F_ISCHECK=" + Convert.ToInt16(cbcheck.Checked) + ",");
                strBuild.Append(" F_ISARCHIEVE=" + Convert.ToInt16(cbarchive.Checked) + ",");
                strBuild.Append(" OTHER_LANGUAGE_DESCR='" + ValueToField.StringToField(txtOTHER_LANGUAGE_DESCR.Text) + "'");
                strBuild.Append(" WHERE F_NO=" + frmFlow.iPackNo);
                DBOpt.dbHelper.ExecuteSql(strBuild.ToString());
            }
            else
            {
                uint iMax = DBOpt.dbHelper.GetMaxNum("DMIS_SYS_PACKTYPE", "F_NO");

                StringBuilder strBuild = new StringBuilder();
                strBuild.Append("INSERT INTO DMIS_SYS_PACKTYPE(F_NO,F_NAME,F_ISFLOW,F_ISCHECK,F_ISARCHIEVE,OTHER_LANGUAGE_DESCR) VALUES(");
                strBuild.Append(iMax + ",");
                strBuild.Append("'" + ValueToField.StringToField(tbName.Text) + "',");   //ValueToField.StringToField函数已经去掉'
                strBuild.Append(Convert.ToInt16(cbflow.Checked) + ",");
                strBuild.Append(Convert.ToInt16(cbcheck.Checked) + ",");
                strBuild.Append(Convert.ToInt16(cbarchive.Checked) + ",");
                strBuild.Append("'" + ValueToField.StringToField(txtOTHER_LANGUAGE_DESCR.Text) + "'");
                strBuild.Append(")");
                DBOpt.dbHelper.ExecuteSql(strBuild.ToString());
                frmFlow.iPackNo = Convert.ToInt16(iMax);
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 2
0
        private void btSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                //MessageBox.Show();
                txtName.Focus();
                return;
            }

            if (txtOTHER_LANGUAGE_DESCR.Text.Trim() == "")
            {
                //MessageBox.Show();
                txtOTHER_LANGUAGE_DESCR.Focus();
                return;
            }

            //DataTable dtTmp;
            //dtTmp = DBOpt.dbHelper.GetDataTable("select F_NO FROM DMIS_SYS_DOCTYPE WHERE F_PACKTYPEDEF=1 AND F_PACKTYPENO="
            //        + frmFlow.iPackNo);
            //if (dtTmp != null)
            //{
            //    if (dtTmp.Rows.Count > 0)
            //    {
            //        if ((FieldToValue.FieldToInt(dtTmp.Rows[0]["F_NO"]) != frmFlow.iDocNo))
            //        {
            //            if (cbAutoCreate.Checked)
            //            {
            //                MessageBox.Show("一个业务自动创建文档只能唯一");
            //                return;
            //            }
            //        }
            //    }
            //}
            frmFlow.sDocName = txtName.Text;
            if (frmFlow.iDocNo > 0)
            {
                StringBuilder strBuild = new StringBuilder();
                strBuild.Append("UPDATE DMIS_SYS_DOCTYPE SET ");
                strBuild.Append(" F_NAME='" + ValueToField.StringToField(txtName.Text) + "',");
                strBuild.Append(" F_DOCCAT='" + ValueToField.StringToField(cbbType.Text) + "',");
                strBuild.Append(" F_FORMFILE='" + ValueToField.StringToField(txtForm.Text) + "',");

                //***** Modify Start v2.00 liujp 2010/01/14 报表文本框改为下拉框 *****
                strBuild.Append(" F_REPORTFILE='" + ValueToField.StringToField(cbbReport.SelectedValue) + "',");
                //***** Modify End *****

                strBuild.Append(" F_ICONFILE='" + ValueToField.StringToField(txtIcon.Text) + "',");
                strBuild.Append(" F_OPENICON='" + ValueToField.StringToField(txtOpenIcon.Text) + "',");
                strBuild.Append(" F_TABLENAME='" + ValueToField.StringToField(cbbTable.Text) + "',");
                strBuild.Append(" OTHER_LANGUAGE_DESCR='" + ValueToField.StringToField(txtOTHER_LANGUAGE_DESCR.Text) + "'");
                //strBuild.Append(" F_PACKTYPEDEF=" + Convert.ToInt16(cbAutoCreate.Checked));
                strBuild.Append(" WHERE F_NO=" + frmFlow.iDocNo);
                DBOpt.dbHelper.ExecuteSql(strBuild.ToString());
            }
            else
            {
                uint   iMax = 1;
                string sTmp = DBOpt.dbHelper.ExecuteScalar("SELECT MAX(F_NO) FROM DMIS_SYS_DOCTYPE").ToString();
                if (sTmp != "")
                {
                    iMax = Convert.ToUInt32(sTmp) + 1;
                }

                StringBuilder strBuild = new StringBuilder();
                strBuild.Append("INSERT INTO DMIS_SYS_DOCTYPE(F_NO,F_PACKTYPENO,F_NAME,F_DOCCAT,");
                strBuild.Append("F_FORMFILE,F_REPORTFILE,F_ICONFILE,F_OPENICON,F_TABLENAME,OTHER_LANGUAGE_DESCR) VALUES(");
                strBuild.Append(iMax + ",");
                strBuild.Append(frmFlow.iPackNo + ",'");
                strBuild.Append(ValueToField.StringToField(txtName.Text) + "','");
                strBuild.Append(ValueToField.StringToField(cbbType.Text) + "','");
                strBuild.Append(ValueToField.StringToField(txtForm.Text) + "','");

                //***** Modify Start v2.00 liujp 2010/01/14 报表文本框改为下拉框 *****
                strBuild.Append(ValueToField.StringToField(cbbReport.SelectedValue) + "','");
                //***** Modify End *****

                strBuild.Append(ValueToField.StringToField(txtIcon.Text) + "','");
                strBuild.Append(ValueToField.StringToField(txtOpenIcon.Text) + "','");
                strBuild.Append(ValueToField.StringToField(cbbTable.Text) + "','");
                strBuild.Append(ValueToField.StringToField(txtOTHER_LANGUAGE_DESCR.Text) + "'");
                //strBuild.Append( Convert.ToInt16(cbAutoCreate.Checked));
                strBuild.Append(")");
                DBOpt.dbHelper.ExecuteSql(strBuild.ToString());
                frmFlow.iDocNo = Convert.ToInt16(iMax);
            }
            this.DialogResult = DialogResult.OK;
        }