public HttpResponseMessage DeletePSInfo(HttpRequestMessage reqObject)
        {
            int result = 0;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _PSInfo = JsonConvert.DeserializeObject <PSInfo>(_requestedDataObject.BusinessData);
            }

            if (_PSInfo == null || string.IsNullOrWhiteSpace(_PSInfo.PoliceStationId))
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, "Account Status Setup Id Not Found...");
                _response        = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
                return(_response);
            }

            result = _IPSInfoService.DeletePSInfo(_PSInfo);
            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 GetPSInfoById(HttpRequestMessage reqObject)
        {
            string AccountStatusId = string.Empty;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _PSInfo         = JsonConvert.DeserializeObject <PSInfo>(_requestedDataObject.BusinessData);
                AccountStatusId = _PSInfo.PoliceStationId;
            }

            if (!string.IsNullOrWhiteSpace(AccountStatusId))
            {
                _PSInfo = new PSInfo();
                _PSInfo = _IPSInfoService.GetPSInfoById(AccountStatusId);
            }
            if (_PSInfo != null)
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(_PSInfo, "information has been fetched successfully");
            }
            else
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(_PSInfo, "Account Status Setup Not Found...");
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
        public HttpResponseMessage UpdatePSInfo(HttpRequestMessage reqObject)
        {
            int result = 0;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _PSInfo = JsonConvert.DeserializeObject <PSInfo>(_requestedDataObject.BusinessData);
                bool IsValid = ModelValidation.TryValidateModel(_PSInfo, out _modelErrorMsg);
                if (IsValid)
                {
                    result = _IPSInfoService.UpdatePSInfo(_PSInfo);
                }
            }

            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);
        }
Example #4
0
        public int AddPSInfo(PSInfo _PSInfo)
        {
            try
            {
                var _max = _IUoW.Repository <PSInfo>().GetMaxValue(x => x.PoliceStationId) + 1;
                _PSInfo.PoliceStationId = _max.ToString().PadLeft(3, '0');
                _PSInfo.AuthStatusId    = "A";
                _PSInfo.LastAction      = "ADD";
                _PSInfo.MakeDT          = System.DateTime.Now;
                _PSInfo.MakeBy          = "mtaka";
                var result = _IUoW.Repository <PSInfo>().Add(_PSInfo);
                #region Auth Log
                if (result == 1)
                {
                    _IAuthLogService = new AuthLogService();
                    long _outMaxSlAuthLogDtl = 0;
                    result = _IAuthLogService.AddAuthLog(_IUoW, null, _PSInfo, "ADD", "0001", "090101007", 1, "PSInfo", "MTK_CP_PS_INFO", "PoliceStationId", _PSInfo.PoliceStationId, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl);
                }
                #endregion

                if (result == 1)
                {
                    _IUoW.Commit();
                }
                return(result);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddPSInfo(obj)", string.Empty);
                return(0);
            }
        }
Example #5
0
        public int UpdatePSInfo(PSInfo _PSInfo)
        {
            try
            {
                int  result = 0;
                bool IsRecordExist;
                if (!string.IsNullOrWhiteSpace(_PSInfo.PoliceStationId))
                {
                    IsRecordExist = _IUoW.Repository <PSInfo>().IsRecordExist(x => x.PoliceStationId == _PSInfo.PoliceStationId);
                    if (IsRecordExist)
                    {
                        var _oldPSInfo       = _IUoW.Repository <PSInfo>().GetBy(x => x.PoliceStationId == _PSInfo.PoliceStationId);
                        var _oldPSInfoForLog = ObjectCopier.DeepCopy(_oldPSInfo);

                        _oldPSInfo.AuthStatusId = _PSInfo.AuthStatusId = "U";
                        _oldPSInfo.LastAction   = _PSInfo.LastAction = "EDT";
                        _oldPSInfo.LastUpdateDT = _PSInfo.LastUpdateDT = System.DateTime.Now;
                        _PSInfo.MakeBy          = "mtaka";
                        result = _IUoW.Repository <PSInfo>().Update(_oldPSInfo);

                        #region Testing Purpose
                        #endregion

                        #region Auth Log
                        if (result == 1)
                        {
                            _IAuthLogService = new AuthLogService();
                            long _outMaxSlAuthLogDtl = 0;
                            result = _IAuthLogService.AddAuthLog(_IUoW, _oldPSInfoForLog, _PSInfo, "EDT", "0001", "090101007", 1, "PSInfo", "MTK_CP_PS_INFO", "PoliceStationId", _PSInfo.PoliceStationId, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl);
                        }
                        #endregion

                        if (result == 1)
                        {
                            _IUoW.Commit();
                        }
                        return(result);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "UpdatePSInfo(obj)", string.Empty);
                return(0);
            }
        }
 public HttpResponseMessage GetPSInfoBy(HttpRequestMessage reqObject)
 {
     _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
     if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
     {
         _PSInfo = JsonConvert.DeserializeObject <PSInfo>(_requestedDataObject.BusinessData);
         _PSInfo = _IPSInfoService.GetPSInfoBy(_PSInfo);
     }
     if (_PSInfo != null)
     {
         _serviceResponse = _IDataManipulation.SetResponseObject(_PSInfo, "information has been fetched successfully");
     }
     else
     {
         _serviceResponse = _IDataManipulation.SetResponseObject(_PSInfo, "Account Status Setup Not Found...");
     }
     _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
     return(_response);
 }
Example #7
0
 public PSInfo GetPSInfoBy(PSInfo _PSInfo)
 {
     try
     {
         if (_PSInfo == null)
         {
             return(_PSInfo);
         }
         return(_IUoW.Repository <PSInfo>().GetBy(x => x.PoliceStationId == _PSInfo.PoliceStationId &&
                                                  x.AuthStatusId == "A" &&
                                                  x.LastAction != "DEL"));
     }
     catch (Exception ex)
     {
         _ObjErrorLogService = new ErrorLogService();
         _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetPSInfoBy(obj)", string.Empty);
         return(null);
     }
 }
Example #8
0
        public List <PSInfo> GetAllPSInfo()
        {
            try
            {
                List <PSInfo> OBJ_LIST_PSInfo = new List <PSInfo>();
                var           _ListPSInfo     = _IUoW.Repository <PSInfo>().Get(x => x.AuthStatusId == "A" && x.LastAction != "DEL").OrderByDescending(x => x.PoliceStationId);
                foreach (var item in _ListPSInfo)
                {
                    PSInfo             OBJ_PSInfo             = new PSInfo();
                    UpazilaInfoService OBJ_UpazilaInfoService = new UpazilaInfoService();

                    OBJ_PSInfo.PoliceStationId      = item.PoliceStationId;
                    OBJ_PSInfo.PoliceStationNm      = item.PoliceStationNm;
                    OBJ_PSInfo.PoliceStationShortNm = item.PoliceStationShortNm;
                    OBJ_PSInfo.UpazilaId            = item.UpazilaId;
                    foreach (var item1 in OBJ_UpazilaInfoService.GetUpazilaInfoForDD())
                    {
                        if (item1.Value == OBJ_PSInfo.UpazilaId)
                        {
                            OBJ_PSInfo.UpazilaNm = item1.Text;
                        }
                    }
                    OBJ_PSInfo.AuthStatusId = item.AuthStatusId;
                    OBJ_PSInfo.LastAction   = item.LastAction;
                    OBJ_PSInfo.LastUpdateDT = item.LastUpdateDT;
                    OBJ_PSInfo.MakeBy       = item.MakeBy;
                    OBJ_PSInfo.MakeDT       = item.MakeDT;
                    OBJ_PSInfo.TransDT      = item.TransDT;
                    OBJ_LIST_PSInfo.Add(OBJ_PSInfo);
                }
                return(OBJ_LIST_PSInfo);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetAllPSInfo()", string.Empty);
                return(null);
            }
        }