protected void btnSave_Click(object sender, EventArgs e) { if (PubFunc.FormDataCheck(FormMx).Length > 0) { return; } //if (tbxCode.Text.Length != ddlSJCODE.SelectedValue.Length + 2 && tbxCode.Text.Length > 2) //{ // Alert.Show("编码规则不正确,请检查!", "提示信息", MessageBoxIcon.Warning); // return; //} //增加控制避免主键重复 if ((DbHelperOra.Exists("select 1 from SYS_DEPT where code = '" + tbxCode.Text + "'")) && (tbxCode.Enabled)) { Alert.Show("你输入的编码已存在,请检查!"); return; } if (string.IsNullOrWhiteSpace(ddlSJCODE.SelectedValue)) { Alert.Show("请填选上级!", "提示", MessageBoxIcon.Information); return; } if (!CheckTel(tbxSTR6.Text)) { Alert.Show("联系电话请保证格式(固话XXX-XXX)(手机1XXX)!"); return; } string ls_codelabel; MyTable mtTable = new MyTable(strTable, "CODE"); mtTable.ColRow = PubFunc.FormDataHT(FormMx); ls_codelabel = PubFunc.FormLabelGet(FormMx, "CODE"); if (PubFunc.StrIsEmpty(mtTable.ColRow["CODE"].ToString())) { Alert.Show("【" + ls_codelabel + "】不能为空!"); return; } if (tbxCode.Enabled) //新增 { mtTable.InsertExec(); } else { mtTable.UpdateExec(""); } //写入日志 OperLog("管理架构定义", "修改资料【" + tbxCode.Text + "】"); Alert.Show("数据保存成功!"); ERPUtility.CacheClear("SYS_DEPT"); tbxCode.Enabled = false; InitTree(); }
protected void btnSave_Click(object sender, EventArgs e) { if (PubFunc.FormDataCheck(FormMx).Length > 0) { return; } //判断此类别是否存在 if ((DbHelperOra.Exists("select 1 from SYS_CATEGORY where code = '" + tbxCode.Text + "'")) && (tbxCode.Enabled)) { Alert.Show("此商品类别编码已经存在,请检查!"); return; } string ls_codelabel; MyTable mtTable = new MyTable(strTable, "CODE"); mtTable.ColRow = PubFunc.FormDataHT(FormMx); ls_codelabel = PubFunc.FormLabelGet(FormMx, "CODE"); if (PubFunc.StrIsEmpty(mtTable.ColRow["CODE"].ToString())) { Alert.Show("【" + ls_codelabel + "】不能为空!"); return; } else if (mtTable.ColRow["CODE"].ToString().Length != CodeLen(tbxCLASS.Text)) { Alert.Show("【" + ls_codelabel + "】长度应该为【" + CodeLen(tbxCLASS.Text).ToString() + "】,请修改!"); return; } if (tbxCode.Enabled) //新增 { mtTable.InsertExec(); } else { mtTable.UpdateExec(""); } Alert.Show("数据保存成功!"); tbxCode.Enabled = false; InitTree(); }