Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
66f5b89b
Commit
66f5b89b
authored
Jun 05, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
69b90b23
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
207 additions
and
0 deletions
+207
-0
SupplierModule.cs
Mall.Module.User/SupplierModule.cs
+207
-0
No files found.
Mall.Module.User/SupplierModule.cs
0 → 100644
View file @
66f5b89b
using
Mall.Common.Plugin
;
using
Mall.Model.Entity.Finance
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.User
;
using
Mall.Repository
;
using
Mall.Repository.Finance
;
using
Mall.Repository.User
;
using
NPOI.SS.Formula.Functions
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Mall.Module.User
{
public
class
SupplierModule
{
private
RB_SupplierRepository
supplierRepository
=
new
RB_SupplierRepository
();
private
RB_ClientBankAccountRepository
clientBankAccountRepository
=
new
RB_ClientBankAccountRepository
();
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Supplier_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Supplier_Extend
dmodel
)
{
var
list
=
supplierRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
rowCount
,
dmodel
);
if
(
list
!=
null
&&
list
.
Any
())
{
string
ids
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
BankAccountId
));
var
backList
=
clientBankAccountRepository
.
GetList
(
new
RB_ClientBankAccount
(),
""
,
ids
);
foreach
(
var
item
in
list
)
{
item
.
ClientBankAccount
=
new
RB_ClientBankAccount
();
item
.
ClientBankAccount
=
backList
.
Where
(
x
=>
x
.
ID
==
item
.
BankAccountId
).
FirstOrDefault
();
}
}
return
list
;
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Supplier_Extend
>
GetList
(
RB_Supplier_Extend
dmodel
)
{
var
list
=
supplierRepository
.
GetList
(
dmodel
);
if
(
list
!=
null
&&
list
.
Any
())
{
string
ids
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
BankAccountId
));
var
backList
=
clientBankAccountRepository
.
GetList
(
new
RB_ClientBankAccount
(),
""
,
ids
);
foreach
(
var
item
in
list
)
{
item
.
ClientBankAccount
=
new
RB_ClientBankAccount
();
item
.
ClientBankAccount
=
backList
.
Where
(
x
=>
x
.
ID
==
item
.
BankAccountId
).
FirstOrDefault
();
}
}
return
list
;
}
public
bool
AddOrUpdateSupplier
(
RB_Supplier_Extend
model
)
{
bool
flag
=
false
;
var
trans
=
supplierRepository
.
DbTransaction
;
try
{
if
(
model
.
ID
>
0
)
{
if
(
model
.
ClientBankAccount
.
ID
==
0
)
{
model
.
Status
=
(
int
)
Common
.
Enum
.
DateStateEnum
.
Normal
;
var
id
=
clientBankAccountRepository
.
Insert
(
model
.
ClientBankAccount
,
trans
);
model
.
BankAccountId
=
id
;
}
else
{
IDictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_ClientBankAccount
.
Type
),(
int
)
model
.
ClientBankAccount
.
Type
},
{
nameof
(
RB_ClientBankAccount
.
ObjID
),
model
.
ClientBankAccount
.
ObjID
},
{
nameof
(
RB_ClientBankAccount
.
BankId
),
model
.
ClientBankAccount
.
BankId
},
{
nameof
(
RB_ClientBankAccount
.
OpenBankName
),
model
.
ClientBankAccount
.
OpenBankName
},
{
nameof
(
RB_ClientBankAccount
.
AccountHolder
),
model
.
ClientBankAccount
.
AccountHolder
},
{
nameof
(
RB_ClientBankAccount
.
CardNum
),
model
.
ClientBankAccount
.
CardNum
},
{
nameof
(
RB_ClientBankAccount
.
AccountAlias
),
model
.
ClientBankAccount
.
AccountAlias
},
{
nameof
(
RB_ClientBankAccount
.
Status
),
model
.
ClientBankAccount
.
Status
}
};
IList
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_ClientBankAccount
.
ID
),
FiledValue
=
model
.
BankAccountId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
clientBankAccountRepository
.
Update
(
fileds
,
whereHelpers
,
trans
);
}
IDictionary
<
string
,
object
>
filedsSupplier
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplier
.
BankAccountId
),
model
.
BankAccountId
},
{
nameof
(
RB_Supplier
.
Name
),
model
.
Name
},
{
nameof
(
RB_Supplier
.
Mobile
),
model
.
Mobile
},
{
nameof
(
RB_Supplier
.
Address
),
model
.
Address
},
{
nameof
(
RB_Supplier
.
UpdateDate
),
model
.
UpdateDate
}
};
IList
<
WhereHelper
>
whereHelpersSupplier
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplier
.
ID
),
FiledValue
=
model
.
ID
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
supplierRepository
.
Update
(
filedsSupplier
,
whereHelpersSupplier
,
trans
);
}
else
{
model
.
Status
=
(
int
)
Common
.
Enum
.
DateStateEnum
.
Normal
;
var
id
=
clientBankAccountRepository
.
Insert
(
model
.
ClientBankAccount
,
trans
);
model
.
BankAccountId
=
id
;
flag
=
supplierRepository
.
Insert
(
model
,
trans
)
>
0
;
}
supplierRepository
.
DBSession
.
Commit
();
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"AddOrUpdateSupplier"
);
supplierRepository
.
DBSession
.
Rollback
(
"AddOrUpdateSupplier"
);
return
false
;
}
return
flag
;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="ID"></param>
/// <param name="EmployeeId"></param>
/// <returns></returns>
public
bool
RemoveSupplier
(
int
ID
,
int
BankAccountId
)
{
bool
flag
=
false
;
var
trans
=
supplierRepository
.
DbTransaction
;
try
{
IDictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_ClientBankAccount
.
Status
),(
int
)
Common
.
Enum
.
DateStateEnum
.
Delete
}
};
IList
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_ClientBankAccount
.
ID
),
FiledValue
=
BankAccountId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
clientBankAccountRepository
.
Update
(
fileds
,
whereHelpers
,
trans
);
IDictionary
<
string
,
object
>
filedsSupplier
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_ClientBankAccount
.
Status
),(
int
)
Common
.
Enum
.
DateStateEnum
.
Delete
}
};
IList
<
WhereHelper
>
whereHelpersSupplier
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_ClientBankAccount
.
ID
),
FiledValue
=
BankAccountId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
supplierRepository
.
Update
(
filedsSupplier
,
whereHelpersSupplier
,
trans
);
supplierRepository
.
DBSession
.
Commit
();
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"RemoveSupplier"
);
supplierRepository
.
DBSession
.
Rollback
(
"RemoveSupplier"
);
return
false
;
}
return
flag
;
}
/// <summary>
/// 验证重复
/// </summary>
/// <param name="ID"></param>
/// <param name="Name"></param>
/// <param name="RB_Group_Id"></param>
/// <param name="RB_Branch_Id"></param>
/// <returns></returns>
public
bool
ExistsClientAccount
(
int
ID
,
string
Num
,
int
RB_Group_Id
,
int
RB_Branch_Id
)
{
IList
<
WhereHelper
>
where
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_ClientBankAccount
.
Status
),
FiledValue
=
(
int
)
Common
.
Enum
.
DateStateEnum
.
Normal
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_ClientBankAccount
.
CardNum
),
FiledValue
=
Num
.
Trim
(),
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_ClientBankAccount
.
RB_Group_Id
),
FiledValue
=
RB_Group_Id
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_ClientBankAccount
.
RB_Branch_Id
),
FiledValue
=
RB_Branch_Id
,
OperatorEnum
=
OperatorEnum
.
Equal
},
};
if
(
ID
>
0
)
{
where
.
Add
(
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_ClientBankAccount
.
ID
),
FiledValue
=
ID
.
ToString
(),
OperatorEnum
=
OperatorEnum
.
NotEqual
});
}
return
clientBankAccountRepository
.
Exists
(
where
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment