Пример #1
0
        public JsonResult GetPaymentListByLocation(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;
            long            MISNumber     = 0;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                locationId = 0;//Need to fetch all data
                var paymentList = _IPaymentManager.GetListPaymentByLocationId(UserId, locationId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var payment in paymentList.rows)
                {
                    if (payment.BillNo != null)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id       = Cryptography.GetEncryptedData(Convert.ToString(payment.BillNo), true);
                        row.cell     = new string[14];
                        row.cell[0]  = payment.BillNo.ToString();
                        row.cell[1]  = payment.LocationName == null ? "N/A" : payment.LocationName;
                        row.cell[2]  = payment.VendorName == null ? "N/A" : payment.VendorName;
                        row.cell[3]  = payment.OperatingCompany == null ? "N/A" : payment.OperatingCompany;
                        row.cell[4]  = payment.BillType == null ? "N/A" : payment.BillType;
                        row.cell[5]  = payment.BillAmount.ToString();
                        row.cell[6]  = payment.BillDate.ToString();
                        row.cell[7]  = payment.GracePeriod == null ? "N/A" : payment.GracePeriod.ToString();
                        row.cell[8]  = (payment.PaymentMode == null && payment.BillType == "MIS") ? "MISC" : (payment.PaymentMode == null && payment.BillType == "ManualBill") ? "ManualBill" : payment.PaymentMode.ToString();
                        row.cell[9]  = payment.Status.ToString();
                        row.cell[10] = payment.VendorId > 0 ? payment.VendorId.ToString() : "0";
                        row.cell[11] = payment.OperatingCompanyId > 0 ? payment.OperatingCompanyId.ToString() : "0";
                        row.cell[12] = payment.LocationId > 0 ? payment.LocationId.ToString() : "0";
                        row.cell[13] = payment.LLBL_ID.ToString();
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public JsonResult GetPaymentListByLocation(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null, string BillTypeId = null)
        {
            eTracLoginModel ObjLoginModel = null;
            long            MISNumber     = 0;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            ViewBag.PaymentModeList = _IVendorManagement.PaymentModeList();
            try
            {
                locationId = 0;        //Need to fetch all data // it was previously done need to be discussed
                if (BillTypeId == "0") // Logic :to show all data
                {
                    BillTypeId = null;
                }
                if (!string.IsNullOrEmpty(txtSearch))
                {
                    var paymentList = _IPaymentManager.GetListPaymentByLocationId(UserId, locationId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType, BillTypeId).Where(x => !String.IsNullOrEmpty(x.VendorName));
                    var FilterList  = paymentList.Where(X => X.VendorName.ToLower().Contains(txtSearch.ToLower())).ToList();
                    return(Json(FilterList.ToList(), JsonRequestBehavior.AllowGet));
                }
                else
                {
                    var paymentList = _IPaymentManager.GetListPaymentByLocationId(UserId, locationId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType, BillTypeId);
                    return(Json(paymentList.ToList(), JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(ex.Message, JsonRequestBehavior.AllowGet));
            }

            //JQGridResults result = new JQGridResults();
            //List<JQGridRow> rowss = new List<JQGridRow>();
            //sord = string.IsNullOrEmpty(sord) ? "desc" : sord;
            //sidx = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            //txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            //try
            //{
            //    locationId = 0;//Need to fetch all data
            //    var paymentList = _IPaymentManager.GetListPaymentByLocationId(UserId, locationId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
            //    foreach (var payment in paymentList.rows)
            //    {
            //        if (payment.BillNo != null)
            //        {
            //            JQGridRow row = new JQGridRow();
            //            row.id = Cryptography.GetEncryptedData(Convert.ToString(payment.BillNo), true);
            //            row.cell = new string[14];
            //            row.cell[0] = payment.BillNo.ToString();
            //            row.cell[1] = payment.LocationName == null ? "N/A" : payment.LocationName;
            //            row.cell[2] = payment.VendorName == null ? "N/A" : payment.VendorName;
            //            row.cell[3] = payment.OperatingCompany == null ? "N/A" : payment.OperatingCompany;
            //            row.cell[4] = payment.BillType == null ? "N/A" : payment.BillType;
            //            row.cell[5] = payment.BillAmount.ToString();
            //            row.cell[6] = payment.BillDate.ToString();
            //            row.cell[7] = payment.GracePeriod == null ? "N/A" : payment.GracePeriod.ToString();
            //            row.cell[8] = (payment.PaymentMode == null && payment.BillType == "MIS") ? "MISC" : (payment.PaymentMode == null && payment.BillType == "ManualBill") ? "ManualBill" : payment.PaymentMode.ToString();
            //            row.cell[9] = payment.Status.ToString();
            //            row.cell[10] = payment.VendorId > 0 ? payment.VendorId.ToString() : "0";
            //            row.cell[11] = payment.OperatingCompanyId > 0 ? payment.OperatingCompanyId.ToString() : "0";
            //            row.cell[12] = payment.LocationId > 0 ? payment.LocationId.ToString() : "0";
            //            row.cell[13] = payment.LLBL_ID.ToString();
            //            rowss.Add(row);
            //        }
            //    }
            //    result.rows = rowss.ToArray();
            //    result.page = Convert.ToInt32(page);
            //    result.total = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
            //    result.records = Convert.ToInt32(TotalRecords.Value);
            //}
            //catch (Exception ex)
            //{ return Json(ex.Message, JsonRequestBehavior.AllowGet); }
        }