public string TrackMissedCall(string clid, string calltime, string called)
        {
            string    sYear           = DateTime.Now.Year.ToString();
            string    sMonth          = DateTime.Now.Month.ToString();
            string    sDay            = DateTime.Now.Day.ToString();
            string    sErrorTime      = sYear + sMonth + sDay;
            string    filePath        = HttpContext.Current.Server.MapPath("~/App_Data/TrackMissedCall_" + sErrorTime + ".log");
            LogEvents log             = new LogEvents();
            string    TataBSSResponse = "";

            try
            {
                MissedCall objMissedCall = new MissedCall();
                objMissedCall.CallTo   = called;
                objMissedCall.CallFrom = clid;
                objMissedCall.Provider = "NA";
                objMissedCall.Location = "NA";
                objMissedCall.Source   = "MissedCall";
                TataBSSResponse        = PostToTata(objMissedCall);
                log.Logevent("clid = " + clid + " calltime = " + calltime + " called= " + called + " TataBSSResponse = " + TataBSSResponse, filePath);
                return("success");
            }
            catch (Exception ex)
            {
                log.Logevent(ex.Message, filePath);
                return("fail");
            }
        }
        public HttpResponseMessage Post(TeleSales value)
        {
            string sYear      = DateTime.Now.Year.ToString();
            string sMonth     = DateTime.Now.Month.ToString();
            string sDay       = DateTime.Now.Day.ToString();
            string sErrorTime = sYear + sMonth + sDay;
            //string strUserAgent = HttpContext.Current.Request.UserAgent.ToString().ToLower();
            //bool result = HttpContext.Current.Request.Browser.IsMobileDevice;
            string    filePath = HttpContext.Current.Server.MapPath("~/App_Data/TeleSalesEvent_" + sErrorTime + ".log");
            LogEvents log      = new LogEvents();

            //log.Logevent(headers, filePath);
            try
            {
                TeleSales objTele = new TeleSales();
                string    result  = objTele.ValidateData(value);
                if (result == "")
                {
                    if (Membership.ValidateUser(value.UserName, value.Password))
                    {
                        AcceesModel obj = new AcceesModel();
                        ;
                        obj.GetResult("SetTeleSalesStagingData " +
                                      value.TeleSalesId + ",'" + value.MerchantName + "','" + value.FNAME + "','" + value.MNAME + "','" + value.LNAME + "','" + value.PhoneNo + "','" + value.CampaignCode + "','" + value.LeadPhoneNo + "','" + value.MissedCall + "','" +
                                      value.DateandTime.ToString("MM-dd-yyyy hh:mm:ss") + "','" + value.Circle + "','" + value.Operator + "','" + value.YourName + "','" + value.Email + "','" + value.City + "'," + value.NoofYearinBusiness + ",'" + value.LoanAmount + "','" + value.Avgsalespermonth +
                                      "','" + value.Source + "','" + value.DOB + "','" + value.ADDRESSOfResidence + "','" + value.ADDRESSOfShop + "','" + value.AddressPinCode + "','" + value.ShopPinCode + "','" + value.Industry + "'"
                                      );
                        log.Logevent(value, filePath);
                        return(Request.CreateResponse(HttpStatusCode.OK, "Data Saved Successfully"));
                    }
                    else
                    {
                        log.Logevent("Authentication Failed", filePath);
                        return(Request.CreateResponse(HttpStatusCode.BadRequest, "Authentication Failed"));
                    }
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, result));
                }
            }
            catch (Exception ex)
            {
                log.Logevent(ex.Message, filePath);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message.ToString()));
            }
        }
    void IResultFilter.OnResultExecuted(ResultExecutedContext filterContext)
    {
        filterContext.Controller.ViewBag.OnResultExecuted = "IResultFilter.OnResultExecuted filter called";
        NameValueCollection headers = HttpContext.Current.Request.Headers;
        string    sYear             = DateTime.Now.Year.ToString();
        string    sMonth            = DateTime.Now.Month.ToString();
        string    sDay       = DateTime.Now.Day.ToString();
        string    sErrorTime = sYear + sMonth + sDay;
        string    filePath   = filterContext.HttpContext.Server.MapPath("~/App_Data/Event_" + sErrorTime + ".log");
        LogEvents log        = new LogEvents();

        log.Logevent(headers, filePath);
    }
    void IAuthorizationFilter.OnAuthorization(AuthorizationContext filterContext)
    {
        filterContext.Controller.ViewBag.OnAuthorization = "IAuthorizationFilter.OnAuthorization filter called";
        NameValueCollection headers = HttpContext.Current.Request.Headers;
        string sYear      = DateTime.Now.Year.ToString();
        string sMonth     = DateTime.Now.Month.ToString();
        string sDay       = DateTime.Now.Day.ToString();
        string sErrorTime = sYear + sMonth + sDay;
        //string strUserAgent = HttpContext.Current.Request.UserAgent.ToString().ToLower();
        //bool result = HttpContext.Current.Request.Browser.IsMobileDevice;
        string    filePath = filterContext.HttpContext.Server.MapPath("~/App_Data/Event_" + sErrorTime + ".log");
        LogEvents log      = new LogEvents();

        log.Logevent(headers, filePath);
    }
        public string TeleSalesPost(TelesalesPost val)
        {
            string    sYear      = DateTime.Now.Year.ToString();
            string    sMonth     = DateTime.Now.Month.ToString();
            string    sDay       = DateTime.Now.Day.ToString();
            string    sErrorTime = sYear + sMonth + sDay;
            string    filePath   = HttpContext.Server.MapPath("~/App_Data/Event_" + sErrorTime + ".log");
            LogEvents objLog     = new LogEvents();

            try
            {
                objLog.Logevent("Started Post", filePath);
                AcceesModel obj = new AcceesModel();
                obj.GetResult("SetTeleSalesData " +
                              +val._TelesalesId + ","
                              + val._UniqueId + ","
                              + val._Industry + ","
                              + val._ProductFamily + ","
                              + val._ProductCode + ","
                              + "'" + val._PurposeOfLoan + "',"
                              + val._LeadSource + ","
                              + val._Branch + ","
                              + val._LOAN_AMOUNT + ","
                              + "'" + val._MerchantName + "',"
                              + "'" + val._Title + "',"
                              + "'" + val._FNAME + "',"
                              + "'" + val._MNAME + "',"
                              + "'" + val._LNAME + "',"
                              + "'" + val._DOB + "',"
                              + "'" + val._SEX + "',"
                              + "'" + val._ADDRESS1 + "',"
                              + val._Country + ","
                              + "'" + val._STATE + "',"
                              + val._City + ","
                              + "'" + val._ZIPCODE + "',"
                              + "'" + val._PAN_NO + "',"
                              + "'" + val._PHONENO + "',"
                              + "'" + val._AddedBy + "',"
                              + "'" + val._EmailId + "',"
                              + val._BusinessPremises + ","
                              + val._BusinessStability + ","
                              + val._ResidencePremises + ","
                              + "'" + val._Acquirerbank + "',"
                              + val._Anyexistingbusinessloanongoing + ","
                              + val._cardsales + ","
                              + val._EMI + ","
                              + val._Noofbranches + ","
                              + val._Noofcurrentaccounts + ","
                              + val._Noofemployees + ","
                              + val._Noofsalestransactionspermonth + ","
                              + val._Noofterminals + ","
                              + "'" + val._Relationshipwithentity + "',"
                              + val._Totalamountoftransactionspermonth + ","
                              + "''"
                              );
                objLog.Logevent("Post Complete", filePath);
                return("Complete");
            }
            catch (Exception ex)
            {
                objLog.Logevent("Error Occured on TeleSalesPost at " + DateTime.Now.ToString() + " : " + ex.Message, filePath);
                return("Error");
            }
        }