├── docs └── readme.md ├── source └── BizBook │ ├── Server.Identity │ ├── favicon.ico │ ├── Global.asax │ ├── Service References │ │ └── Application Insights │ │ │ └── ConnectedService.json │ ├── App_Start │ │ ├── FilterConfig.cs │ │ ├── RouteConfig.cs │ │ └── CacheConfig.cs │ ├── Filters │ │ ├── MessageHandler.cs │ │ └── MultipleOperationsWithSameVerbFilter.cs │ ├── Models │ │ ├── SecurityHelperModels.cs │ │ ├── IdentityRequestModels.cs │ │ ├── ApplicationResourceViewModel.cs │ │ ├── ApplicationPermissionViewModel.cs │ │ ├── SecurityDbContext.cs │ │ └── ApplicationUser.cs │ ├── Migrations │ │ ├── Configuration.cs │ │ └── 201901181446153_Init.Designer.cs │ ├── Global.asax.cs │ ├── Providers │ │ └── OAuthTokenProvider.cs │ ├── Helper │ │ ├── ApplicationInsightHelpers.cs │ │ └── B2BSignalrEventHandlers.cs │ ├── Results │ │ └── ChallengeResult.cs │ ├── Controllers │ │ ├── QueryControllers │ │ │ └── System │ │ │ │ ├── ApplicationUserRoleQueryController.cs │ │ │ │ └── ApplicationResourceQueryController.cs │ │ └── ValuesController.cs │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Startup.cs │ ├── Server.Inventory │ ├── favicon.ico │ ├── Global.asax │ ├── Attributes │ │ └── PermissionRequest.cs │ ├── Models │ │ ├── Location.cs │ │ ├── ClientRequestModel.cs │ │ └── ApplicationUser.cs │ ├── App_Start │ │ ├── FilterConfig.cs │ │ ├── RouteConfig.cs │ │ └── WebApiConfig.cs │ ├── Helpers │ │ └── ConnectionModel.cs │ ├── Filters │ │ └── MessageHandler.cs │ ├── Handlers │ │ └── CustomExceptionHandler.cs │ ├── Controllers │ │ ├── CommandControllers │ │ │ ├── Message │ │ │ │ ├── SmsController.cs │ │ │ │ ├── SmsHookController.cs │ │ │ │ ├── HookDetailController.cs │ │ │ │ └── SmsHistoryController.cs │ │ │ ├── Customers │ │ │ │ ├── CustomerController.cs │ │ │ │ ├── CustomerAddressController.cs │ │ │ │ └── CustomerFeedbackController.cs │ │ │ ├── Shops │ │ │ │ ├── BrandController.cs │ │ │ │ ├── CourierController.cs │ │ │ │ ├── DealerController.cs │ │ │ │ └── SupplierController.cs │ │ │ ├── Warehouses │ │ │ │ ├── DamageController.cs │ │ │ │ ├── WarehouseController.cs │ │ │ │ └── StockTransferController.cs │ │ │ ├── Products │ │ │ │ ├── ProductDetailController.cs │ │ │ │ ├── ProductGroupController.cs │ │ │ │ ├── ProductCategoryController.cs │ │ │ │ └── SupplierProductController.cs │ │ │ ├── Transactions │ │ │ │ ├── WalletController.cs │ │ │ │ ├── TransactionController.cs │ │ │ │ └── AccountHeadController.cs │ │ │ ├── Operation │ │ │ │ └── OperationLogController.cs │ │ │ └── Employees │ │ │ │ └── EmployeeInfoController.cs │ │ └── QueryControllers │ │ │ ├── Message │ │ │ ├── SmsQueryController.cs │ │ │ ├── HookDetailQueryController.cs │ │ │ └── SmsHistoryQueryController.cs │ │ │ ├── Shops │ │ │ ├── CourierQueryController.cs │ │ │ ├── DealerQueryController.cs │ │ │ └── BrandQueryController.cs │ │ │ ├── Warehouses │ │ │ ├── DamageQueryController.cs │ │ │ └── StockTransferQueryController.cs │ │ │ ├── Transactions │ │ │ ├── WalletQueryController.cs │ │ │ └── AccountHeadQueryController.cs │ │ │ ├── Operation │ │ │ ├── OperationLogQueryController.cs │ │ │ └── OperationLogDetailQueryController.cs │ │ │ ├── Sales │ │ │ ├── InstallmentQueryController.cs │ │ │ └── InstallmentDetailQueryController.cs │ │ │ ├── Customers │ │ │ └── CustomerFeedbackQueryController.cs │ │ │ ├── Employees │ │ │ └── EmployeeInfoQueryController.cs │ │ │ ├── Products │ │ │ ├── DealerProductQueryController.cs │ │ │ ├── SupplierProductQueryController.cs │ │ │ ├── ProductGroupQueryController.cs │ │ │ └── ProductCategoryQueryController.cs │ │ │ └── OtherQueryController.cs │ ├── Providers │ │ └── OAuthTokenProvider.cs │ ├── Results │ │ └── ChallengeResult.cs │ ├── Startup.cs │ ├── Web.Debug.config │ ├── Global.asax.cs │ └── Properties │ │ └── AssemblyInfo.cs │ ├── Utility │ ├── packages.config │ ├── Extensions.cs │ ├── App.config │ └── Properties │ │ └── AssemblyInfo.cs │ ├── CommonLibrary │ ├── Model │ │ ├── BusinessConstants.cs │ │ └── Entity.cs │ ├── packages.config │ ├── ViewModel │ │ ├── IsViewable.cs │ │ ├── DropdownViewModel.cs │ │ └── BaseViewModel.cs │ └── Properties │ │ └── AssemblyInfo.cs │ ├── ReportModel │ ├── packages.config │ ├── Parameters │ │ ├── ProductReportParameter.cs │ │ ├── SaleReportParameter.cs │ │ ├── ReportParameterBase.cs │ │ └── TransactionReportParameter.cs │ ├── BaseReport.cs │ ├── App.config │ └── Properties │ │ └── AssemblyInfo.cs │ ├── ViewModel │ ├── packages.config │ ├── Products │ │ ├── ProductGroupReportModel.cs │ │ ├── ProductCategoryReportModel.cs │ │ ├── ProductDetailReportModel.cs │ │ ├── ProductGroupViewModel.cs │ │ ├── ProductCategoryViewModel.cs │ │ ├── DealerProductViewModel.cs │ │ └── SupplierProductViewModel.cs │ ├── Sales │ │ ├── IBaseReportViewModel.cs │ │ ├── SalesDuesUpdateModel.cs │ │ └── InstallmentDetailViewModel.cs │ ├── Transactions │ │ ├── AccountHeadReportModel.cs │ │ ├── TransactionReportModel.cs │ │ ├── AccountHeadViewModel.cs │ │ └── WalletViewModel.cs │ ├── Shops │ │ ├── SupplierReportModel.cs │ │ ├── BrandReportModel.cs │ │ ├── CourierViewModel.cs │ │ ├── SupplierViewModel.cs │ │ ├── BrandViewModel.cs │ │ └── DealerViewModel.cs │ ├── Employees │ │ ├── EmployeeReportModel.cs │ │ └── EmployeeInfoViewModel.cs │ ├── Customers │ │ ├── CustomerReportModel.cs │ │ ├── CustomerProductViewModel.cs │ │ ├── CustomerFeedbackViewModel.cs │ │ └── AddressViewModel.cs │ ├── Warehouses │ │ ├── WarehouseProductHistoryViewModel.cs │ │ ├── WarehouseHistoryViewModel.cs │ │ ├── WarehouseViewModel.cs │ │ └── DamageViewModel.cs │ ├── Purchases │ │ └── PurchaseReportModel.cs │ ├── ShopChildViewModel.cs │ ├── Message │ │ ├── SmsHistoryViewModel.cs │ │ ├── SmsHookViewModel.cs │ │ ├── HookDetailViewModel.cs │ │ └── SmsViewModel.cs │ ├── Reports │ │ ├── BaseReportViewModel.cs │ │ ├── AccountReportViewModel.cs │ │ └── SaleReportGridModel.cs │ ├── BaseViewModel.cs │ ├── Operation │ │ └── OperationLogViewModel.cs │ └── Properties │ │ └── AssemblyInfo.cs │ ├── Model │ ├── packages.config │ ├── Message │ │ ├── SmsHistory.cs │ │ ├── SmsHook.cs │ │ ├── HookDetail.cs │ │ └── Sms.cs │ ├── Customers │ │ ├── District.cs │ │ ├── Zone.cs │ │ ├── CustomerFeedback.cs │ │ └── Address.cs │ ├── ShopChild.cs │ ├── Transactions │ │ ├── AccountHead.cs │ │ └── Wallet.cs │ ├── Shops │ │ ├── Courier.cs │ │ └── Brand.cs │ ├── Sales │ │ ├── SaleState.cs │ │ ├── Shipping.cs │ │ ├── Billing.cs │ │ ├── Installment.cs │ │ └── InstallmentDetail.cs │ ├── Products │ │ ├── ProductGroup.cs │ │ ├── ProductImage.cs │ │ ├── ProductSerial.cs │ │ ├── DealerProductTransaction.cs │ │ ├── SupplierProductTransaction.cs │ │ ├── ProductCategory.cs │ │ ├── ProductVariation.cs │ │ ├── DealerProduct.cs │ │ ├── SupplierProduct.cs │ │ └── WarehouseProduct.cs │ ├── Operations │ │ ├── OperationLog.cs │ │ └── OperationLogDetail.cs │ ├── Warehouses │ │ ├── Damage.cs │ │ ├── Warehouse.cs │ │ └── StockTransferDetail.cs │ ├── Employees │ │ └── EmployeeInfo.cs │ ├── Migrations │ │ ├── 201901191332239_Init.Designer.cs │ │ └── Configuration.cs │ ├── Purchases │ │ └── PurchaseDetail.cs │ └── Properties │ │ └── AssemblyInfo.cs │ ├── RequestModel │ ├── Reports │ │ ├── SalesByProductRequestModel.cs │ │ ├── CustomerBySaleRequestModel.cs │ │ ├── DailySalesOverviewRequestModel.cs │ │ ├── BaseReportRequestModel.cs │ │ └── SaleReportRequestModel.cs │ ├── FilterCollection.cs │ ├── packages.config │ ├── PartnerRequestModel.cs │ ├── Message │ │ ├── MessageRequestModel.cs │ │ ├── SmsHookRequestModel.cs │ │ ├── SmsHistoryRequestModel.cs │ │ ├── SmsRequestModel.cs │ │ └── HookDetailRequestModel.cs │ ├── Shops │ │ ├── DealerRequestModel.cs │ │ ├── CourierRequestModel.cs │ │ ├── BrandRequestModel.cs │ │ ├── SupplierRequestModel.cs │ │ └── ShopRequestModel.cs │ ├── Transactions │ │ ├── AccountHeadRequestModel.cs │ │ └── WalletRequestModel.cs │ ├── Warehouses │ │ ├── WarehouseHistoryRequestModel.cs │ │ └── WarehouseRequestModel.cs │ ├── Products │ │ ├── ProductSerialRequestModel.cs │ │ └── ProductGroupRequestModel.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Sales │ │ └── InstallmentDetailRequestModel.cs │ ├── ServiceLibrary │ ├── Products │ │ └── ProductCategoryService.cs │ ├── Sales │ │ └── SaleDetailService.cs │ ├── packages.config │ ├── Shops │ │ └── ShopService.cs │ ├── Reports │ │ ├── IReportService.cs │ │ ├── BaseReportService.cs │ │ └── SchedulerService.cs │ ├── Subscription │ │ ├── MD5Hash.cs │ │ └── HardwareInfo.cs │ └── Properties │ │ └── AssemblyInfo.cs │ └── LoggingService │ ├── packages.config │ └── Properties │ └── AssemblyInfo.cs └── scripts └── sql ├── 001_Permission_Seed_Data_Insert.sql └── 002_SuperAdmin_Data_Insert.sql /docs/readme.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foyzulkarim/bizbook-server/HEAD/source/BizBook/Server.Identity/favicon.ico -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foyzulkarim/bizbook-server/HEAD/source/BizBook/Server.Inventory/favicon.ico -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Server.Identity.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /scripts/sql/001_Permission_Seed_Data_Insert.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foyzulkarim/bizbook-server/HEAD/scripts/sql/001_Permission_Seed_Data_Insert.sql -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Server.Inventory.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /source/BizBook/Utility/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /source/BizBook/CommonLibrary/Model/BusinessConstants.cs: -------------------------------------------------------------------------------- 1 | namespace CommonLibrary.Model 2 | { 3 | public enum CustomerType 4 | { 5 | Registered, Unregistered 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /source/BizBook/CommonLibrary/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /source/BizBook/ReportModel/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Products/ProductGroupReportModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Products 2 | { 3 | public class ProductGroupReportModel 4 | { 5 | public string Name { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Attributes/PermissionRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Server.Inventory.Attributes 2 | { 3 | public class PermissionRequest 4 | { 5 | public string Name { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Products/ProductCategoryReportModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Products 2 | { 3 | public class ProductCategoryReportModel 4 | { 5 | public string Name { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Sales/IBaseReportViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Sales 2 | { 3 | public interface IBaseReportViewModel 4 | { 5 | string DateRange { get; set; } 6 | int EntryFound { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /source/BizBook/Model/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Transactions/AccountHeadReportModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Transactions 2 | { 3 | public class AccountHeadReportModel 4 | { 5 | public string AccountType { get; set; } 6 | public string Name { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /source/BizBook/CommonLibrary/ViewModel/IsViewable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CommonLibrary.ViewModel 4 | { 5 | [AttributeUsage(AttributeTargets.Property)] 6 | public class IsViewable: Attribute 7 | { 8 | public bool Value { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Shops/SupplierReportModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Shops 2 | { 3 | public class SupplierReportModel 4 | { 5 | public string Name { get; set; } 6 | public string Address { get; set; } 7 | public string Phone { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Employees/EmployeeReportModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Employees 2 | { 3 | public class EmployeeReportModel 4 | { 5 | public string Name { get; set; } 6 | public string Email { get; set; } 7 | public string Phone { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Message/SmsHistory.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Message 2 | { 3 | public class SmsHistory : ShopChild 4 | { 5 | public double Amount { get; set; } 6 | 7 | public string SmsId { get; set; } 8 | 9 | public string Text { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Customers/CustomerReportModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Customers 2 | { 3 | public class CustomerReportModel 4 | { 5 | public string Name { get; set; } 6 | public string District { get; set; } 7 | public string Phone { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Products/ProductDetailReportModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Products 2 | { 3 | public class ProductDetailReportModel 4 | { 5 | public string Name { get; set; } 6 | public double Price { get; set; } 7 | public int OnHand { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /source/BizBook/CommonLibrary/ViewModel/DropdownViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace CommonLibrary.ViewModel 2 | { 3 | public class DropdownViewModel 4 | { 5 | public string Id { get; set; } 6 | public string Text { get; set; } 7 | 8 | public object Data { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Service References/Application Insights/ConnectedService.json: -------------------------------------------------------------------------------- 1 | { 2 | "ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider", 3 | "Version": "8.6.404.2", 4 | "GettingStartedDocument": { 5 | "Uri": "https://go.microsoft.com/fwlink/?LinkID=613413" 6 | } 7 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Models/Location.cs: -------------------------------------------------------------------------------- 1 | namespace Server.Inventory.Models 2 | { 3 | public class Location 4 | { 5 | public string District { get; set; } 6 | public string Thana { get; set; } 7 | public string SubOffice { get; set; } 8 | public string Postcode { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Warehouses/WarehouseProductHistoryViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Warehouses 2 | { 3 | public class WarehouseProductHistoryViewModel 4 | { 5 | public string ProductName { get; set; } 6 | public double SaleQuantity { get; set; } 7 | public double PurchaseQuantity { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace Server.Inventory 4 | { 5 | public class FilterConfig 6 | { 7 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 8 | { 9 | filters.Add(new HandleErrorAttribute()); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace Server.Identity 4 | { 5 | public class FilterConfig 6 | { 7 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 8 | { 9 | //filters.Add(new AiHandleErrorAttribute()); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Shops/BrandReportModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ViewModel.Shops 4 | { 5 | public class BrandReportModel 6 | { 7 | public string Name { get; set; } 8 | public string Address { get; set; } 9 | public string Phone { get; set; } 10 | public DateTime Modified { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using System.Web.Routing; 3 | 4 | namespace Server.Inventory 5 | { 6 | public class RouteConfig 7 | { 8 | public static void RegisterRoutes(RouteCollection routes) 9 | { 10 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /source/BizBook/Model/Customers/District.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using CommonLibrary.Model; 3 | 4 | namespace Model.Customers 5 | { 6 | public class District : Entity 7 | { 8 | public string Name { get; set; } 9 | 10 | public string Name_Bn { get; set; } 11 | 12 | public virtual ICollection Zones { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Customers/Zone.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | using CommonLibrary.Model; 3 | 4 | namespace Model.Customers 5 | { 6 | public class Zone : Entity 7 | { 8 | public string Name { get; set; } 9 | 10 | public string DistrictId { get; set; } 11 | 12 | [ForeignKey("DistrictId")] public virtual District District { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Purchases/PurchaseReportModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ViewModel.Purchases 4 | { 5 | public class PurchaseReportModel 6 | { 7 | public string Memo { get; set; } 8 | public string Supplier { get; set; } 9 | public DateTime Date { get; set; } 10 | public double Total { get; set; } 11 | public string ModifiedBy { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /source/BizBook/Model/ShopChild.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using CommonLibrary.Model; 4 | using Model.Shops; 5 | 6 | namespace Model 7 | { 8 | public abstract class ShopChild : Entity 9 | { 10 | [Required] public string ShopId { get; set; } 11 | [ForeignKey("ShopId")] public virtual Shop Shop { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Transactions/AccountHead.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Transactions 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | 6 | public class AccountHead : ShopChild 7 | { 8 | [Index] [Required] [MaxLength(50)] public string Name { get; set; } 9 | 10 | [Index] [Required] public AccountHeadType AccountHeadType { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Helpers/ConnectionModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Server.Inventory.Helpers 4 | { 5 | public class ConnectionModel 6 | { 7 | public string ConnectionId { get; set; } 8 | public string UserId { get; set; } 9 | public string UserName { get; set; } 10 | public string ShopId { get; set; } 11 | public DateTime SessionStarted { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/ShopChildViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model; 3 | 4 | namespace ViewModel 5 | { 6 | public abstract class ShopChildViewModel : BaseViewModel where T : ShopChild 7 | { 8 | public string ShopId { get; set; } 9 | 10 | protected ShopChildViewModel(ShopChild x) : base(x) 11 | { 12 | this.ShopId = x.ShopId; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Reports/SalesByProductRequestModel.cs: -------------------------------------------------------------------------------- 1 | namespace RequestModel.Reports 2 | { 3 | using System; 4 | 5 | public class SalesByProductRequestModel 6 | { 7 | public string ShopId { get; set; } 8 | 9 | public DateTime StartDate { get; set; } 10 | 11 | public DateTime EndDate { get; set; } 12 | public string Keyword { get; set; } 13 | 14 | public string WarehouseId { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Message/SmsHook.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Message 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class SmsHook : ShopChild 6 | { 7 | [Required] public BizSmsHook BizSmsHook { get; set; } 8 | 9 | [Required] [MaxLength(100)] public string Name { get; set; } 10 | 11 | [MaxLength(100)] public string Description { get; set; } 12 | 13 | [Required] public bool IsEnabled { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Transactions/TransactionReportModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Transactions 2 | { 3 | using System; 4 | 5 | public class TransactionReportModel 6 | { 7 | public string Type { get; set; } 8 | public string Order { get; set; } 9 | public double Amount { get; set; } 10 | public DateTime Date { get; set; } 11 | public string Person { get; set; } 12 | public string Service { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Shops/Courier.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Shops 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | 6 | public class Courier : ShopChild 7 | { 8 | [MaxLength(50)] public string ContactPersonName { get; set; } 9 | 10 | [Required] public string CourierShopId { get; set; } 11 | 12 | [ForeignKey("CourierShopId")] public virtual Shop CourierShop { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /source/BizBook/ReportModel/Parameters/ProductReportParameter.cs: -------------------------------------------------------------------------------- 1 | namespace ReportModel.Parameters 2 | { 3 | using System; 4 | 5 | public class ProductReportParameter : ReportParameterBase 6 | { 7 | public ProductReportParameter(DateTime date, string value, string shopId) : base(date, value, shopId) 8 | { 9 | } 10 | 11 | public string ProductDetailId { get; set; } 12 | 13 | public double StartingQuantity { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Warehouses/WarehouseHistoryViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ViewModel.Warehouses 4 | { 5 | public class WarehouseHistoryViewModel 6 | { 7 | public string Id { get; set; } 8 | public string OrderNumber { get; set; } 9 | 10 | public string Type { get; set; } 11 | 12 | public string ProductName { get; set; } 13 | 14 | public double Quantity { get; set; } 15 | 16 | public DateTime Date { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Message/SmsHistoryViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Message; 3 | 4 | namespace ViewModel.Message 5 | { 6 | public class SmsHistoryViewModel : BaseViewModel 7 | { 8 | public SmsHistoryViewModel(SmsHistory x) : base(x) 9 | { 10 | Amount = x.Amount; 11 | Text = x.Text; 12 | } 13 | 14 | public double Amount { get; set; } 15 | 16 | public string Text { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Sales/SaleState.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace Model.Sales 5 | { 6 | public class SaleState : ShopChild 7 | { 8 | [Index] [Required] [MaxLength(50)] public string State { get; set; } 9 | 10 | public string Remarks { get; set; } 11 | 12 | [Required] public string SaleId { get; set; } 13 | 14 | [ForeignKey("SaleId")] public virtual Sale Sale { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Filters/MessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace Server.Identity.Filters 6 | { 7 | public class MessageHandler : DelegatingHandler 8 | { 9 | protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 10 | { 11 | var r = request; 12 | return base.SendAsync(request, cancellationToken); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Filters/MessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace Server.Inventory.Filters 6 | { 7 | public class MessageHandler : DelegatingHandler 8 | { 9 | protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 10 | { 11 | var r = request; 12 | return base.SendAsync(request, cancellationToken); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Models/SecurityHelperModels.cs: -------------------------------------------------------------------------------- 1 | namespace Server.Identity.Models 2 | { 3 | public class PermissionRequest 4 | { 5 | public string Name { get; set; } 6 | } 7 | 8 | public class ResourcePermissionViewModel 9 | { 10 | public string Id { get; set; } 11 | public string ApplicationResourceId { get; set; } 12 | public string RoleId { get; set; } 13 | public bool IsAllowed { get; set; } 14 | public string Name { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Reports/CustomerBySaleRequestModel.cs: -------------------------------------------------------------------------------- 1 | namespace RequestModel.Reports 2 | { 3 | using System; 4 | 5 | public class CustomerBySaleRequestModel 6 | { 7 | public DateTime StartDate { get; set; } 8 | 9 | public DateTime EndDate { get; set; } 10 | 11 | public string ShopId { get; set; } 12 | 13 | public double MinimumAmountSpend { get; set; } 14 | 15 | public string Keyword { get; set; } 16 | 17 | public string WarehouseId { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Migrations/Configuration.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.Migrations; 2 | using Server.Identity.Models; 3 | 4 | namespace Server.Identity.Migrations 5 | { 6 | internal sealed class Configuration : DbMigrationsConfiguration 7 | { 8 | public Configuration() 9 | { 10 | AutomaticMigrationsEnabled = false; 11 | } 12 | 13 | protected override void Seed(SecurityDbContext context) 14 | { 15 | 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Handlers/CustomExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Server.Inventory.Handlers 2 | { 3 | using System.Web.Http.ExceptionHandling; 4 | 5 | //https://stackoverflow.com/questions/16028919/catch-all-unhandled-exceptions-in-asp-net-web-api 6 | public class CustomExceptionHandler : ExceptionLogger 7 | { 8 | public override void Log(ExceptionLoggerContext context) 9 | { 10 | Serilog.Log.Logger.Error(context.Exception, "Unhandled exception occurred"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Products/ProductGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Model.Products 6 | { 7 | public class ProductGroup : ShopChild 8 | { 9 | [Index] 10 | [Required] 11 | [MaxLength(50)] 12 | [DataType(DataType.Text)] 13 | public string Name { get; set; } 14 | 15 | public virtual ICollection ProductCategories { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /source/BizBook/ReportModel/Parameters/SaleReportParameter.cs: -------------------------------------------------------------------------------- 1 | namespace ReportModel.Parameters 2 | { 3 | using System; 4 | 5 | public class SaleReportParameter : ReportParameterBase 6 | { 7 | public SaleReportParameter(DateTime date, string value, string shopId) : base(date, value, shopId) 8 | { 9 | } 10 | 11 | public SaleType SaleType { get; set; } 12 | } 13 | 14 | public enum SaleType 15 | { 16 | All = 0, 17 | DealerSale = 1, 18 | CustomerSale = 2 19 | } 20 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Models/IdentityRequestModels.cs: -------------------------------------------------------------------------------- 1 | namespace Server.Identity.Models 2 | { 3 | public class EmployeeRequestModel 4 | { 5 | public string OrderBy { get; set; } 6 | public string IsAscending { get; set; } 7 | public string Id { get; set; } 8 | public string Keyword { get; set; } 9 | public string ShopId { get; set; } 10 | public string RoleId { get; set; } 11 | public string Role { get; set; } 12 | public int Page { get; set; } 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Transactions/AccountHeadViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Transactions 2 | { 3 | using Model.Transactions; 4 | 5 | public class AccountHeadViewModel : ShopChildViewModel 6 | { 7 | public AccountHeadViewModel(AccountHead x) : base(x) 8 | { 9 | Name = x.Name; 10 | this.AccountHeadType = x.AccountHeadType.ToString(); 11 | } 12 | 13 | public string AccountHeadType { get; set; } 14 | 15 | public string Name { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Reports/DailySalesOverviewRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Model; 3 | 4 | namespace RequestModel.Reports 5 | { 6 | public class DailySalesOverviewRequestModel 7 | { 8 | public DateTime StartDate { get; set; } 9 | 10 | public DateTime EndDate { get; set; } 11 | 12 | public string ShopId { get; set; } 13 | 14 | public string WarehouseId { get; set; } 15 | 16 | public string Keyword { get; set; } 17 | 18 | public SaleFrom SaleFrom { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Sales/Shipping.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Sales 2 | { 3 | public class Shipping 4 | { 5 | public string FirstName { get; set; } 6 | public string LastName { get; set; } 7 | public string Company { get; set; } 8 | public string Address1 { get; set; } 9 | public string Address2 { get; set; } 10 | public string City { get; set; } 11 | public string State { get; set; } 12 | public string PostCode { get; set; } 13 | public string Country { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /source/BizBook/ReportModel/Parameters/ReportParameterBase.cs: -------------------------------------------------------------------------------- 1 | namespace ReportModel.Parameters 2 | { 3 | using System; 4 | 5 | public class ReportParameterBase 6 | { 7 | public ReportParameterBase(DateTime date, string value, string shopId) 8 | { 9 | this.Date = date; 10 | this.Value = value; 11 | this.ReportShopId = shopId; 12 | } 13 | 14 | public DateTime Date { get; } 15 | public string Value { get; } 16 | public string ReportShopId { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Message/HookDetail.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace Model.Message 5 | { 6 | public class HookDetail : ShopChild 7 | { 8 | [Required] [Index] public string SmsHookId { get; set; } 9 | 10 | [ForeignKey("SmsHookId")] public virtual SmsHook SmsHook { get; set; } 11 | 12 | [Index] [Required] [MaxLength(200)] public string HookName { get; set; } 13 | 14 | [Required] public bool IsEnabled { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Operations/OperationLog.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Model.Operations 4 | { 5 | public class OperationLog : ShopChild 6 | { 7 | public OperationType OperationType { get; set; } 8 | public ModelName ModelName { get; set; } 9 | public string ObjectId { get; set; } 10 | public string ObjectIdentifier { get; set; } 11 | public string Remarks { get; set; } 12 | public virtual ICollection OperationLogDetails { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Sales/SalesDuesUpdateModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Sales 2 | { 3 | using System.Collections.Generic; 4 | using Model.Transactions; 5 | 6 | public class SalesDuesUpdateModel 7 | { 8 | public string ShopId { get; set; } 9 | 10 | public Transaction Transaction { get; set; } 11 | 12 | public List Sales { get; set; } 13 | } 14 | 15 | public class SaleDue 16 | { 17 | public string Id { get; set; } 18 | 19 | public double NewlyPaid { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Products/ProductGroupViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Products; 3 | 4 | namespace ViewModel.Products 5 | { 6 | public class ProductGroupViewModel : BaseViewModel 7 | { 8 | public ProductGroupViewModel(ProductGroup x) : base(x) 9 | { 10 | Id = x.Id; 11 | Name = x.Name; 12 | ShopId = x.ShopId; 13 | } 14 | 15 | public string ShopId { get; set; } 16 | 17 | [IsViewable] public string Name { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Transactions/Wallet.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace Model.Transactions 5 | { 6 | public class Wallet : ShopChild 7 | { 8 | [Index] [Required] [MaxLength(50)] public string AccountTitle { get; set; } 9 | 10 | 11 | [MaxLength(100)] public string AccountNumber { get; set; } 12 | 13 | [MaxLength(50)] public string BankName { get; set; } 14 | 15 | [Index] [Required] public WalletType WalletType { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Warehouses/Damage.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | using Model.Products; 3 | 4 | namespace Model.Warehouses 5 | { 6 | public class Damage : ShopChild 7 | { 8 | public string WarehouseId { get; set; } 9 | [ForeignKey("WarehouseId")] public virtual Warehouse Warehouse { get; set; } 10 | public string ProductDetailId { get; set; } 11 | 12 | [ForeignKey("ProductDetailId")] public virtual ProductDetail ProductDetail { get; set; } 13 | public double Quantity { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Models/ApplicationResourceViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace Server.Identity.Models 2 | { 3 | public class ApplicationResourceViewModel 4 | { 5 | public string ApplicationResourceId { get; set; } 6 | public string ApplicationResourceName { get; set; } 7 | 8 | public ApplicationResourceViewModel(string applicationResourceId, string applicationResourceName) 9 | { 10 | ApplicationResourceId = applicationResourceId; 11 | ApplicationResourceName = applicationResourceName; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/Products/ProductCategoryService.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.Repository; 2 | using CommonLibrary.Service; 3 | using Model.Products; 4 | using RequestModel.Products; 5 | using ViewModel.Products; 6 | 7 | namespace ServiceLibrary.Products 8 | { 9 | 10 | public class ProductCategoryService : BaseService 11 | { 12 | public ProductCategoryService(BaseRepository repository) : base(repository) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Message/SmsHookViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Message; 3 | 4 | namespace ViewModel.Message 5 | { 6 | public class SmsHookViewModel : BaseViewModel 7 | { 8 | public SmsHookViewModel(SmsHook x) : base(x) 9 | { 10 | Name = x.Name; 11 | IsEnabled = x.IsEnabled; 12 | ShopId = x.ShopId; 13 | } 14 | 15 | public string ShopId { get; set; } 16 | public string Name { get; set; } 17 | public bool IsEnabled { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Reports/BaseReportRequestModel.cs: -------------------------------------------------------------------------------- 1 | namespace RequestModel.Reports 2 | { 3 | using CommonLibrary.Model; 4 | using CommonLibrary.RequestModel; 5 | using Model; 6 | 7 | public abstract class BaseReportRequestModel : RequestModel where T : Entity 8 | { 9 | public ReportTimeType ReportTimeType { get; set; } 10 | 11 | protected BaseReportRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : 12 | base(keyword, orderBy, isAscending) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/FilterCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Linq.Expressions; 4 | 5 | namespace RequestModel 6 | { 7 | public static class FilterCollection 8 | { 9 | public static IQueryable FilterBy(this IQueryable queryable, string id, Expression> predicate) 10 | { 11 | if (!string.IsNullOrWhiteSpace(id) && id != new Guid().ToString()) 12 | { 13 | queryable = queryable.Where(predicate); 14 | } 15 | return queryable; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /source/BizBook/LoggingService/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using System.Web.Routing; 3 | 4 | namespace Server.Identity 5 | { 6 | public class RouteConfig 7 | { 8 | public static void RegisterRoutes(RouteCollection routes) 9 | { 10 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 11 | 12 | //routes.MapRoute( 13 | // name: "Default", 14 | // url: "{controller}/{action}/{id}", 15 | // defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 16 | //); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/Model/Sales/Billing.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Sales 2 | { 3 | public class Billing 4 | { 5 | public string FirstName { get; set; } 6 | public string LastName { get; set; } 7 | public string Company { get; set; } 8 | public string Address1 { get; set; } 9 | public string Address2 { get; set; } 10 | public string City { get; set; } 11 | public string State { get; set; } 12 | public string PostCode { get; set; } 13 | public string Country { get; set; } 14 | public string Email { get; set; } 15 | public string Phone { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /source/BizBook/ReportModel/BaseReport.cs: -------------------------------------------------------------------------------- 1 | namespace ReportModel 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.ComponentModel.DataAnnotations.Schema; 6 | using CommonLibrary.Model; 7 | 8 | public class BaseReport : Entity 9 | { 10 | [Index] [Required] [MaxLength(50)] public string Value { get; set; } 11 | 12 | [Index] 13 | [Required] 14 | [DataType(DataType.DateTime)] 15 | public DateTime Date { get; set; } 16 | 17 | [Index] [Required] public int RowsCount { get; set; } 18 | 19 | [Index] [Required] [MaxLength(128)] public string ShopId { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Message/SmsController.cs: -------------------------------------------------------------------------------- 1 | using Model.Message; 2 | using RequestModel.Message; 3 | using System.Web.Http; 4 | using ViewModel.Message; 5 | using CommonLibrary.Repository; 6 | using CommonLibrary.Service; 7 | using Model; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Message 10 | { 11 | [RoutePrefix("api/Sms")] 12 | public class SmsController : BaseCommandController 13 | { 14 | public SmsController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Customers/CustomerController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using Model; 4 | using Model.Customers; 5 | using RequestModel.Customers; 6 | using ServiceLibrary.Customers; 7 | using ViewModel.Customers; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Customers 10 | { 11 | [RoutePrefix("api/Customer")] 12 | public class CustomerController : BaseCommandController 13 | { 14 | public CustomerController() : base(new CustomerService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/Sales/SaleDetailService.cs: -------------------------------------------------------------------------------- 1 | 2 | using Vm = ViewModel.Sales.SaleDetailViewModel; 3 | using Rm = RequestModel.Sales.SaleDetailRequestModel; 4 | using Repo = CommonLibrary.Repository.BaseRepository; 5 | using M = Model.Sales.SaleDetail; 6 | using CommonLibrary.Service; 7 | 8 | namespace ServiceLibrary.Sales 9 | { 10 | public class SaleDetailService : BaseService 11 | { 12 | public SaleDetailService(Repo repository) : base(repository) 13 | { 14 | //customerRepo = new BaseRepository(base.Repository.Db); 15 | //customerService = new CustomerService(customerRepo); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Model/Products/ProductImage.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Products 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | 6 | public class ProductImage : ShopChild 7 | { 8 | public int WcId { get; set; } 9 | 10 | [Required] [MaxLength(500)] public string Src { get; set; } 11 | [MaxLength(50)] public string Name { get; set; } 12 | [MaxLength(50)] public string Alt { get; set; } 13 | public int? Position { get; set; } 14 | 15 | 16 | [Required] public string ProductDetailId { get; set; } 17 | [ForeignKey("ProductDetailId")] public ProductDetail ProductDetail { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Products/ProductSerial.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using Model.Purchases; 4 | 5 | namespace Model.Products 6 | { 7 | public class ProductSerial : ShopChild 8 | { 9 | [Index] [Required] [MaxLength(50)] public string SerialNumber { get; set; } 10 | 11 | [Required] public string ProductDetailId { get; set; } 12 | 13 | [ForeignKey("ProductDetailId")] public virtual ProductDetail ProductDetail { get; set; } 14 | 15 | public string PurchaseDetailId { get; set; } 16 | 17 | [ForeignKey("PurchaseDetailId")] public virtual PurchaseDetail PurchaseDetail { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Products/DealerProductTransaction.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Products 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using Model.Transactions; 6 | 7 | public class DealerProductTransaction : ShopChild 8 | { 9 | [Required] public double Amount { get; set; } 10 | 11 | [Required] public string TransactionId { get; set; } 12 | 13 | [ForeignKey("TransactionId")] public virtual Transaction Transaction { get; set; } 14 | 15 | [Required] public string DealerProductId { get; set; } 16 | 17 | [ForeignKey("DealerProductId")] public virtual DealerProduct DealerProduct { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Products/SupplierProductTransaction.cs: -------------------------------------------------------------------------------- 1 | using Model.Transactions; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Model.Products 6 | { 7 | public class SupplierProductTransaction : ShopChild 8 | { 9 | [Required] public double Amount { get; set; } 10 | 11 | [Required] public string TransactionId { get; set; } 12 | 13 | [ForeignKey("TransactionId")] public virtual Transaction Transaction { get; set; } 14 | 15 | [Required] public string SupplierProductId { get; set; } 16 | 17 | [ForeignKey("SupplierProductId")] public virtual SupplierProduct SupplierProduct { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Shops/BrandController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Shops; 6 | using RequestModel.Shops; 7 | using ViewModel.Shops; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Shops 10 | { 11 | [RoutePrefix("api/Brand")] 12 | public class BrandController : BaseCommandController 13 | { 14 | public BrandController(): base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Shops/CourierController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Shops; 6 | using RequestModel.Shops; 7 | using ViewModel.Shops; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Shops 10 | { 11 | [RoutePrefix("api/Courier")] 12 | public class CourierController : BaseCommandController 13 | { 14 | public CourierController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Message/SmsQueryController.cs: -------------------------------------------------------------------------------- 1 | using Model.Message; 2 | using RequestModel.Message; 3 | using System.Web.Http; 4 | using ViewModel.Message; 5 | using CommonLibrary.Service; 6 | using Model; 7 | using CommonLibrary.Repository; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Message 10 | { 11 | [RoutePrefix("api/SmsQuery")] 12 | public class SmsQueryController : BaseQueryController 13 | { 14 | public SmsQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Shops/DealerController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using RequestModel.Shops; 6 | using ViewModel.Shops; 7 | 8 | namespace Server.Inventory.Controllers.CommandControllers.Shops 9 | { 10 | using Model.Dealers; 11 | 12 | [RoutePrefix("api/Dealer")] 13 | public class DealerController : BaseCommandController 14 | { 15 | public DealerController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Shops/SupplierController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using RequestModel.Shops; 6 | using ViewModel.Shops; 7 | using M = Model.Shops.Supplier; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Shops 10 | { 11 | [RoutePrefix("api/Supplier")] 12 | public class SupplierController : BaseCommandController 13 | { 14 | public SupplierController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Reports/BaseReportViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Reports 2 | { 3 | using System; 4 | using CommonLibrary.ViewModel; 5 | using ReportModel; 6 | 7 | public class BaseReportViewModel : BaseViewModel where T : BaseReport 8 | { 9 | public BaseReportViewModel(BaseReport x) : base(x) 10 | { 11 | this.Value = x.Value; 12 | this.Date = x.Date; 13 | this.RowsCount = x.RowsCount; 14 | this.ShopId = x.ShopId; 15 | } 16 | 17 | public string Value { get; set; } 18 | public DateTime Date { get; set; } 19 | public int RowsCount { get; set; } 20 | public string ShopId { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Message/SmsHookController.cs: -------------------------------------------------------------------------------- 1 | using Model.Message; 2 | using RequestModel.Message; 3 | using System.Web.Http; 4 | using ViewModel.Message; 5 | using CommonLibrary.Service; 6 | using CommonLibrary.Repository; 7 | using Model; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Message 10 | { 11 | [RoutePrefix("api/SmsHook")] 12 | public class SmsHookController : BaseCommandController 13 | { 14 | public SmsHookController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Warehouses/DamageController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Warehouses; 6 | using RequestModel.Warehouses; 7 | using ViewModel.Warehouses; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Warehouses 10 | { 11 | [RoutePrefix("api/Damage")] 12 | public class DamageController : BaseCommandController 13 | { 14 | public DamageController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Shops/CourierQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Shops; 6 | using RequestModel.Shops; 7 | using ViewModel.Shops; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Shops 10 | { 11 | [RoutePrefix("api/CourierQuery")] 12 | public class CourierQueryController : BaseQueryController 13 | { 14 | public CourierQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Model/Customers/CustomerFeedback.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace Model.Customers 5 | { 6 | public class CustomerFeedback : ShopChild 7 | { 8 | [Required] 9 | public string CustomerId { get; set; } 10 | 11 | [ForeignKey("CustomerId")] 12 | public virtual Customer Customer { get; set; } 13 | 14 | public string OrderNumber { get; set; } 15 | 16 | [MaxLength(500)] 17 | public string Feedback { get; set; } 18 | 19 | public FeedbackType FeedbackType { get; set; } 20 | 21 | [MaxLength(500)] 22 | public string ManagerComment { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Shops/DealerQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using RequestModel.Shops; 6 | using ViewModel.Shops; 7 | 8 | namespace Server.Inventory.Controllers.QueryControllers.Shops 9 | { 10 | using Model.Dealers; 11 | 12 | [RoutePrefix("api/DealerQuery")] 13 | public class DealerQueryController : BaseQueryController 14 | { 15 | public DealerQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Products/ProductDetailController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using Model; 4 | using Model.Products; 5 | using RequestModel.Products; 6 | using ServiceLibrary.Products; 7 | using ViewModel.Products; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Products 10 | { 11 | [RoutePrefix("api/ProductDetail")] 12 | public class ProductDetailController : BaseCommandController 13 | { 14 | public ProductDetailController() : base(new ProductDetailService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Transactions/WalletController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Transactions; 6 | using RequestModel.Transactions; 7 | using ViewModel.Transactions; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Transactions 10 | { 11 | [RoutePrefix("api/Wallet")] 12 | public class WalletController : BaseCommandController 13 | { 14 | public WalletController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Warehouses/DamageQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Warehouses; 6 | using RequestModel.Warehouses; 7 | using ViewModel.Warehouses; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Warehouses 10 | { 11 | [RoutePrefix("api/DamageQuery")] 12 | public class DamageQueryController : BaseQueryController 13 | { 14 | public DamageQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Operation/OperationLogController.cs: -------------------------------------------------------------------------------- 1 | using Rm = RequestModel.Operation.OperationLogRequestModel; 2 | using M = Model.Operations.OperationLog; 3 | using Vm = ViewModel.Operation.OperationLogViewModel; 4 | using System.Web.Http; 5 | using Model; 6 | using CommonLibrary.Service; 7 | using CommonLibrary.Repository; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Operation 10 | { 11 | [RoutePrefix("api/OperationLog")] 12 | public class OperationLogController : BaseQueryController 13 | { 14 | public OperationLogController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Message/HookDetailController.cs: -------------------------------------------------------------------------------- 1 | using Model.Message; 2 | using RequestModel.Message; 3 | using System.Web.Http; 4 | using ViewModel.Message; 5 | using CommonLibrary.Service; 6 | using Model; 7 | using CommonLibrary.Repository; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Message 10 | { 11 | [RoutePrefix("api/HookDetail")] 12 | public class HookDetailController : BaseCommandController 13 | { 14 | public HookDetailController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Transactions/WalletQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Transactions; 6 | using RequestModel.Transactions; 7 | using ViewModel.Transactions; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Transactions 10 | { 11 | [RoutePrefix("api/WalletQuery")] 12 | public class WalletQueryController : BaseQueryController 13 | { 14 | 15 | public WalletQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Customers/CustomerAddressController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Customers; 6 | using RequestModel.Customers; 7 | using ViewModel.Customers; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Customers 10 | { 11 | [RoutePrefix("api/CustomerAddress")] 12 | public class CustomerAddressController : BaseCommandController 13 | { 14 | public CustomerAddressController() : base(new BaseService(new BaseRepository
(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /source/BizBook/Model/Products/ProductCategory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Model.Products 6 | { 7 | public class ProductCategory : ShopChild 8 | { 9 | [Index] 10 | [Required] 11 | [MaxLength(100)] 12 | [DataType(DataType.Text)] 13 | public string Name { get; set; } 14 | 15 | [Index] public int WcId { get; set; } 16 | 17 | [Index] [Required] public string ProductGroupId { get; set; } 18 | 19 | [ForeignKey("ProductGroupId")] public virtual ProductGroup ProductGroup { get; set; } 20 | 21 | public virtual ICollection ProductDetails { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Message/SmsHistoryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Message; 6 | using RequestModel.Message; 7 | using ViewModel.Message; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Message 10 | { 11 | [RoutePrefix("api/SmsHistory")] 12 | public class SmsHistoryController : BaseCommandController 13 | { 14 | public SmsHistoryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Message/HookDetailQueryController.cs: -------------------------------------------------------------------------------- 1 | using Model.Message; 2 | using RequestModel.Message; 3 | using System.Web.Http; 4 | using ViewModel.Message; 5 | using CommonLibrary.Service; 6 | using CommonLibrary.Repository; 7 | using Model; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Message 10 | { 11 | [RoutePrefix("api/HookDetailQuery")] 12 | public class HookDetailQueryController : BaseQueryController 13 | { 14 | public HookDetailQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Message/SmsHistoryQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Message; 6 | using RequestModel.Message; 7 | using ViewModel.Message; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Message 10 | { 11 | [RoutePrefix("api/SmsHistoryQuery")] 12 | public class SmsHistoryQueryController : BaseQueryController 13 | { 14 | public SmsHistoryQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Warehouses/StockTransferQueryController.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.Repository; 2 | using Model; 3 | using Model.Warehouses; 4 | using RequestModel.Warehouses; 5 | using ViewModel.Warehouses; 6 | using System.Web.Http; 7 | using ServiceLibrary.Warehouses; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Warehouses 10 | { 11 | [RoutePrefix("api/StockTransferQuery")] 12 | public class StockTransferQueryController : BaseQueryController 13 | { 14 | public StockTransferQueryController() : base(new StockTransferService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Customers/CustomerFeedbackController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using M = Model.Customers.CustomerFeedback; 6 | using RM = RequestModel.Customers.CustomerFeedbackRequestModel; 7 | using VM = ViewModel.Customers.CustomerFeedbackViewModel; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Customers 10 | { 11 | [RoutePrefix("api/CustomerFeedback")] 12 | public class CustomerFeedbackController : BaseCommandController 13 | { 14 | public CustomerFeedbackController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Products/ProductGroupController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using RequestModel.Products; 6 | using ViewModel.Products; 7 | using M=Model.Products.ProductGroup; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Products 10 | { 11 | [RoutePrefix("api/ProductGroup")] 12 | public class ProductGroupController : BaseCommandController 13 | { 14 | public ProductGroupController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Operation/OperationLogQueryController.cs: -------------------------------------------------------------------------------- 1 | using Rm = RequestModel.Operation.OperationLogRequestModel; 2 | using M = Model.Operations.OperationLog; 3 | using Vm = ViewModel.Operation.OperationLogViewModel; 4 | using System.Web.Http; 5 | using Model; 6 | using CommonLibrary.Service; 7 | using CommonLibrary.Repository; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.operation 10 | { 11 | [RoutePrefix("api/OperationLogQuery")] 12 | public class OperationLogQueryController : BaseQueryController 13 | { 14 | public OperationLogQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Sales/InstallmentQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using Rm = RequestModel.Sales.InstallmentRequestModel; 3 | using M = Model.Sales.Installment; 4 | using Vm = ViewModel.Sales.InstallmentViewModel; 5 | 6 | namespace Server.Inventory.Controllers.QueryControllers.Sales 7 | { 8 | using CommonLibrary.Repository; 9 | using CommonLibrary.Service; 10 | 11 | using Model; 12 | 13 | [RoutePrefix("api/InstallmentQuery")] 14 | public class InstallmentQueryController : BaseQueryController 15 | { 16 | public InstallmentQueryController() 17 | : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Transactions/AccountHeadQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Rm = RequestModel.Transactions.AccountHeadRequestModel; 6 | using M = Model.Transactions.AccountHead; 7 | using Vm = ViewModel.Transactions.AccountHeadViewModel; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Transactions 10 | { 11 | [RoutePrefix("api/AccountHeadQuery")] 12 | public class AccountHeadQueryController: BaseQueryController 13 | { 14 | public AccountHeadQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Customers/CustomerFeedbackQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Rm = RequestModel.Customers.CustomerFeedbackRequestModel; 6 | using M = Model.Customers.CustomerFeedback; 7 | using Vm = ViewModel.Customers.CustomerFeedbackViewModel; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Customers 10 | { 11 | [RoutePrefix("api/CustomerFeedbackQuery")] 12 | public class CustomerFeedbackQueryController : BaseQueryController 13 | { 14 | public CustomerFeedbackQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/BizBook/Model/Operations/OperationLogDetail.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | 3 | namespace Model.Operations 4 | { 5 | public class OperationLogDetail : ShopChild 6 | { 7 | 8 | public OperationType OperationType { get; set; } 9 | public ModelName ModelName { get; set; } 10 | public string ObjectId { get; set; } 11 | public string ObjectIdentifier { get; set; } 12 | public string PropertyName { get; set; } 13 | public string OldValue { get; set; } 14 | public string NewValue { get; set; } 15 | public string Remarks { get; set; } 16 | public string OperationLogId { get; set; } 17 | [ForeignKey("OperationLogId")] public virtual OperationLog OperationLog { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Filters/MultipleOperationsWithSameVerbFilter.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http.Description; 2 | using Swashbuckle.Swagger; 3 | 4 | namespace Server.Identity.Filters 5 | { 6 | public class MultipleOperationsWithSameVerbFilter : IOperationFilter 7 | { 8 | public void Apply( 9 | Operation operation, 10 | SchemaRegistry schemaRegistry, 11 | ApiDescription apiDescription) 12 | { 13 | if (operation.parameters != null) 14 | { 15 | operation.operationId += "_"; 16 | foreach (var parm in operation.parameters) 17 | { 18 | operation.operationId += string.Format("{0}", parm.name); 19 | } 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Employees/EmployeeInfoController.cs: -------------------------------------------------------------------------------- 1 | using Model.Employees; 2 | using RequestModel.Employees; 3 | using System.Web.Http; 4 | using ViewModel.Employees; 5 | using CommonLibrary.Service; 6 | using CommonLibrary.Repository; 7 | using Model; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Employees 10 | { 11 | [RoutePrefix("api/EmployeeInfo")] 12 | public class EmployeeInfoController : BaseCommandController 13 | { 14 | public EmployeeInfoController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/BaseViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Model; 3 | 4 | namespace ViewModel 5 | { 6 | public abstract class BaseViewModel where T : Entity 7 | { 8 | protected BaseViewModel(Entity x) 9 | { 10 | Id = x.Id; 11 | Created = x.Created; 12 | CreatedBy = x.CreatedBy; 13 | Modified = x.Modified; 14 | ModifiedBy = x.ModifiedBy; 15 | } 16 | 17 | protected BaseViewModel() 18 | { 19 | } 20 | 21 | public string Id { get; set; } 22 | 23 | public DateTime Created { get; set; } 24 | 25 | public string CreatedBy { get; set; } 26 | 27 | public DateTime Modified { get; set; } 28 | 29 | public string ModifiedBy { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Transactions/TransactionController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using Model; 4 | using Model.Transactions; 5 | using RequestModel.Transactions; 6 | using ViewModel.Transactions; 7 | using TransactionService = ServiceLibrary.Transactions.TransactionService; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Transactions 10 | { 11 | [RoutePrefix("api/Transaction")] 12 | public class TransactionController : BaseCommandController 13 | { 14 | public TransactionController() : base(new TransactionService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Operation/OperationLogDetailQueryController.cs: -------------------------------------------------------------------------------- 1 | using Rm = RequestModel.Operation.OperationLogDetailRequestModel; 2 | using M = Model.Operations.OperationLogDetail; 3 | using Vm = ViewModel.Operation.OperationLogDetailViewModel; 4 | using System.Web.Http; 5 | using CommonLibrary.Service; 6 | using CommonLibrary.Repository; 7 | using Model; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.operation 10 | { 11 | [RoutePrefix("api/OperationLogDetailQuery")] 12 | public class OperationLogDetailQueryController : BaseQueryController 13 | { 14 | public OperationLogDetailQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/Shops/ShopService.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.Repository; 2 | using CommonLibrary.Service; 3 | using Model.Shops; 4 | using RequestModel.Shops; 5 | using ViewModel.Shops; 6 | 7 | namespace ServiceLibrary.Shops 8 | { 9 | public class ShopService : BaseService 10 | { 11 | public ShopService(BaseRepository repository) : base(repository) 12 | { 13 | } 14 | 15 | public virtual ShopViewModel GetMyDetail(string id) 16 | { 17 | var model = Repository.GetById(id); 18 | if (model == null) 19 | { 20 | return null; 21 | } 22 | var myDetail = new ShopViewModel(model); 23 | return myDetail; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Message/HookDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Message; 3 | 4 | namespace ViewModel.Message 5 | { 6 | public class HookDetailViewModel : BaseViewModel 7 | { 8 | public HookDetailViewModel(HookDetail x) : base(x) 9 | { 10 | SetProperties(x); 11 | } 12 | 13 | public void SetProperties(HookDetail x) 14 | { 15 | ShopId = x.ShopId; 16 | HookName = x.HookName; 17 | IsEnabled = x.IsEnabled; 18 | SmsHookId = x.SmsHookId; 19 | } 20 | 21 | public string ShopId { get; set; } 22 | public string HookName { get; set; } 23 | public bool IsEnabled { get; set; } 24 | public string SmsHookId { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Employees/EmployeeInfoQueryController.cs: -------------------------------------------------------------------------------- 1 | using Model.Employees; 2 | using RequestModel.Employees; 3 | using System.Web.Http; 4 | using ViewModel.Employees; 5 | using CommonLibrary.Service; 6 | using Model; 7 | using CommonLibrary.Repository; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Employees 10 | { 11 | [RoutePrefix("api/EmployeeInfoQuery")] 12 | public class EmployeeInfoQueryController : BaseQueryController 13 | { 14 | public EmployeeInfoQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Customers/CustomerProductViewModel.cs: -------------------------------------------------------------------------------- 1 | using ViewModel.Sales; 2 | 3 | namespace ViewModel.Customers 4 | { 5 | public class CustomerProductViewModel 6 | { 7 | 8 | public CustomerProductViewModel(SaleDetailViewModel x, string productName, double salePrice) 9 | { 10 | 11 | Total = x.Total; 12 | Quantity = x.Quantity; 13 | ProductName = x.ProductDetailName; 14 | InvoiceNumber = x.SaleOrderNo; 15 | Price = x.SalePricePerUnit; 16 | } 17 | public string InvoiceNumber { get; set; } 18 | public string ProductName { get; set; } 19 | public double Quantity { get; set; } 20 | public double Price { get; set; } 21 | public double Total { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Products/DealerProductQueryController.cs: -------------------------------------------------------------------------------- 1 | using Model.Products; 2 | using RequestModel.Products; 3 | using System.Web.Http; 4 | using ViewModel.Products; 5 | using CommonLibrary.Service; 6 | using CommonLibrary.Repository; 7 | using Model; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Products 10 | { 11 | [RoutePrefix("api/DealerProductQuery")] 12 | public class DealerProductQueryController : BaseQueryController 13 | { 14 | public DealerProductQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/Reports/IReportService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ServiceLibrary.Reports 5 | { 6 | using Model; 7 | 8 | using ReportModel; 9 | using ReportModel.Parameters; 10 | 11 | public interface IReportService where T : ShopChild where M : BaseReport 12 | { 13 | void ShopClose(string shopId, DateTime start, DateTime end, ReportTimeType reportTimeType); 14 | IEnumerable CreateReportModels(List models, ReportParameterBase p); 15 | M CreateReportModel(List models, ReportParameterBase reportParameter); 16 | void SaveReports(List reports); 17 | } 18 | 19 | public interface IReportService2 20 | { 21 | string QuickUpdate(string shopId, string itemId, DateTime date); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/BizBook/Utility/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Utility 4 | { 5 | public static class Extensions 6 | { 7 | public static bool IdIsOk(this string id) 8 | { 9 | if (string.IsNullOrWhiteSpace(id)) 10 | { 11 | return false; 12 | } 13 | Guid guid; 14 | if (!Guid.TryParse(id, out guid)) 15 | { 16 | return false; 17 | } 18 | if (guid == new Guid()) 19 | { 20 | return false; 21 | } 22 | return true; 23 | } 24 | 25 | public static double ToDecimal(this double input) 26 | { 27 | return Math.Round(input, 2, MidpointRounding.AwayFromZero); 28 | } 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Products/ProductCategoryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using Model.Products; 6 | using RequestModel.Products; 7 | using ViewModel.Products; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Products 10 | { 11 | [RoutePrefix("api/ProductCategory")] 12 | public class ProductCategoryController : BaseCommandController 13 | { 14 | public ProductCategoryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Transactions/AccountHeadController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using CommonLibrary.Repository; 3 | using CommonLibrary.Service; 4 | using Model; 5 | using RequestModel.Transactions; 6 | using ViewModel.Transactions; 7 | 8 | namespace Server.Inventory.Controllers.CommandControllers.Transactions 9 | { 10 | using Model.Transactions; 11 | 12 | 13 | [RoutePrefix("api/AccountHead")] 14 | public class AccountHeadController : BaseCommandController 15 | { 16 | public AccountHeadController() : base(new BaseService( 17 | new BaseRepository(BusinessDbContext.Create()))) 18 | { 19 | 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Products/ProductVariation.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace Model.Products 5 | { 6 | public class ProductVariation 7 | { 8 | [NotMapped] public string Permalink { get; set; } 9 | [NotMapped] public int WcVariationId { get; set; } 10 | [NotMapped] public string Option { get; set; } 11 | [NotMapped] public double CostPrice { get; set; } 12 | [NotMapped] public double SalePrice { get; set; } 13 | [NotMapped] public int OnHand { get; set; } 14 | [NotMapped] public int Purchased { get; set; } 15 | [NotMapped] public int Sold { get; set; } 16 | [NotMapped] public List Images { get; set; } 17 | [NotMapped] public string Name { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Warehouses/WarehouseController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | 3 | namespace Server.Inventory.Controllers.CommandControllers.Warehouses 4 | { 5 | using CommonLibrary.Repository; 6 | using CommonLibrary.Service; 7 | 8 | using Model; 9 | using Model.Warehouses; 10 | using RequestModel.Warehouses; 11 | using ViewModel.Warehouses; 12 | 13 | [RoutePrefix("api/Warehouse")] 14 | public class WarehouseController : BaseCommandController 15 | { 16 | public WarehouseController(): base(new BaseService( 17 | new BaseRepository(BusinessDbContext.Create()))) 18 | { 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Transactions/WalletViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Transactions; 3 | 4 | namespace ViewModel.Transactions 5 | { 6 | public class WalletViewModel : BaseViewModel 7 | { 8 | public WalletViewModel(Wallet x) : base(x) 9 | { 10 | AccountTitle = x.AccountTitle; 11 | AccountNumber = x.AccountNumber; 12 | BankName = x.BankName; 13 | WalletType = x.WalletType.ToString(); 14 | ShopId = x.ShopId; 15 | } 16 | 17 | public string ShopId { get; set; } 18 | 19 | public string AccountTitle { get; set; } 20 | 21 | public string AccountNumber { get; set; } 22 | 23 | public string BankName { get; set; } 24 | 25 | public string WalletType { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Warehouses/Warehouse.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations.Schema; 2 | using Model.Customers; 3 | 4 | namespace Model.Warehouses 5 | { 6 | public class Warehouse : ShopChild 7 | { 8 | public string Name { get; set; } 9 | 10 | public string StreetAddress { get; set; } 11 | 12 | public string Area { get; set; } 13 | 14 | public string District { get; set; } 15 | 16 | public bool IsMain { get; set; } 17 | } 18 | 19 | public class WarehouseZone : ShopChild 20 | { 21 | public string WarehouseId { get; set; } 22 | 23 | [ForeignKey("WarehouseId")] public virtual Warehouse Warehouse { get; set; } 24 | 25 | public string ZoneId { get; set; } 26 | 27 | [ForeignKey("ZoneId")] public virtual Zone Zone { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Products/SupplierProductQueryController.cs: -------------------------------------------------------------------------------- 1 | using Model.Products; 2 | using RequestModel.Products; 3 | using System.Web.Http; 4 | using ViewModel.Products; 5 | using CommonLibrary.Service; 6 | using CommonLibrary.Repository; 7 | using Model; 8 | 9 | namespace Server.Inventory.Controllers.QueryControllers.Products 10 | { 11 | [RoutePrefix("api/SupplierProductQuery")] 12 | public class SupplierProductQueryController : BaseQueryController 13 | { 14 | public SupplierProductQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/BizBook/ReportModel/Parameters/TransactionReportParameter.cs: -------------------------------------------------------------------------------- 1 | namespace ReportModel.Parameters 2 | { 3 | using System; 4 | 5 | public class TransactionReportParameter : ReportParameterBase 6 | { 7 | public TransactionReportParameter(DateTime date, string value, string shopId) : base(date, value, shopId) 8 | { 9 | } 10 | 11 | public string AccountHeadName { get; set; } 12 | 13 | public string AccountHeadId { get; set; } 14 | 15 | public double TotalStarting { get; set; } 16 | 17 | public double CashStarting { get; set; } 18 | 19 | public double CardStarting { get; set; } 20 | 21 | public double ChequeStarting { get; set; } 22 | 23 | public double MobileStarting { get; set; } 24 | 25 | public double OtherStarting { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Employees/EmployeeInfo.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using Model.Warehouses; 4 | 5 | namespace Model.Employees 6 | { 7 | public class EmployeeInfo : ShopChild 8 | { 9 | [Index] [Required] [MaxLength(200)] public string Name { get; set; } 10 | 11 | [Index] [MaxLength(100)] public string Phone { get; set; } 12 | 13 | [Index] [MaxLength(50)] public string Email { get; set; } 14 | public string RoleId { get; set; } 15 | public double Salary { get; set; } 16 | public double SaleTargetAmount { get; set; } 17 | public double SaleAchivedAmount { get; set; } 18 | 19 | public string WarehouseId { get; set; } 20 | 21 | [ForeignKey("WarehouseId")] public virtual Warehouse Warehouse { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Products/ProductCategoryViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Products; 3 | 4 | namespace ViewModel.Products 5 | { 6 | public class ProductCategoryViewModel : BaseViewModel 7 | { 8 | public ProductCategoryViewModel(ProductCategory x) : base(x) 9 | { 10 | Name = x.Name; 11 | ProductGroupId = x.ProductGroupId; 12 | if (x.ProductGroup != null) 13 | { 14 | ProductGroupName = x.ProductGroup.Name; 15 | } 16 | 17 | ShopId = x.ShopId; 18 | } 19 | 20 | public string ShopId { get; set; } 21 | 22 | [IsViewable] public string ProductGroupName { get; set; } 23 | 24 | [IsViewable] public string Name { get; set; } 25 | public string ProductGroupId { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | using System.Web; 3 | using System.Web.Http; 4 | using System.Web.Mvc; 5 | using System.Web.Routing; 6 | using Model; 7 | using Server.Identity.Models; 8 | 9 | namespace Server.Identity 10 | { 11 | public class WebApiApplication : HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | GlobalConfiguration.Configure(WebApiConfig.Register); 17 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 18 | RouteConfig.RegisterRoutes(RouteTable.Routes); 19 | // BundleConfig.RegisterBundles(BundleTable.Bundles); 20 | Database.SetInitializer(null); 21 | Database.SetInitializer(null); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Sales/InstallmentDetailQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | 3 | namespace Server.Inventory.Controllers.QueryControllers.Sales 4 | { 5 | using CommonLibrary.Repository; 6 | using CommonLibrary.Service; 7 | 8 | using Model; 9 | using Model.Sales; 10 | using RequestModel.Sales; 11 | using ViewModel.Sales; 12 | 13 | [RoutePrefix("api/InstallmentDetailQuery")] 14 | public class InstallmentDetailQueryController : BaseQueryController 15 | { 16 | public InstallmentDetailQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 17 | { 18 | } 19 | 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/BizBook/ReportModel/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Providers/OAuthTokenProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.Owin.Security.OAuth; 4 | 5 | namespace Server.Identity.Providers 6 | { 7 | public class OAuthTokenProvider : OAuthBearerAuthenticationProvider 8 | 9 | { 10 | public override Task RequestToken(OAuthRequestTokenContext context) 11 | { 12 | if (context == null) throw new ArgumentNullException("context"); 13 | 14 | // try to find bearer token in a cookie 15 | // (by default OAuthBearerAuthenticationHandler 16 | // only checks Authorization header) 17 | var tokenCookie = context.OwinContext.Request.Cookies["BearerToken"]; 18 | if (!string.IsNullOrEmpty(tokenCookie)) 19 | context.Token = tokenCookie; 20 | return Task.FromResult(null); 21 | 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Warehouses/WarehouseViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Warehouses 2 | { 3 | using CommonLibrary.ViewModel; 4 | using Model.Warehouses; 5 | 6 | public class WarehouseViewModel : BaseViewModel 7 | { 8 | public WarehouseViewModel(Warehouse entity) : base(entity) 9 | { 10 | Name = entity.Name; 11 | StreetAddress = entity.StreetAddress; 12 | Area = entity.Area; 13 | District = entity.District; 14 | IsMain = entity.IsMain; 15 | ShopId = entity.ShopId; 16 | } 17 | 18 | public string Name { get; set; } 19 | 20 | public string StreetAddress { get; set; } 21 | 22 | public string Area { get; set; } 23 | 24 | public string District { get; set; } 25 | 26 | public bool IsMain { get; set; } 27 | public string ShopId { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Helper/ApplicationInsightHelpers.cs: -------------------------------------------------------------------------------- 1 | namespace Server.Identity.Helper 2 | { 3 | public class ApplicationInsightHelpers 4 | { 5 | } 6 | 7 | //public class RequestBodyInitializer : ITelemetryInitializer 8 | //{ 9 | // public void Initialize(ITelemetry telemetry) 10 | // { 11 | // var requestTelemetry = telemetry as RequestTelemetry; 12 | // if (requestTelemetry != null && (requestTelemetry.HttpMethod == HttpMethod.Post.ToString() || requestTelemetry.HttpMethod == HttpMethod.Put.ToString())) 13 | // { 14 | // using (var reader = new StreamReader(HttpContext.Current.Request.InputStream)) 15 | // { 16 | // string requestBody = reader.ReadToEnd(); 17 | // requestTelemetry.Properties.Add("body", requestBody); 18 | // } 19 | // } 20 | // } 21 | //} 22 | } -------------------------------------------------------------------------------- /source/BizBook/Utility/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Providers/OAuthTokenProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Server.Inventory.Providers 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | using Microsoft.Owin.Security.OAuth; 7 | 8 | public class OAuthTokenProvider : OAuthBearerAuthenticationProvider 9 | 10 | { 11 | public override Task RequestToken(OAuthRequestTokenContext context) 12 | { 13 | if (context == null) throw new ArgumentNullException("context"); 14 | 15 | // try to find bearer token in a cookie 16 | // (by default OAuthBearerAuthenticationHandler 17 | // only checks Authorization header) 18 | var tokenCookie = context.OwinContext.Request.Cookies["BearerToken"]; 19 | if (!string.IsNullOrEmpty(tokenCookie)) 20 | context.Token = tokenCookie; 21 | return Task.FromResult(null); 22 | 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/Reports/BaseReportService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ServiceLibrary.Reports 4 | { 5 | using ReportModel; 6 | 7 | public class BaseReportService 8 | { 9 | protected T SetDefaults(T report, string shopId, DateTime date) where T : BaseReport 10 | { 11 | report.Id = Guid.NewGuid().ToString(); 12 | DateTime dateTime = DateTime.Now; 13 | report.Created = dateTime; 14 | report.Modified = dateTime; 15 | report.CreatedBy = "System"; 16 | report.ModifiedBy = "System"; 17 | report.CreatedFrom = "System"; 18 | report.IsActive = true; 19 | 20 | report.Date = date; 21 | report.Value = date.ToString("dd/MM/yyyy"); 22 | report.RowsCount = 0; 23 | report.ShopId = shopId; 24 | return report; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Shops/BrandQueryController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Net.Http; 7 | using System.Net.Http.Headers; 8 | using System.Threading.Tasks; 9 | using System.Web.Http; 10 | using CommonLibrary.Repository; 11 | using CommonLibrary.Service; 12 | using Model; 13 | using RequestModel.Shops; 14 | using ViewModel.Shops; 15 | using M = Model.Shops.Brand; 16 | 17 | namespace Server.Inventory.Controllers.QueryControllers.Shops 18 | { 19 | [RoutePrefix("api/BrandQuery")] 20 | public class BrandQueryController : BaseQueryController 21 | { 22 | public BrandQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 23 | { 24 | 25 | } 26 | 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /source/BizBook/CommonLibrary/Model/Entity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace CommonLibrary.Model 5 | { 6 | using System.ComponentModel.DataAnnotations.Schema; 7 | 8 | [Serializable] 9 | public abstract class Entity 10 | { 11 | [Key] 12 | public string Id { get; set; } 13 | 14 | [Index] 15 | [Required] 16 | [Column(TypeName = "datetime2")] 17 | public DateTime Created { get; set; } 18 | 19 | [Required] 20 | public string CreatedBy { get; set; } 21 | 22 | [Required] 23 | public string CreatedFrom { get; set; } 24 | 25 | [Index] 26 | [Required] 27 | [Column(TypeName = "datetime2")] 28 | public DateTime Modified { get; set; } 29 | 30 | [Required] 31 | public string ModifiedBy { get; set; } 32 | 33 | [Required] 34 | public bool IsActive { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Migrations/201901191332239_Init.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | namespace Model.Migrations 3 | { 4 | using System.CodeDom.Compiler; 5 | using System.Data.Entity.Migrations; 6 | using System.Data.Entity.Migrations.Infrastructure; 7 | using System.Resources; 8 | 9 | [GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")] 10 | public sealed partial class Init : IMigrationMetadata 11 | { 12 | private readonly ResourceManager Resources = new ResourceManager(typeof(Init)); 13 | 14 | string IMigrationMetadata.Id 15 | { 16 | get { return "201901191332239_Init"; } 17 | } 18 | 19 | string IMigrationMetadata.Source 20 | { 21 | get { return null; } 22 | } 23 | 24 | string IMigrationMetadata.Target 25 | { 26 | get { return Resources.GetString("Target"); } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Shops/CourierViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Shops; 3 | 4 | namespace ViewModel.Shops 5 | { 6 | public class CourierViewModel : BaseViewModel 7 | { 8 | public CourierViewModel(Courier x) : base(x) 9 | { 10 | ShopId = x.ShopId; 11 | ContactPersonName = x.ContactPersonName; 12 | CourierShopId = x.CourierShopId; 13 | if (x.CourierShop != null) 14 | { 15 | CourierShopName = x.CourierShop.Name; 16 | CourierShopPhone = x.CourierShop.Phone; 17 | } 18 | } 19 | 20 | public string CourierShopName { get; set; } 21 | 22 | public string CourierShopPhone { get; set; } 23 | 24 | public string ShopId { get; set; } 25 | 26 | [IsViewable] public string ContactPersonName { get; set; } 27 | 28 | [IsViewable] public string CourierShopId { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Products/DealerProduct.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | 5 | namespace Model.Products 6 | { 7 | using Model.Dealers; 8 | 9 | public class DealerProduct : ShopChild 10 | { 11 | [Required] public double Quantity { get; set; } 12 | 13 | [Required] public double TotalPrice { get; set; } 14 | 15 | [Required] public double Paid { get; set; } 16 | 17 | [Required] public double Due { get; set; } 18 | 19 | [Required] public string ProductDetailId { get; set; } 20 | 21 | [ForeignKey("ProductDetailId")] public ProductDetail ProductDetail { get; set; } 22 | 23 | [Required] public string DealerId { get; set; } 24 | 25 | [ForeignKey("DealerId")] public Dealer Dealer { get; set; } 26 | 27 | public virtual ICollection Transactions { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Products/SupplierProduct.cs: -------------------------------------------------------------------------------- 1 | using Model.Shops; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | 6 | namespace Model.Products 7 | { 8 | public class SupplierProduct : ShopChild 9 | { 10 | [Required] public double Quantity { get; set; } 11 | 12 | [Required] public double TotalPrice { get; set; } 13 | 14 | [Required] public double Paid { get; set; } 15 | 16 | [Required] public double Due { get; set; } 17 | 18 | [Required] public string ProductDetailId { get; set; } 19 | 20 | [ForeignKey("ProductDetailId")] public ProductDetail ProductDetail { get; set; } 21 | 22 | [Required] public string SupplierId { get; set; } 23 | 24 | [ForeignKey("SupplierId")] public Supplier Supplier { get; set; } 25 | 26 | public virtual ICollection Transactions { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Migrations/201901181446153_Init.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | namespace Server.Identity.Migrations 3 | { 4 | using System.CodeDom.Compiler; 5 | using System.Data.Entity.Migrations; 6 | using System.Data.Entity.Migrations.Infrastructure; 7 | using System.Resources; 8 | 9 | [GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")] 10 | public sealed partial class Init : IMigrationMetadata 11 | { 12 | private readonly ResourceManager Resources = new ResourceManager(typeof(Init)); 13 | 14 | string IMigrationMetadata.Id 15 | { 16 | get { return "201901181446153_Init"; } 17 | } 18 | 19 | string IMigrationMetadata.Source 20 | { 21 | get { return null; } 22 | } 23 | 24 | string IMigrationMetadata.Target 25 | { 26 | get { return Resources.GetString("Target"); } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/BizBook/CommonLibrary/ViewModel/BaseViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using CommonLibrary.Model; 3 | 4 | namespace CommonLibrary.ViewModel 5 | { 6 | public abstract class BaseViewModel where T : Entity 7 | { 8 | protected BaseViewModel(Entity x) 9 | { 10 | Id = x.Id; 11 | Created = x.Created; 12 | CreatedBy = x.CreatedBy; 13 | Modified = x.Modified; 14 | ModifiedBy = x.ModifiedBy; 15 | CreatedFrom = x.CreatedFrom; 16 | IsActive = x.IsActive; 17 | } 18 | 19 | 20 | public bool IsActive { get; set; } 21 | 22 | [IsViewable] 23 | public string Id { get; set; } 24 | 25 | public DateTime Created { get; set; } 26 | 27 | public string CreatedBy { get; set; } 28 | 29 | public string CreatedFrom { get; set; } 30 | 31 | public DateTime Modified { get; set; } 32 | 33 | public string ModifiedBy { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Message/Sms.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace Model.Message 5 | { 6 | public class Sms : ShopChild 7 | { 8 | [Required] [MaxLength(200)] public string Text { get; set; } 9 | 10 | [Required] public SmsReceiverType SmsReceiverType { get; set; } = SmsReceiverType.Unknown; 11 | 12 | [Index] [MaxLength(20)] public string ReceiverNumber { get; set; } 13 | 14 | [Index] [Required] [MaxLength(128)] public string ReceiverId { get; set; } 15 | 16 | [Index] [Required] public SmsReasonType ReasonType { get; set; } = SmsReasonType.Unknown; 17 | 18 | [Index] [Required] [MaxLength(128)] public string ReasonId { get; set; } 19 | 20 | [Required] [MaxLength(100)] public string DeliveryStatus { get; set; } 21 | 22 | [Required] public bool Ismasked { get; set; } 23 | 24 | [NotMapped] public string SenderApp { get; set; } = "BizBook"; 25 | } 26 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Shops/SupplierViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Shops; 3 | 4 | namespace ViewModel.Shops 5 | { 6 | public class SupplierViewModel : BaseViewModel 7 | { 8 | public SupplierViewModel(Supplier x) : base(x) 9 | { 10 | Name = x.Name; 11 | Address = x.StreetAddress; 12 | Phone = x.Phone; 13 | Remarks = x.Remarks; 14 | ContactPersonName = x.ContactPersonName; 15 | ShopId = x.ShopId; 16 | Country = x.Country; 17 | } 18 | 19 | public string ShopId { get; set; } 20 | 21 | [IsViewable] public string Name { get; set; } 22 | [IsViewable] public string Address { get; set; } 23 | [IsViewable] public string Phone { get; set; } 24 | [IsViewable] public string Remarks { get; set; } 25 | [IsViewable] public string ContactPersonName { get; set; } 26 | [IsViewable] public string Country { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Models/ApplicationPermissionViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace Server.Identity.Models 2 | { 3 | public class ApplicationPermissionViewModel 4 | { 5 | public string Id { get; set; } 6 | public string ResourceId { get; set; } 7 | public string RoleId { get; set; } 8 | public bool IsAllowed { get; set; } 9 | public bool IsDisabled { get; set; } 10 | 11 | public ApplicationPermissionViewModel(string id,string resourceId,string roleId,bool isAllowed) 12 | { 13 | Id = id; 14 | ResourceId = resourceId; 15 | RoleId = roleId; 16 | IsAllowed = isAllowed; 17 | } 18 | 19 | public ApplicationPermissionViewModel(string id, string resourceId, string roleId, bool isAllowed,bool isDisabled) 20 | { 21 | Id = id; 22 | ResourceId = resourceId; 23 | RoleId = roleId; 24 | IsAllowed = isAllowed; 25 | IsDisabled = isDisabled; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Products/ProductGroupQueryController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Net.Http; 7 | using System.Net.Http.Headers; 8 | using System.Threading.Tasks; 9 | using System.Web.Http; 10 | using CommonLibrary.Repository; 11 | using CommonLibrary.Service; 12 | using Model; 13 | using ViewModel.Products; 14 | using Rm = RequestModel.Products.ProductGroupRequestModel; 15 | using M = Model.Products.ProductGroup; 16 | using Vm = ViewModel.Products.ProductGroupViewModel; 17 | 18 | namespace Server.Inventory.Controllers.QueryControllers.Products 19 | { 20 | [RoutePrefix("api/ProductGroupQuery")] 21 | public class ProductGroupQueryController : BaseQueryController 22 | { 23 | public ProductGroupQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 24 | { 25 | } 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/Subscription/MD5Hash.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Cryptography; 2 | using System.Text; 3 | 4 | namespace ServiceLibrary.Subscription 5 | { 6 | public static class MD5Hash 7 | { 8 | public static string GetMd5Hash(MD5 md5Hash, string input) 9 | { 10 | 11 | // Convert the input string to a byte array and compute the hash. 12 | byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input)); 13 | 14 | // Create a new Stringbuilder to collect the bytes 15 | // and create a string. 16 | StringBuilder sBuilder = new StringBuilder(); 17 | 18 | // Loop through each byte of the hashed data 19 | // and format each one as a hexadecimal string. 20 | for (int i = 0; i < data.Length; i++) 21 | { 22 | sBuilder.Append(data[i].ToString("x2")); 23 | } 24 | 25 | // Return the hexadecimal string. 26 | return sBuilder.ToString(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/BizBook/RequestModel/PartnerRequestModel.cs: -------------------------------------------------------------------------------- 1 | using Model; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Linq.Expressions; 8 | 9 | namespace RequestModel 10 | { 11 | public class PartnerRequestModel : RequestModelBase 12 | { 13 | public PartnerRequestModel(string keyword, string orderBy, string isAscending) : base(keyword, orderBy, isAscending) 14 | { 15 | } 16 | 17 | protected override Expression> GetExpression() 18 | { 19 | if (!string.IsNullOrWhiteSpace(Keyword)) 20 | { 21 | ExpressionObj = x => x.PartnerShopId.ToLower().Contains(Keyword) || x.ShopId.ToLower().Contains(Keyword); 22 | } 23 | if (!string.IsNullOrWhiteSpace(Id)) 24 | { 25 | ExpressionObj = ExpressionObj.And(x => x.Id == Id); 26 | } 27 | return ExpressionObj; 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Results/ChallengeResult.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using System.Net.Http; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using System.Web.Http; 6 | 7 | namespace Server.Identity.Results 8 | { 9 | public class ChallengeResult : IHttpActionResult 10 | { 11 | public ChallengeResult(string loginProvider, ApiController controller) 12 | { 13 | LoginProvider = loginProvider; 14 | Request = controller.Request; 15 | } 16 | 17 | public string LoginProvider { get; set; } 18 | public HttpRequestMessage Request { get; set; } 19 | 20 | public Task ExecuteAsync(CancellationToken cancellationToken) 21 | { 22 | Request.GetOwinContext().Authentication.Challenge(LoginProvider); 23 | 24 | HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Unauthorized); 25 | response.RequestMessage = Request; 26 | return Task.FromResult(response); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Results/ChallengeResult.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using System.Net.Http; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using System.Web.Http; 6 | 7 | namespace Server.Inventory.Results 8 | { 9 | public class ChallengeResult : IHttpActionResult 10 | { 11 | public ChallengeResult(string loginProvider, ApiController controller) 12 | { 13 | LoginProvider = loginProvider; 14 | Request = controller.Request; 15 | } 16 | 17 | public string LoginProvider { get; set; } 18 | public HttpRequestMessage Request { get; set; } 19 | 20 | public Task ExecuteAsync(CancellationToken cancellationToken) 21 | { 22 | Request.GetOwinContext().Authentication.Challenge(LoginProvider); 23 | 24 | HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Unauthorized); 25 | response.RequestMessage = Request; 26 | return Task.FromResult(response); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/BizBook/Model/Sales/Installment.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Model.Sales 4 | { 5 | public class Installment : ShopChild 6 | { 7 | public double CashPriceAmount { get; set; } 8 | 9 | public double ProfitPercent { get; set; } 10 | 11 | public double ProfitAmount { get; set; } 12 | 13 | public double InstallmentTotalAmount { get; set; } 14 | 15 | public double DownPaymentPercent { get; set; } 16 | 17 | public double DownPaymentAmount { get; set; } 18 | 19 | public double InstallmentDueAmount { get; set; } 20 | 21 | public string InstallmentMonth { get; set; } 22 | 23 | public double InstallmentPerMonthAmount { get; set; } 24 | 25 | public int SaleType { get; set; } 26 | 27 | public double CashPriceDueAmount { get; set; } 28 | 29 | public double ProfitAmountPerMonth { get; set; } 30 | 31 | public string SaleId { get; set; } 32 | 33 | public virtual ICollection InstallmentDetails { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Helper/B2BSignalrEventHandlers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.AspNet.SignalR; 3 | using Server.Identity.Hubs; 4 | 5 | namespace Server.Identity.Helper 6 | { 7 | public static class B2BSignalrEventHandlers 8 | { 9 | public static B2BSignalrEvents B2BSignalrEvents { get; set; } 10 | static B2BSignalrEventHandlers() 11 | { 12 | B2BSignalrEvents=new B2BSignalrEvents(); 13 | B2BSignalrEvents.ChatReceived += B2BSignalrEvents_ChatReceived; 14 | 15 | } 16 | 17 | private static void B2BSignalrEvents_ChatReceived(object sender, EventArgs e) 18 | { 19 | ChatEventArgs chatArgs = (ChatEventArgs) e; 20 | IHubContext hubContext = GlobalHost.ConnectionManager.GetHubContext(); 21 | //var connections = ConnectionHandler.Connections.GetConnections(chatArgs.ReceiverUsername).ToList(); 22 | 23 | //hubContext.Clients.Clients(connections).chatReceived(chatArgs.SenderUsername,chatArgs.Message); 24 | } 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Products/WarehouseProduct.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Products 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using Model.Warehouses; 6 | 7 | public class WarehouseProduct : ShopChild 8 | { 9 | [Required] public int StartingInventory { get; set; } = 0; 10 | 11 | [Required] public double Purchased { get; set; } 12 | 13 | [Required] public double Sold { get; set; } 14 | 15 | [Required] public double TransferredIn { get; set; } 16 | 17 | [Required] public double TransferredOut { get; set; } 18 | 19 | [Required] public double OnHand { get; set; } 20 | 21 | public int MinimumStockToNotify { get; set; } 22 | 23 | public string WarehouseId { get; set; } 24 | 25 | [ForeignKey("WarehouseId")] public virtual Warehouse Warehouse { get; set; } 26 | 27 | public string ProductDetailId { get; set; } 28 | 29 | [ForeignKey("ProductDetailId")] public virtual ProductDetail ProductDetail { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/Products/ProductCategoryQueryController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Net.Http; 7 | using System.Net.Http.Headers; 8 | using System.Threading.Tasks; 9 | using System.Web.Http; 10 | using CommonLibrary.Repository; 11 | using CommonLibrary.Service; 12 | using Model; 13 | using Model.Products; 14 | using RequestModel.Products; 15 | using ViewModel.Products; 16 | 17 | namespace Server.Inventory.Controllers.QueryControllers.Products 18 | { 19 | [RoutePrefix("api/ProductCategoryQuery")] 20 | public class ProductCategoryQueryController : BaseQueryController 21 | { 22 | 23 | public ProductCategoryQueryController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 24 | { 25 | } 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/BizBook/Model/Sales/InstallmentDetail.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Sales 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using Model.Transactions; 6 | 7 | public class InstallmentDetail : ShopChild 8 | { 9 | public string InstallmentId { get; set; } 10 | 11 | [ForeignKey("InstallmentId")] public virtual Installment Installment { get; set; } 12 | 13 | public string SaleId { get; set; } 14 | 15 | [ForeignKey("SaleId")] public virtual Sale Sale { get; set; } 16 | 17 | public string TansactionId { get; set; } 18 | 19 | [ForeignKey("TansactionId")] public virtual Transaction Transaction { get; set; } 20 | 21 | public double ScheduledAmount { get; set; } 22 | 23 | public double PaidAmount { get; set; } 24 | 25 | public double DueAmount { get; set; } 26 | 27 | [Column(TypeName = "datetime2")] 28 | public DateTime ScheduledDate { get; set; } 29 | 30 | [Column(TypeName = "datetime2")] 31 | public DateTime? PaidDate { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Warehouses/DamageViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Warehouses; 3 | 4 | namespace ViewModel.Warehouses 5 | { 6 | public class DamageViewModel : BaseViewModel 7 | { 8 | public DamageViewModel(Damage x) : base(x) 9 | { 10 | ProductDetailId = x.ProductDetailId; 11 | 12 | if (x.ProductDetail != null) 13 | { 14 | ProductName = x.ProductDetail.Name; 15 | } 16 | 17 | WarehouseId = x.WarehouseId; 18 | 19 | if (x.Warehouse != null) 20 | { 21 | Name = x.Warehouse.Name; 22 | } 23 | 24 | Quantity = x.Quantity; 25 | 26 | ShopId = x.ShopId; 27 | } 28 | 29 | public string ShopId { get; set; } 30 | public string WarehouseId { get; set; } 31 | public string Name { get; set; } 32 | public string ProductDetailId { get; set; } 33 | public string ProductName { get; set; } 34 | public double Quantity { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/Reports/SchedulerService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ServiceLibrary.Reports 4 | { 5 | using Model; 6 | 7 | public class SchedulerService 8 | { 9 | public static void ProcessData(string shopId) 10 | { 11 | var db = BusinessDbContext.Create(); 12 | var end = DateTime.Today.Date.AddDays(1).AddSeconds(-2); 13 | var start = DateTime.Today.Date; 14 | var timeType = ReportTimeType.Daily; 15 | 16 | //SaleReportService saleReportService = new SaleReportService(new BaseRepository(db)); 17 | //saleReportService.ShopClose(shopId, start, end, timeType); 18 | 19 | //TransactionReportService service2 = new TransactionReportService(new BaseRepository(db)); 20 | //service2.ShopClose(shopId, start, end, timeType); 21 | 22 | //ProductReportService productReportService = new ProductReportService(new BaseRepository(db)); 23 | //productReportService.ShopClose(shopId, start, end, timeType); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Reports/AccountReportViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Reports 2 | { 3 | using Model; 4 | using ReportModel; 5 | 6 | public class AccountReportViewModel : BaseReportViewModel 7 | { 8 | public AccountReportViewModel(AccountReport x) 9 | : base(x) 10 | { 11 | this.AccountHeadName = x.AccountHeadName; 12 | AmountTotalStarting = x.AmountTotalStarting; 13 | AmountTotalIn = x.AmountTotalIn; 14 | AmountTotalOut = x.AmountTotalOut; 15 | AmountTotalEnding = x.AmountTotalEnding; 16 | } 17 | 18 | public AccountReportType TransactionReportType { get; set; } 19 | 20 | public string AccountHeadName { get; set; } 21 | 22 | 23 | public double AmountTotalStarting { get; set; } = 0; 24 | 25 | 26 | public double AmountTotalIn { get; set; } = 0; 27 | 28 | 29 | public double AmountTotalOut { get; set; } = 0; 30 | 31 | 32 | public double AmountTotalEnding { get; set; } = 0; 33 | 34 | 35 | public int CountTotalTrx { get; set; } = 0; 36 | } 37 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Migrations/Configuration.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Migrations 2 | { 3 | using System.Data.Entity.Migrations; 4 | 5 | internal sealed class Configuration : DbMigrationsConfiguration 6 | { 7 | public Configuration() 8 | { 9 | AutomaticMigrationsEnabled = false; 10 | } 11 | 12 | protected override void Seed(BusinessDbContext context) 13 | { 14 | BusinessSeedData.AddSysShop(context); 15 | const string demoShopId = "00000000-0000-0000-0000-000000000001"; 16 | BusinessSeedData.AddShop(context, demoShopId, "Demo1"); 17 | BusinessSeedData.AddBrand(demoShopId, context); 18 | BusinessSeedData.AddAccountHeads(context, demoShopId); 19 | BusinessSeedData.AddWallet(context, demoShopId); 20 | BusinessSeedData.AddProducts(context, demoShopId); 21 | BusinessSeedData.AddSupplier(context, demoShopId); 22 | BusinessSeedData.AddCustomer(context, demoShopId); 23 | BusinessSeedData.AddWarehouse(context, demoShopId); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Controllers/QueryControllers/System/ApplicationUserRoleQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using System.Web.Http; 4 | using Server.Identity.Models; 5 | 6 | namespace Server.Identity.Controllers.QueryControllers.System 7 | { 8 | [RoutePrefix("api/ApplicationUserRoleQuery")] 9 | [Authorize(Roles = "SuperAdmin")] 10 | public class ApplicationUserRoleQueryController : ApiController 11 | { 12 | private SecurityDbContext db = new SecurityDbContext(); 13 | 14 | [Route("Data")] 15 | [ActionName("Data")] 16 | [HttpGet] 17 | public async Task Data() 18 | { 19 | var roles = db.Roles.ToDictionary(x => x.Id, x => x.Name); 20 | var users = db.Users.ToDictionary(x => x.Id, x => x.Email); 21 | var identityUserRoles = db.ApplicationUserRoles.ToList().Select(x => new AppUserRolesViewModel { RoleId = x.RoleId, UserId = x.UserId, RoleName = roles[x.RoleId], UserName = users[x.UserId] }).ToList(); 22 | return Ok(identityUserRoles); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Employees/EmployeeInfoViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Employees; 3 | 4 | namespace ViewModel.Employees 5 | { 6 | public class EmployeeInfoViewModel : BaseViewModel 7 | { 8 | public EmployeeInfoViewModel(EmployeeInfo x) : base(x) 9 | { 10 | Name = x.Name; 11 | Phone = x.Phone; 12 | Email = x.Email; 13 | RoleId = x.RoleId; 14 | Salary = x.Salary; 15 | SaleTargetAmount = x.SaleTargetAmount; 16 | SaleAchivedAmount = x.SaleAchivedAmount; 17 | ShopId = x.ShopId; 18 | WarehouseId = x.WarehouseId; 19 | } 20 | 21 | public string WarehouseId { get; set; } 22 | 23 | public string Name { get; set; } 24 | public string Phone { get; set; } 25 | public string Email { get; set; } 26 | public string RoleId { get; set; } 27 | public double Salary { get; set; } 28 | public double SaleTargetAmount { get; set; } 29 | public double SaleAchivedAmount { get; set; } 30 | public string ShopId { get; set; } 31 | } 32 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Models/SecurityDbContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | using System.Data.Entity.ModelConfiguration.Conventions; 3 | using Microsoft.AspNet.Identity.EntityFramework; 4 | 5 | namespace Server.Identity.Models 6 | { 7 | public class SecurityDbContext : IdentityDbContext 8 | { 9 | public SecurityDbContext() 10 | : base("DefaultConnection", throwIfV1Schema: false) 11 | { 12 | } 13 | 14 | public static SecurityDbContext Create() 15 | { 16 | return new SecurityDbContext(); 17 | } 18 | 19 | public DbSet ApplicationRoles { get; set; } 20 | public DbSet ApplicationUserRoles { get; set; } 21 | public DbSet Permissions { get; set; } 22 | public DbSet Resources { get; set; } 23 | 24 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 25 | { 26 | modelBuilder.Conventions.Remove(); 27 | base.OnModelCreating(modelBuilder); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Customers/Address.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Customers 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | 6 | public class Address : ShopChild 7 | { 8 | [MaxLength(50)] public string AddressName { get; set; } 9 | 10 | public bool IsDefault { get; set; } 11 | 12 | [MaxLength(100)] public string ContactName { get; set; } 13 | 14 | [MaxLength(100)] public string ContactPhone { get; set; } 15 | 16 | [MaxLength(500)] public string StreetAddress { get; set; } 17 | 18 | [MaxLength(50)] public string Area { get; set; } 19 | 20 | [MaxLength(50)] public string Thana { get; set; } 21 | 22 | [MaxLength(20)] public string PostCode { get; set; } 23 | 24 | [MaxLength(50)] public string District { get; set; } 25 | 26 | [MaxLength(50)] public string Country { get; set; } 27 | 28 | [MaxLength(150)] public string SpecialNote { get; set; } 29 | 30 | [Required] public string CustomerId { get; set; } 31 | 32 | [ForeignKey("CustomerId")] public virtual Customer Customer { get; set; } 33 | } 34 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Purchases/PurchaseDetail.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using Model.Products; 4 | using Model.Warehouses; 5 | 6 | namespace Model.Purchases 7 | { 8 | public class PurchaseDetail : ShopChild 9 | { 10 | [Required] public string ProductDetailId { get; set; } 11 | 12 | [ForeignKey("ProductDetailId")] public ProductDetail ProductDetail { get; set; } 13 | 14 | [Required] public string PurchaseId { get; set; } 15 | 16 | [ForeignKey("PurchaseId")] public virtual Purchase Purchase { get; set; } 17 | 18 | [Required] public double Quantity { get; set; } 19 | 20 | [Required] public double CostPricePerUnit { get; set; } 21 | 22 | [Required] public double CostTotal { get; set; } 23 | 24 | [Required] public double Paid { get; set; } 25 | 26 | [Required] public double Payable { get; set; } 27 | 28 | [MaxLength(50)] public string Remarks { get; set; } 29 | 30 | public string WarehouseId { get; set; } 31 | 32 | [ForeignKey("WarehouseId")] public virtual Warehouse Warehouse { get; set; } 33 | } 34 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Message/MessageRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using CommonLibrary.RequestModel; 4 | using CommonLibrary.ViewModel; 5 | using Model.Message; 6 | 7 | namespace RequestModel.Message 8 | { 9 | public class MessageRequestModel : RequestModel 10 | { 11 | public MessageRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 12 | keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | 17 | protected override Expression> GetExpression() 18 | { 19 | if (!string.IsNullOrWhiteSpace(Keyword)) 20 | { 21 | ExpressionObj = x => x.Text.ToLower().Contains(Keyword); 22 | } 23 | 24 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 25 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 26 | return ExpressionObj; 27 | } 28 | 29 | public override Expression> Dropdown() 30 | { 31 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Text}; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Message/SmsHookRequestModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.RequestModel; 2 | using Model.Message; 3 | using System; 4 | using CommonLibrary.ViewModel; 5 | using System.Linq.Expressions; 6 | 7 | namespace RequestModel.Message 8 | { 9 | public class SmsHookRequestModel : RequestModel 10 | { 11 | public SmsHookRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 12 | keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | protected override Expression> GetExpression() 17 | { 18 | if (!string.IsNullOrWhiteSpace(Keyword)) 19 | { 20 | ExpressionObj = x => x.Name.ToLower().Contains(Keyword); 21 | } 22 | 23 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 24 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 25 | return ExpressionObj; 26 | } 27 | 28 | public override Expression> Dropdown() 29 | { 30 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Name}; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/Subscription/HardwareInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Management; 3 | 4 | namespace ServiceLibrary.Subscription 5 | { 6 | public static class HardwareInfo 7 | { 8 | public static string GetHDDSerialNo() 9 | { 10 | ManagementClass mangnmt = new ManagementClass("Win32_LogicalDisk"); 11 | ManagementObjectCollection mcol = mangnmt.GetInstances(); 12 | string result = ""; 13 | foreach (ManagementObject strt in mcol) 14 | { 15 | result += Convert.ToString(strt["VolumeSerialNumber"]); 16 | } 17 | return result; 18 | } 19 | 20 | public static string GetRamSerialNo() 21 | { 22 | string ram = String.Empty; 23 | ManagementObjectSearcher searcher = new 24 | ManagementObjectSearcher("select * from Win32_PhysicalMemory"); 25 | foreach (ManagementObject obj in searcher.Get()) 26 | { 27 | object serial = obj["SerialNumber"]; 28 | ram += serial?.ToString().Trim() ?? String.Empty; 29 | 30 | } 31 | return ram; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Sales/InstallmentDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Sales 2 | { 3 | using System; 4 | using CommonLibrary.ViewModel; 5 | using Model.Sales; 6 | 7 | public class InstallmentDetailViewModel : BaseViewModel 8 | { 9 | public InstallmentDetailViewModel(InstallmentDetail x) 10 | : base(x) 11 | { 12 | this.ShopId = x.ShopId; 13 | this.SaleId = x.SaleId; 14 | this.InstallmentId = x.InstallmentId; 15 | this.ScheduledAmount = x.ScheduledAmount; 16 | this.PaidAmount = x.PaidAmount; 17 | this.DueAmount = x.DueAmount; 18 | this.ScheduledDate = x.ScheduledDate; 19 | this.PaidDate = x.PaidDate; 20 | } 21 | 22 | public string ShopId { get; set; } 23 | 24 | public string SaleId { get; set; } 25 | public string InstallmentId { get; set; } 26 | public double ScheduledAmount { get; set; } 27 | 28 | public double PaidAmount { get; set; } 29 | 30 | public double DueAmount { get; set; } 31 | 32 | public DateTime ScheduledDate { get; set; } 33 | public DateTime? PaidDate { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Message/SmsHistoryRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using CommonLibrary.RequestModel; 4 | using CommonLibrary.ViewModel; 5 | using Model.Message; 6 | 7 | namespace RequestModel.Message 8 | { 9 | public class SmsHistoryRequestModel : RequestModel 10 | { 11 | public SmsHistoryRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 12 | keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | protected override Expression> GetExpression() 17 | { 18 | if (!string.IsNullOrWhiteSpace(Keyword)) 19 | { 20 | ExpressionObj = x => x.Text.ToLower().Contains(Keyword); 21 | } 22 | 23 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 24 | 25 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 26 | 27 | return ExpressionObj; 28 | } 29 | 30 | public override Expression> Dropdown() 31 | { 32 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Text}; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Customers/CustomerFeedbackViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model; 3 | using Model.Customers; 4 | 5 | namespace ViewModel.Customers 6 | { 7 | public class CustomerFeedbackViewModel : BaseViewModel 8 | { 9 | public CustomerFeedbackViewModel(CustomerFeedback x) : base(x) 10 | { 11 | CustomerId = x.CustomerId; 12 | OrderNumber = x.OrderNumber; 13 | Feedback = x.Feedback; 14 | FeedbackType = x.FeedbackType; 15 | ManagerComment = x.ManagerComment; 16 | 17 | if (x.Customer != null) 18 | { 19 | CustomerName = x.Customer.Name; 20 | CustomerPhone = x.Customer.Phone; 21 | } 22 | } 23 | 24 | public string CustomerId { get; set; } 25 | 26 | public string OrderNumber { get; set; } 27 | 28 | public string Feedback { get; set; } 29 | 30 | public FeedbackType FeedbackType { get; set; } 31 | 32 | public string ManagerComment { get; set; } 33 | 34 | [IsViewable] public string CustomerName { get; set; } 35 | 36 | [IsViewable] public string CustomerPhone { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Shops/DealerRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using CommonLibrary.RequestModel; 4 | using CommonLibrary.ViewModel; 5 | 6 | namespace RequestModel.Shops 7 | { 8 | using Model.Dealers; 9 | 10 | public class DealerRequestModel : RequestModel 11 | { 12 | public DealerRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 13 | keyword, orderBy, isAscending) 14 | { 15 | } 16 | 17 | protected override Expression> GetExpression() 18 | { 19 | if (!string.IsNullOrWhiteSpace(Keyword)) 20 | { 21 | ExpressionObj = x => x.Name.ToLower().Contains(Keyword) || x.Phone.ToLower().Contains(Keyword); 22 | } 23 | 24 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 25 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 26 | return ExpressionObj; 27 | } 28 | 29 | public override Expression> Dropdown() 30 | { 31 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Name + "(" + x.Phone + ")"}; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Controllers/ValuesController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Web.Http; 5 | 6 | namespace Server.Identity.Controllers 7 | { 8 | using Serilog; 9 | 10 | using Server.Identity.Hubs; 11 | 12 | [AllowAnonymous] 13 | [RoutePrefix("api/Values")] 14 | public class ValuesController : ApiController 15 | { 16 | // GET api/values 17 | [HttpGet] 18 | [ActionName("GetValue")] 19 | [Route("GetValue")] 20 | public IEnumerable Get() 21 | { 22 | //var dbContext = Request.GetOwinContext().Get(); 23 | //int count = dbContext.Shops.Count(); 24 | Trace.WriteLine("Get request at ValuesController at " + DateTime.UtcNow); 25 | Log.Logger.Information("hello world at " + DateTime.Now); 26 | return new[] { " " + DateTime.UtcNow }; 27 | } 28 | 29 | [HttpGet] 30 | [ActionName("GetConnections")] 31 | [Route("GetConnections")] 32 | public string GetConnections() 33 | { 34 | string value = RedisService.GetValue("Connections"); 35 | return value; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/BizBook/Model/Warehouses/StockTransferDetail.cs: -------------------------------------------------------------------------------- 1 | namespace Model.Warehouses 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using Model.Products; 6 | 7 | public class StockTransferDetail : ShopChild 8 | { 9 | [Required] public double Quantity { get; set; } 10 | 11 | [Required] public double SalePricePerUnit { get; set; } 12 | 13 | [Required] public double PriceTotal { get; set; } 14 | 15 | [Required] public string StockTransferId { get; set; } 16 | 17 | [ForeignKey("StockTransferId")] public virtual StockTransfer StockTransfer { get; set; } 18 | 19 | [Required] public string ProductDetailId { get; set; } 20 | 21 | [ForeignKey("ProductDetailId")] public ProductDetail ProductDetail { get; set; } 22 | 23 | public string SourceWarehouseId { get; set; } 24 | 25 | [ForeignKey("SourceWarehouseId")] public virtual Warehouse SourceWarehouse { get; set; } 26 | 27 | public string DestinationWarehouseId { get; set; } 28 | 29 | [ForeignKey("DestinationWarehouseId")] public virtual Warehouse DestinationWarehouse { get; set; } 30 | 31 | [MaxLength(200)] public string Remarks { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Message/SmsViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Message; 3 | 4 | namespace ViewModel.Message 5 | { 6 | using Model; 7 | 8 | public class SmsViewModel : BaseViewModel 9 | { 10 | public SmsViewModel(Sms x) : base(x) 11 | { 12 | SetProperties(x); 13 | } 14 | 15 | public void SetProperties(Sms x) 16 | { 17 | ShopId = x.ShopId; 18 | Text = x.Text; 19 | SmsReceiverType = x.SmsReceiverType; 20 | ReceiverNumber = x.ReceiverNumber; 21 | ReceiverId = x.ReceiverId; 22 | ReasonType = x.ReasonType; 23 | ReasonId = x.ReasonId; 24 | DeliveryStatus = x.DeliveryStatus; 25 | Ismasked = x.Ismasked; 26 | } 27 | 28 | public string ShopId { get; set; } 29 | public string Text { get; set; } 30 | public SmsReceiverType SmsReceiverType { get; set; } 31 | public string ReceiverNumber { get; set; } 32 | public string ReceiverId { get; set; } 33 | public SmsReasonType ReasonType { get; set; } 34 | public string ReasonId { get; set; } 35 | public string DeliveryStatus { get; set; } 36 | public bool Ismasked { get; set; } 37 | } 38 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Message/SmsRequestModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.RequestModel; 2 | using Model.Message; 3 | using System; 4 | using CommonLibrary.ViewModel; 5 | using System.Linq.Expressions; 6 | 7 | namespace RequestModel.Message 8 | { 9 | public class SmsRequestModel : RequestModel 10 | { 11 | public SmsRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 12 | keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | protected override Expression> GetExpression() 17 | { 18 | if (!string.IsNullOrWhiteSpace(Keyword)) 19 | { 20 | ExpressionObj = x => 21 | x.ReceiverNumber.ToLower().Contains(Keyword) || x.ReceiverId.ToLower().Contains(Keyword) || x.ReasonId.ToLower().Contains(Keyword); 22 | } 23 | 24 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 25 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 26 | return ExpressionObj; 27 | } 28 | 29 | public override Expression> Dropdown() 30 | { 31 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Text}; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/App_Start/CacheConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Runtime.Caching; 4 | using Server.Identity.Models; 5 | 6 | namespace Server.Identity 7 | { 8 | public class CacheConfig 9 | { 10 | public static void Register() 11 | { 12 | var cache = MemoryCache.Default; 13 | var policy = new CacheItemPolicy 14 | { 15 | SlidingExpiration = new TimeSpan(1, 0, 0) 16 | }; 17 | SecurityDbContext db = SecurityDbContext.Create(); 18 | var roles = db.Roles.ToList().Select(x => new ApplicationRole { Id = x.Id, Name = x.Name }).ToList(); 19 | bool addedRoles = cache.Add("Roles", roles, policy); 20 | var users = db.Users.ToList().Select( 21 | x => new ApplicationUser 22 | { 23 | UserName = x.UserName, 24 | RoleName = x.RoleName, 25 | Id = x.Id, 26 | ShopId = x.ShopId, 27 | IsActive = x.IsActive 28 | }).ToList(); 29 | bool addedUsers = cache.Add("Users", users, policy); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Shops/BrandViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Shops; 3 | 4 | namespace ViewModel.Shops 5 | { 6 | public class BrandViewModel : BaseViewModel 7 | { 8 | public BrandViewModel(Brand x) : base(x) 9 | { 10 | Name = x.Name; 11 | Address = x.Address; 12 | Phone = x.Phone; 13 | Remarks = x.Remarks; 14 | ContactPersonName = x.ContactPersonName; 15 | Country = x.Country; 16 | Email = x.Email; 17 | BrandCode = x.BrandCode; 18 | ShopId = x.ShopId; 19 | MadeInCountry = x.MadeInCountry; 20 | } 21 | 22 | public string MadeInCountry { get; set; } 23 | 24 | public string ShopId { get; set; } 25 | 26 | [IsViewable] public string BrandCode { get; set; } 27 | 28 | [IsViewable] public string Email { get; set; } 29 | [IsViewable] public string Country { get; set; } 30 | 31 | [IsViewable] public string Name { get; set; } 32 | [IsViewable] public string Address { get; set; } 33 | [IsViewable] public string Phone { get; set; } 34 | [IsViewable] public string Remarks { get; set; } 35 | [IsViewable] public string ContactPersonName { get; set; } 36 | } 37 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Shops/CourierRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using CommonLibrary.RequestModel; 4 | using CommonLibrary.ViewModel; 5 | using Model.Shops; 6 | 7 | namespace RequestModel.Shops 8 | { 9 | public class CourierRequestModel : RequestModel 10 | { 11 | public CourierRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 12 | keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | protected override Expression> GetExpression() 17 | { 18 | if (!string.IsNullOrWhiteSpace(Keyword)) 19 | { 20 | ExpressionObj = x => x.ContactPersonName.ToLower().Contains(Keyword); 21 | } 22 | 23 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 24 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 25 | return ExpressionObj; 26 | } 27 | 28 | public override Expression> Dropdown() 29 | { 30 | return x => new DropdownViewModel() 31 | { 32 | Id = x.CourierShopId, 33 | Text = x.CourierShop.Name 34 | }; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Microsoft.Owin.Cors; 3 | using Owin; 4 | using Server.Inventory; 5 | 6 | [assembly: OwinStartup(typeof(Startup))] 7 | 8 | namespace Server.Inventory 9 | { 10 | using System.Configuration; 11 | 12 | using LoggingService; 13 | 14 | using Microsoft.Owin.Security.OAuth; 15 | 16 | using Server.Inventory.Providers; 17 | 18 | public class Startup 19 | { 20 | public void Configuration(IAppBuilder app) 21 | { 22 | app.UseCors(CorsOptions.AllowAll); 23 | //ConfigureAuth(app); 24 | app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions 25 | { 26 | Provider = new OAuthTokenProvider() 27 | }); 28 | 29 | 30 | app.MapSignalR(); 31 | string name = ConfigurationManager.AppSettings["LoggingDefaults"]; 32 | SeriLogHelper.ConfigureLoggingDefaults(name); 33 | //GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultSchedulerConnection"); 34 | //app.UseHangfireDashboard(); 35 | //app.UseHangfireServer(); 36 | 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Transactions/AccountHeadRequestModel.cs: -------------------------------------------------------------------------------- 1 | namespace RequestModel.Transactions 2 | { 3 | using System; 4 | using System.Linq.Expressions; 5 | using CommonLibrary.RequestModel; 6 | using CommonLibrary.ViewModel; 7 | using Model.Transactions; 8 | 9 | public class AccountHeadRequestModel : RequestModel 10 | { 11 | public AccountHeadRequestModel(string keyword, string orderBy, string isAscending) : base(keyword, orderBy, 12 | isAscending) 13 | { 14 | } 15 | 16 | protected override Expression> GetExpression() 17 | { 18 | if (!string.IsNullOrWhiteSpace(Keyword)) 19 | { 20 | ExpressionObj = x => 21 | x.Name.ToLower().Contains(Keyword) || x.AccountHeadType.ToString().ToLower().Contains(Keyword); 22 | } 23 | 24 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 25 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 26 | return ExpressionObj; 27 | } 28 | 29 | public override Expression> Dropdown() 30 | { 31 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Name}; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Transactions/WalletRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using CommonLibrary.RequestModel; 4 | using CommonLibrary.ViewModel; 5 | using Model.Transactions; 6 | 7 | namespace RequestModel.Transactions 8 | { 9 | public class WalletRequestModel : RequestModel 10 | { 11 | public WalletRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : 12 | base(keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | protected override Expression> GetExpression() 17 | { 18 | if (!string.IsNullOrWhiteSpace(Keyword)) 19 | { 20 | ExpressionObj = x => 21 | x.AccountTitle.ToLower().Contains(Keyword) || 22 | x.WalletType.ToString().ToLower().Contains(Keyword); 23 | } 24 | 25 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 26 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 27 | return ExpressionObj; 28 | } 29 | 30 | public override Expression> Dropdown() 31 | { 32 | return x => new DropdownViewModel() {Id = x.Id, Text = x.AccountTitle}; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Warehouses/WarehouseHistoryRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace RequestModel.Warehouses 4 | { 5 | using System.Linq.Expressions; 6 | using CommonLibrary.RequestModel; 7 | using CommonLibrary.ViewModel; 8 | using Model.Warehouses; 9 | 10 | public class WarehouseHistoryRequestModel : RequestModel 11 | { 12 | public WarehouseHistoryRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") 13 | : base(keyword, orderBy, isAscending) 14 | { 15 | } 16 | 17 | protected override Expression> GetExpression() 18 | { 19 | if (!string.IsNullOrWhiteSpace(Keyword)) 20 | { 21 | ExpressionObj = x => 22 | x.Name.ToLower().Contains(Keyword) || x.Area.ToString().ToLower().Contains(Keyword); 23 | } 24 | 25 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 26 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 27 | return ExpressionObj; 28 | } 29 | 30 | public override Expression> Dropdown() 31 | { 32 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Name}; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Warehouses/StockTransferController.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.Repository; 2 | using Model; 3 | using Model.Warehouses; 4 | using RequestModel.Warehouses; 5 | using ViewModel.Warehouses; 6 | using System.Web.Http; 7 | using ServiceLibrary.Warehouses; 8 | 9 | namespace Server.Inventory.Controllers.CommandControllers.Warehouses 10 | { 11 | [RoutePrefix("api/StockTransfer")] 12 | public class StockTransferController : BaseCommandController 13 | { 14 | public StockTransferController(): base(new StockTransferService(new BaseRepository(BusinessDbContext.Create()))) 15 | { 16 | 17 | } 18 | 19 | 20 | [Route("UpdateState")] 21 | [ActionName("UpdateState")] 22 | [HttpPut] 23 | public IHttpActionResult UpdateState(StockTransfer stockTransfer) 24 | { 25 | if (stockTransfer==null || string.IsNullOrWhiteSpace(stockTransfer.Id)) 26 | { 27 | return BadRequest("Data should not be null"); 28 | } 29 | 30 | var service = Service as StockTransferService; 31 | bool updateState = service.UpdateState(stockTransfer.Id); 32 | return Ok(updateState); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Shops/BrandRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using CommonLibrary.RequestModel; 4 | using CommonLibrary.ViewModel; 5 | using Model.Shops; 6 | 7 | namespace RequestModel.Shops 8 | { 9 | public class BrandRequestModel : RequestModel 10 | { 11 | public BrandRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 12 | keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | 17 | protected override Expression> GetExpression() 18 | { 19 | if (!string.IsNullOrWhiteSpace(Keyword)) 20 | { 21 | ExpressionObj = x => 22 | x.Name.ToLower().Contains(Keyword) || x.Address.ToLower().Contains(Keyword) || 23 | x.Phone.ToLower().Contains(Keyword) || x.ContactPersonName.ToLower().Contains(Keyword); 24 | } 25 | 26 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 27 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 28 | return ExpressionObj; 29 | } 30 | 31 | public override Expression> Dropdown() 32 | { 33 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Name}; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | 3 | using System.Web.Mvc; 4 | using System.Web.Routing; 5 | 6 | namespace Server.Inventory 7 | { 8 | using System.Configuration; 9 | using System.Web.Http.ExceptionHandling; 10 | using LoggingService; 11 | using Server.Inventory.Handlers; 12 | 13 | public class WebApiApplication : HttpApplication 14 | { 15 | protected void Application_Start() 16 | { 17 | AreaRegistration.RegisterAllAreas(); 18 | System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register); 19 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 20 | RouteConfig.RegisterRoutes(RouteTable.Routes); 21 | string name = ConfigurationManager.AppSettings["LoggingDefaults"]; 22 | SeriLogHelper.ConfigureLoggingDefaults(name); 23 | System.Web.Http.GlobalConfiguration.Configuration.IncludeErrorDetailPolicy = System.Web.Http.IncludeErrorDetailPolicy.Always; 24 | System.Web.Http.GlobalConfiguration.Configuration.Services.Add(typeof(IExceptionLogger), new CustomExceptionHandler()); 25 | //Hangfire.GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultSchedulerConnection").UseDashboardMetric(SqlServerStorage.ActiveConnections); 26 | 27 | //SampleScheduler.Start(); 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Shops/SupplierRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using CommonLibrary.RequestModel; 4 | using CommonLibrary.ViewModel; 5 | using Model.Shops; 6 | 7 | namespace RequestModel.Shops 8 | { 9 | public class SupplierRequestModel : RequestModel 10 | { 11 | public SupplierRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 12 | keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | 17 | protected override Expression> GetExpression() 18 | { 19 | if (!string.IsNullOrWhiteSpace(Keyword)) 20 | { 21 | ExpressionObj = x => 22 | x.Name.ToLower().Contains(Keyword) || x.StreetAddress.ToLower().Contains(Keyword) || 23 | x.Phone.ToLower().Contains(Keyword) || x.ContactPersonName.ToLower().Contains(Keyword); 24 | } 25 | 26 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 27 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 28 | return ExpressionObj; 29 | } 30 | 31 | public override Expression> Dropdown() 32 | { 33 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Name + " (" + x.Phone + ")"}; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Models/ClientRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Http.Controllers; 4 | 5 | namespace Server.Inventory.Models 6 | { 7 | [Serializable] 8 | public class ClientRequestModel 9 | { 10 | public string UserName { get; set; } 11 | public string ConnectionId { get; set; } 12 | 13 | public string BrowserName { get; set; } 14 | 15 | public string Platform { get; set; } 16 | 17 | public string RawUrl { get; set; } 18 | 19 | public string MobileDeviceModel { get; set; } 20 | 21 | public bool IsMobileDevice { get; set; } 22 | 23 | public string UserHostAddress { get; set; } 24 | 25 | public string ShopId { get; set; } 26 | 27 | public ClientRequestModel(HttpActionContext actionContext) 28 | { 29 | HttpRequestBase request = ((HttpContextWrapper)actionContext.Request.Properties["MS_HttpContext"]).Request; 30 | var browser = request.Browser; 31 | BrowserName = browser.Browser; 32 | Platform = browser.Platform; 33 | RawUrl = request.RawUrl; 34 | UserHostAddress = request.UserHostAddress; 35 | IsMobileDevice = browser.IsMobileDevice; 36 | MobileDeviceModel = browser.MobileDeviceModel; 37 | ConnectionId = request.Headers["ConnectionId"]; 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Reports/SaleReportGridModel.cs: -------------------------------------------------------------------------------- 1 | namespace ViewModel.Reports 2 | { 3 | using Model; 4 | 5 | using Newtonsoft.Json; 6 | using Newtonsoft.Json.Converters; 7 | 8 | public class SaleReportGridModel 9 | { 10 | public SaleReportGridModel(SaleReportViewModel report) 11 | { 12 | // SaleReportType = report.SaleReportType; 13 | this.Value = report.Value; 14 | this.SaleFrom = report.SaleFrom; 15 | this.SaleChannel = report.SaleChannel; 16 | this.TotalAmount = report.TotalAmount; 17 | this.DiscountAmount = report.DiscountAmount; 18 | this.PayableTotalAmount = report.PayableTotalAmount; 19 | this.PaidAmount = report.PaidAmount; 20 | this.DueAmount = report.DueAmount; 21 | } 22 | 23 | public string Value { get; set; } 24 | 25 | [JsonConverter(typeof(StringEnumConverter))] 26 | public SaleFrom SaleFrom { get; set; } 27 | 28 | [JsonConverter(typeof(StringEnumConverter))] 29 | public SaleChannel SaleChannel { get; set; } 30 | 31 | public double TotalAmount { get; set; } 32 | 33 | public double DiscountAmount { get; set; } 34 | 35 | public double PayableTotalAmount { get; set; } 36 | 37 | public double PaidAmount { get; set; } 38 | 39 | public double DueAmount { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /scripts/sql/002_SuperAdmin_Data_Insert.sql: -------------------------------------------------------------------------------- 1 | USE [BizBookDb] 2 | GO 3 | 4 | INSERT INTO [dbo].[AspNetUsers] 5 | ([Id] 6 | ,[FirstName] 7 | ,[LastName] 8 | ,[IsActive] 9 | ,[PhoneNumber] 10 | ,[ShopId] 11 | ,[RoleName] 12 | ,[Email] 13 | ,[EmailConfirmed] 14 | ,[PasswordHash] 15 | ,[SecurityStamp] 16 | ,[PhoneNumberConfirmed] 17 | ,[TwoFactorEnabled] 18 | ,[LockoutEndDateUtc] 19 | ,[LockoutEnabled] 20 | ,[AccessFailedCount] 21 | ,[UserName]) 22 | VALUES 23 | ('8f9dc73a-f065-47c6-ac83-4c0db1a74a06' 24 | ,'Super' 25 | ,'Admin' 26 | ,1 27 | ,'+8801968569097' 28 | ,'00000000-0000-0000-0000-000000000000' 29 | ,'SuperAdmin' 30 | ,'foyzulkarim@gmail.com' 31 | ,1 32 | ,'AGJNOoecZasTJYZZFImChiYCg4U3KtqL2adkLuLGmVeX14jhVG9FTsQgLujDY4r8kw==' 33 | ,'b22709f1-3ab9-4b50-a606-93ae682749f3' 34 | ,1 35 | ,0 36 | ,NULL 37 | ,0 38 | ,0 39 | ,'foyzulkarim@gmail.com') 40 | 41 | INSERT INTO [dbo].[AspNetUserRoles] 42 | ([UserId] 43 | ,[RoleId]) 44 | VALUES 45 | ('8f9dc73a-f065-47c6-ac83-4c0db1a74a06' 46 | ,'3360c5a0-6526-4450-9a3d-f9b91e1ccf92') 47 | GO -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Products/ProductSerialRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using CommonLibrary.RequestModel; 4 | using CommonLibrary.ViewModel; 5 | using Model.Products; 6 | 7 | namespace RequestModel.Products 8 | { 9 | public class ProductSerialRequestModel : RequestModel 10 | { 11 | public ProductSerialRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : 12 | base(keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | protected override Expression> GetExpression() 17 | { 18 | if (!string.IsNullOrWhiteSpace(Keyword)) 19 | { 20 | ExpressionObj = x => x.SerialNumber.ToLower().Contains(Keyword); 21 | } 22 | 23 | if (ParentId.IdIsOk()) 24 | { 25 | ExpressionObj = ExpressionObj.And(x => x.ProductDetailId == ParentId); 26 | } 27 | 28 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 29 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 30 | return ExpressionObj; 31 | } 32 | 33 | public override Expression> Dropdown() 34 | { 35 | return x => new DropdownViewModel() {Id = x.Id, Text = x.SerialNumber}; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Message/HookDetailRequestModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.RequestModel; 2 | using Model.Message; 3 | using System; 4 | using CommonLibrary.ViewModel; 5 | using System.Linq.Expressions; 6 | 7 | namespace RequestModel.Message 8 | { 9 | public class HookDetailRequestModel : RequestModel 10 | { 11 | public string HookId { get; set; } 12 | 13 | public HookDetailRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 14 | keyword, orderBy, isAscending) 15 | { 16 | } 17 | 18 | protected override Expression> GetExpression() 19 | { 20 | if (!string.IsNullOrWhiteSpace(Keyword)) 21 | { 22 | ExpressionObj = x => x.HookName.ToLower().Contains(Keyword); 23 | } 24 | 25 | if (HookId.IdIsOk()) 26 | { 27 | ExpressionObj = ExpressionObj.And(x => x.SmsHookId == HookId); 28 | } 29 | 30 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 31 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 32 | return ExpressionObj; 33 | } 34 | 35 | public override Expression> Dropdown() 36 | { 37 | return x => new DropdownViewModel() {Id = x.Id, Text = x.HookName}; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Controllers/QueryControllers/System/ApplicationResourceQueryController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data.Entity; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Web.Http; 6 | using Server.Identity.Models; 7 | 8 | namespace Server.Identity.Controllers.QueryControllers.System 9 | { 10 | [RoutePrefix("api/ApplicationResourceQuery")] 11 | [Authorize(Roles = "SuperAdmin")] 12 | public class ApplicationResourceQueryController : ApiController 13 | { 14 | private SecurityDbContext db = new SecurityDbContext(); 15 | 16 | [Route("ResourceDropdown")] 17 | [ActionName("ResourceDropdown")] 18 | [HttpGet] 19 | public async Task GetApplicationResourceDropdown() 20 | { 21 | var roles = await db.Resources.Select(x => new { x.Id, x.Name }).ToListAsync(); 22 | return Ok(roles); 23 | } 24 | 25 | [Route("Data")] 26 | [ActionName("Data")] 27 | [HttpGet] 28 | public async Task Data() 29 | { 30 | IQueryable queryable = db.Resources.OrderBy(x=>x.ResourceType); 31 | List resources = await queryable.ToListAsync(); 32 | List list = resources.ConvertAll(x => new AppResourceViewModel(x)); 33 | return Ok(list); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Shops/ShopRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using CommonLibrary.RequestModel; 4 | using CommonLibrary.ViewModel; 5 | using Model.Shops; 6 | 7 | namespace RequestModel.Shops 8 | { 9 | public class ShopRequestModel : RequestModel 10 | { 11 | public bool HasDeliveryChain { get; set; } 12 | 13 | public ShopRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : base( 14 | keyword, orderBy, isAscending) 15 | { 16 | } 17 | 18 | protected override Expression> GetExpression() 19 | { 20 | if (!string.IsNullOrWhiteSpace(Keyword)) 21 | { 22 | ExpressionObj = x => 23 | x.Name.ToLower().Contains(Keyword) || x.Phone.ToLower().Contains(Keyword) || 24 | x.ContactPersonName.ToLower().Contains(Keyword); 25 | } 26 | 27 | if (HasDeliveryChain) 28 | { 29 | ExpressionObj = this.ExpressionObj.And(x => x.HasDeliveryChain); 30 | } 31 | 32 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 33 | return ExpressionObj; 34 | } 35 | 36 | public override Expression> Dropdown() 37 | { 38 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Name}; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /source/BizBook/Model/Shops/Brand.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | using Model.Products; 5 | 6 | namespace Model.Shops 7 | { 8 | public class Brand : ShopChild 9 | { 10 | [Index] 11 | [Required] 12 | [DataType(DataType.Text)] 13 | [MaxLength(50)] 14 | public string Name { get; set; } 15 | 16 | [MaxLength(200)] 17 | [DataType(DataType.MultilineText)] 18 | public string Address { get; set; } 19 | 20 | [MaxLength(50)] public string Phone { get; set; } 21 | 22 | [MaxLength(200)] 23 | [DataType(DataType.Text)] 24 | public string Remarks { get; set; } 25 | 26 | 27 | [MaxLength(50)] 28 | [DataType(DataType.Text)] 29 | public string ContactPersonName { get; set; } 30 | 31 | [MaxLength(50)] 32 | [DataType(DataType.Text)] 33 | public string Country { get; set; } 34 | 35 | [MaxLength(50)] 36 | [DataType(DataType.Text)] 37 | public string MadeInCountry { get; set; } 38 | 39 | [MaxLength(50)] 40 | [DataType(DataType.Text)] 41 | public string Email { get; set; } 42 | 43 | [MaxLength(20)] 44 | [DataType(DataType.Text)] 45 | public string BrandCode { get; set; } 46 | 47 | public virtual ICollection ProductDetails { get; set; } 48 | } 49 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Products/ProductGroupRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using Model.Products; 4 | using CommonLibrary.RequestModel; 5 | using CommonLibrary.ViewModel; 6 | 7 | namespace RequestModel.Products 8 | { 9 | public class ProductGroupRequestModel : RequestModel 10 | { 11 | public ProductGroupRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") : 12 | base(keyword, orderBy, isAscending) 13 | { 14 | } 15 | 16 | public bool IsProductGroupActive { get; set; } 17 | 18 | protected override Expression> GetExpression() 19 | { 20 | if (!string.IsNullOrWhiteSpace(Keyword)) 21 | { 22 | ExpressionObj = x => x.Name.ToLower().Contains(Keyword); 23 | } 24 | if (IsProductGroupActive) 25 | { 26 | ExpressionObj = ExpressionObj.And(x => x.IsActive == IsProductGroupActive); 27 | } 28 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 29 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 30 | return ExpressionObj; 31 | } 32 | 33 | public override Expression> Dropdown() 34 | { 35 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Name}; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Server.Identity")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Server.Identity")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("60beb0f7-7efe-4690-9ecd-779e74521e2a")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Revision and Build Numbers 32 | // by using the '*' as shown below: 33 | [assembly: AssemblyVersion("1.0.0.0")] 34 | [assembly: AssemblyFileVersion("1.0.0.0")] 35 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Server.Inventory")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Server.Inventory")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("62bd8919-f248-4c7e-8ad8-1a3d57993843")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Revision and Build Numbers 32 | // by using the '*' as shown below: 33 | [assembly: AssemblyVersion("1.0.0.0")] 34 | [assembly: AssemblyFileVersion("1.0.0.0")] 35 | -------------------------------------------------------------------------------- /source/BizBook/ReportModel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("ReportModel")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("ReportModel")] 12 | [assembly: AssemblyCopyright("Copyright © 2018")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("304befb7-be73-453d-aa3f-0893d616be54")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /source/BizBook/Utility/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Utility")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Utility")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("aeba7a9d-5636-4ec8-afd0-bd41171d6023")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Operation/OperationLogViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model; 3 | using Model.Operations; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | namespace ViewModel.Operation 8 | { 9 | public class OperationLogViewModel : BaseViewModel 10 | { 11 | public OperationLogViewModel(OperationLog x) : base(x) 12 | { 13 | OperationType = x.OperationType; 14 | ModelName = x.ModelName; 15 | ObjectId = x.ObjectId; 16 | ObjectIdentifier = x.ObjectIdentifier; 17 | Remarks = x.Remarks; 18 | 19 | if (x.OperationLogDetails != null) 20 | { 21 | this.OperationLogDetails = x.OperationLogDetails.ToList().ConvertAll(y => new OperationLogDetailViewModel(y)).ToList(); 22 | 23 | } 24 | } 25 | 26 | public OperationType OperationType { get; set; } 27 | public ModelName ModelName { get; set; } 28 | public string ObjectId { get; set; } 29 | public string ObjectIdentifier { get; set; } 30 | public string PropertyName { get; set; } 31 | public string OldValue { get; set; } 32 | public string NewValue { get; set; } 33 | public string Remarks { get; set; } 34 | 35 | public List OperationLogDetails { get; set; } 36 | // public virtual ICollection OperationLogDetails { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/BizBook/LoggingService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("LoggingService")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("LoggingService")] 12 | [assembly: AssemblyCopyright("Copyright © 2017")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("7f0bce14-32b3-4c6f-9728-a4da01275e90")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /source/BizBook/CommonLibrary/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("CommonLibrary")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("CommonLibrary")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("c369a485-80df-4d39-873b-5c3236fcb81a")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /source/BizBook/ServiceLibrary/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("ServiceLibrary")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("ServiceLibrary")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("78f59332-694b-40aa-bea5-b028b659c8d9")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /source/BizBook/Model/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Importer.Model")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Importer.Model")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("1ffb3cf0-056d-47e0-8335-f46dc10742e5")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Models/ApplicationUser.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using System.Security.Claims; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNet.Identity; 6 | using Microsoft.AspNet.Identity.EntityFramework; 7 | 8 | namespace Server.Inventory.Models 9 | { 10 | //[Serializable] 11 | public class ApplicationUser : IdentityUser 12 | { 13 | public async Task GenerateUserIdentityAsync(UserManager manager, string authenticationType) 14 | { 15 | // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType 16 | var userIdentity = await manager.CreateIdentityAsync(this, authenticationType); 17 | // Add custom user claims here 18 | return userIdentity; 19 | } 20 | 21 | public string FirstName { get; set; } 22 | public string LastName { get; set; } 23 | 24 | [Index] 25 | public bool IsActive { get; set; } 26 | 27 | [Index("UniquePhone", IsUnique = true)] 28 | [MaxLength(20)] 29 | public override string PhoneNumber { get; set; } 30 | 31 | [MaxLength(128)] 32 | [Index("IX_ShopId")] 33 | public string ShopId { get; set; } 34 | 35 | [Index("IX_RoleName")] 36 | [MaxLength(128)] 37 | public string RoleName { get; set; } 38 | 39 | [NotMapped] 40 | public string ConnectionId { get; set; } 41 | } 42 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Importer.ViewModel")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Importer.ViewModel")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("1d96eabd-3d0c-499e-9531-ef2bd46f1600")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("Importer.RequestModel")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Importer.RequestModel")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | 25 | [assembly: Guid("45855334-9412-42a4-9547-6513bae7ef19")] 26 | 27 | // Version information for an assembly consists of the following four values: 28 | // 29 | // Major Version 30 | // Minor Version 31 | // Build Number 32 | // Revision 33 | // 34 | // You can specify all the values or you can default the Build and Revision Numbers 35 | // by using the '*' as shown below: 36 | // [assembly: AssemblyVersion("1.0.*")] 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] 39 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http.Formatting; 2 | using System.Web.Http; 3 | using Newtonsoft.Json.Serialization; 4 | 5 | namespace Server.Inventory 6 | { 7 | public static class WebApiConfig 8 | { 9 | public static void Register(HttpConfiguration config) 10 | { 11 | // Web API configuration and services 12 | // Configure Web API to use only bearer token authentication. 13 | // config.SuppressDefaultHostAuthentication(); 14 | // config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType)); 15 | 16 | //var corsAttr = new EnableCorsAttribute("*", "*", "*"); 17 | //config.EnableCors(corsAttr); 18 | 19 | config.Formatters.Clear(); 20 | config.Formatters.Add(new JsonMediaTypeFormatter()); 21 | 22 | // Web API routes 23 | config.MapHttpAttributeRoutes(); 24 | 25 | config.Routes.MapHttpRoute( 26 | name: "SearchAPI", 27 | routeTemplate: "api/{controller}/{action}/{id}", 28 | defaults: new { id = RouteParameter.Optional }); 29 | 30 | config.Routes.MapHttpRoute( 31 | name: "DefaultApi", 32 | routeTemplate: "api/{controller}/{id}", 33 | defaults: new { id = RouteParameter.Optional }); 34 | 35 | config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); 36 | 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/QueryControllers/OtherQueryController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Http; 3 | using CommonLibrary.Model; 4 | using CommonLibrary.RequestModel; 5 | using Serilog; 6 | 7 | namespace Server.Inventory.Controllers.QueryControllers 8 | { 9 | public class OtherQueryController : ApiController 10 | { 11 | public static ILogger Logger = Log.ForContext(typeof(OtherQueryController)); 12 | 13 | [Route("api/OtherQuery/Dropdown")] 14 | [ActionName("Dropdown")] 15 | [HttpPost] 16 | public IHttpActionResult Dropdown(RequestModel request) 17 | { 18 | throw new NotImplementedException(); 19 | //try 20 | //{ 21 | // List item1 = new List 22 | // { 23 | // new DropdownViewModel {Id = "other", Text = "Other"} 24 | // }; 25 | 26 | // int item2 = item1.Count; 27 | // var tuple = new Tuple, int>(item1, item2); 28 | // var response = Request.CreateResponse(HttpStatusCode.OK, tuple); 29 | // return ResponseMessage(response); 30 | //} 31 | //catch (Exception exception) 32 | //{ 33 | // Logger.Fatal(exception, "Exception occurred while trying to get Dropdown {TypeName} with Request {Request}", "Other", request); 34 | // return InternalServerError(exception); 35 | //} 36 | } 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Models/ApplicationUser.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using System.Security.Claims; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNet.Identity; 6 | using Microsoft.AspNet.Identity.EntityFramework; 7 | 8 | namespace Server.Identity.Models 9 | { 10 | public class ApplicationUser : IdentityUser 11 | { 12 | public async Task GenerateUserIdentityAsync(UserManager manager, string authenticationType) 13 | { 14 | // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType 15 | ClaimsIdentity userIdentity = await manager.CreateIdentityAsync(this, authenticationType); 16 | Claim c = new Claim("ShopId", this.ShopId, ClaimValueTypes.String); 17 | userIdentity.AddClaim(c); 18 | // Add custom user claims here 19 | return userIdentity; 20 | } 21 | 22 | public string FirstName { get; set; } 23 | public string LastName { get; set; } 24 | 25 | [Index] 26 | public bool IsActive { get; set; } 27 | 28 | [Index("UniquePhone", IsUnique = true)] 29 | [MaxLength(20)] 30 | public override string PhoneNumber { get; set; } 31 | 32 | [MaxLength(128)] 33 | [Index("IX_ShopId")] 34 | public string ShopId { get; set; } 35 | 36 | [Index("IX_RoleName")] 37 | [MaxLength(128)] 38 | public string RoleName { get; set; } 39 | } 40 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Identity/Startup.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | using Microsoft.AspNet.SignalR; 3 | using Microsoft.Owin; 4 | using Microsoft.Owin.Cors; 5 | using Microsoft.Owin.Security.OAuth; 6 | using Owin; 7 | using Server.Identity; 8 | using Server.Identity.Providers; 9 | 10 | [assembly: OwinStartup(typeof(Startup))] 11 | 12 | namespace Server.Identity 13 | { 14 | using LoggingService; 15 | 16 | public partial class Startup 17 | { 18 | public void Configuration(IAppBuilder app) 19 | { 20 | app.UseCors(CorsOptions.AllowAll); 21 | ConfigureAuth(app); 22 | app.Map("/signalr", map => 23 | { 24 | //CorsPolicyProvider provider = new EnableCorsAttribute("*", "*", "*"); 25 | CorsOptions options = CorsOptions.AllowAll; 26 | //options.PolicyProvider = 27 | map.UseCors(options); 28 | 29 | map.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions 30 | { 31 | Provider = new OAuthTokenProvider() 32 | }); 33 | 34 | var hubConfiguration = new HubConfiguration 35 | { 36 | Resolver = GlobalHost.DependencyResolver 37 | }; 38 | map.RunSignalR(hubConfiguration); 39 | }); 40 | 41 | string name = ConfigurationManager.AppSettings["LoggingDefaults"]; 42 | SeriLogHelper.ConfigureLoggingDefaults(name); 43 | CacheConfig.Register(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Products/DealerProductViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Products; 3 | using System.Collections.Generic; 4 | 5 | namespace ViewModel.Products 6 | { 7 | using Model; 8 | using Model.Transactions; 9 | 10 | public class DealerProductDetailUpdateModel : ShopChild 11 | { 12 | public string DealerId { get; set; } 13 | 14 | public Transaction Transaction { get; set; } 15 | 16 | public List DealerProductTransactions { get; set; } 17 | } 18 | 19 | public class DealerProductViewModel : BaseViewModel 20 | { 21 | public DealerProductViewModel(DealerProduct x) : base(x) 22 | { 23 | ShopId = x.ShopId; 24 | Quantity = x.Quantity; 25 | TotalPrice = x.TotalPrice; 26 | Paid = x.Paid; 27 | Due = x.Due; 28 | ProductDetailId = x.ProductDetailId; 29 | DealerId = x.DealerId; 30 | if (x.ProductDetail != null) 31 | { 32 | ProductName = x.ProductDetail.Name; 33 | } 34 | } 35 | 36 | public string ShopId { get; set; } 37 | 38 | public double Quantity { get; set; } 39 | public double TotalPrice { get; set; } 40 | 41 | public double Paid { get; set; } 42 | 43 | public double Due { get; set; } 44 | 45 | public string ProductDetailId { get; set; } 46 | 47 | public string DealerId { get; set; } 48 | 49 | [IsViewable] public string ProductName { get; set; } 50 | } 51 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Products/SupplierProductViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Products; 3 | using System.Collections.Generic; 4 | using Model.Transactions; 5 | using Model; 6 | 7 | namespace ViewModel.Products 8 | { 9 | public class SupplierProductDetailUpdateModel : ShopChild 10 | { 11 | public string SupplierId { get; set; } 12 | 13 | public Transaction Transaction { get; set; } 14 | 15 | public List SupplierProductTransactions { get; set; } 16 | } 17 | 18 | public class SupplierProductViewModel : BaseViewModel 19 | { 20 | public SupplierProductViewModel(SupplierProduct x) : base(x) 21 | { 22 | ShopId = x.ShopId; 23 | Quantity = x.Quantity; 24 | TotalPrice = x.TotalPrice; 25 | Paid = x.Paid; 26 | Due = x.Due; 27 | ProductDetailId = x.ProductDetailId; 28 | SupplierId = x.SupplierId; 29 | if (x.ProductDetail != null) 30 | { 31 | ProductName = x.ProductDetail.Name; 32 | } 33 | } 34 | 35 | public string ShopId { get; set; } 36 | 37 | public double Quantity { get; set; } 38 | public double TotalPrice { get; set; } 39 | 40 | public double Paid { get; set; } 41 | 42 | public double Due { get; set; } 43 | 44 | public string ProductDetailId { get; set; } 45 | 46 | public string SupplierId { get; set; } 47 | 48 | [IsViewable] public string ProductName { get; set; } 49 | } 50 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Shops/DealerViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | 3 | namespace ViewModel.Shops 4 | { 5 | using Model.Dealers; 6 | 7 | public class DealerViewModel : BaseViewModel 8 | { 9 | public DealerViewModel(Dealer x) : base(x) 10 | { 11 | ShopId = x.ShopId; 12 | Area = x.Area; 13 | CompanyName = x.CompanyName; 14 | ContactPersonName = x.CompanyName; 15 | Country = x.Country; 16 | District = x.District; 17 | IsVerified = x.IsVerified; 18 | StreetAddress = x.StreetAddress; 19 | PostCode = x.PostCode; 20 | Remarks = x.Remarks; 21 | Name = x.Name; 22 | Phone = x.Phone; 23 | Thana = x.Thana; 24 | } 25 | 26 | public string ShopId { get; set; } 27 | [IsViewable] public string Name { get; set; } 28 | [IsViewable] public string StreetAddress { get; set; } 29 | [IsViewable] public string Area { get; set; } 30 | [IsViewable] public string Thana { get; set; } 31 | [IsViewable] public string PostCode { get; set; } 32 | [IsViewable] public string District { get; set; } 33 | [IsViewable] public string Country { get; set; } 34 | [IsViewable] public string Phone { get; set; } 35 | [IsViewable] public string Remarks { get; set; } 36 | [IsViewable] public string CompanyName { get; set; } 37 | [IsViewable] public string ContactPersonName { get; set; } 38 | [IsViewable] public bool IsVerified { get; set; } 39 | } 40 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Sales/InstallmentDetailRequestModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.RequestModel; 2 | using CommonLibrary.ViewModel; 3 | using Model.Sales; 4 | using System; 5 | using System.Data.Entity; 6 | using System.Linq; 7 | using System.Linq.Expressions; 8 | 9 | namespace RequestModel.Sales 10 | { 11 | public class InstallmentDetailRequestModel : RequestModel 12 | { 13 | public DateTime ScheduledDate { get; set; } 14 | 15 | public InstallmentDetailRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") 16 | : base(keyword, orderBy, isAscending) 17 | { 18 | } 19 | 20 | protected override Expression> GetExpression() 21 | { 22 | if (ScheduledDate != new DateTime()) 23 | { 24 | this.ExpressionObj = this.ExpressionObj.And(x => x.ScheduledDate.Date == ScheduledDate.Date); 25 | } 26 | 27 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 28 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 29 | return ExpressionObj; 30 | } 31 | 32 | public override IQueryable IncludeParents(IQueryable queryable) 33 | { 34 | return queryable.Include(x => x.Installment); 35 | } 36 | 37 | public override Expression> Dropdown() 38 | { 39 | return x => new DropdownViewModel() {Data = x, Id = x.Id, Text = x.ToString()}; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Warehouses/WarehouseRequestModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace RequestModel.Warehouses 4 | { 5 | using System.Linq.Expressions; 6 | using CommonLibrary.RequestModel; 7 | using CommonLibrary.ViewModel; 8 | using Model.Warehouses; 9 | 10 | public class WarehouseRequestModel : RequestModel 11 | { 12 | public WarehouseRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") 13 | : base(keyword, orderBy, isAscending) 14 | { 15 | } 16 | 17 | public string WarehouseId { get; set; } 18 | 19 | protected override Expression> GetExpression() 20 | { 21 | if (!string.IsNullOrWhiteSpace(Keyword)) 22 | { 23 | ExpressionObj = x => 24 | x.Name.ToLower().Contains(Keyword) || x.Area.ToString().ToLower().Contains(Keyword); 25 | } 26 | 27 | if (!string.IsNullOrWhiteSpace(WarehouseId)) 28 | { 29 | if (WarehouseId.IdIsOk()) 30 | { 31 | ExpressionObj = ExpressionObj.And(x => x.Id == WarehouseId); 32 | } 33 | } 34 | 35 | ExpressionObj = ExpressionObj.And(x => x.ShopId == ShopId); 36 | ExpressionObj = ExpressionObj.And(GenerateBaseEntityExpression()); 37 | return ExpressionObj; 38 | } 39 | 40 | public override Expression> Dropdown() 41 | { 42 | return x => new DropdownViewModel() {Id = x.Id, Text = x.Name}; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /source/BizBook/ViewModel/Customers/AddressViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommonLibrary.ViewModel; 2 | using Model.Customers; 3 | 4 | namespace ViewModel.Customers 5 | { 6 | public class AddressViewModel : BaseViewModel
7 | { 8 | public AddressViewModel(Address x) : base(x) 9 | { 10 | AddressName = x.AddressName; 11 | ContactName = x.ContactName; 12 | ContactPhone = x.ContactPhone; 13 | StreetAddress = x.StreetAddress; 14 | Area = x.Area; 15 | Thana = x.Thana; 16 | PostCode = x.PostCode; 17 | District = x.District; 18 | Country = x.Country; 19 | SpecialNote = x.SpecialNote; 20 | CustomerId = x.CustomerId; 21 | ShopId = x.ShopId; 22 | IsDefault = x.IsDefault; 23 | IsActivate = x.IsActive; 24 | } 25 | 26 | public string ShopId { get; set; } 27 | 28 | public string CustomerId { get; set; } 29 | 30 | public string ContactName { get; set; } 31 | 32 | public string ContactPhone { get; set; } 33 | 34 | public string StreetAddress { get; set; } 35 | 36 | public string Area { get; set; } 37 | 38 | public string Thana { get; set; } 39 | 40 | public string PostCode { get; set; } 41 | 42 | public string District { get; set; } 43 | 44 | public string Country { get; set; } 45 | 46 | public string SpecialNote { get; set; } 47 | 48 | public string AddressName { get; set; } 49 | 50 | public bool IsDefault { get; set; } 51 | public bool IsActivate { get; set; } 52 | } 53 | } -------------------------------------------------------------------------------- /source/BizBook/RequestModel/Reports/SaleReportRequestModel.cs: -------------------------------------------------------------------------------- 1 | namespace RequestModel.Reports 2 | { 3 | using System; 4 | using System.Data.Entity; 5 | using System.Linq.Expressions; 6 | using CommonLibrary.RequestModel; 7 | using CommonLibrary.ViewModel; 8 | using Model; 9 | using ReportModel; 10 | using ReportModel.Parameters; 11 | 12 | public class SaleReportRequestModel : BaseReportRequestModel 13 | { 14 | public SaleType SaleType { get; set; } 15 | public SaleReportType SaleReportType { get; set; } 16 | 17 | public SaleChannel SaleChannel { get; set; } 18 | 19 | public SaleFrom SaleFrom { get; set; } 20 | 21 | public SaleReportRequestModel(string keyword, string orderBy = "Modified", string isAscending = "False") 22 | : base(keyword, orderBy, isAscending) 23 | { 24 | } 25 | 26 | protected override Expression> GetExpression() 27 | { 28 | StartDate = StartDate.Date; 29 | EndDate = EndDate.Date; 30 | this.ExpressionObj = this.ExpressionObj.And(x => x.SaleType == SaleType); 31 | this.ExpressionObj = this.ExpressionObj.And(x => x.ShopId == this.ShopId); 32 | this.ExpressionObj = this.ExpressionObj.And( 33 | x => DbFunctions.TruncateTime(x.Date) >= StartDate && DbFunctions.TruncateTime(x.Date) <= EndDate); 34 | return this.ExpressionObj; 35 | } 36 | 37 | public override Expression> Dropdown() 38 | { 39 | throw new NotImplementedException(); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /source/BizBook/Server.Inventory/Controllers/CommandControllers/Products/SupplierProductController.cs: -------------------------------------------------------------------------------- 1 | using Model.Products; 2 | using RequestModel.Products; 3 | using System.Web.Http; 4 | using ViewModel.Products; 5 | using CommonLibrary.Service; 6 | using CommonLibrary.Repository; 7 | using Model; 8 | using Server.Inventory.Filters; 9 | using ServiceLibrary.Products; 10 | 11 | namespace Server.Inventory.Controllers.CommandControllers.Products 12 | { 13 | [RoutePrefix("api/SupplierProduct")] 14 | public class SupplierProductController : BaseCommandController 15 | { 16 | public SupplierProductController() : base(new BaseService(new BaseRepository(BusinessDbContext.Create()))) 17 | { 18 | 19 | } 20 | 21 | [HttpPut] 22 | [Route("UpdateDues")] 23 | [ActionName("UpdateDues")] 24 | [EntitySaveFilter] 25 | public IHttpActionResult UpdateDues(SupplierProductDetailUpdateModel model) 26 | { 27 | var service = new SupplierProductService(new BaseRepository(BusinessDbContext.Create())); 28 | 29 | AddCommonValues(model, model.Transaction); 30 | 31 | foreach (var entity in model.SupplierProductTransactions) 32 | { 33 | AddCommonValues(model, entity); 34 | entity.TransactionId = model.Transaction.Id; 35 | } 36 | 37 | bool updated = service.UpdateDues(model); 38 | return Ok(updated); 39 | } 40 | } 41 | 42 | 43 | } 44 | --------------------------------------------------------------------------------