public HttpResponseMessage TransactionSearch(HttpRequestMessage req, DL_TransactionSearch tranSearch)
        {
            User user = new User()
            {
                Password = tranSearch.Key, UserId = tranSearch.UserId
            };

            Validation.UserCheck(user);

            if (Validation._IsSuccess)
            {
                try
                {
                    // Logger.WriteLog(LogLevelL4N.INFO, "Params | UserId : " + trans.UserId + "UserType :" + trans.Pass + " FromDate : " + trans.FromDate + " ToDate :" + trans.ToDate);
                    if (tranSearch != null && !string.IsNullOrEmpty(tranSearch.UserId) && !string.IsNullOrEmpty(tranSearch.Key))
                    {
                        if (string.IsNullOrEmpty(tranSearch.Value))
                        {
                            tranSearch.Value = null;
                        }
                        if (tranSearch.TypeId < 0)
                        {
                            tranSearch.TypeId = 0;
                        }


                        DL_TransactionReturn tranSearchReturn = dash.TransactionSearch(tranSearch);
                        if (dash._IsSuccess)
                        {
                            return(req.CreateResponse <DL_TransactionReturn>(HttpStatusCode.OK, tranSearchReturn));
                        }
                        else
                        {
                            return(req.CreateErrorResponse(HttpStatusCode.InternalServerError, "ServerError"));
                        }
                    }
                    Logger.WriteLog(LogLevelL4N.FATAL, "Bad Request");
                    return(req.CreateResponse(HttpStatusCode.BadRequest, "Bad Request"));
                }
                catch (Exception ex)
                {
                    Logger.WriteLog(LogLevelL4N.ERROR, "Inside the transactionDetails api | Error : " + ex.Message);
                }
            }
            Logger.WriteLog(LogLevelL4N.FATAL, "Unauthorized Request");
            return(req.CreateResponse(HttpStatusCode.Unauthorized, "Unauthorized"));
        }
        public DL_TransactionReturn TransactionSearch(DL_TransactionSearch tranSearch)
        {
            this.transReturn = new DL_TransactionReturn();
            this.SpName      = DL_StoreProcedure.SP_DHS_API_GetTransactionSearch; //Sp Name
            this._IsSuccess  = true;
            try
            {
                SqlParameter[] param = new SqlParameter[3];
                param[0] = new SqlParameter("@UserId", tranSearch.UserId);
                param[1] = new SqlParameter("@Value", tranSearch.Value);
                param[2] = new SqlParameter("@TypeId", tranSearch.TypeId);
                this.ds  = db.GetDataSet(this.SpName, param);
                if (this.ds != null && this.ds.Tables.Count > 0)
                {
                    //ds.Tables
                    var Json = JsonConvert.SerializeObject(ds.Tables[0], Formatting.None);
                    List <DL_TransactionReturns> transReturns = JsonConvert.DeserializeObject <List <DL_TransactionReturns> >(Json);
                    double totalAmount = 0, totalProfit = 0;

                    foreach (var item in transReturns)
                    {
                        totalAmount += Convert.ToDouble(item.Amount);
                        totalProfit += Convert.ToDouble(item.Profit);
                    }

                    transReturn.dL_TransactionReturns = transReturns;
                    transReturn.TotalAmount           = totalAmount; transReturn.TotalProfit = totalProfit;
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(LogLevelL4N.ERROR, "Exception : " + ex.Message);
                this._IsSuccess = false;
            }

            return(this.transReturn);
        }