public IHttpActionResult Update(int id, DTO.PLCMng.PLC dtoItem) { Library.DTO.Notification notification; // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (id > 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate)) { // edit case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } else if (id == 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate)) { // create new case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } // validation if (!Helper.CommonHelper.ValidateDTO <DTO.PLCMng.PLC>(dtoItem, out notification)) { return(Ok(new Library.DTO.ReturnData <DTO.PLCMng.PLC>() { Data = dtoItem, Message = notification })); } // continue processing BLL.PLCMng bll = new BLL.PLCMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext)); bll.UpdateData(id, ref dtoItem, ControllerContext.GetAuthUserId(), out notification); return(Ok(new Library.DTO.ReturnData <DTO.PLCMng.PLC>() { Data = dtoItem, Message = notification })); }
public IHttpActionResult GetInitData() { BLL.PLCMng bll = new BLL.PLCMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext)); Library.DTO.Notification notification; DTO.PLCMng.InitFormData data = bll.GetInitData(ControllerContext.GetAuthUserId(), out notification); return(Ok(new Library.DTO.ReturnData <DTO.PLCMng.InitFormData>() { Data = data, Message = notification, TotalRows = 0 })); }
public IHttpActionResult Delete(int id) { // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanDelete)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } BLL.PLCMng bll = new BLL.PLCMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext)); Library.DTO.Notification notification; bll.DeleteData(id, ControllerContext.GetAuthUserId(), out notification); return(Ok(new Library.DTO.ReturnData <int>() { Data = id, Message = notification })); }
public IHttpActionResult Get(int id, int bookingID, int factoryID, int offerLineID, int offerLineSparepartID) { // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanRead)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } BLL.PLCMng bll = new BLL.PLCMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext)); Library.DTO.Notification notification; DTO.PLCMng.EditFormData data = bll.GetData(id, ControllerContext.GetAuthUserId(), bookingID, factoryID, offerLineID, offerLineSparepartID, out notification); return(Ok(new Library.DTO.ReturnData <DTO.PLCMng.EditFormData>() { Data = data, Message = notification })); }
public IHttpActionResult Gets(DTO.Search searchInput) { // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanRead)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } BLL.PLCMng bll = new BLL.PLCMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext)); Library.DTO.Notification notification; int totalRows = 0; DTO.PLCMng.SearchFormData data = bll.GetDataWithFilter(ControllerContext.GetAuthUserId(), searchInput.Filters, searchInput.PageSize, searchInput.PageIndex, searchInput.SortedBy, searchInput.SortedDirection, out totalRows, out notification); return(Ok(new Library.DTO.ReturnData <DTO.PLCMng.SearchFormData>() { Data = data, Message = notification, TotalRows = totalRows })); }
public IHttpActionResult GetReportData(string plcids) { Library.DTO.Notification notification; // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanRead)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } BLL.PLCMng bll = new BLL.PLCMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext)); string dataFileName = bll.GetReportData(ControllerContext.GetAuthUserId(), plcids, out notification); if (notification.Type == Library.DTO.NotificationType.Error) { return(InternalServerError(new Exception(notification.Message))); } return(Ok(new Library.DTO.ReturnData <string>() { Data = dataFileName, Message = notification })); }