public async Task <dynamic> GetDocPropIdentityForSpecificDocType(string _OwnerID, string _DocCategoryID, string _DocTypeID, string _DocPropertyID) { List <DSM_DocPropIdentify> objDocPropIdentifies = null; await Task.Run(() => _DocPropIdentityService.GetDocPropIdentify(UserID, "", out objDocPropIdentifies)); var result = (from dp in objDocPropIdentifies where dp.OwnerID == _OwnerID & dp.DocCategoryID == _DocCategoryID & dp.DocTypeID == _DocTypeID & dp.DocPropertyID == _DocPropertyID & dp.Status == 1 orderby dp.IdentificationSL select new DSM_DocPropIdentify { DocPropIdentifyID = dp.DocPropIdentifyID, DocPropertyID = dp.DocPropertyID, DocTypeID = dp.DocTypeID, DocCategoryID = dp.DocCategoryID, OwnerID = dp.OwnerID, IdentificationCode = dp.IdentificationCode, IdentificationSL = dp.IdentificationSL, IdentificationAttribute = dp.IdentificationAttribute, AttributeGroup = dp.AttributeGroup, IsRequired = dp.IsRequired, IsAuto = dp.IsAuto, IsRestricted = dp.IsRestricted, Remarks = dp.Remarks, Status = dp.Status }).ToList(); return(Json(new { Msg = "", result }, JsonRequestBehavior.AllowGet)); }
public async Task <dynamic> GetDocPropIdentityForSpecificUser(string _UserID, string _DocPropertyID) { List <DSM_DocPropIdentify> objDocPropIdentifies = null; List <SEC_UserDataAccess> secUserDataAccesses = null; await Task.Run(() => _ownerProperIdentityService.GetDocPropIdentify(UserID, "", out objDocPropIdentifies)); await Task.Run(() => _dataLevelPermissionService.GetAllUserDataAccess(_UserID, out secUserDataAccesses)); var result = (from ow in objDocPropIdentifies where ow.DocPropertyID == _DocPropertyID & ow.Status == 1 from uda in secUserDataAccesses.Where(x => x.DocPropIdentifyID == ow.DocPropIdentifyID & x.UserID == _UserID & x.Status == 1).DefaultIfEmpty() select new { DocPropIdentifyID = ow.DocPropIdentifyID, IdentificationAttribute = ow.IdentificationAttribute, IsSelected = (uda != null), TimeLimit = (uda == null ? null : (uda.AccessTimeLimit).ToString()), Remarks = (uda == null ? null : uda.Remarks), MetaValue = (uda == null ? null : uda.MetaValue) }).ToList(); return(Json(result, JsonRequestBehavior.AllowGet)); }
public async Task <dynamic> GetDocPropIdentityForSpecificUser(string _DocPropertyID, string _DestroyPolicyID) { List <DSM_DocPropIdentify> objDocPropIdentifies = null; List <DSM_DestroyPolicy> dsmDestroyPolicies = null; await Task.Run(() => _ownerProperIdentityService.GetDocPropIdentify(UserID, "", out objDocPropIdentifies)); await Task.Run(() => _destroyPolicyService.GetDestroyPolicyBySearchParam(_DestroyPolicyID, UserID, null, null, null, _DocPropertyID, null, out dsmDestroyPolicies)); if (_DestroyPolicyID != "") { var result = (from dc in objDocPropIdentifies where dc.DocPropertyID == _DocPropertyID & dc.Status == 1 join dpd in dsmDestroyPolicies on new { DocPropIdentifyID = dc.DocPropIdentifyID, //DestroyPolicyID = _DestroyPolicyID } equals new { DocPropIdentifyID = dpd.DocPropIdentifyID, //DestroyPolicyID = _DestroyPolicyID } into Policies from dpd in Policies.DefaultIfEmpty() //where dpd.DestroyPolicyID == _DestroyPolicyID select new { DestroyPolicyDtlID = dpd == null ? "" : dpd.DestroyPolicyDtlID, DocPropIdentifyID = dc.DocPropIdentifyID, IdentificationAttribute = dc.IdentificationAttribute, IsSelected = (dpd != null && dpd.IsSelected), TimeValue = (dpd == null ? "" : dpd.TimeValue), TimeUnit = (dpd == null ? "" : dpd.TimeUnit), ExceptionValue = (dpd == null ? "" : dpd.ExceptionValue) }).ToList(); return(Json(new { Msg = "", result }, JsonRequestBehavior.AllowGet)); } else { var result = (from dc in objDocPropIdentifies where dc.DocPropertyID == _DocPropertyID & dc.Status == 1 select new { DocPropIdentifyID = dc.DocPropIdentifyID, IdentificationAttribute = dc.IdentificationAttribute, IsSelected = false }).ToList(); return(Json(new { Msg = "", result }, JsonRequestBehavior.AllowGet)); } }
public async Task <dynamic> GetDocPropIdentityForSelectedDocTypes(string _OwnerID, string _DocCategoryID, string _DocTypeID, string _SelectedPropID) { var SelectedPropID = _SelectedPropID.Split(',').Select(x => x).ToList(); List <DSM_DocPropIdentify> objDocPropIdentifies = null; List <DSM_DocProperty> objDocPropertyList = null; await Task.Run(() => _ownerProperIdentityService.GetDocPropIdentify (UserID, "", out objDocPropIdentifies)); await Task.Run(() => _docPropertyService.GetDocProperty ("", UserID, out objDocPropertyList)); var result = (from dpi in objDocPropIdentifies.AsEnumerable() where dpi.OwnerID == _OwnerID & dpi.DocCategoryID == _DocCategoryID & dpi.DocTypeID == _DocTypeID & dpi.Status == 1 & SelectedPropID.Contains(dpi.DocPropertyID) join dp in objDocPropertyList on dpi.DocPropertyID equals dp.DocPropertyID orderby dp.SerialNo select new DSM_DocPropIdentify { DocPropIdentifyID = dpi.DocPropIdentifyID, DocPropertyID = dpi.DocPropertyID, DocPropertyName = dp.DocPropertyName, //DocTypeID = dpi.DocTypeID, //DocCategoryID = dpi.DocCategoryID, //OwnerID = dpi.OwnerID, //IdentificationCode = dpi.IdentificationCode, //IdentificationSL = dpi.IdentificationSL, IdentificationAttribute = dpi.IdentificationAttribute, //AttributeGroup = dpi.AttributeGroup, IsRequired = dpi.IsRequired, IsAuto = dpi.IsAuto, //Remarks = dpi.Remarks, Status = dpi.Status, IsRestricted = dpi.IsRequired }).ToList(); return(Json(new { Msg = "", result }, JsonRequestBehavior.AllowGet)); }
public async Task <dynamic> GetDocPropIdentityForSpecificUser(string _DestroyPolicyID, string _OwnerID, string _DocCategoryID, string _DocTypeID, string _DocPropertyID, string _DestroyID) { List <DSM_DocPropIdentify> objDocPropIdentifies = null; List <DSM_DestroyPolicy> dsmDestroyPolicies = null; List <DSM_DestroyPolicy> dsmDestroy = null; await Task.Run(() => _ownerProperIdentityService.GetDocPropIdentify(UserID, "", out objDocPropIdentifies)); await Task.Run(() => _destroyPolicyService.GetDestroyPolicyBySearchParam(null, UserID, _OwnerID, _DocCategoryID, _DocTypeID, _DocPropertyID, null, out dsmDestroyPolicies)); await Task.Run(() => _docDestroyService.GetDestroyDetailsBySearchParam(_DestroyID, UserID, _OwnerID, null, null, null, null, out dsmDestroy)); if (_DestroyID == "") { var result = (from dc in dsmDestroyPolicies where dc.PolicyDetailStatus == 1 & dc.OwnerID == _OwnerID & dc.DocCategoryID == _DocCategoryID & dc.DocTypeID == _DocTypeID & dc.DocPropertyID == _DocPropertyID join c in objDocPropIdentifies on dc.DocPropIdentifyID equals c.DocPropIdentifyID select new { DestroyPolicyDtlID = dc.DestroyPolicyDtlID, DestroyPolicyID = dc.DestroyPolicyID, DocPropIdentifyID = dc.DocPropIdentifyID, IdentificationAttribute = c.IdentificationAttribute, IsSelected = false, TimeValue = (dc.TimeValue), TimeUnit = (dc.TimeUnit), ExceptionValue = (dc.ExceptionValue) }).ToList(); return(Json(new { Msg = "", result }, JsonRequestBehavior.AllowGet)); } else { var result = (from dpd in dsmDestroyPolicies where dpd.PolicyDetailStatus == 1 join d in dsmDestroy.Where(x => x.DestroyPolicyID == _DestroyPolicyID) on dpd.DocPropIdentifyID equals d.DocPropIdentifyID into Categories from d in Categories.DefaultIfEmpty() join dc in objDocPropIdentifies on dpd.DocPropIdentifyID equals dc.DocPropIdentifyID into CategoryDetails from dc in CategoryDetails.DefaultIfEmpty() select new { DestroyPolicyDtlID = dpd.DestroyPolicyDtlID, DestroyPolicyID = dpd.DestroyPolicyID, DocPropIdentifyID = dpd.DocPropIdentifyID, IdentificationAttribute = dc.IdentificationAttribute, IsSelected = (d != null && d.IsSelected), TimeValue = (dpd.TimeValue), TimeUnit = (dpd.TimeUnit), ExceptionValue = (dpd.ExceptionValue) }).ToList(); return(Json(new { Msg = "", result }, JsonRequestBehavior.AllowGet)); } }
public dynamic AddDocumentInfo(DocumentsInfo modelDocumentsInfo, string selectedPropId, DocMetaValue docMetaValues) { List <DocMetaValue> lstMetaValues = new List <DocMetaValue>(); List <DSM_DocPropIdentify> objDocPropIdentifies = new List <DSM_DocPropIdentify>(); List <string> existColumnName = new List <string>(); var action = ""; if (ModelState.IsValid) { action = "add"; modelDocumentsInfo.SetBy = _userId; modelDocumentsInfo.ModifiedBy = modelDocumentsInfo.SetBy; DataTable dt = (DataTable)TempData["ExcelData"]; if (dt != null) { _docPropertyIdentityService.GetDocPropIdentify(_userId, "", out objDocPropIdentifies); var documentList = objDocPropIdentifies.Where(ob => ob.DocPropertyID == modelDocumentsInfo.DocProperty.DocPropertyID).Select(ob => ob.IdentificationAttribute).ToList(); var arrayNames = (from DataColumn x in dt.Columns select x.ColumnName).ToArray(); foreach (string item in arrayNames) { if (documentList.Contains(item)) { existColumnName.Add(item); } } if (existColumnName.Count > 0) { // Database and Import File match column foreach (var columnName in existColumnName) { foreach (DataRow row in dt.Rows) { DocMetaValue ob = new DocMetaValue(); ob.DocumentID = docMetaValues.DocumentID; ob.MetaValue = row[columnName].ToString(); ob.DocPropIdentifyID = ( from t in objDocPropIdentifies where (t.DocCategoryID == modelDocumentsInfo.DocCategory.DocCategoryID) && (t.DocTypeID == modelDocumentsInfo.DocType.DocTypeID) && (t.IdentificationAttribute == columnName) select t.DocPropIdentifyID).FirstOrDefault();// docMetaValues.DocPropIdentifyID; ob.DocPropertyID = selectedPropId; ob.DocMetaID = docMetaValues.DocMetaID; ob.DocumentID = docMetaValues.DocumentID; ob.DocVersionID = docMetaValues.DocVersionID; lstMetaValues.Add(ob); } } if (lstMetaValues.Count > 0) { if (modelDocumentsInfo.DidtributionOf.Equals("Original")) { _respStatus = _docDistributionService.AddDocumentInfo(modelDocumentsInfo, selectedPropId, lstMetaValues, action, out outStatus); } else { _respStatus = _docDistributionService.AddDocumentInfoForVersion(modelDocumentsInfo, selectedPropId, lstMetaValues, action, out outStatus); } _respStatus = new SILDMS.Utillity.ValidationResult(outStatus, _localizationService.GetResource(outStatus)); } } else { _respStatus = new SILDMS.Utillity.ValidationResult("E411", _localizationService.GetResource("E411")); } } } else { //var errors = ModelState.Values.SelectMany(v => v.Errors); _respStatus = new SILDMS.Utillity.ValidationResult("E404", _localizationService.GetResource("E404")); // return Json(new { Message = _respStatus.Message, _respStatus }, JsonRequestBehavior.AllowGet); } return(Json(new { Message = _respStatus.Message, _respStatus }, JsonRequestBehavior.AllowGet)); }