예제 #1
0
        public ActionResult TableServerSideGetData(int pageIndex, int pageSize, string filter)
        {
            var db    = new PaymentProductDAL();
            int?total = 0;
            TableColumnsTotal totalColumns = new TableColumnsTotal();
            var baseListParam = new BaseListParam()
            {
                FilterField  = filter,
                OrderByField = "",
                UserType     = Global.CurrentUser.RoleId,
                UserId       = Global.CurrentUser.LoginUserId,
                DeptId       = Global.CurrentUser.OrganizationUnitID,
                PageIndex    = pageIndex,
                PageSize     = pageSize,
                LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString()
            };
            var result   = db.GetPaymentProduct(baseListParam, out total, out totalColumns);
            var lstTotal = new TableColumnsTotalModel();

            lstTotal.Total1 = "15";
            lstTotal.Total2 = "25";
            lstTotal.Total3 = "35";
            return(Content(JsonConvert.SerializeObject(new
            {
                employees = result,
                totalCount = total,
                lstTotal = totalColumns,
                roleid = baseListParam.UserType.ToString()
            })));
        }
예제 #2
0
        public ActionResult SavePaymentProduct(PaymentProduct obj)
        {
            var baseListParam = new BaseListParam()
            {
                UserType     = Global.CurrentUser.RoleId,
                UserId       = Global.CurrentUser.LoginUserId,
                DeptId       = Global.CurrentUser.OrganizationUnitID,
                LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString()
            };
            var db     = new PaymentProductDAL();
            var result = db.SavePaymentProduct(baseListParam, obj);

            //if (result.IsSuccess == true && obj.WPID == 0)
            //{
            //    result.Message = AppRes.MSG_INSERT_SUCCESSFUL;
            //}
            //else if (result.IsSuccess == true && obj.WPID != 0)
            //{
            //    result.Message = AppRes.MS_Update_success;
            //}
            return(Content(JsonConvert.SerializeObject(new
            {
                result
            })));
        }
예제 #3
0
        public ActionResult GetsBD()
        {
            var db     = new PaymentProductDAL();
            var result = db.StaffWhereRoleBD();

            return(Content(JsonConvert.SerializeObject(new
            {
                result
            })));
        }
예제 #4
0
        public ActionResult GetEditItemById(int id, int CustomerID)
        {
            var baseListParam = new BaseListParam()
            {
                UserType     = Global.CurrentUser.RoleId,
                UserId       = Global.CurrentUser.LoginUserId,
                DeptId       = Global.CurrentUser.OrganizationUnitID,
                LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString()
            };
            var db     = new PaymentProductDAL();
            var result = db.GetPaymentProductById(baseListParam, id, CustomerID);

            return(Content(JsonConvert.SerializeObject(new
            {
                result
            })));
        }
예제 #5
0
        public ActionResult PaymentProductExportExcel(int pageIndex, int pageSize, ListFilterParam list, string filter = "")
        {
            DataTable dt = new DataTable("Grid");

            dt.Columns.AddRange(new DataColumn[9]
            {
                new DataColumn(AppRes.CustomerCode),
                new DataColumn(AppRes.Email),
                new DataColumn(AppRes.Website),
                new DataColumn(AppRes.BD),
                new DataColumn(AppRes.OrganizationUnitName),
                new DataColumn(AppRes.Product),
                new DataColumn(AppRes.Margin),
                new DataColumn(AppRes.PaymentDate),
                new DataColumn(AppRes.StatusName)
            });
            dt.Columns[0].DataType = typeof(int);
            dt.Columns[1].DataType = typeof(string);
            dt.Columns[2].DataType = typeof(string);
            dt.Columns[3].DataType = typeof(string);
            dt.Columns[4].DataType = typeof(string);
            dt.Columns[5].DataType = typeof(string);
            dt.Columns[6].DataType = typeof(double);
            dt.Columns[7].DataType = typeof(DateTime);
            dt.Columns[8].DataType = typeof(string);

            var db            = new PaymentProductDAL();
            int?total         = 0;
            var baseListParam = new BaseListParam()
            {
                FilterField  = filter,
                OrderByField = "",
                UserType     = Global.CurrentUser.RoleId,
                UserId       = Global.CurrentUser.LoginUserId,
                DeptId       = Global.CurrentUser.OrganizationUnitID,
                PageIndex    = pageIndex,
                PageSize     = int.MaxValue,
                LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString()
            };
            var lstData = db.ExportExcelPaymentProduct(baseListParam, list, out total);

            foreach (var item in lstData)
            {
                dt.Rows.Add(
                    item.CustomerID,
                    item.Email == null ? "" : item.Email,
                    item.Website == null ? "" : item.Website,
                    item.BDName == null ? "" : item.BDName,
                    item.OrganizationUnitName == null ? "": item.OrganizationUnitName,
                    item.ProductName == null ? "" : item.ProductName,
                    item.Amount,
                    item.PaymentDate,
                    item.StatusName == null ? "" : item.StatusName
                    );
            }
            var wb = new XLWorkbook();

            wb.Worksheets.Add(dt);
            byte[] data = null;
            using (var stream = new MemoryStream())
            {
                wb.SaveAs(stream);
                data = stream.ToArray();
            }
            return(File(data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "PaymentProduct.xlsx"));
        }
예제 #6
0
        public ActionResult PaymentReferExportExcel(int pageIndex, int pageSize, ListFilterParam list, string filter = "")
        {
            filter = filter.Replace("!!", "%");
            DateTime FromDateTypeDate = new DateTime();
            DateTime ToDateTypeDate   = new DateTime();

            list.FromDate = Convert.ToDateTime(DateTime.ParseExact(list.StringFromDate, "dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture));
            list.ToDate   = Convert.ToDateTime(DateTime.ParseExact(list.StringToDate, "dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture));
            DataTable dt = new DataTable("Grid");

            dt.Columns.AddRange(new DataColumn[8]
            {
                new DataColumn(AppRes.CustomerCode),
                new DataColumn(AppRes.Email),
                new DataColumn(AppRes.ContractCode),
                new DataColumn(AppRes.PaymentDate),
                new DataColumn(AppRes.BD),
                new DataColumn(AppRes.OrganizationUnitName),
                new DataColumn(AppRes.Amount),
                new DataColumn(AppRes.AccountConverted)
            });

            dt.Columns[0].DataType = typeof(string);
            dt.Columns[1].DataType = typeof(string);
            dt.Columns[2].DataType = typeof(string);
            dt.Columns[3].DataType = typeof(DateTime);
            dt.Columns[4].DataType = typeof(string);
            dt.Columns[5].DataType = typeof(string);
            dt.Columns[6].DataType = typeof(double);
            dt.Columns[7].DataType = typeof(double);

            var db            = new PaymentProductDAL();
            int?total         = 0;
            var baseListParam = new BaseListParam()
            {
                FilterField  = filter,
                OrderByField = "",
                UserType     = Global.CurrentUser.RoleId,
                UserId       = Global.CurrentUser.LoginUserId,
                DeptId       = Global.CurrentUser.OrganizationUnitID,
                PageIndex    = pageIndex,
                PageSize     = int.MaxValue,
                LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString()
            };
            var lstData = db.ExportExcelPaymentRefer(baseListParam, list, out total);

            foreach (var item in lstData)
            {
                dt.Rows.Add(
                    item.CustomerCode,
                    item.Email,
                    item.ContractCode == null ? "" : item.ContractCode,
                    item.PaymentDate,
                    item.BD == null ? "" : item.BD,
                    item.OrganizationUnitName == null ? "" : item.OrganizationUnitName,
                    item.Amount,
                    item.AccountConversion
                    );
            }
            var wb = new XLWorkbook();

            wb.Worksheets.Add(dt);
            byte[] data = null;
            using (var stream = new MemoryStream())
            {
                wb.SaveAs(stream);
                data = stream.ToArray();
            }
            return(File(data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "ReportsMarginRefer.xlsx"));
        }