public int AddUpazilaInfo(UpazilaInfo _UpazilaInfo)
        {
            try
            {
                var _max = _IUoW.Repository <UpazilaInfo>().GetMaxValue(x => x.UpazilaId) + 1;
                _UpazilaInfo.UpazilaId    = _max.ToString().PadLeft(3, '0');
                _UpazilaInfo.AuthStatusId = "A";
                _UpazilaInfo.LastAction   = "ADD";
                _UpazilaInfo.MakeDT       = System.DateTime.Now;
                _UpazilaInfo.MakeBy       = "mtaka";
                var result = _IUoW.Repository <UpazilaInfo>().Add(_UpazilaInfo);
                #region Auth Log
                if (result == 1)
                {
                    _IAuthLogService = new AuthLogService();
                    long _outMaxSlAuthLogDtl = 0;
                    result = _IAuthLogService.AddAuthLog(_IUoW, null, _UpazilaInfo, "ADD", "0001", "090101006", 1, "UpazilaInfo", "MTK_CP_UPAZILA_INFO", "UpazilaId", _UpazilaInfo.UpazilaId, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl);
                }
                #endregion

                if (result == 1)
                {
                    _IUoW.Commit();
                }
                return(result);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddUpazilaInfo(obj)", string.Empty);
                return(0);
            }
        }
Esempio n. 2
0
        public HttpResponseMessage GetUpazilaInfoById(HttpRequestMessage reqObject)
        {
            string AccountStatusId = string.Empty;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _UpazilaInfo    = JsonConvert.DeserializeObject <UpazilaInfo>(_requestedDataObject.BusinessData);
                AccountStatusId = _UpazilaInfo.UpazilaId;
            }

            if (!string.IsNullOrWhiteSpace(AccountStatusId))
            {
                _UpazilaInfo = new UpazilaInfo();
                _UpazilaInfo = _IUpazilaInfoService.GetUpazilaInfoById(AccountStatusId);
            }
            if (_UpazilaInfo != null)
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(_UpazilaInfo, "information has been fetched successfully");
            }
            else
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(_UpazilaInfo, "Account Status Setup Not Found...");
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
Esempio n. 3
0
        public HttpResponseMessage DeleteUpazilaInfo(HttpRequestMessage reqObject)
        {
            int result = 0;

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

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

            result = _IUpazilaInfoService.DeleteUpazilaInfo(_UpazilaInfo);
            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);
        }
Esempio n. 4
0
        public HttpResponseMessage UpdateUpazilaInfo(HttpRequestMessage reqObject)
        {
            int result = 0;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _UpazilaInfo = JsonConvert.DeserializeObject <UpazilaInfo>(_requestedDataObject.BusinessData);
                bool IsValid = ModelValidation.TryValidateModel(_UpazilaInfo, out _modelErrorMsg);
                if (IsValid)
                {
                    result = _IUpazilaInfoService.UpdateUpazilaInfo(_UpazilaInfo);
                }
            }

            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);
        }
        public int UpdateUpazilaInfo(UpazilaInfo _UpazilaInfo)
        {
            try
            {
                int  result = 0;
                bool IsRecordExist;
                if (!string.IsNullOrWhiteSpace(_UpazilaInfo.UpazilaId))
                {
                    IsRecordExist = _IUoW.Repository <UpazilaInfo>().IsRecordExist(x => x.UpazilaId == _UpazilaInfo.UpazilaId);
                    if (IsRecordExist)
                    {
                        var _oldUpazilaInfo       = _IUoW.Repository <UpazilaInfo>().GetBy(x => x.UpazilaId == _UpazilaInfo.UpazilaId);
                        var _oldUpazilaInfoForLog = ObjectCopier.DeepCopy(_oldUpazilaInfo);

                        _oldUpazilaInfo.AuthStatusId = _UpazilaInfo.AuthStatusId = "U";
                        _oldUpazilaInfo.LastAction   = _UpazilaInfo.LastAction = "EDT";
                        _oldUpazilaInfo.LastUpdateDT = _UpazilaInfo.LastUpdateDT = System.DateTime.Now;
                        _UpazilaInfo.MakeBy          = "mtaka";
                        result = _IUoW.Repository <UpazilaInfo>().Update(_oldUpazilaInfo);

                        #region Testing Purpose
                        #endregion

                        #region Auth Log
                        if (result == 1)
                        {
                            _IAuthLogService = new AuthLogService();
                            long _outMaxSlAuthLogDtl = 0;
                            result = _IAuthLogService.AddAuthLog(_IUoW, _oldUpazilaInfoForLog, _UpazilaInfo, "EDT", "0001", "090101006", 1, "UpazilaInfo", "MTK_CP_UPAZILA_INFO", "UpazilaId", _UpazilaInfo.UpazilaId, "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, "UpdateUpazilaInfo(obj)", string.Empty);
                return(0);
            }
        }
 public UpazilaInfo GetUpazilaInfoBy(UpazilaInfo _UpazilaInfo)
 {
     try
     {
         if (_UpazilaInfo == null)
         {
             return(_UpazilaInfo);
         }
         return(_IUoW.Repository <UpazilaInfo>().GetBy(x => x.UpazilaId == _UpazilaInfo.UpazilaId &&
                                                       x.AuthStatusId == "A" &&
                                                       x.LastAction != "DEL"));
     }
     catch (Exception ex)
     {
         _ObjErrorLogService = new ErrorLogService();
         _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetUpazilaInfoBy(obj)", string.Empty);
         return(null);
     }
 }
Esempio n. 7
0
 public HttpResponseMessage GetUpazilaInfoBy(HttpRequestMessage reqObject)
 {
     _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
     if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
     {
         _UpazilaInfo = JsonConvert.DeserializeObject <UpazilaInfo>(_requestedDataObject.BusinessData);
         _UpazilaInfo = _IUpazilaInfoService.GetUpazilaInfoBy(_UpazilaInfo);
     }
     if (_UpazilaInfo != null)
     {
         _serviceResponse = _IDataManipulation.SetResponseObject(_UpazilaInfo, "information has been fetched successfully");
     }
     else
     {
         _serviceResponse = _IDataManipulation.SetResponseObject(_UpazilaInfo, "Account Status Setup Not Found...");
     }
     _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
     return(_response);
 }
        public List <UpazilaInfo> GetAllUpazilaInfo()
        {
            try
            {
                List <UpazilaInfo> OBJ_LIST_UpazilaInfo = new List <UpazilaInfo>();
                var _ListUpazilaInfo = _IUoW.Repository <UpazilaInfo>().Get(x => x.AuthStatusId == "A" && x.LastAction != "DEL").OrderByDescending(x => x.UpazilaId);
                foreach (var item in _ListUpazilaInfo)
                {
                    UpazilaInfo         OBJ_UpazilaInfo         = new UpazilaInfo();
                    DistrictInfoService OBJ_DistrictInfoService = new DistrictInfoService();

                    OBJ_UpazilaInfo.UpazilaId      = item.UpazilaId;
                    OBJ_UpazilaInfo.UpazilaNm      = item.UpazilaNm;
                    OBJ_UpazilaInfo.UpazilaShortNm = item.UpazilaShortNm;
                    OBJ_UpazilaInfo.DistrictId     = item.DistrictId;
                    foreach (var item1 in OBJ_DistrictInfoService.GetDistrictInfoForDD())
                    {
                        if (item1.Value == OBJ_UpazilaInfo.DistrictId)
                        {
                            OBJ_UpazilaInfo.DistrictNm = item1.Text;
                        }
                    }
                    OBJ_UpazilaInfo.AuthStatusId = item.AuthStatusId;
                    OBJ_UpazilaInfo.LastAction   = item.LastAction;
                    OBJ_UpazilaInfo.LastUpdateDT = item.LastUpdateDT;
                    OBJ_UpazilaInfo.MakeBy       = item.MakeBy;
                    OBJ_UpazilaInfo.MakeDT       = item.MakeDT;
                    OBJ_UpazilaInfo.TransDT      = item.TransDT;
                    OBJ_LIST_UpazilaInfo.Add(OBJ_UpazilaInfo);
                }
                return(OBJ_LIST_UpazilaInfo);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetAllUpazilaInfo()", string.Empty);
                return(null);
            }
        }