public IHttpActionResult UpdateMasterDirectionSubIndex(UpdateMasterDirectionSubIndexRequest updateMasterDirectionSubIndexRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } var masterDirectionSubIndex = new MasterDirectionSubIndex() { MasterDirectionSubIndexId = updateMasterDirectionSubIndexRequest.MasterDirectionSubIndexId, MasterDirectionIndexId = updateMasterDirectionSubIndexRequest.MasterDirectionIndexId, SubIndexNo = updateMasterDirectionSubIndexRequest.SubIndexNo, SubIndexName = updateMasterDirectionSubIndexRequest.SubIndexName, SubIndexContent = updateMasterDirectionSubIndexRequest.SubIndexContent, SaveAfterSubIndexId = updateMasterDirectionSubIndexRequest.SaveAfterSubIndexId, ModifiedBy = Utility.UserId }; int result = iMasterDirectionSubIndex.UpdateMasterDirectionSubIndex(masterDirectionSubIndex); switch (result) { case 1: responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "MasterDirectionSubIndex updated successfully."; break; case -2: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "MasterDirectionSubIndex already exists."; break; case -3: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "MasterDirectionSubIndex doesn't exist."; break; default: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating MasterDirectionSubIndex."; break; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating MasterDirectionSubIndex."; Utility.WriteLog("UpdateMasterDirectionSubIndex", updateMasterDirectionSubIndexRequest, "Error while updating MasterDirectionSubIndex. (MasterDirectionSubIndexAdminController)", ex.ToString()); } return(Ok(responses)); }
public IEnumerable <MasterDirectionSubIndex> GetMasterDirectionSubIndex(MasterDirectionSubIndex masterDirectionSubIndex) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter totalPageCount = new ObjectParameter("TotalPageCount", typeof(int)); ObjectParameter totalRecord = new ObjectParameter("TotalRecord", typeof(int)); var masterDirectionSubIndexes = dataContext.MasterDirectionSubIndexGet(masterDirectionSubIndex.MasterDirectionSubIndexId, masterDirectionSubIndex.MasterDirectionId, masterDirectionSubIndex.MasterDirectionIndexId, Utility.TrimString(masterDirectionSubIndex.SearchText), masterDirectionSubIndex.IsActive, masterDirectionSubIndex.PageNumber, masterDirectionSubIndex.PageSize, masterDirectionSubIndex.IsPagingRequired, Utility.TrimString(masterDirectionSubIndex.OrderBy), Utility.TrimString(masterDirectionSubIndex.OrderByDirection), totalPageCount, totalRecord).ToList(); var masterDirectionSubIndexList = new List <MasterDirectionSubIndex>(); foreach (var masterDirectionSubIndexDetail in masterDirectionSubIndexes) { masterDirectionSubIndexList.Add(new MasterDirectionSubIndex() { MasterDirectionSubIndexId = masterDirectionSubIndexDetail.MDSubIndex, MasterDirectionIndexId = masterDirectionSubIndexDetail.MDPartIndexID, SubIndexNo = masterDirectionSubIndexDetail.SubIndexNo, SubIndexName = masterDirectionSubIndexDetail.SubIndexName, SubIndexContent = masterDirectionSubIndexDetail.SubIndexContent, SortId = masterDirectionSubIndexDetail.SortId, IsActive = masterDirectionSubIndexDetail.IsActive, TotalPageCount = Convert.ToInt32(totalPageCount.Value), TotalRecord = Convert.ToInt32(totalRecord.Value) }); } return(masterDirectionSubIndexList); } }
public int DeleteMasterDirectionSubIndex(MasterDirectionSubIndex masterDirectionSubIndex) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter result = new ObjectParameter("Result", typeof(int)); dataContext.MasterDirectionSubIndexDelete(masterDirectionSubIndex.MasterDirectionSubIndexId, masterDirectionSubIndex.MasterDirectionIndexId, masterDirectionSubIndex.ModifiedBy, result); return(Convert.ToInt32(result.Value)); } }
public int UpdateMasterDirectionSubIndex(MasterDirectionSubIndex masterDirectionSubIndex) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter result = new ObjectParameter("Result", typeof(int)); dataContext.MasterDirectionSubIndexUpdate(masterDirectionSubIndex.MasterDirectionSubIndexId, masterDirectionSubIndex.MasterDirectionIndexId, Utility.TrimString(masterDirectionSubIndex.SubIndexNo), Utility.TrimString(masterDirectionSubIndex.SubIndexName), Utility.TrimString(masterDirectionSubIndex.SubIndexContent), masterDirectionSubIndex.SaveAfterSubIndexId, masterDirectionSubIndex.ModifiedBy, result); return(Convert.ToInt32(result.Value)); } }
public IHttpActionResult AddMasterDirectionSubIndex(AddMasterDirectionSubIndexRequest addMasterDirectionSubIndexRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var masterDirectionSubIndex = new MasterDirectionSubIndex() { MasterDirectionIndexId = addMasterDirectionSubIndexRequest.MasterDirectionIndexId, SubIndexNo = addMasterDirectionSubIndexRequest.SubIndexNo, SubIndexName = addMasterDirectionSubIndexRequest.SubIndexName, SubIndexContent = addMasterDirectionSubIndexRequest.SubIndexContent, SaveAfterSubIndexId = addMasterDirectionSubIndexRequest.SaveAfterSubIndexId }; int result = iMasterDirectionSubIndex.AddMasterDirectionSubIndex(masterDirectionSubIndex); if (result > 0) { responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "MasterDirectionSubIndex added successfully."; } else if (result == -2) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "MasterDirectionSubIndex alread exists."; } else { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding MasterDirectionSubIndex."; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding MasterDirectionSubIndex."; Utility.WriteLog("AddMasterDirectionSubIndex", addMasterDirectionSubIndexRequest, "Error while adding MasterDirectionSubIndex. (MasterDirectionSubIndexAdminController)", ex.ToString()); } return(Ok(responses)); }
public IHttpActionResult GetMasterDirectionSubIndex([FromUri] GetMasterDirectionSubIndexRequest getMasterDirectionSubIndexRequest) { var responses = new Responses(); try { if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } if (getMasterDirectionSubIndexRequest == null) { getMasterDirectionSubIndexRequest = new GetMasterDirectionSubIndexRequest(); } if (getMasterDirectionSubIndexRequest.PageSize == null) { getMasterDirectionSubIndexRequest.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]); } var masterDirectionSubIndex = new MasterDirectionSubIndex() { MasterDirectionSubIndexId = getMasterDirectionSubIndexRequest.MasterDirectionSubIndexId, MasterDirectionIndexId = getMasterDirectionSubIndexRequest.MasterDirectionIndexId, SearchText = getMasterDirectionSubIndexRequest.SearchText, IsActive = getMasterDirectionSubIndexRequest.IsActive, PageNumber = getMasterDirectionSubIndexRequest.PageNumber, PageSize = Convert.ToInt32(getMasterDirectionSubIndexRequest.PageSize), IsPagingRequired = (getMasterDirectionSubIndexRequest.PageNumber != null) ? true : false, OrderBy = getMasterDirectionSubIndexRequest.OrderBy, OrderByDirection = getMasterDirectionSubIndexRequest.OrderByDirection }; var masterDirectionSubIndexes = iMasterDirectionSubIndex.GetMasterDirectionSubIndex(masterDirectionSubIndex); var masterDirectionSubIndexList = new List <GetMasterDirectionSubIndexResponse>(); foreach (var masterDirectionSubIndexDetail in masterDirectionSubIndexes) { masterDirectionSubIndexList.Add(new GetMasterDirectionSubIndexResponse() { MasterDirectionSubIndexId = Convert.ToInt32(masterDirectionSubIndexDetail.MasterDirectionSubIndexId), MasterDirectionIndexId = Convert.ToInt32(masterDirectionSubIndexDetail.MasterDirectionIndexId), SubIndexNo = masterDirectionSubIndexDetail.SubIndexNo, SubIndexName = masterDirectionSubIndexDetail.SubIndexName, SubIndexContent = masterDirectionSubIndexDetail.SubIndexContent, SortId = masterDirectionSubIndexDetail.SortId, IsActive = Convert.ToBoolean(masterDirectionSubIndexDetail.IsActive), CreatedBy = masterDirectionSubIndexDetail.CreatedBy, TotalPageCount = masterDirectionSubIndexDetail.TotalPageCount, TotalRecord = masterDirectionSubIndexDetail.TotalRecord }); } responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "MasterDirectionSubIndex retrieved successfully"; responses.Response = masterDirectionSubIndexList; } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while retrieving MasterDirectionSubIndex."; Utility.WriteLog("GetMasterDirectionSubIndex", getMasterDirectionSubIndexRequest, "Error while retrieving MasterDirectionSubIndex. (MasterDirectionSubIndexAdminController)", ex.ToString()); } return(Ok(responses)); }