Exemplo n.º 1
0
        public ActionResult CostList(int id = 0)
        {
            try
            {
                if (id != 0)
                {
                    ViewBag.msg = 1;
                }

                var    result       = _costservice.GetAll();
                double totalbalance = 0;

                foreach (var p in result.Data)
                {
                    totalbalance += p.Amount;
                }

                ViewBag.totalbalance = (totalbalance);

                ViewBag.totalbalance1 = NumberToWord.NumberToWords((int)totalbalance);
                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(Content("Problem is : " + result.Message));
                }
                CostListModel cost = new CostListModel();
                cost.CostLogs  = result.Data;
                cost.Employees = _employeeservice.GetAll().Data;
                return(View(cost));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
Exemplo n.º 2
0
        public ActionResult CollectionLog()
        {
            try
            {
                var result  = _collectionservice.GetAll();
                var result2 = _clientservice.GetAll().Data.Where(d => d.IsValid == 0).ToList();
                ViewBag.totalclient = result2.Count;
                double totalbalance = 0;
                foreach (var p in result.Data)
                {
                    totalbalance += p.Amount;
                }

                ViewBag.totalbalance  = totalbalance;
                ViewBag.totalbalance2 = NumberToWord.NumberToWords((int)totalbalance);
                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(Content("Problem is : " + result.Message));
                }
                return(View(result));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
Exemplo n.º 3
0
        public ActionResult ClientShowAll(int id = 0)
        {
            try
            {
                //var a = HttpUtil.CurrentUser.UserId;
                if (id != 0)
                {
                    ViewBag.msg = 1;
                }
                var result  = _clientservice.GetAll();
                var result2 = _clientservice.GetAll().Data.Where((d => d.IsValid == 0)).ToList();

                foreach (var p in result2)
                {
                    if (p.IsNewMonth == 0)
                    {
                        p.Due        = getmonthlydue(p);
                        p.IsNewMonth = 1;
                        _clientservice.Save(p);
                        _clientservice.MonthDue(p.ClientId);
                    }
                    if (DateTime.Today.Day == p.JoinDate.Day + 1)
                    {
                        p.IsNewMonth = 0;
                        _clientservice.MonthDue(p.ClientId);
                    }
                }


                double totalbalance = 0;
                double totaldue     = 0;

                foreach (var p in result2)
                {
                    totalbalance += p.Pay;
                    totaldue     += p.Due;
                }



                ViewBag.totalbalance  = (totalbalance);
                ViewBag.totaldue      = (totaldue);
                ViewBag.totalbalance1 = NumberToWord.NumberToWords((int)totalbalance);
                ViewBag.totaldue1     = NumberToWord.NumberToWords((int)totaldue);
                ViewBag.totalclient1  = result2.Count;

                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(Content("Problem is : " + result.Message));
                }

                return(View(result2));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
        public void NumberToWordsTestFailMethod()
        {
            //Arrange
            var numberToWord = new NumberToWord();
            var result       = numberToWord.NumberToWords(0);

            Assert.AreNotEqual("one", result.ToLower());
        }
        public void NumberToWordsTestMethod()
        {
            //Arrange
            var numberToWord = new NumberToWord();
            var result       = numberToWord.NumberToWords(3);

            Assert.AreEqual("three", result.ToLower());
        }
Exemplo n.º 6
0
        public ActionResult CollectionLog(Searching searching)
        {
            try
            {
                string key = "";
                if (searching.Month != null && searching.Year != null)
                {
                    if (!searching.Month.Contains("Month") && !searching.Year.Contains("Year"))
                    {
                        key = searching.Month.Substring(0, 3) + "-" + searching.Year.Substring(2);
                    }
                    else if (searching.Month.Contains("Month") && searching.Year.Contains("Year"))
                    {
                        key = " ";
                    }
                    else if (searching.Month.Contains("Month"))
                    {
                        key = searching.Year.Substring(2);
                    }
                    else if (searching.Year.Contains("Year"))
                    {
                        key = "-" + searching.Month.Substring(0, 3);
                    }
                }
                else if (searching.Key != null)
                {
                    key = searching.Key;
                }
                else
                {
                    key = " ";
                }

                var result  = _collectionservice.GetAll(key);
                var result2 = _clientservice.GetAll().Data.Where(d => d.IsValid == 0).ToList();
                ViewBag.totalclient = result2.Count;

                double totalbalance = 0;

                foreach (var p in result.Data)
                {
                    totalbalance += p.Amount;
                }

                ViewBag.totalbalance  = totalbalance;
                ViewBag.totalbalance2 = NumberToWord.NumberToWords((int)totalbalance);
                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(Content("Problem is : " + result.Message));
                }
                return(View(result));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
Exemplo n.º 7
0
        public ActionResult CostList(string key1, string key2)
        {
            try
            {
                string key = "";
                if (key1 != null && key2 != null)
                {
                    if (!key1.Contains("Month") && !key2.Contains("Year"))
                    {
                        key = key1.Substring(0, 3) + "-" + key2.Substring(2);
                    }
                    else if (key1.Contains("Month"))
                    {
                        key = key2.Substring(2);
                    }
                    else if (key2.Contains("Year"))
                    {
                        key = "-" + key1.Substring(0, 3);
                    }
                }
                else if (key1.Contains("Employee Name"))
                {
                    key = " ";
                }
                else if (key2 == null)
                {
                    key = key1;
                }

                else
                {
                    key = " ";
                }
                var result = _costservice.GetAll(key);

                ViewBag.totalclient = result.Data.Count;
                double totalbalance = 0;

                foreach (var p in result.Data)
                {
                    totalbalance += p.Amount;
                }

                ViewBag.totalbalance = (totalbalance);

                ViewBag.totalbalance1 = NumberToWord.NumberToWords((int)totalbalance);

                CostListModel cost = new CostListModel();
                cost.CostLogs  = result.Data;
                cost.Employees = _employeeservice.GetAll().Data;
                return(View(cost));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
Exemplo n.º 8
0
        public ActionResult ClientShowAll(string key1, string key2)
        {
            try
            {
                string key = "";
                if (key1 != null && key2 != null)
                {
                    if (!key1.Contains("Month") && !key2.Contains("Year"))
                    {
                        key = key1.Substring(0, 3) + "-" + key2.Substring(2);
                    }
                    else if (key1.Contains("Month") && key2.Contains("Year"))
                    {
                        key = " ";
                    }
                    else if (key1.Contains("Month"))
                    {
                        key = key2.Substring(2);
                    }
                    else if (key2.Contains("Year"))
                    {
                        key = "-" + key1.Substring(0, 3);
                    }
                }


                else if (key1.Contains("Address"))
                {
                    key = " ";
                }
                else if (key1.Contains("BandWidth"))
                {
                    key = " ";
                }
                else if (key2 == null)
                {
                    key = key1;
                }
                else
                {
                    key = " ";
                }
                var result = _clientservice.GetAll(key).Data.Where((d => d.IsValid == 0)).ToList();
                foreach (var p in result)
                {
                    if (p.IsNewMonth == 0)
                    {
                        p.Due        = getmonthlydue(p);
                        p.IsNewMonth = 1;
                        _clientservice.Save(p);
                        _clientservice.MonthDue(p.ClientId);
                    }
                    if (DateTime.Today.Day == p.JoinDate.Day + 1)
                    {
                        p.IsNewMonth = 0;
                        _clientservice.MonthDue(p.ClientId);
                    }
                }

                ViewBag.totalclient1 = result.Count;
                double totalbalance = 0;
                double totaldue     = 0;
                foreach (var p in result)
                {
                    totalbalance += p.Pay;
                    totaldue     += p.Due;
                }

                ViewBag.totalbalance  = (totalbalance);
                ViewBag.totaldue      = (totaldue);
                ViewBag.totalbalance1 = NumberToWord.NumberToWords((int)totalbalance);
                ViewBag.totaldue1     = NumberToWord.NumberToWords((int)totaldue);
                return(View(result));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }