public ResponseModel UpdateBroadcastConfiguration([FromBody] StoreBroadcastConfiguration storeBroadcastConfiguration)
        {
            int UpdateCount = 0;
            StoreCampaignCaller storecampaigncaller = new StoreCampaignCaller();
            ResponseModel       objResponseModel    = new ResponseModel();
            int    statusCode    = 0;
            string statusMessage = "";

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                UpdateCount = storecampaigncaller.UpdateBroadcastConfiguration(new StoreCampaignService(_connectioSting),
                                                                               storeBroadcastConfiguration, authenticate.UserMasterID);
                statusCode =
                    UpdateCount.Equals(0) ?
                    (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);

                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = statusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = UpdateCount;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
Beispiel #2
0
        /// <summary>
        /// GetBroadcastConfiguration
        /// </summary>
        /// <param name="TenantId"></param>
        /// <param name="UserId"></param>
        /// <param name="ProgramCode"></param>
        /// <returns></returns>
        public StoreBroadcastConfiguration GetBroadcastConfiguration(int tenantId, int userId, string programCode)
        {
            DataSet ds = new DataSet();
            StoreBroadcastConfiguration storeBroadcastConfiguration = new StoreBroadcastConfiguration();

            try
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SP_HSGetBroadcastConfigurationList", conn)
                {
                    CommandType = CommandType.StoredProcedure
                };
                cmd.Parameters.AddWithValue("@_tenantID", tenantId);
                cmd.Parameters.AddWithValue("@UserID", userId);
                cmd.Parameters.AddWithValue("@_prgramCode", programCode);

                MySqlDataAdapter da = new MySqlDataAdapter
                {
                    SelectCommand = cmd
                };
                da.Fill(ds);

                if (ds != null && ds.Tables[0] != null)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        storeBroadcastConfiguration.ID = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"]);
                        storeBroadcastConfiguration.MaxClickAllowed          = ds.Tables[0].Rows[0]["MaxClickAllowed"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["MaxClickAllowed"]);
                        storeBroadcastConfiguration.EnableClickAfterValue    = ds.Tables[0].Rows[0]["EnableClickAfterValue"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["EnableClickAfterValue"]);
                        storeBroadcastConfiguration.EnableClickAfterDuration = ds.Tables[0].Rows[0]["EnableClickAfterDuration"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[0]["EnableClickAfterDuration"]);
                        storeBroadcastConfiguration.Programcode  = ds.Tables[0].Rows[0]["Programcode"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[0]["Programcode"]);
                        storeBroadcastConfiguration.SmsFlag      = ds.Tables[0].Rows[0]["SmsFlag"] == DBNull.Value ? false : Convert.ToBoolean(ds.Tables[0].Rows[0]["SmsFlag"]);
                        storeBroadcastConfiguration.EmailFlag    = ds.Tables[0].Rows[0]["EmailFlag"] == DBNull.Value ? false : Convert.ToBoolean(ds.Tables[0].Rows[0]["EmailFlag"]);
                        storeBroadcastConfiguration.WhatsappFlag = ds.Tables[0].Rows[0]["WhatsappFlag"] == DBNull.Value ? false : Convert.ToBoolean(ds.Tables[0].Rows[0]["WhatsappFlag"]);
                        storeBroadcastConfiguration.ProviderName = ds.Tables[0].Rows[0]["ProviderName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[0]["ProviderName"]);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (ds != null)
                {
                    ds.Dispose();
                }
            }
            return(storeBroadcastConfiguration);
        }
Beispiel #3
0
        /// <summary>
        /// Update Broadcast Configuration
        /// </summary>
        /// <param name="storeBroadcastConfiguration"></param>
        /// <param name="modifiedBy"></param>
        /// <returns></returns>
        public int UpdateBroadcastConfiguration(StoreBroadcastConfiguration storeBroadcastConfiguration, int modifiedBy)
        {
            int UpdateCount = 0;

            try
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SP_HSUpdateBroadcastConfiguration", conn)
                {
                    Connection = conn
                };
                cmd.Parameters.AddWithValue("@_ID", storeBroadcastConfiguration.ID);
                cmd.Parameters.AddWithValue("@_MaxClickAllowed", storeBroadcastConfiguration.MaxClickAllowed);
                cmd.Parameters.AddWithValue("@_EnableClickAfterValue", storeBroadcastConfiguration.EnableClickAfterValue);
                cmd.Parameters.AddWithValue("@_EnableClickAfterDuration", storeBroadcastConfiguration.EnableClickAfterDuration);
                cmd.Parameters.AddWithValue("@_ModifiedBy", modifiedBy);
                cmd.Parameters.AddWithValue("@_SmsFlag", Convert.ToInt16(storeBroadcastConfiguration.SmsFlag));
                cmd.Parameters.AddWithValue("@_EmailFlag", Convert.ToInt16(storeBroadcastConfiguration.EmailFlag));
                cmd.Parameters.AddWithValue("@_WhatsappFlag", Convert.ToInt16(storeBroadcastConfiguration.WhatsappFlag));
                cmd.Parameters.AddWithValue("@_ProviderName", Convert.ToString(storeBroadcastConfiguration.ProviderName));

                cmd.CommandType = CommandType.StoredProcedure;
                UpdateCount     = Convert.ToInt32(cmd.ExecuteNonQuery());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }

            return(UpdateCount);
        }
Beispiel #4
0
 public int UpdateBroadcastConfiguration(IStoreCampaign Campaign, StoreBroadcastConfiguration storeBroadcastConfiguration, int modifiedBy)
 {
     _CampaignRepository = Campaign;
     return(_CampaignRepository.UpdateBroadcastConfiguration(storeBroadcastConfiguration, modifiedBy));
 }