public HttpResponseMessage GetPromoCodeConfigById(HttpRequestMessage reqObject)
        {
            string ConfigurationId = string.Empty;

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

            if (!string.IsNullOrWhiteSpace(ConfigurationId))
            {
                _PromoCodeConfig = new PromoCodeConfig();
                _PromoCodeConfig = _IPromoCodeConfigService.GetPromoCodeConfigById(ConfigurationId);
            }
            if (_PromoCodeConfig != null)
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(_PromoCodeConfig, "information has been fetched successfully");
            }
            else
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(_PromoCodeConfig, "Promo Code Configuration Not Found...");
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
        public HttpResponseMessage DeletePromoCodeConfig(HttpRequestMessage reqObject)
        {
            int result = 0;

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

            if (_PromoCodeConfig == null || string.IsNullOrWhiteSpace(_PromoCodeConfig.ConfigurationId))
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, "StatusWise Service Map Id Not Found...");
                _response        = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
                return(_response);
            }

            result = _IPromoCodeConfigService.DeletePromoCodeConfig(_PromoCodeConfig);
            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 UpdatePromoCodeConfig(HttpRequestMessage reqObject)
        {
            int result = 0;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _PromoCodeConfig = JsonConvert.DeserializeObject <PromoCodeConfig>(_requestedDataObject.BusinessData);
                bool IsValid = ModelValidation.TryValidateModel(_PromoCodeConfig, out _modelErrorMsg);
                if (IsValid)
                {
                    result = _IPromoCodeConfigService.AddOrUpdatePromoCodeConfig(_PromoCodeConfig);
                }
            }

            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);
        }
예제 #4
0
 public PromoCodeConfig GetPromoCodeConfigBy(PromoCodeConfig _PromoCodeConfigBy)
 {
     try
     {
         if (_PromoCodeConfigBy == null)
         {
             return(_PromoCodeConfigBy);
         }
         return(_IUoW.Repository <PromoCodeConfig>().GetBy(x => x.ConfigurationId == _PromoCodeConfigBy.ConfigurationId &&
                                                           x.AuthStatusId != "D" &&
                                                           x.LastAction != "DEL"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
        public int DeletePromoCodeConfig(PromoCodeConfig _PromoCodeConfig)
        {
            try
            {
                int  result = 0;
                bool IsRecordExist;
                if (!string.IsNullOrWhiteSpace(_PromoCodeConfig.ConfigurationId))
                {
                    IsRecordExist = _IUoW.Repository <PromoCodeConfig>().IsRecordExist(x => x.ConfigurationId == _PromoCodeConfig.ConfigurationId);
                    if (IsRecordExist)
                    {
                        var _oldPromoCodeConfig       = _IUoW.Repository <PromoCodeConfig>().GetBy(x => x.ConfigurationId == _PromoCodeConfig.ConfigurationId);
                        var _oldPromoCodeConfigForLog = ObjectCopier.DeepCopy(_oldPromoCodeConfig);

                        _oldPromoCodeConfig.AuthStatusId = _PromoCodeConfig.AuthStatusId = "U";
                        _oldPromoCodeConfig.LastAction   = _PromoCodeConfig.LastAction = "DEL";
                        _oldPromoCodeConfig.LastUpdateDT = _PromoCodeConfig.LastUpdateDT = System.DateTime.Now;
                        result = _IUoW.Repository <PromoCodeConfig>().Update(_oldPromoCodeConfig);

                        #region Auth Log
                        if (result == 1)
                        {
                            _IAuthLogService = new AuthLogService();
                            long _outMaxSlAuthLogDtl = 0;
                            _IAuthLogService.AddAuthLog(_IUoW, _oldPromoCodeConfigForLog, _PromoCodeConfig, "DEL", "0001", _PromoCodeConfig.FunctionId, 1, "PromoCodeConfig", "MTK_SP_PROMO_CODE_CONFIG", "ConfigurationId", _PromoCodeConfig.ConfigurationId, _PromoCodeConfig.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl);
                        }
                        #endregion

                        if (result == 1)
                        {
                            _IUoW.Commit();
                        }
                        return(result);
                    }
                    //result = _IUoW.Repository<PromoCodeConfig>().Delete(_PromoCodeConfig);
                    return(result);
                }
                return(result);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "DeletePromoCodeConfig(obj)", string.Empty);
                return(0);
            }
        }
 public HttpResponseMessage GetPromoCodeConfigBy(HttpRequestMessage reqObject)
 {
     _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
     if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
     {
         _PromoCodeConfig = JsonConvert.DeserializeObject <PromoCodeConfig>(_requestedDataObject.BusinessData);
         _PromoCodeConfig = _IPromoCodeConfigService.GetPromoCodeConfigBy(_PromoCodeConfig);
     }
     if (_PromoCodeConfig != null)
     {
         _serviceResponse = _IDataManipulation.SetResponseObject(_PromoCodeConfig, "information has been fetched successfully");
     }
     else
     {
         _serviceResponse = _IDataManipulation.SetResponseObject(_PromoCodeConfig, "Promo Code Configuration Not Found...");
     }
     _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
     return(_response);
 }
예제 #7
0
        public int AddOrUpdatePromoCodeConfig(PromoCodeConfig _PromoCodeConfig)
        {
            try
            {
                int  result = 0;
                bool IsRecordExist;
                var  _IfExistPromoCodeConfig = _IUoW.Repository <PromoCodeConfig>().GetAll();
                if (_IfExistPromoCodeConfig.Count == 0)
                {
                    var _max = _IUoW.Repository <PromoCodeConfig>().GetMaxValue(x => x.ConfigurationId) + 1;
                    _PromoCodeConfig.ConfigurationId = _max.ToString().PadLeft(3, '0');
                    _PromoCodeConfig.AuthStatusId    = "A";
                    _PromoCodeConfig.LastAction      = "ADD";
                    _PromoCodeConfig.MakeBy          = "mTaka";
                    _PromoCodeConfig.MakeDT          = System.DateTime.Now;
                    #region Checked True/False
                    if (_PromoCodeConfig.IntroducerControlFlag == "True")
                    {
                        _PromoCodeConfig.IntroducerControlFlag = "1";
                    }
                    else
                    {
                        _PromoCodeConfig.IntroducerControlFlag = "0";
                    }
                    if (_PromoCodeConfig.EmailFlag == "True")
                    {
                        _PromoCodeConfig.EmailFlag = "1";
                    }
                    else
                    {
                        _PromoCodeConfig.EmailFlag = "0";
                    }
                    if (_PromoCodeConfig.SMSFlag == "True")
                    {
                        _PromoCodeConfig.SMSFlag = "1";
                    }
                    else
                    {
                        _PromoCodeConfig.SMSFlag = "0";
                    }
                    #endregion
                    result = _IUoW.Repository <PromoCodeConfig>().Add(_PromoCodeConfig);
                    #region Auth Log
                    if (result == 1)
                    {
                        _IAuthLogService = new AuthLogService();
                        long _outMaxSlAuthLogDtl = 0;
                        _IAuthLogService.AddAuthLog(_IUoW, null, _PromoCodeConfig, "ADD", "0001", _PromoCodeConfig.FunctionId, 1, "PromoCodeConfig", "MTK_SP_PROMO_CODE_CONFIG", "ConfigurationId", _PromoCodeConfig.ConfigurationId, _PromoCodeConfig.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl);
                    }
                    #endregion

                    if (result == 1)
                    {
                        _IUoW.Commit();
                    }
                    return(result);
                }
                if (_IfExistPromoCodeConfig.Count != 0)
                {
                    if (!string.IsNullOrWhiteSpace(_PromoCodeConfig.ConfigurationId))
                    {
                        var _oldPromoCodeConfig = _IUoW.Repository <PromoCodeConfig>().GetBy(x => x.ConfigurationId == _PromoCodeConfig.ConfigurationId);
                        if (_oldPromoCodeConfig != null)
                        {
                            var _oldPromoCodeConfigForLog = ObjectCopier.DeepCopy(_oldPromoCodeConfig);

                            _oldPromoCodeConfig.AuthStatusId = _PromoCodeConfig.AuthStatusId = "U";
                            _oldPromoCodeConfig.LastAction   = _PromoCodeConfig.LastAction = "EDT";
                            _oldPromoCodeConfig.LastUpdateDT = _PromoCodeConfig.LastUpdateDT = System.DateTime.Now;
                            _PromoCodeConfig.MakeBy          = "mtaka";
                            result = _IUoW.Repository <PromoCodeConfig>().Update(_oldPromoCodeConfig);

                            #region Auth Log
                            if (result == 1)
                            {
                                _IAuthLogService = new AuthLogService();
                                long _outMaxSlAuthLogDtl = 0;
                                _IAuthLogService.AddAuthLog(_IUoW, _oldPromoCodeConfigForLog, _PromoCodeConfig, "EDT", "0001", _PromoCodeConfig.FunctionId, 1, "PromoCodeConfig", "MTK_SP_PROMO_CODE_CONFIG", "ConfigurationId", _PromoCodeConfig.ConfigurationId, _PromoCodeConfig.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl);
                            }
                            #endregion

                            if (result == 1)
                            {
                                _IUoW.Commit();
                            }
                            return(result);
                        }
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "UpdatePromoCodeConfig(obj)", string.Empty);
                return(0);
            }
        }