Beispiel #1
0
        public string VehicleBalanceReportFilter(Int32 VehicleId, int Month, int Year)
        {
            DateTime newDate = Convert.ToDateTime("01-" + Month + "-" + Year);

            newDate = newDate.AddMonths(-1);
            int     PMonth = Convert.ToInt32(newDate.ToString("MM"));
            int     PYear  = Convert.ToInt32(newDate.ToString("yyyy"));
            DataSet ds     = CustomerVehicleBLL.GetVehicleBalanceReport(VehicleId, Month, Year, PMonth, PYear);
            string  Det    = JsonConvert.SerializeObject(ds, Formatting.Indented);

            return(Det.Replace("\r", "").Replace("\n", ""));
        }
Beispiel #2
0
        public ActionResult VehicleBalanceReport()
        {
            if (Session["LoggedUserId"] == null)
            {
                return(RedirectToAction("Logout", "Login"));
            }
            ViewBag.MainMenu = HelperClass.NewMenu(Convert.ToInt16(Session["LoggedUserId"]), "Report", "VehicleBalanceReport");
            List <CustomerVehicleCBE> SortedList = CustomerVehicleBLL.GetAllAsList().OrderBy(o => o.VehRegNo).ToList();

            ViewData["CustomerVehicle"] = SortedList;
            return(View());
        }
        public string ExportCSVANPR()
        {
            var filename = "Transaction_ANPR_" + DateTime.Now.ToString(Constants.dateTimeFormat24HForFileName) + ".csv";

            try
            {
                FileInfo file        = new FileInfo(Server.MapPath("~/Attachment/ExportFiles/" + filename));
                Int16    IsDataFound = CSVUtility.CreateCsv(file.FullName, CustomerVehicleBLL.GetAllAsCSV());
                if (IsDataFound == 0)
                {
                    filename = "No Data to Export.";
                }
            }
            catch (Exception ex)
            {
                HelperClass.LogMessage("Failed Export Customer CSV " + ex);
            }
            string Det = JsonConvert.SerializeObject(filename, Formatting.Indented);

            return(Det.Replace("\r", "").Replace("\n", ""));
        }
        public string ExportCustomerVehicleFilter(CustomerVehicleModel objCustomerVehicleModel)
        {
            var      filename    = "Vehicle_" + DateTime.Now.ToString(Constants.dateTimeFormat24HForFileName) + ".csv";
            FileInfo file        = new FileInfo(Server.MapPath("~/Attachment/ExportFiles/" + filename));
            Int16    IsDataFound = 0;

            try
            {
                string strQuery = " WHERE 1=1";
                if (objCustomerVehicleModel.SearchEnable)
                {
                    #region Filter Query
                    if (objCustomerVehicleModel.AccountId > 0)
                    {
                        strQuery += " AND CA.ACCOUNT_ID LIKE '%" + objCustomerVehicleModel.AccountId + "%' ";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.ResidentId))
                    {
                        strQuery += " AND CA.RESIDENT_ID LIKE '%" + objCustomerVehicleModel.ResidentId.ToLower() + "%'";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.MobileNo))
                    {
                        strQuery += " AND CA.MOB_NUMBER LIKE '%" + objCustomerVehicleModel.MobileNo.ToLower() + "%' ";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.EmailId))
                    {
                        strQuery += " AND LOWER(CA.EMAIL_ID) LIKE '%" + objCustomerVehicleModel.EmailId.ToLower() + "%' ";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.FirstName))
                    {
                        strQuery += " AND LOWER(CA.FIRST_NAME) LIKE '%" + objCustomerVehicleModel.FirstName.ToLower() + "%' ";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.VehRegNo))
                    {
                        strQuery += " AND LOWER(CV.VEH_REG_NO) LIKE '%" + objCustomerVehicleModel.VehRegNo.ToLower() + "%' ";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.VehicleRCNumber))
                    {
                        strQuery += " AND LOWER(CV.VEHICLE_RC_NO) LIKE '%" + objCustomerVehicleModel.VehicleRCNumber.ToLower() + "%'";
                    }
                    if (objCustomerVehicleModel.VehicleClassId > 0)
                    {
                        strQuery += " AND CV.VEHICLE_CLASS_ID = " + objCustomerVehicleModel.VehicleClassId + "";
                    }
                    if (objCustomerVehicleModel.QueueStatus > 0)
                    {
                        strQuery += " AND CV.QUEUE_STATUS = " + objCustomerVehicleModel.QueueStatus + "";
                    }
                    if (objCustomerVehicleModel.ExceptionFlag > 0)
                    {
                        strQuery += " AND CV.EXCEPTION_FLAG = " + objCustomerVehicleModel.ExceptionFlag + "";
                    }
                    IsDataFound = CSVUtility.CreateCsvWithTitleFilter(file.FullName, CustomerVehicleBLL.GetFilterCSV(strQuery), "Vehicle", objCustomerVehicleModel);
                    #endregion
                }
                else
                {
                    IsDataFound = CSVUtility.CreateCsvWithTitle(file.FullName, CustomerVehicleBLL.GetFilterCSV(strQuery), "Vehicle");
                }
                if (IsDataFound == 0)
                {
                    filename = "No Data to Export.";
                }
            }
            catch (Exception ex)
            {
                HelperClass.LogMessage("Failed Export Customer CSV " + ex);
            }
            string Det = JsonConvert.SerializeObject(filename, Formatting.Indented);
            return(Det.Replace("\r", "").Replace("\n", ""));
        }