Ejemplo n.º 1
0
        public HttpResponseMessage AddEOD(HttpRequestMessage reqObject)
        {
            int result = 0;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _EOD = new EOD();
                _EOD = JsonConvert.DeserializeObject <EOD>(_requestedDataObject.BusinessData);

                bool IsValid = ModelValidation.TryValidateModel(_EOD, out _modelErrorMsg);
                if (IsValid)
                {
                    result = _IEODService.AddEOD(_EOD);
                }
            }
            if (!string.IsNullOrWhiteSpace(_modelErrorMsg))
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, _modelErrorMsg);
            }
            else if (result == 1)
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been added successfully");
            }
            else
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been added");
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
Ejemplo n.º 2
0
        public int AddEOD(EOD _EOD)
        {
            try
            {
                var _max = _IUoW.Repository <EOD>().GetMaxValue(x => x.EodId) + 1;
                _EOD.EodId        = _max.ToString().PadLeft(3, '0');
                _EOD.AuthStatusId = "U";
                _EOD.LastAction   = "ADD";
                _EOD.MakeDT       = System.DateTime.Now;
                _EOD.MakeBy       = "mtaka";
                var result = _IUoW.Repository <EOD>().Add(_EOD);

                if (result == 1)
                {
                    _IUoW.Commit();
                }
                return(result);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddEOD(obj)", string.Empty);
                return(0);
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Stores stores   = new Stores();
            var    filePath = ConfigurationManager.AppSettings["logPathFile"];
            Logger log      = LogManager.GetCurrentClassLogger();

            try
            {
                Console.WriteLine("Console Start successfully");
                while (true)
                {
                    try
                    {
                        if (!File.Exists(filePath))
                        {
                            File.Create(filePath).Dispose();
                        }
                        Console.WriteLine("Data Pull starts at: " + DateTime.Now);
                        using (StreamWriter writer = File.AppendText(filePath))
                        {
                            writer.WriteLine("Data Pull starts at: " + DateTime.Now);
                        }
                        stores.CheckAllOrders();
                        Console.WriteLine("Data Pull stops at: " + DateTime.Now);
                        using (StreamWriter writer = File.AppendText(filePath))
                        {
                            writer.WriteLine("Data Pull stops at: " + DateTime.Now);
                        }
                        if (DateTime.Now >= DateTime.Parse("6:00 pm") && DateTime.Now <= DateTime.Parse("7:00 pm"))
                        {
                            Console.WriteLine("EOD Process Starts at: " + DateTime.Now);
                            using (StreamWriter writer = File.AppendText(filePath))
                            {
                                writer.WriteLine("EOD Process Starts at: " + DateTime.Now);
                            }
                            EOD eod = new EOD();
                            eod.OrdersEOD();
                            using (StreamWriter writer = File.AppendText(filePath))
                            {
                                writer.WriteLine("EOD Process Ends at: " + DateTime.Now);
                            }
                            Console.WriteLine("EOD Process Ends at: " + DateTime.Now);
                        }
                        Console.WriteLine("Console sleeps at: " + DateTime.Now);
                        Thread.Sleep(3600000);
                        Console.WriteLine("Console awake at: " + DateTime.Now);
                    }
                    catch (Exception ex) {
                        Console.WriteLine("Console Error on program" + ex.Message + " at: " + DateTime.Now);
                        Thread.Sleep(3600000);
                    }
                }
            }
            catch (Exception ex) {
                Console.WriteLine("Something went very Wrong Error:" + ex.Message + " at: " + DateTime.Now);
            }
        }
Ejemplo n.º 4
0
 void RunProcess()
 {
     eventLog1.WriteEntry("Entro A Correr EOD " + DateTime.Now);
     while (true)
     {
         if (DateTime.Now == DateTime.Parse("03:33:00 pm"))
         {
             eventLog1.WriteEntry("EOD Process Starts at: " + DateTime.Now);
             EOD eod = new EOD();
             eod.OrdersEOD();
             eventLog1.WriteEntry("EOD Process Ends at: " + DateTime.Now);
         }
     }
 }
Ejemplo n.º 5
0
 void RunProcess()
 {
     while (true)
     {
         eventLog1.WriteEntry("Data Pull starts at: " + DateTime.Now);
         stores.CheckAllOrders();
         eventLog1.WriteEntry("Data Pull stops at: " + DateTime.Now);
         if (DateTime.Now >= DateTime.Parse("6:00 pm") && DateTime.Now <= DateTime.Parse("7:00 pm"))
         {
             eventLog1.WriteEntry("EOD Process Starts at: " + DateTime.Now);
             EOD eod = new EOD();
             eod.OrdersEOD();
             eventLog1.WriteEntry("EOD Process Ends at: " + DateTime.Now);
         }
         Thread.Sleep(3600000);
     }
 }
Ejemplo n.º 6
0
    public static EOD CalculateElements(double JD, EOE elements)
    {
        double Epsilon = CAANutation.MeanObliquityOfEcliptic(elements.JDEquinox);

        double JD0 = JD;

        //What will be the return value
        EOD details = new EOD();

        Epsilon = CT.D2R(Epsilon);
        double omega = CT.D2R(elements.omega);
        double w = CT.D2R(elements.w);
        double i = CT.D2R(elements.i);

        double sinEpsilon = Math.Sin(Epsilon);
        double cosEpsilon = Math.Cos(Epsilon);
        double sinOmega = Math.Sin(omega);
        double cosOmega = Math.Cos(omega);
        double cosi = Math.Cos(i);
        double sini = Math.Sin(i);

        double F = cosOmega;
        double G = sinOmega * cosEpsilon;
        double H = sinOmega * sinEpsilon;
        double P = -sinOmega * cosi;
        double Q = cosOmega *cosi *cosEpsilon - sini *sinEpsilon;
        double R = cosOmega *cosi *sinEpsilon + sini *cosEpsilon;
        double a = Math.Sqrt(F *F + P *P);
        double b = Math.Sqrt(G *G + Q *Q);
        double c = Math.Sqrt(H *H + R *R);
        double A = Math.Atan2(F, P);
        double B = Math.Atan2(G, Q);
        double C = Math.Atan2(H, R);
        double n = ELL.MeanMotionFromSemiMajorAxis(elements.a);

        C3D SunCoord = CAASun.EquatorialRectangularCoordinatesAnyEquinox(JD, elements.JDEquinox);

        for (int j =0; j<2; j++)
        {
          double M = n * (JD0 - elements.T);
          double E = CAAKepler.Calculate(M, elements.e);
          E = CT.D2R(E);
          double v = 2 *Math.Atan(Math.Sqrt((1 + elements.e) / (1 - elements.e)) * Math.Tan(E/2));
          double r = elements.a * (1 - elements.e *Math.Cos(E));
          double x = r * a * Math.Sin(A + w + v);
          double y = r * b * Math.Sin(B + w + v);
          double z = r * c * Math.Sin(C + w + v);

          if (j == 0)
          {
        details.HeliocentricRectangularEquatorial.X = x;
        details.HeliocentricRectangularEquatorial.Y = y;
        details.HeliocentricRectangularEquatorial.Z = z;

        //Calculate the heliocentric ecliptic coordinates also
        double u = omega + v;
        double cosu = Math.Cos(u);
        double sinu = Math.Sin(u);

        details.HeliocentricRectangularEcliptical.X = r * (cosOmega *cosu - sinOmega *sinu *cosi);
        details.HeliocentricRectangularEcliptical.Y = r * (sinOmega *cosu + cosOmega *sinu *cosi);
        details.HeliocentricRectangularEcliptical.Z = r *sini *sinu;

        details.HeliocentricEclipticLongitude = Math.Atan2(y, x);
        details.HeliocentricEclipticLongitude = CT.M24(CT.R2D(details.HeliocentricEclipticLongitude) / 15);
        details.HeliocentricEclipticLatitude = Math.Asin(z / r);
        details.HeliocentricEclipticLatitude = CT.R2D(details.HeliocentricEclipticLatitude);
          }

          double psi = SunCoord.X + x;
          double nu = SunCoord.Y + y;
          double sigma = SunCoord.Z + z;

          double Alpha = Math.Atan2(nu, psi);
          Alpha = CT.R2D(Alpha);
          double Delta = Math.Atan2(sigma, Math.Sqrt(psi *psi + nu *nu));
          Delta = CT.R2D(Delta);
          double Distance = Math.Sqrt(psi *psi + nu *nu + sigma *sigma);

          if (j == 0)
          {
        details.TrueGeocentricRA = CT.M24(Alpha / 15);
        details.TrueGeocentricDeclination = Delta;
        details.TrueGeocentricDistance = Distance;
        details.TrueGeocentricLightTime = DistanceToLightTime(Distance);
          }
          else
          {
        details.AstrometricGeocenticRA = CT.M24(Alpha / 15);
        details.AstrometricGeocentricDeclination = Delta;
        details.AstrometricGeocentricDistance = Distance;
        details.AstrometricGeocentricLightTime = DistanceToLightTime(Distance);

        double RES = Math.Sqrt(SunCoord.X *SunCoord.X + SunCoord.Y *SunCoord.Y + SunCoord.Z *SunCoord.Z);

        details.Elongation = Math.Acos((RES *RES + Distance *Distance - r *r) / (2 * RES * Distance));
        details.Elongation = CT.R2D(details.Elongation);

        details.PhaseAngle = Math.Acos((r *r + Distance *Distance - RES *RES) / (2 * r * Distance));
        details.PhaseAngle = CT.R2D(details.PhaseAngle);
          }

          if (j == 0) //Prepare for the next loop around
        JD0 = JD - details.TrueGeocentricLightTime;
        }

        return details;
    }
Ejemplo n.º 7
0
    public static EOD CalculateElements(double JD, EOE elements)
    {
        double Epsilon = CAANutation.MeanObliquityOfEcliptic(elements.JDEquinox);

        double JD0 = JD;

        //What will be the return value
        EOD details = new EOD();

        Epsilon = CT.D2R(Epsilon);
        double omega = CT.D2R(elements.omega);
        double w     = CT.D2R(elements.w);
        double i     = CT.D2R(elements.i);

        double sinEpsilon = Math.Sin(Epsilon);
        double cosEpsilon = Math.Cos(Epsilon);
        double sinOmega   = Math.Sin(omega);
        double cosOmega   = Math.Cos(omega);
        double cosi       = Math.Cos(i);
        double sini       = Math.Sin(i);

        double F = cosOmega;
        double G = sinOmega * cosEpsilon;
        double H = sinOmega * sinEpsilon;
        double P = -sinOmega * cosi;
        double Q = cosOmega * cosi * cosEpsilon - sini * sinEpsilon;
        double R = cosOmega * cosi * sinEpsilon + sini * cosEpsilon;
        double a = Math.Sqrt(F * F + P * P);
        double b = Math.Sqrt(G * G + Q * Q);
        double c = Math.Sqrt(H * H + R * R);
        double A = Math.Atan2(F, P);
        double B = Math.Atan2(G, Q);
        double C = Math.Atan2(H, R);
        double n = ELL.MeanMotionFromSemiMajorAxis(elements.a);

        C3D SunCoord = CAASun.EquatorialRectangularCoordinatesAnyEquinox(JD, elements.JDEquinox);

        for (int j = 0; j < 2; j++)
        {
            double M = n * (JD0 - elements.T);
            double E = CAAKepler.Calculate(M, elements.e);
            E = CT.D2R(E);
            double v = 2 * Math.Atan(Math.Sqrt((1 + elements.e) / (1 - elements.e)) * Math.Tan(E / 2));
            double r = elements.a * (1 - elements.e * Math.Cos(E));
            double x = r * a * Math.Sin(A + w + v);
            double y = r * b * Math.Sin(B + w + v);
            double z = r * c * Math.Sin(C + w + v);

            if (j == 0)
            {
                details.HeliocentricRectangularEquatorial.X = x;
                details.HeliocentricRectangularEquatorial.Y = y;
                details.HeliocentricRectangularEquatorial.Z = z;

                //Calculate the heliocentric ecliptic coordinates also
                double u    = omega + v;
                double cosu = Math.Cos(u);
                double sinu = Math.Sin(u);

                details.HeliocentricRectangularEcliptical.X = r * (cosOmega * cosu - sinOmega * sinu * cosi);
                details.HeliocentricRectangularEcliptical.Y = r * (sinOmega * cosu + cosOmega * sinu * cosi);
                details.HeliocentricRectangularEcliptical.Z = r * sini * sinu;

                details.HeliocentricEclipticLongitude = Math.Atan2(y, x);
                details.HeliocentricEclipticLongitude = CT.M24(CT.R2D(details.HeliocentricEclipticLongitude) / 15);
                details.HeliocentricEclipticLatitude  = Math.Asin(z / r);
                details.HeliocentricEclipticLatitude  = CT.R2D(details.HeliocentricEclipticLatitude);
            }

            double psi   = SunCoord.X + x;
            double nu    = SunCoord.Y + y;
            double sigma = SunCoord.Z + z;

            double Alpha = Math.Atan2(nu, psi);
            Alpha = CT.R2D(Alpha);
            double Delta = Math.Atan2(sigma, Math.Sqrt(psi * psi + nu * nu));
            Delta = CT.R2D(Delta);
            double Distance = Math.Sqrt(psi * psi + nu * nu + sigma * sigma);

            if (j == 0)
            {
                details.TrueGeocentricRA          = CT.M24(Alpha / 15);
                details.TrueGeocentricDeclination = Delta;
                details.TrueGeocentricDistance    = Distance;
                details.TrueGeocentricLightTime   = DistanceToLightTime(Distance);
            }
            else
            {
                details.AstrometricGeocenticRA           = CT.M24(Alpha / 15);
                details.AstrometricGeocentricDeclination = Delta;
                details.AstrometricGeocentricDistance    = Distance;
                details.AstrometricGeocentricLightTime   = DistanceToLightTime(Distance);

                double RES = Math.Sqrt(SunCoord.X * SunCoord.X + SunCoord.Y * SunCoord.Y + SunCoord.Z * SunCoord.Z);

                details.Elongation = Math.Acos((RES * RES + Distance * Distance - r * r) / (2 * RES * Distance));
                details.Elongation = CT.R2D(details.Elongation);

                details.PhaseAngle = Math.Acos((r * r + Distance * Distance - RES * RES) / (2 * r * Distance));
                details.PhaseAngle = CT.R2D(details.PhaseAngle);
            }

            if (j == 0) //Prepare for the next loop around
            {
                JD0 = JD - details.TrueGeocentricLightTime;
            }
        }

        return(details);
    }
        public bool PostTransaction(TellerPosting post, out string message)
        {
            EOD           EOD         = new EOD();
            var           EODlogic    = unitOfwork.EntityRepository <EOD>();
            FinancialDate currentDate = unitOfwork.EntityRepository <FinancialDate>().GetById(1);

            // if (post.CustomerAccount.AccountStatus == Status.Active)
            if (post.CustomerAccount.IsClosed == false)
            {
                if (post.PostAmount >= 100)
                {
                    switch (post.PostType)
                    {
                    case PostType.Deposit:
                        post.Till.TillAccount.AccountBalance += post.PostAmount;
                        post.CustomerAccount.AccountBalance  += post.PostAmount;
                        message = "Deposit Successful";
                        return(true);

                    case PostType.Withdrawal:
                        double cot = 0;
                        if (CheckMinimumBalanceConfig(post.CustomerAccount.AccountBalance, post.PostAmount + cot) == true)
                        {
                            //NO COT
                            if (post.CustomerAccount.AccountType == AccountType.Savings)
                            {
                                post.Till.TillAccount.AccountBalance -= post.PostAmount;
                                post.CustomerAccount.AccountBalance  -= post.PostAmount;
                            }
                            else if (post.CustomerAccount.AccountType == AccountType.Current)
                            {
                                var currentaccount = unitOfwork.EntityRepository <CurrentAccountConfig>().GetById(1);
                                cot = (currentaccount.CreditInterestRate) * post.PostAmount;

                                if (post.CustomerAccount.AccountBalance > (post.PostAmount + cot))
                                {
                                    post.Till.TillAccount.AccountBalance -= post.PostAmount;
                                    post.CustomerAccount.AccountBalance  -= (post.PostAmount + cot);
                                    //post.CustomerAccount.AccountBalance -= cot;
                                    post.TransactionDate = currentDate.CurrentFinancialDate;
                                    currentaccount.COTIncomeGL.AccountBalance += cot;


                                    //:::::**IMPORTANT**:::::
                                    // EOD.Amount = cot;
                                    // EOD.CustomerAccount = post.CustomerAccount;
                                    // EOD.GLAccount = currentaccount.COTIncomeGL;
                                    // EOD.FinancialDate = currentDate.CurrentFinancialDate;

                                    EODlogic.Save(EOD);
                                }
                                else
                                {
                                    //Insufficient Funds
                                    message = "Insufficient Funds";
                                    return(false);
                                }
                            }
                        }
                        else
                        {
                            message = "Insuffient funds (Minimum balance)";
                            return(false);
                        }
                        message = "Transaction done";
                        return(true);

                    default:
                        message = "Invalid Transaction";
                        return(false);
                    }
                }
                else
                {
                    message = "Invalid amount";
                    return(false);
                }
            }
            else
            {
                message = "CustomerAccount is closed";
                return(false);
            }
        }
Ejemplo n.º 9
0
        public JsonResult RunOrdersEod()
        {
            EOD eod = new EOD();

            return(Json(eod.OrdersEOD(), JsonRequestBehavior.AllowGet));
        }