public int UpdateUnionInfo(UnionInfo _UnionInfo) { try { int result = 0; bool IsRecordExist; if (!string.IsNullOrWhiteSpace(_UnionInfo.UnionId)) { IsRecordExist = _IUoW.Repository <UnionInfo>().IsRecordExist(x => x.UnionId == _UnionInfo.UnionId); if (IsRecordExist) { _UnionInfo.AuthStatusId = "U"; _UnionInfo.LastAction = "EDT"; _UnionInfo.LastUpdateDT = System.DateTime.Now; _UnionInfo.MakeBy = "mtaka"; result = _IUoW.Repository <UnionInfo>().Update(_UnionInfo); _IUoW.Commit(); return(result); } } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "UpdateUnionInfo(obj)", string.Empty); return(0); } }
public int AddUnionInfo(UnionInfo _UnionInfo) { try { var _max = _IUoW.Repository <UnionInfo>().GetMaxValue(x => x.UnionId) + 1; _UnionInfo.UnionId = _max.ToString().PadLeft(3, '0'); _UnionInfo.AuthStatusId = "U"; _UnionInfo.LastAction = "ADD"; _UnionInfo.MakeDT = System.DateTime.Now; _UnionInfo.MakeBy = "mtaka"; var result = _IUoW.Repository <UnionInfo>().Add(_UnionInfo); #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; _IAuthLogService.AddAuthLog(_IUoW, null, _UnionInfo, "ADD", "0001", "090101010", 1, "UnionInfo", "MTK_CP_UNION_INFO", "UnionID", _UnionInfo.UnionId, "mtaka", 0, out _outMaxSlAuthLogDtl); } #endregion _IUoW.Commit(); return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddUnionInfo(obj)", string.Empty); return(0); } }
public HttpResponseMessage GetUnionInfoById(HttpRequestMessage reqObject) { string AccountStatusId = string.Empty; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _UnionInfo = JsonConvert.DeserializeObject <UnionInfo>(_requestedDataObject.BusinessData); AccountStatusId = _UnionInfo.UnionId; } if (!string.IsNullOrWhiteSpace(AccountStatusId)) { _UnionInfo = new UnionInfo(); _UnionInfo = _IUnionInfoService.GetUnionInfoById(AccountStatusId); } if (_UnionInfo != null) { _serviceResponse = _IDataManipulation.SetResponseObject(_UnionInfo, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(_UnionInfo, "Union Information Not Found..."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public HttpResponseMessage DeleteUnionInfo(HttpRequestMessage reqObject) { int result = 0; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _UnionInfo = JsonConvert.DeserializeObject <UnionInfo>(_requestedDataObject.BusinessData); } if (_UnionInfo == null || string.IsNullOrWhiteSpace(_UnionInfo.UnionId)) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "Union Information Id Not Found..."); _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); } result = _IUnionInfoService.DeleteUnionInfo(_UnionInfo); if (result == 1) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been deleted successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been deleted"); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public HttpResponseMessage UpdateUnionInfo(HttpRequestMessage reqObject) { int result = 0; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _UnionInfo = JsonConvert.DeserializeObject <UnionInfo>(_requestedDataObject.BusinessData); bool IsValid = ModelValidation.TryValidateModel(_UnionInfo, out _modelErrorMsg); if (IsValid) { result = _IUnionInfoService.UpdateUnionInfo(_UnionInfo); } } if (!string.IsNullOrWhiteSpace(_modelErrorMsg)) { _serviceResponse = _IDataManipulation.SetResponseObject(result, _modelErrorMsg); } else if (result == 1) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been updated successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been updated"); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
private KeyValuePair <string, TSAliasDescription> ToTypeAlias(UnionInfo u) { var ret = new TSAliasDescription { TargetType = TSSimpleType.Any }; ret.JsDoc.Add("", u.HelpString); return(KVP($"{u.Parent.Name}.{u.Name}", ret)); }
public UnionInfo GetUnionsData() { UnionInfo info = new UnionInfo(); foreach (var union in Unions) { var u = union.Value; info.Unions.Add(u.GetSimplified()); } return(info); }
public UnionInfo GetUnionInfo(UnionInfo _UnionInfo) { try { if (_UnionInfo == null) { return(_UnionInfo); } return(_IUoW.Repository <UnionInfo>().GetBy(x => x.UnionId == _UnionInfo.UnionId && x.AuthStatusId == "A" && x.LastAction != "DEL")); } catch (Exception ex) { throw ex; } }
public HttpResponseMessage GetUnionInfoBy(HttpRequestMessage reqObject) { _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _UnionInfo = JsonConvert.DeserializeObject <UnionInfo>(_requestedDataObject.BusinessData); _UnionInfo = _IUnionInfoService.GetUnionInfo(_UnionInfo); } if (_UnionInfo != null) { _serviceResponse = _IDataManipulation.SetResponseObject(_UnionInfo, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(_UnionInfo, "Union Information Not Found..."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public int DeleteUnionInfo(UnionInfo _UnionInfo) { try { int result = 0; if (!string.IsNullOrWhiteSpace(_UnionInfo.UnionId)) { result = _IUoW.Repository <UnionInfo>().Delete(_UnionInfo); _IUoW.Commit(); return(result); } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "DeleteUnionInfo(obj)", string.Empty); return(0); } }
private void CreateUnionInfo() { var defaultUnionInfo = _context.UnionInfos.IgnoreQueryFilters().FirstOrDefault(e => e.UnionName == "اتحاديه صنعت فارس"); if (defaultUnionInfo == null) { defaultUnionInfo = new UnionInfo { Code = "5210", UnionName = "اتحاديه صنعت فارس" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5217", UnionName = "اتحاديه صنعت اصفهان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5223", UnionName = "اتحاديه صنعت کهگيلويه و بوير احمد" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5216", UnionName = "اتحاديه صنعت تهران" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5214", UnionName = "اتحاديه صنعت ايلام" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5220", UnionName = "اتحاديه صنعت چهارمحال و بختياري" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5226", UnionName = "اتحاديه صنعت سمنان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5202", UnionName = "اتحاديه صنعت قزوين" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5200", UnionName = "اتحاديه صنعت مازندران" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5222", UnionName = "اتحاديه صنعت مرکزي" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5215", UnionName = "اتحاديه صنعت هرمزگان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5204", UnionName = "اتحاديه صنعت البرز" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "52111", UnionName = "اتحاديه صنعت آدربايجان غربي" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5227", UnionName = "اتحاديه صنعت دامداران و دامپروران سيستان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5213", UnionName = "اتحاديه صنعت گلستان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5208", UnionName = "اتحاديه صنعت همدان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5209", UnionName = "اتحاديه صنعت کرمان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5206", UnionName = "اتحاديه صنعت خراسان رضوي" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5203", UnionName = "اتحاديه صنعت خوزستان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5281", UnionName = "اتحاديه صنعت آذربايجان شرقي" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5205", UnionName = "اتحاديه صنعت جنوب کرمان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5211", UnionName = "اتحاديه صنعت کرمانشاه" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5201", UnionName = "اتحاديه صنعت سيستان بلوچستان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5219", UnionName = "اتحاديه صنعت گيلان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "5218", UnionName = "اتحاديه صنعت زنجان" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "52155", UnionName = "اتحاديه صنعت بوشهر" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "52241", UnionName = "اتحاديه صنعت آذربايجان غربي" }; _context.UnionInfos.Add(defaultUnionInfo); defaultUnionInfo = new UnionInfo { Code = "11111", UnionName = "اتحاديه صنعت اردبيل" }; _context.UnionInfos.Add(defaultUnionInfo); _context.SaveChanges(); } }