Пример #1
0
        public JsonResult GetPaidListByBillID(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.GetListPaidtByLocationId(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[13];
                        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.Description == null ? "N/A" : payment.Description;
                        row.cell[10] = payment.Status == "P" ? "Paid" : "Cancel";
                        row.cell[11] = payment.OperatingCompanyId > 0 ? payment.OperatingCompanyId.ToString() : "0";
                        row.cell[12] = payment.LocationId > 0 ? payment.LocationId.ToString() : "0";
                        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));
        }