LittleDemon WebShell


Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64
Path : /home/devsafetybis/.trash/yuvatrip.com/App_Code/
File Upload :
Command :
Current File : /home/devsafetybis/.trash/yuvatrip.com/App_Code/btcCommon.cs

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Dynamic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Xml;
using System.Xml.Serialization;
namespace btcYuvatrip.Common
{
     
    public class Status
    {
        public string StatusCode { get; set; }
        public string Description { get; set; }
    }
    public class MethodStatus : Status
    {
        public string MethodName { get; set; }
        protected internal MethodStatus() { }
        public MethodStatus(string methodName, string status, string description)
        {
            MethodName = methodName;
            StatusCode = status;
            Description = description;
        }
    }
    public class ProcStatus : MethodStatus
    {
        public int Count { get; set; }
        public bool HasRow { get; set; }
        public bool HasError { get; set; }
        public ProcStatus() { }
        public ProcStatus(string methodName, int count, bool hasRow, bool hasError, string statusCode, string description)
        {
            MethodName = methodName;
            Count = count;
            HasRow = hasRow;
            HasError = hasError;
            StatusCode = statusCode;
            Description = description;
        }

    }
    public class Process
    {
        public List<MethodStatus> Method { get; set; }
        protected internal Process() { }
        protected internal Process(MethodStatus method)
        {
            Method = new List<MethodStatus>();
            Method.Add(method);
        }
    }
    public class ProcessList : ProcStatus
    {
        public List<Process> Process { get; set; }
        protected internal ProcessList() { }
        protected internal ProcessList(Process process)
        {
            Process = new List<Process>();
            Process.Add(process);
        }
    }    
    public class YTLog
    {

        public string EmployeeID { get; set; }
        public string ClientID { get; set; }
        public string Group { get; set; }
        public string Method { get; set; }
        public string TableInfo { get; set; }
        public void Write()
        {
            string QueryString = "Insert into Log([EmployeeID], [ClientID], [Group], [Method], [Description])Values(@EmployeeID, @ClientID, @Group, @Method, @Description)";
            BtcDButility Connection = new BtcDButility();
            SqlCommand Command = new SqlCommand(QueryString, Connection.Connect());
            Command.CommandType = CommandType.Text;
            Command.Parameters.Add(new SqlParameter("@EmployeeID", HttpContext.Current.Session["EmployeeID"] == null ? "" : HttpContext.Current.Session["EmployeeID"].ToString()));
            Command.Parameters.Add(new SqlParameter("@ClientID", HttpContext.Current.Session["ContactID"] == null ? "" : HttpContext.Current.Session["ClientID"].ToString() + "-" + HttpContext.Current.Session["ContactID"].ToString()));
            Command.Parameters.Add(new SqlParameter("@Group", Group));
            Command.Parameters.Add(new SqlParameter("@Method", Method));
            Command.Parameters.Add(new SqlParameter("@Description", TableInfo));
            Command.ExecuteNonQuery();
            Connection.CloseConnectionAndNullify();
        }
    }
    public class SQLHelper
    {
        public SqlCommand CreateSQLParameter(object obj)
        {
            SqlCommand Command = new SqlCommand();
            Type ObjectType = obj.GetType();
            PropertyInfo[] objMember = ObjectType.GetProperties();

            foreach (MemberInfo member in objMember)
            {
                var gt = ObjectType.GetProperty(member.Name);
                var value = ObjectType.GetProperty(member.Name).GetValue(obj);
                SqlParameter parameter = new SqlParameter();
                parameter.ParameterName = "@" + member.Name.ToString();
                parameter.Value = value == null ? (object)DBNull.Value : value;
                if (gt.PropertyType.BaseType.Name == "Enum")
                {
                    parameter.SqlDbType = SqlDbType.NVarChar;
                }

                Command.Parameters.Add(parameter);
            }

            return Command;
        }
    }
    public class SaveXML
    {
        public string MethodName { get; set; }
        public string ClientID { get; set; }
        public string SearchID { get; set; }
        public string SessionID { get; set; }
        public string ObjectSet { get; set; }
        public string OldClientID { get; set; }

        public string Serialize<T>(T obj, bool write)
        {
            XmlSerializer xs = null;
            StringWriter sw = null;
            try
            {
                xs = new XmlSerializer(typeof(T));
                sw = new StringWriter();
                xs.Serialize(sw, obj);
                sw.Flush();
                if (write)
                {
                    ObjectSet = sw.ToString();
                    Write();
                }

            }
            catch (Exception exception) { return exception.Message; }
            finally
            {
                if (sw != null)
                {
                    sw.Close();
                    sw.Dispose();
                }
            }
            return sw.ToString();
        }
        public string Write()
        {
            try
            {
                string type = SearchID + "_" + OldClientID + "_" + MethodName + "_" + SessionID;
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(ObjectSet);
                doc.PreserveWhitespace = true;
                string path = HttpContext.Current.Server.MapPath("~/API/") + type + ".xml";
                doc.Save(HttpContext.Current.Server.MapPath("~/API/") + type + ".xml");


            }
            catch (Exception exception)
            {
                return exception.Message;
            }
            return "Write Successful.";
        }
        public XmlReader Read()
        {
            XmlReader reader;
            FileStream fs;
            try
            {
                string type = SearchID + "_" + OldClientID + "_" + MethodName + "_" + SessionID;
                fs = new FileStream(HttpContext.Current.Server.MapPath("~/API/") + type + ".xml", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read);
                reader = XmlReader.Create(fs);

            }
            catch { throw; }
            finally { }
            return reader;
        }
    }
    public sealed class CommonFunction
    {
        public static string TitleCase(string value)
        {
            if (!String.IsNullOrEmpty(value) && !String.IsNullOrWhiteSpace(value))
            {
                return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(value.Trim().ToLower());
            }
            else
            {
                return String.Empty;
            }
        }
        public static string GenerateOTP()
        {
            string strPwdchar = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            string OTP = "";
            Random rnd = new Random();
            for (int i = 1; i <= 6; i++)
            {
                int iRandom = rnd.Next(0, strPwdchar.Length - 1);
                OTP += strPwdchar.Substring(iRandom, 1);
            }
            return OTP;
        }
        public static string GeneratePassword()
        {
            string strPwdchar = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            string OTP = "";
            Random rnd = new Random();
            for (int i = 1; i <= 8; i++)
            {
                int iRandom = rnd.Next(0, strPwdchar.Length - 1);
                OTP += strPwdchar.Substring(iRandom, 1);
            }
            return OTP;
        }
        public static string GenerateMobileVerification()
        {
            string strPwdchar = "0123456789";
            string OTP = "";
            Random rnd = new Random();
            for (int i = 1; i <= 6; i++)
            {
                int iRandom = rnd.Next(0, strPwdchar.Length - 1);
                OTP += strPwdchar.Substring(iRandom, 1);
            }
            return OTP;
        }
    }


    public class ClientFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ClientFilter(FilterByClient filterByClient, string value)
        {
            Key = filterByClient.ToString();
            Value = value;
        }
    }
    public enum FilterByClient
    {
        ID,
        Name,
        EmailID,
        IsEmailVerified,
        Type,
        Source,
    }
    public enum ClientType
    {
        Customer,
        Supplier,
        Corporate,
        Agent,
    }
    public enum ClientSource
    {
        Mailer,
        Event,
        Sales,
        Promotion,
        Offline,
        Online,
    }
    public class ClientAddressFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ClientAddressFilter(FilterByClientaddress filterByClientaddress, string value)
        {
            Key = filterByClientaddress.ToString();
            Value = value;
        }
    }
    public enum FilterByClientaddress
    {
        ClientID,
        City,
    }
    public class ClientAdditionalInfoFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ClientAdditionalInfoFilter(FilterByClientAdditionalInfo filterByClientAdditionalInfo, string value)
        {
            Key = filterByClientAdditionalInfo.ToString();
            Value = value;
        }
    }
    public enum FilterByClientAdditionalInfo
    {
        ClientID,
    }
    public class ClientOfficialInfoFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ClientOfficialInfoFilter(FilterByClientOfficialInfo filterByClientOfficialInfo, string value)
        {
            Key = filterByClientOfficialInfo.ToString();
            Value = value;
        }
    }
    public enum FilterByClientOfficialInfo
    {
        ClientID,
        IsRegistrationComplete,
        IsAuthorized,
    }
    public class ContactFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ContactFilter(FilterByContact filterByContact, string value)
        {
            Key = filterByContact.ToString();
            Value = value;
        }
    }
    public enum FilterByContact
    {
        ID,
        Name,
        EmailID,
        MobileNo,
        IsAdministrator,
    }
    public class ContactPasswordFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ContactPasswordFilter(FilterByContactPassword filterByContactPassword, string value)
        {
            Key = filterByContactPassword.ToString();
            Value = value;
        }
    }
    public enum FilterByContactPassword
    {
        ContactID,
    }
   
    public class ClientAccountSettingFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ClientAccountSettingFilter(FilterByClientAccountSetting filterByClientAccountSetting, string value)
        {
            Key = filterByClientAccountSetting.ToString();
            Value = value;
        }
    }
    public enum FilterByClientAccountSetting
    {
        ClientID,
        DomMarkupType,
        IntMarkupType,
    }
    public enum MarkupType
    {
        Percentage,
        Flat,
    }
    public class AdminMarkupFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public AdminMarkupFilter(FilterByAdminMarkup filterByAdminMarkup, string value)
        {
            Key = filterByAdminMarkup.ToString();
            Value = value;
        }
    }
    public enum FilterByAdminMarkup
    {
        ManagerAccountId,
        ClientID,
    }
    public class YTFlightMarkupFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public YTFlightMarkupFilter(FilterByYTFlightMarkup filterByYTFlightMarkup, string value)
        {
            Key = filterByYTFlightMarkup.ToString();
            Value = value;
        }
    }
    public enum FilterByYTFlightMarkup
    {
        ID,
        Name,
        DomMarkupType,
        DomMarkupAmount,
        DomInfantMarkupAmount,
        DomNonCommMarkupAmount,
        DomNonRefMarkupAmount,
        IntMarkupType,
        IntMarkupAmount,
        IntInfantMarkupAmount,
        IntNonCommMarkupAmount,
        IntNonRefMarkupAmount,
    }
    public class PaymentTransactionFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public PaymentTransactionFilter(FilterByPaymentTransaction filterByPaymentTransaction, string value)
        {
            Key = filterByPaymentTransaction.ToString();
            Value = value;
        }
    }
    public enum FilterByPaymentTransaction
    {
        ID,
        Mode,
        ModeType,
        Amount,
    }
    public enum PaymentTransactionMode
    {
        Offline,
        Online,
    }
    public enum PaymentTransactionModeType
    {
        ITZCash,
        AirtelMoney,
        NetBanking,
        DebitCard,
        AmexCard,
        CreditCard,
        ATMTransfer,
        NEFT_RTGS,
        Draft,
        Cheque,
        Cash,
    }

    public class YTAccountFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public YTAccountFilter(FilterByYTAccount filterByYTAccount, string value)
        {
            Key = filterByYTAccount.ToString();
            Value = value;
        }
    }
    public enum FilterByYTAccount
    {
        ID,
        Name,
        Type,
    }
    public enum YTAccountType
    {
        YTCR,
        DPCRDI,
        DPCR,
        CASHDI,
        CASH,
    }
    public class BookingFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public BookingFilter(FilterByBooking filterByBooking, string value)
        {
            Key = filterByBooking.ToString();
            Value = value;
        }
    }
    public enum FilterByBooking
    {
        ID,
        TripStartDate,
        Origin,
        Destination,
        Status,
        Adult,
    }
    public enum BookingServicesAvail
    {
        MICE,
        Car,
        Bus,
        LandPackages,
        HolidayPackages,
        Hotel,
        GroupDeparture,
        FixedDeparture,
        Flight,
    }
    public enum BookingStatus
    {
        Booked,
        Rejected,
        InProcess,
        Cancelled,
        HoldWithAdvance,
        Hold,
        Ticketed,
    }

    public class PaymentAllocationFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public PaymentAllocationFilter(FilterByPaymentAllocation filterByPaymentAllocation, string value)
        {
            Key = filterByPaymentAllocation.ToString();
            Value = value;
        }
    }
    public enum FilterByPaymentAllocation
    {
        ID,
        
    }
    public class AccountsFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public AccountsFilter(FilterByAccounts filterByAccounts, string value)
        {
            Key = filterByAccounts.ToString();
            Value = value;
        }
    }
    public enum FilterByAccounts
    {
        ID,
        TransactionID,
        TransactionDate,
        Particular,
        Mode,
        ModeType,
        Amount,
        IsCredit,
    }
    public enum AccountsMode
    {
        Offline,
        Online,
    }
    public enum AccountsModeType
    {
        ITZCash,
        AirtelMoney,
        NetBanking,
        DebitCard,
        AmexCard,
        CreditCard,
        ATMTransfer,
        NEFT_RTGS,
        Draft,
        Cheque,
        Cash,
        AccountDebit,
        AccountCredit,
    }

    public class ClientYTAccountFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ClientYTAccountFilter(FilterByClientYTAccount filterByClientYTAccount, string value)
        {
            Key = filterByClientYTAccount.ToString();
            Value = value;
        }
    }
    public enum FilterByClientYTAccount
    {
        ClientID,
    }

    public class ItemDetailFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ItemDetailFilter(FilterByItemDetail filterByItemDetail, string value)
        {
            Key = filterByItemDetail.ToString();
            Value = value;
        }
    }
    public enum FilterByItemDetail
    {
        ID,
        BookingItemID,
        BaseFare,
        Tax,
    }

    public class PassengerFareFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public PassengerFareFilter(FilterByPassengerFare filterByPassengerFare, string value)
        {
            Key = filterByPassengerFare.ToString();
            Value = value;
        }
    }
    public enum FilterByPassengerFare
    {
        ID,
        Type,
    }

    public class PassengerFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public PassengerFilter(FilterByPassenger filterByPassenger, string value)
        {
            Key = filterByPassenger.ToString();
            Value = value;
        }
    }
    public enum FilterByPassenger
    {
        ID,
        FirstName,
        LastName,
        Email,
        Mobile,
        Type,
    }
    public enum PassengerTypeYT
    {
        Adult = 0,
        Child = 1,
        Infant = 2,
        Senior = 3,
    }

    public class FlightSegmentFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public FlightSegmentFilter(FilterByFlightSegment filterByFlightSegment, string value)
        {
            Key = filterByFlightSegment.ToString();
            Value = value;
        }
    }
    public enum FilterByFlightSegment
    {
        ID,
        AirlineCode,
        AirlineName,
        FlightNo,
        FareClass,
        DepTime,
        ArrTime,
        OriginCityCode,
        DestinationCityCode,
        AirlinePNR,
    }

    public class BookingItemFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public BookingItemFilter(FilterByBookingItem filterByBookingItem, string value)
        {
            Key = filterByBookingItem.ToString();
            Value = value;
        }
    }
    public enum FilterByBookingItem
    {
        ID,
    }

    public class YTFlightMarkupOnYTAccountFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public YTFlightMarkupOnYTAccountFilter(FilterByYTFlightMarkupOnYTAccount filterByYTFlightMarkupOnYTAccount, string value)
        {
            Key = filterByYTFlightMarkupOnYTAccount.ToString();
            Value = value;
        }
    }
    public enum FilterByYTFlightMarkupOnYTAccount
    {
        YTAccountID,
        YTFlightMarkupID,
        RowCreated,
        RowModified,
    }

    
    public class FlightSectorFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public FlightSectorFilter(FilterByFlightSector filterByFlightSector, string value)
        {
            Key = filterByFlightSector.ToString();
            Value = value;
        }
    }
    public enum FilterByFlightSector
    {
        ID,
        SegmentIndicator,
        Origin,
        Destination,
    }

    public class FlightTicketFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public FlightTicketFilter(FilterByFlightTicket filterByFlightTicket, string value)
        {
            Key = filterByFlightTicket.ToString();
            Value = value;
        }
    }
    public enum FilterByFlightTicket
    {
        ID,
        TicketID,
        TicketNumber,
    }

    public class ClientChangeRequestFilter
    {

        public string Key { get; set; }

        public string Value { get; set; }

        public ClientChangeRequestFilter(FilterByClientChangeRequest filterByClientChangeRequest, string value)
        {

            Key = filterByClientChangeRequest.ToString();

            Value = value;

        }

    }

    public enum FilterByClientChangeRequest
    {

        ID,

        RowCreated,

        RowModified,

    }


    public class SendChangeRequestFilter
    {

        public string Key { get; set; }

        public string Value { get; set; }

        public SendChangeRequestFilter(FilterBySendChangeRequest filterBySendChangeRequest, string value)
        {

            Key = filterBySendChangeRequest.ToString();

            Value = value;

        }

    }

    public enum FilterBySendChangeRequest
    {

        ID,

        TboBookingRef,

        RequestType,

        TicketIDs,

        Remarks,

        IsFullCancel,

        Sectors,

        RowCreated,

        RowModified,

    }

    public class SendChangeResponseFilter
    {

        public string Key { get; set; }

        public string Value { get; set; }

        public SendChangeResponseFilter(FilterBySendChangeResponse filterBySendChangeResponse, string value)
        {

            Key = filterBySendChangeResponse.ToString();

            Value = value;

        }

    }

    public enum FilterBySendChangeResponse
    {

        ID,

        RowCreated,

        RowModified,

    }

    public class SendChangeStatusFilter
    {

        public string Key { get; set; }

        public string Value { get; set; }

        public SendChangeStatusFilter(FilterBySendChangeStatus filterBySendChangeStatus, string value)
        {

            Key = filterBySendChangeStatus.ToString();

            Value = value;

        }

    }

    public enum FilterBySendChangeStatus
    {

        ID,

        TboChangeRequestID,

        RowCreated,

        RowModified,

    }


    public class ClientCreditStatementFilter
    {
        public string Key { get; set; }
        public string Value { get; set; }
        public ClientCreditStatementFilter(FilterByClientCreditStatement filterByClientCreditStatement, string value)
        {
            Key = filterByClientCreditStatement.ToString();
            Value = value;
        }
    }
    public enum FilterByClientCreditStatement
    {
        Id,
    }


    //#region Extended Class
    public static class DataTableExtensions
    {
        public static List<dynamic> ToDynamic(this DataTable dt)
        {
            var dynamicDt = new List<dynamic>();
            foreach (DataRow row in dt.Rows)
            {
                dynamic dyn = new ExpandoObject();
                foreach (DataColumn column in dt.Columns)
                {
                    var dic = (IDictionary<string, object>)dyn;
                    dic[column.ColumnName] = row[column];

                }
                dynamicDt.Add(((ExpandoObject)dyn).ToDictionary(item => item.Key, item => item.Value));
            }
            return dynamicDt;
        }
        public static dynamic ToExpandoObject(this DataTable dt)
        {
            dynamic dyn = new ExpandoObject();
            if (dt.Rows.Count > 0)
            {
                DataRow row = dt.Rows[0];

                foreach (DataColumn column in dt.Columns)
                {
                    var dic = (IDictionary<string, object>)dyn;
                    dic[column.ColumnName] = row[column];

                }
            }


            return (ExpandoObject)dyn;

        }
        public static dynamic ToExpandoObject(this DataRow row)
        {
            dynamic dyn = new ExpandoObject();

            foreach (DataColumn column in row.Table.Columns)
            {
                var dic = (IDictionary<string, object>)dyn;
                dic[column.ColumnName] = row[column];

            }

            return (ExpandoObject)dyn;

        }
        public static dynamic ToDynamicObject(this DataRow row)
        {
            dynamic dyn = new ExpandoObject();

            foreach (DataColumn column in row.Table.Columns)
            {
                var dic = (IDictionary<string, object>)dyn;
                dic[column.ColumnName] = row[column];
            }
            return (dynamic)(ExpandoObject)dyn;
        }

    }
}

LittleDemon - FACEBOOK
[ KELUAR ]