private void btnCreate_Click(object sender, EventArgs e) { RelatedCode relcode = new RelatedCode(); relcode.RelatedCodeID = txtNewRelatedCode.Text; relcode.FKCodeTypeFrom = cbxFrom.Text; relcode.FKCodeTypeTo = cbxTo.Text; relcode.Description = txtRelatedCodeDescription.Text; if (string.IsNullOrEmpty(relcode.FKCodeTypeTo)) { return; } if (string.IsNullOrEmpty(relcode.FKCodeTypeFrom)) { return; } var response = BUSReferenceData.AddRelatedCodeType(relcode); ControllerUtils.ShowFCMMessage(response, Utils.UserID); // Reload is necessary since new code has been added. // Cache.CachedInfo.LoadRelatedCodeInCache(); LoadInitialValues(); }
/// <summary> /// Refresh cache /// </summary> /// <returns></returns> public static void LoadReferenceDataInCache(HeaderInfo headerInfo) { if (CachedInfo.ListOfCodeTypes == null) { CachedInfo.ListOfCodeTypes = new List <CodeType>(); } var codeType = new CodeType(); codeType.List(headerInfo); ListOfCodeTypes.Clear(); ListOfCodeTypes = codeType.codeTypeList; if (ListOfCodeValues != null) { ListOfCodeValues.Clear(); } var codeValue = new CodeValue(); ListOfCodeValues = codeValue.ListS(); if (ListOfScreensAllowedToUser != null) { ListOfScreensAllowedToUser.Clear(); } CachedInfo.ListOfScreensAllowedToUser = BUSReferenceData.GetListScreensForUser(Utils.UserID); return; }
private void LinkValueToCode(object sender, DragEventArgs e) { // Get selected document from tree // TreeNode tnDocumentSelectedTo = tvTo.SelectedNode; if (tnDocumentSelectedTo == null) { return; } var tndocselected = (CodeValue)tnDocumentSelectedTo.Tag; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt; TreeNode destinationNode; pt = tvFrom.PointToClient(new Point(e.X, e.Y)); destinationNode = tvFrom.GetNodeAt(pt); if (destinationNode == null) { return; } tnDocumentSelectedTo.Remove(); destinationNode.Nodes.Add(tnDocumentSelectedTo); // Add link to the database // CodeValue itemSelectedTo = new CodeValue(); itemSelectedTo = (CodeValue)tnDocumentSelectedTo.Tag; CodeValue destination = new CodeValue(); destination = (CodeValue)destinationNode.Tag; // New link to be created RelatedCodeValue rcv = new RelatedCodeValue(); rcv.FKRelatedCodeID = cbxRelatedCode.Text; rcv.FKCodeTypeFrom = destination.FKCodeType; rcv.FKCodeValueFrom = destination.ID; rcv.FKCodeTypeTo = itemSelectedTo.FKCodeType; rcv.FKCodeValueTo = itemSelectedTo.ID; var response = BUSReferenceData.AddRelatedCodeValue(rcv); ControllerUtils.ShowFCMMessage(response, Utils.UserID); Cache.CachedInfo.LoadRelatedCodeInCache(); } }
/// <summary> /// Refresh cache /// </summary> /// <returns></returns> public static void LoadRelatedCodeInCache() { if (CachedInfo.ListOfRelatedCodes == null) { CachedInfo.ListOfRelatedCodes = new List <RelatedCode>(); } if (CachedInfo.ListOfRelatedCodes != null) { CachedInfo.ListOfRelatedCodes.Clear(); } CachedInfo.ListOfRelatedCodes = BUSReferenceData.ListRelatedCode(); CachedInfo.ListOfRelatedCodeValues = BUSReferenceData.ListRelatedCodeValue(); return; }