/// <summary> /// 修改預設值 /// </summary> private void SetModifyData() { VersionFieldDataSet versionFieldDs = designFormFieldUCO.GetSingleVersionField(this.formVersionId, this.fieldParentId, this.fieldId); //如果已發佈,則不允許修改 if ((bool)versionFieldDs.FormVersion.Rows[0]["ISSUE_CTL"]) { ((Master_DialogMasterPage)this.Master).Button1Text = ""; UC_FiledDropList1.Enabled = false; } DataRow fieldDr = versionFieldDs.VersionField.Rows[0]; //欄位代號 txtFieldId.Text = fieldDr["FIELD_ID"].ToString(); //欄位名稱 txtFieldName.Text = fieldDr["FIELD_NAME"].ToString(); //欄位備註 txtFieldRemark.Text = fieldDr["FIELD_REMARK"].ToString(); //序號為Lable 顯示 lblSeq.Text = fieldDr["FIELD_SEQ"].ToString(); //欄位排列順序 WebNumericEditFieldSeq.Value = (int)fieldDr["FIELD_SEQ"]; //是否允許刪除此欄位(設計時) delFalg = Convert.ToBoolean(fieldDr["DELFLAG"]) == false ? false : true; txtFieldId.Enabled = delFalg; }
/// <summary> /// 修改預設值 /// </summary> private void SetModifyData() { VersionFieldDataSet versionFieldDs = designFormFieldUCO.GetSingleVersionField(this.formVersionId, this.fieldParentId, this.fieldId); //如果已發佈,則不允許修改 if ((bool)versionFieldDs.FormVersion.Rows[0]["ISSUE_CTL"]) { ((Master_DialogMasterPage)this.Master).Button1Text = ""; UC_FiledDropList1.Enabled = false; } DataRow fieldDr = versionFieldDs.VersionField.Rows[0]; //欄位代號 txtFieldId.Text = fieldDr["FIELD_ID"].ToString(); //欄位名稱 txtFieldName.Text = fieldDr["FIELD_NAME"].ToString(); //欄位備註 txtFieldRemark.Text = fieldDr["FIELD_REMARK"].ToString(); //若有擴充屬性,可以用該屬性存取 //fieldDr["EXTENSION_SETTING"]; //序號為Lable 顯示 lblSeq.Text = fieldDr["FIELD_SEQ"].ToString(); //欄位排列順序 RadNumericTextBoxSeq.Value = (int)fieldDr["FIELD_SEQ"]; if (fieldDr["IS_DISPLAY_FIELD_NAME"].ToString() != "") { cbxDisplayFieldName.Checked = Convert.ToBoolean(fieldDr["IS_DISPLAY_FIELD_NAME"]); } else { cbxDisplayFieldName.Checked = true; } //是否允許刪除此欄位(設計時) delFalg = Convert.ToBoolean(fieldDr["DELFLAG"]) == false ? false : true; txtFieldId.Enabled = delFalg; }
/// <summary> /// 更新表單欄位 /// </summary> /// <returns></returns> private bool UpdateField() { VersionFieldDataSet versionFieldDs = new VersionFieldDataSet(); DataRow versionFieldDr = versionFieldDs.FormVersion.NewRow(); //表單版本編號 versionFieldDr["FORM_VERSION_ID"] = formVersionId; versionFieldDs.FormVersion.Rows.Add(versionFieldDr); DataRow fieldDr = versionFieldDs.VersionField.NewRow(); versionFieldDs.VersionField.Rows.Add(fieldDr); //判斷明細欄位用 fieldDr["PARENT_FIELD_ID"] = fieldParentId; //欄位代號 fieldDr["FIELD_ID"] = txtFieldId.Text; //欄位名稱 fieldDr["FIELD_NAME"] = txtFieldName.Text; //欄位備註 fieldDr["FIELD_REMARK"] = txtFieldRemark.Text; fieldDr["IS_DISPLAY_FIELD_NAME"] = this.cbxDisplayFieldName.Checked.ToString(); //若有擴充屬性,可以用該屬性存取 //fieldDr["EXTENSION_SETTING"]; //欄位顯示寬度,如果有需要控制則可使用此屬性,沒用到就0即可 fieldDr["DISPLAY_LENGTH"] = 0; //欄位內容長度,如果有需要控制則可使用此屬性,沒用到就0即可 fieldDr["FIELD_LENGTH"] = 0; //是否允許修改 fieldDr["FIELD_MODIFY"] = "no"; //排序順序(此欄位不用更改,系統會自動給,要更改欄位排列位置請使用欄位調整功能來做) fieldDr["FIELD_SEQ"] = RadNumericTextBoxSeq.Value; //欄位型態(此欄位的值不可更改) fieldDr["FIELD_TYPE"] = "optionalField"; //外掛欄位型態(此欄位的值不可更改) fieldDr["FIELD_SECTYPE"] = "TKUOFtb_COMPANYCOMPANY_ID"; //是否允許刪除欄位 fieldDr["DELFLAG"] = delFalg.ToString(); try { if (IsModify) { //如果是修改,就更新 designFormFieldUCO.ModifyVersionField(versionFieldDs, hiddenFieldId.Value); } else { designFormFieldUCO.AddVersionField(versionFieldDs); } } catch (FieldIdDuplicateException) { //表單版本代號重複 CustomValidatorFieldId.IsValid = false; return(false); } catch (AggergateModifyOpTypeException) { CustomValidatorModifyFieldType.ErrorMessage = UC_FiledDropList1.ModifyAggeOpErrorMsg; CustomValidatorModifyFieldType.IsValid = false; return(false); } catch (CalculateModifyOpTypeException) { CustomValidatorModifyFieldType.ErrorMessage = UC_FiledDropList1.ModifyCalcOpErrorMsg; CustomValidatorModifyFieldType.IsValid = false; return(false); } return(true); }