private void LoadForm(int id) { ResetForm(); STD_REG_UDFs udf = ServiceInterfaceManager.STD_REG_UDFs_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id); if (udf != null) { hideUdfId.Value = udf.ID.ToString(); txtUdfName.Text = udf.NAME; txtUdfCode.Text = udf.CODE; txtUdfDescription.Text = udf.DESCRIPTION_TEXT; } }
private bool SaveForm(ref string strResult) { STD_REG_UDFs udf = null; if (string.IsNullOrEmpty(txtUdfName.Text)) { strResult = "UDF Name is Required<br /><br />"; } else if (string.IsNullOrEmpty(txtUdfCode.Text)) { strResult = "UDF Code is Required<br /><br />"; } else if (string.IsNullOrEmpty(txtUdfDescription.Text)) { strResult = "UDF Description is Required<br /><br />"; } else { { int id = 0; if (!string.IsNullOrEmpty(hideUdfId.Value)) { int.TryParse(hideUdfId.Value, out id); } if (id > 0) { udf = ServiceInterfaceManager.STD_REG_UDFs_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id); } else { List <STD_REG_UDFs> udfs = ServiceInterfaceManager.STD_REG_UDFs_GET_ALL_BY_REGISTRY(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId); if (udfs != null) { if (udfs.Count >= 10) { strResult = "A maximum of 10 User-Defined Fields are allowed<br /><br />"; return(false); } } } if (udf == null) { udf = new STD_REG_UDFs(); } udf.STD_REGISTRY_ID = UserSession.CurrentRegistryId; udf.CREATEDBY = udf.UPDATEDBY = HttpContext.Current.User.Identity.Name; udf.NAME = txtUdfName.Text; udf.CODE = txtUdfCode.Text; udf.DESCRIPTION_TEXT = txtUdfDescription.Text; udf.ID = ServiceInterfaceManager.STD_REG_UDFs_SAVE(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, udf); if (udf.ID > 0) { hideUdfId.Value = udf.ID.ToString(); strResult = "Save successful<br /><br />"; return(true); } else { strResult = "Error saving User-Defined Field, please try again<br /><br />"; } } // else //{ // strResult = "<ul><li>Field Name is Required</li></ul>"; //} } return(false); }