username@email.com
2021-09-02 9da546cd8de37882147f19f6f090544476bfe5ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.IO;
using System.Globalization;
using System.Text.RegularExpressions;
using CY.Infrastructure.Common;
using CY.Model;
using CY.WebForm.cs;
using CY.BLL;
using CY.BLL.Sys;
using CY.SendMessage;
using CY.Infrastructure;
using CY.BLL.OA;
using CY.Config;
using CY.Infrastructure.Query;
using CY.Infrastructure.DESEncrypt;
 
namespace CY.WebForm.Pages.common
{
    /// <summary>
    /// 吴辉
    /// 公用ajax访问页
    /// </summary>
    public partial class CommonAjax : FrontBasePage
    {
        Sys_CitySiteBLL bll_Sys_CitySiteBLL = null;
        EC_AcceptWayByCustomersBLL bll_EC_AcceptWayByCustomersBLL = null;
        EC_AcceptWayByOrderBLL bll_EC_AcceptWayByOrderBLL = null;
        EC_AcceptWayBySellerBLL bll_EC_AcceptWayBySellerBLL = null;
        Sys_Permissions_MenuBLL bll_Sys_Permissions_MenuBLL = null;
        Sys_Permissions_UserCaseBLL bll_Sys_Permissions_UserCaseBLL = null;
        OA_FirmRoleBLL bll_OA_FirmRoleBLL = null;
        Sys_Permissions_RoleBLL bll_Sys_Permissions_RoleBLL = null;
        Info_SortBLL bll_Info_SortBLL = null;
        Info_AdBLL bll_Info_AdBLL = null;
        Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
        OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
        OA_IntentionCustomerBLL bll_OA_IntentionCustomerBLL = null;
        EC_MemberBasicBLL bll_EC_MemberBasicBLL = null;
        OA_StaffBLL bll_OA_StaffBLL = null;
        OA_DepartmentBll bll_OA_DepartmentBll = null;
        OA_CustomerApplyBLL bll_OA_CustomerApplyBLL = null;
        OA_CarManageBll bll_OA_CarManageBll = null;
        OA_PropertyCateBLL bll_OA_PropertyCateBLL = null;
        OA_PropertyManageBLL bll_OA_PropertyManageBLL = null;
        OA_StaffPostBLL bll_OA_StaffPostBLL = null;
        OA_StaffResumeBLL bll_OA_StaffResumeBLL = null;
        OA_StaffPostLogBLL bll_OA_StaffPostLogBLL = null;
        OA_StaffFirmProfileBLL bll_OA_StaffFirmProfileBLL = null;
        OA_StaffRecruitmentsBLL bll_OA_StaffRecruitmentsBLL = null;
        OA_WageProcessBLL bll_OA_WageProcessBLL = null;
        EC_OnlineAdviserBLL bll_EC_OnlineAdviserBLL = null;
        OA_WageSetPieceBLL bll_OA_WageSetPieceBLL = null;
        OA_WageManageBLL bll_OA_WageManageBLL = null;
        OA_WageAwardPunishBLL bll_OA_WageAwardPunishBLL = null;
        OA_CustomerAccessRecordBLL bll_OA_CustomerAccessRecordBLL = null;
 
        public string old_province = "";
        public string old_city = "";
        public string old_county = "";
 
        //初始化
        public CommonAjax()
        {
            old_province = "";
            old_city = "";
            old_county = "";
            bll_Sys_CitySiteBLL = new Sys_CitySiteBLL();
            bll_EC_AcceptWayByCustomersBLL = new EC_AcceptWayByCustomersBLL();
            bll_EC_AcceptWayByOrderBLL = new EC_AcceptWayByOrderBLL();
            bll_EC_AcceptWayBySellerBLL = new EC_AcceptWayBySellerBLL();
            bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
            bll_Sys_Permissions_MenuBLL = new Sys_Permissions_MenuBLL();
            bll_Sys_Permissions_UserCaseBLL = new Sys_Permissions_UserCaseBLL();
            bll_Info_SortBLL = new Info_SortBLL();
            bll_Info_AdBLL = new Info_AdBLL();
            bll_OA_FirmRoleBLL = new OA_FirmRoleBLL();
            bll_Sys_Permissions_RoleBLL = new Sys_Permissions_RoleBLL();
            bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
            bll_OA_IntentionCustomerBLL = new OA_IntentionCustomerBLL();
            bll_EC_MemberBasicBLL = new EC_MemberBasicBLL();
            bll_OA_StaffBLL = new OA_StaffBLL();
            bll_OA_DepartmentBll = new OA_DepartmentBll();
            bll_OA_CustomerApplyBLL = new OA_CustomerApplyBLL();
            bll_OA_CarManageBll = new OA_CarManageBll();
            bll_OA_PropertyCateBLL = new OA_PropertyCateBLL();
            bll_OA_PropertyManageBLL = new OA_PropertyManageBLL();
            bll_OA_StaffPostBLL = new OA_StaffPostBLL();
            bll_OA_StaffResumeBLL = new OA_StaffResumeBLL();
            bll_OA_StaffPostLogBLL = new OA_StaffPostLogBLL();
            bll_OA_StaffFirmProfileBLL = new OA_StaffFirmProfileBLL();
            bll_OA_StaffRecruitmentsBLL = new OA_StaffRecruitmentsBLL();
            bll_OA_WageProcessBLL = new OA_WageProcessBLL();
            bll_EC_OnlineAdviserBLL = new EC_OnlineAdviserBLL();
            bll_OA_WageSetPieceBLL = new OA_WageSetPieceBLL();
            bll_OA_WageManageBLL = new OA_WageManageBLL();
            bll_OA_WageAwardPunishBLL = new OA_WageAwardPunishBLL();
            bll_OA_CustomerAccessRecordBLL = new OA_CustomerAccessRecordBLL();
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["cityType"] == "province")
            {
                Response.Write(BindProvince());
            }
            else if (Request["cityType"] == "city")
            {
                if (Request["date_type"] == "Name")
                    Response.Write(BindCity(Request["old_province"].ToString2()));
                else
                    Response.Write(BindCity(Request["old_province"].ToInt32() ?? 0));
            }
            else if (Request["cityType"] == "county")
            {
                if (Request["date_type"] == "Name")
                    Response.Write(BindCounty(Request["old_city"].ToString2()));
                else
                    Response.Write(BindCounty(Request["old_city"].ToInt32() ?? 0));
            }
            else if (Request["rt_datetype"] == "order")
            {
                Response.Write(GetOrderReceiptDate(Request["targetid"].ToInt32() ?? 0));
            }
            else if (Request["rt_datetype"] == "member")
            {
                Response.Write(GetMemberReceiptDate(Request["targetid"].ToGuid2()));
            }
            else if (Request["rt_datetype"] == "customer")
            {
                Response.Write(GetCustomerReceiptDate(Request["targetid"].ToGuid2()));
            }
            else if (Request["rt_datetype"] == "rttype")
            {
                Response.Write(GetRtType());
            }
            else if (Request["rt_datetype"] == "invoice")
            {
                Response.Write(GetInvoice());
            }
            else if (Request["verifytype"] == "SMSANDEMAILVerification")
            {
                if (WebInfo.Instance.RegisterVerificationType.ToString2() == "SMS")
                {
                    Response.Write(SendSMSByVerify(Request["verifyvalue"].ToString2()));
                }
                else
                {
                    Response.Write(SendEmailByVerify(Request["verifyvalue"].ToString2()));
                }
            }
            else if (Request["pm_datetype"] == "menu")
            {
                Response.Write(GetPermissionsMenus(Request["KeyId"].ToInt32()));
            }
            else if (Request["pm_datetype"] == "usercase")
            {
                Response.Write(GetUserCase(Request["KeyId"].ToInt32()));
            }
            else if (Request["info_datetype"] == "newsinfo")
            {
                Response.Write(GetInfoSort(Request["KeyId"].ToInt32()));
            }
            else if (Request["ad_datetype"] == "ad")
            {
                Response.Write(GetAd(Request["forumname"].ToString2(), Request["locationname"].ToString2()));
            }
            else if (Request["role_datetype"] == "staff")
            {
                Response.Write(GetMenusByFirmRole(Request["value_keyid"].ToInt32()));
            }
            else if (Request["role_datetype"] == "member")
            {
                Response.Write(GetMenusByMemberRole(Request["value_keyid"].ToInt32()));
            }
            else if (Request["dr_type"] != null)
            {
                Response.Write(SetDefaultRole(Request["dr_type"], Request["value_keyid"].ToInt32()));
            }
            else if (Request["cor_int_datatype"] == "int")
            {
                Response.Write(IntInfoIntoCorInfo(Request["value_keyid"].ToInt32()));
            }
            else if (Request["lg_datetype"] == "IsLogin")
            {
                Response.Write(IsMemberLogin());
            }
            else if (Request["lg_datetype"] == "login")
            {
                Response.Write(LoginDesk(Request["LoginId"].ToString2(), Request["LoginPwd"].ToString2()));
            }
            else if (Request["dateType"] == "Domain")
            {
                Response.Write(IsExitsDomain(Request["dUrl"], Request["MemberId"].ToGuid2()));
            }
            else if (Request["dateType"] == "staffcheckname")
            {
                Response.Write(IsExitsStaffName(Request["name"]));
            }
            else if (Request["dateType"] == "Departmentcheckname")
            {
                Response.Write(IsExitsDepartmentName(Request["name"], Request["Keyid"].ToInt32()));
            }
            else if (Request["dateType"] == "editerUploadImage")
            {
                Response.Write(UploadImage());
            }
            else if (Request["dateType"] == "editerProcessRequest")
            {
                Response.Write(ProcessRequest());
            }
            else if (Request["customchangetype"] == "customchangetype")
            {
                Response.Write(ChangeCustom(Request["keyid"].ToGuid2()));
            }
            else if (Request["dateType"] == "Exitusercase")
            {
                Response.Write(GetNoExitCaseList(Request["menupath"].ToString2()));
            }
            else if (Request["dateType"] == "creat_menu_case")
            {
                Response.Write(CreatUserCase(Request["menupath"].ToString2(), Request["attrs"].ToString2(), Request["texts"].ToString2()));
            }
            else if (Request["dateType"] == "print_cor_int")
            {
                Response.Write(PrintAddRecord());
            }
            else if (Request["dateType"] == "carcheckname")
            {
                Response.Write(IsExitsCarName(Request["name"], Request["keyid"]));
            }
            else if (Request["dateType"] == "propertycheckname")
            {
                Response.Write(IsExitsPropertyCateName(Request["name"], Request["keyid"]));
            }
            else if (Request["dateType"] == "propertyNamecheckname")
            {
                Response.Write(IsExitsPropertyNameCateName(Request["name"], Request["keyid"]));
            }
            else if (Request["dateType"] == "resumeCateChange")
            {
                Response.Write(GetPostListByCateId(Request["cateId"].ToInt32(), Request["Num"].ToInt32()));
            }
            else if (Request["dateType"] == "resumeDeliveryPost")
            {
                Response.Write(DeliveryPost(Request["hi"].ToString2()));
            }
            else if (Request["dateType"] == "WageProcessCheckName")
            {
                Response.Write(IsExitsWageProcessName(Request["name"].ToString2(), Request["keyid"].ToInt32()));
            }
            else if (Request["dateType"] == "onlineadviserclick")
            {
                Response.Write(AddOnlineAdviserClick(Request["id"].ToInt32()));
            }
            else if (Request["dateType"] == "calculatewagepiece")
            {
                Response.Write(CalculateWagePiece(Request["wagesetpieceId"].ToInt32(), Request["quantity"].ToInt32()));
            }
            else if (Request["dateType"] == "getsoftclirntInfo")
            {
                Response.Write(GetClientInfo(Request["id"].ToString2()));
            }
            else if (Request["dateType"] == "staffResetPwd")
            {
                Response.Write(RestStaffPwd(Request["keyid"].ToInt32()));
            }
            else if (!string.IsNullOrEmpty(Request["varitypeforregister"]) && !string.IsNullOrEmpty(Request["dataforregister"]))
            {
                Response.Write(CheckDataFromRegister(Request["varitypeforregister"].ToString2(), Request["dataforregister"]));
            }
            else if (!string.IsNullOrEmpty(Request["varitypeforcalculatestaffwages"]))
            {
                Response.Write(CalculateStaffWages(Request["varitypeforcalculatestaffwages"].ToString2(), Request["staffid"].ToGuid2(), Request["wagestime"]));
            }
            else if (!string.IsNullOrEmpty(Request["varitypeforstatisticsstaffwages"]))
            {
                Response.Write(StatisticsStaffWages(Request["varitypeforstaffwages"].ToString2(), Request["staffid"].ToGuid2(), Request["AggregatePaychecks"].ToDecimal2(), Request["EducedTotal"].ToDecimal2(), Request["Personal"].ToDecimal2()));
            }
            Response.End();
        }
 
        #region 城市区域
 
        /// <summary>
        /// 获取省级列表
        /// </summary>
        /// <returns></returns>
        public string BindProvince()
        {
            return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(0, 0, 1));
        }
 
        /// <summary>
        /// 通过省名称获取市级列表
        /// </summary>
        /// <param name="Province">省名称</param>
        /// <returns></returns>
        public string BindCity(string Province)
        {
            Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByName(Province);
            if (m_Sys_CitySite == null)
            {
                return "";
            }
            else
            {
                return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.Keyid, 0, 2));
            }
        }
 
        /// <summary>
        /// 通过省Keyid获取市级列表
        /// </summary>
        /// <param name="Province">省Keyid</param>
        /// <returns></returns>
        public string BindCity(int Province)
        {
            Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByKeyid(Province);
            if (m_Sys_CitySite == null)
            {
                return "";
            }
            else
            {
                return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.Keyid, 0, 2));
            }
        }
 
        /// <summary>
        /// 通过市名称获取区县级列表
        /// </summary>
        /// <param name="City">市名称</param>
        /// <returns></returns>
        public string BindCounty(string City)
        {
            Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByName(City);
            if (m_Sys_CitySite == null)
            {
                return "";
            }
            else
            {
                return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.ProvinceId, m_Sys_CitySite.Keyid, 3));
            }
 
        }
 
        /// <summary>
        /// 通过市Keyid获取区县级列表
        /// </summary>
        /// <param name="City">市Keyid</param>
        /// <returns></returns>
        public string BindCounty(int City)
        {
            Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByKeyid(City);
            if (m_Sys_CitySite == null)
            {
                return "";
            }
            else
            {
                return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.ProvinceId, m_Sys_CitySite.Keyid, 3));
            }
 
        }
 
        #endregion
 
        #region 收货方式
 
        /// <summary>
        /// 根据来源id获取订单收货方式
        /// </summary>
        /// <param name="TargetId">来源id</param>
        /// <returns></returns>
        public string GetOrderReceiptDate(int? TargetId)
        {
            if (TargetId != null)
            {
                return JsonHelper.GetJsonStringByObject(bll_EC_AcceptWayByOrderBLL.GetModelByTargetId(TargetId));
            }
            else
            {
                return "";
            }
        }
 
        /// <summary>
        /// 根据来源id获取会员收货方式
        /// </summary>
        /// <param name="TargetId">来源id</param>
        /// <returns></returns>
        public string GetMemberReceiptDate(Guid TargetId)
        {
            if (TargetId != null)
            {
                return JsonHelper.GetJsonStringByObject(bll_EC_AcceptWayBySellerBLL.GetModelByTargetId(TargetId));
            }
            else
            {
                return "";
            }
        }
 
        /// <summary>
        /// 根据来源id获取客户收货方式
        /// </summary>
        /// <param name="TargetId">来源id</param>
        /// <returns></returns>
        public string GetCustomerReceiptDate(Guid TargetId)
        {
            if (TargetId != null)
            {
                return JsonHelper.GetJsonStringByObject(bll_EC_AcceptWayByCustomersBLL.GetModelByTargetId(TargetId));
            }
            else
            {
                return "";
            }
        }
 
        /// <summary>
        /// 获得收货方式
        /// </summary>
        /// <returns></returns>
        public string GetRtType()
        {
            return JsonHelper.GetJsonStringByObject(bll_Sys_DictionaryBLL.GetDataByType("收货方式"));
        }
 
        /// <summary>
        /// 获得票据要求
        /// </summary>
        /// <returns></returns>
        public string GetInvoice()
        {
            return JsonHelper.GetJsonStringByObject(bll_Sys_DictionaryBLL.GetDataByType("票据要求"));
        }
 
        #endregion
 
        #region 注册验证重复
 
        /// <summary>
        /// 注册验证重复
        /// </summary>
        /// <param name="varitype"></param>
        /// <param name="varidata"></param>
        /// <returns></returns>
        public string CheckDataFromRegister(string varitype, string varidata)
        {
            bool result = false;
            switch (varitype) //验证请求
            {
                case "loginid": //验证登陆账号
                    result = bll_EC_MemberBasicBLL.ExistMemberByLoginId(varidata);
                    break;
                case "companyname": //验证公司名称
                    result = bll_EC_MemberBasicBLL.ExistMemberByCompanyName(varidata);
                    break;
                case "phone": //验证激活手机
                    result = bll_EC_MemberBasicBLL.ExistMemberByPhone(varidata);
                    break;
                case "email": //验证激活邮箱
                    result = bll_EC_MemberBasicBLL.ExistMemberByEmail(varidata);
                    break;
                default:
                    return "0";
            }
            return (result ? "1" : "0");
        }
 
        #endregion
 
        #region 验证信息
 
        /// <summary>
        /// 发送验证邮件
        /// </summary>
        /// <param name="Email">邮箱</param>
        /// <returns></returns>
        public int SendEmailByVerify(string Email)
        {
            int VerifyCode = MathRandom.RandomNumber(6);
            bool result = SendMessage.SendMessge.SendEmail("四川印刷网验证邮件", "亲爱的用户,您好,您的验证码是:" + VerifyCode, Email);
            if (result)
            {
                Session["VerifyCode"] = VerifyCode;
                Session["VerifyNumber"] = Email;
            }
            return result ? 0 : 1;
        }
 
        /// <summary>
        /// 发送验证短信
        /// </summary>
        /// <param name="Phone">短信</param>
        /// <returns></returns>
        public int SendSMSByVerify(string Phone)
        {
            int VerifyCode = MathRandom.RandomNumber(6);
            bool result = SendMessage.SendMessge.SendSMS(Phone, "亲爱的用户,您好,您的验证码是:" + VerifyCode, "");
            if (result)
            {
                Session["VerifyCode"] = VerifyCode;
                Session["VerifyNumber"] = Phone;
            }
            return result ? 0 : 1;
        }
 
        #endregion
 
        #region 权限菜单
        /// <summary>
        /// 获取单个权限菜单
        /// </summary>
        /// <param name="KeyId"></param>
        /// <returns></returns>
        public string GetPermissionsMenus(int? KeyId)
        {
            if (KeyId != null && KeyId > 0)
            {
                return JsonHelper.GetJsonStringByObject(bll_Sys_Permissions_MenuBLL.SelectModelByKeyId(KeyId));
            }
            else
            {
                return "";
            }
        }
 
        #endregion
 
        #region 用例注册
        /// <summary>
        /// 获取单个用例注册
        /// </summary>
        /// <param name="KeyId"></param>
        /// <returns></returns>
        public string GetUserCase(int? KeyId)
        {
            if (KeyId != null && KeyId > 0)
            {
                return JsonHelper.GetJsonStringByObject(bll_Sys_Permissions_UserCaseBLL.SelectModelByKeyId(KeyId));
            }
            else
            {
                return "";
            }
        }
 
        #endregion
 
        #region 网站资讯
 
        /// <summary>
        /// 获取网站资讯分类信息
        /// </summary>
        /// <param name="KeyId"></param>
        /// <returns></returns>
        public string GetInfoSort(int? KeyId)
        {
            if (KeyId != null && KeyId > 0)
            {
                return JsonHelper.GetJsonStringByObject(bll_Info_SortBLL.SelectModelByKeyId(KeyId));
            }
            else
            {
                return "";
            }
        }
 
        #endregion
 
        #region 网站广告
        /// <summary>
        /// 获取广告信息
        /// </summary>
        /// <param name="locationname"></param>
        /// <returns></returns>
        public string GetAd(string ForumName, string LocationName)
        {
            if (!string.IsNullOrEmpty(ForumName) && !string.IsNullOrEmpty(LocationName))
            {
                return bll_Info_AdBLL.SelectAdByLocationName(ForumName, LocationName);
            }
            else
            {
                return "";
            }
        }
 
        #endregion
 
        #region 厂商角色权限
        /// <summary>
        /// 根据角色编号获取全部权限
        /// </summary>
        /// <param name="keyid"></param>
        /// <returns></returns>
        public string GetMenusByFirmRole(int? value_keyid)
        {
            List<OA_FirmRolePermissionsRel> m_OA_FirmRolePermissionsRelList = bll_OA_FirmRoleBLL.SelectListByRoleId(value_keyid) as List<OA_FirmRolePermissionsRel>;
            if (m_OA_FirmRolePermissionsRelList != null && m_OA_FirmRolePermissionsRelList.Count > 0)
            {
                List<string> Menus = new List<string>();
                foreach (var m_Sys_Permissions_Menu in m_OA_FirmRolePermissionsRelList)
                {
                    Menus.Add(m_Sys_Permissions_Menu.MenuIdOne + "-" + m_Sys_Permissions_Menu.MenuIdTwo + "-" + m_Sys_Permissions_Menu.MenuIdThree + "+" + "0");
                    string[] fucns = m_Sys_Permissions_Menu.FuncGroup.Split(',');
                    foreach (var item in fucns)
                    {
                        Menus.Add(m_Sys_Permissions_Menu.MenuIdOne + "-" + m_Sys_Permissions_Menu.MenuIdTwo + "-" + m_Sys_Permissions_Menu.MenuIdThree + "+" + item);
                    }
                }
                return JsonHelper.GetJsonStringByObject(Menus);
            }
            else
                return "";
        }
 
        #endregion
 
        #region 会员角色权限
        /// <summary>
        /// 根据角色编号获取全部权限
        /// </summary>
        /// <param name="keyid"></param>
        /// <returns></returns>
        public string GetMenusByMemberRole(int? value_keyid)
        {
            List<Sys_Permissions_RoleMenuRelation> m_Sys_Permissions_RoleMenuRelationList = bll_Sys_Permissions_RoleBLL.SelectListByRoleId(value_keyid) as List<Sys_Permissions_RoleMenuRelation>;
            if (m_Sys_Permissions_RoleMenuRelationList != null && m_Sys_Permissions_RoleMenuRelationList.Count > 0)
            {
                List<string> Menus = new List<string>();
                foreach (var m_Sys_Permissions_Menu in m_Sys_Permissions_RoleMenuRelationList)
                {
                    Menus.Add(m_Sys_Permissions_Menu.MenuIdOne + "-" + m_Sys_Permissions_Menu.MenuIdTwo + "-" + m_Sys_Permissions_Menu.MenuIdThree + "+" + "0");
                    string[] fucns = m_Sys_Permissions_Menu.FuncId.Split(',');
                    foreach (var item in fucns)
                    {
                        Menus.Add(m_Sys_Permissions_Menu.MenuIdOne + "-" + m_Sys_Permissions_Menu.MenuIdTwo + "-" + m_Sys_Permissions_Menu.MenuIdThree + "+" + item);
                    }
                }
                return JsonHelper.GetJsonStringByObject(Menus);
            }
            else
                return "";
        }
 
        #endregion
 
        #region 设置默认角色
        /// <summary>
        /// 设置会员默认角色
        /// </summary>
        /// <param name="dr_type"></param>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public string SetDefaultRole(string dr_type, int? Keyid)
        {
            switch (dr_type)
            {
                case "firm":
                    return bll_Sys_Permissions_RoleBLL.SetDefaulFirmRole(Keyid) ? "1" : "-1";
                case "shop":
                    return bll_Sys_Permissions_RoleBLL.SetDefaulShopRole(Keyid) ? "1" : "-1";
                case "buyer":
                    return bll_Sys_Permissions_RoleBLL.SetDefaulBuyerRole(Keyid) ? "1" : "-1";
                default:
                    return "-1";
            }
        }
 
        #endregion
 
        #region 前台登录窗口
 
        /// <summary>
        /// 前台登录窗口
        /// </summary>
        /// <param name="LoginId"></param>
        /// <param name="LoginPwd"></param>
        /// <returns></returns>
        public string LoginDesk(string LoginId, string LoginPwd)
        {
            string res = "";
            bool result = false;
            EC_MemberBasic m_EC_MemberBasic = new EC_MemberBasic();
            if (string.IsNullOrEmpty(LoginId.ToString2()))
            {
                res = "登录帐号不能为空";
            }
            else if (string.IsNullOrEmpty(LoginPwd.ToString2()))
            {
                res = "登录密码不能为空";
            }
            else
            {
                m_EC_MemberBasic = bll_EC_MemberBasicBLL.GetMemberByLogin(LoginId.ToString2(), LoginPwd.ToString2());
                if (m_EC_MemberBasic == null || m_EC_MemberBasic.MemberId == null)
                {
                    res = "帐号或密码错误";
                }
                else
                {
                    if (m_EC_MemberBasic.MemberType == "印刷厂商" || m_EC_MemberBasic.MemberType == "个人网店" || m_EC_MemberBasic.MemberType == "买家会员" || m_EC_MemberBasic.MemberType == "管理员")
                    {
                        if (m_EC_MemberBasic.UseState != 3)
                        {
                            res = "帐号状态异常,请联系客服";
                        }
                        else if (m_EC_MemberBasic.ExpirationTime <= DateTime.Now && m_EC_MemberBasic.MemberType == "印刷厂商")
                        {
                            res = "帐号已到期,请联系客服";
                        }
                        else
                        {
                            m_EC_MemberBasic.TrueMemberId = m_EC_MemberBasic.MemberId;
                            m_EC_MemberBasic.TrueName = m_EC_MemberBasic.Name;
                            m_EC_MemberBasic.TrueType = m_EC_MemberBasic.MemberType;
                            Session["nowMemberLogin"] = m_EC_MemberBasic; //保存登录信息
                            result = true;
                        }
                    }
                    else
                    {
                        OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByMemberId(m_EC_MemberBasic.MemberId);
                        if (m_OA_Staff != null)
                        {
                            EC_MemberBasic m_EC_MemberBasic_firm = bll_EC_MemberBasicBLL.GetMemberByMemberId(m_OA_Staff.FirmId);
 
                            if (m_EC_MemberBasic_firm.UseState != 3)
                            {
                                res = "您所属公司的帐号状态异常,请联系客服";
                            }
                            else if (m_EC_MemberBasic_firm.ExpirationTime <= DateTime.Now && m_EC_MemberBasic_firm.MemberType == "印刷厂商")
                            {
                                res = "您所属公司的帐号已到期,请联系客服";
                            }
                            else if (m_EC_MemberBasic.UseState != 3)
                            {
                                res = "帐号状态异常";
                            }
                            else
                            {
                                m_EC_MemberBasic_firm.TrueMemberId = m_EC_MemberBasic.MemberId;
                                m_EC_MemberBasic_firm.TrueName = m_EC_MemberBasic.Name;
                                m_EC_MemberBasic_firm.TrueType = m_EC_MemberBasic.MemberType;
                                m_EC_MemberBasic_firm.StaffId = m_OA_Staff.Keyid;
                                m_EC_MemberBasic_firm.ShortName = m_EC_MemberBasic.Name;
                                Session["nowMemberLogin"] = m_EC_MemberBasic_firm; //保存登录信息
                                result = true;
                            }
                        }
                    }
                    if (result)
                    {
                        m_EC_MemberBasic.LastLoginDate = DateTime.Now;
                        m_EC_MemberBasic.LastIp = DNTRequest.GetIP();
 
                        if (bll_EC_MemberBasicBLL.UpdateModel(m_EC_MemberBasic))
                        {
                            res = "success";
                        }
                        else
                        {
                            res = "登录失败,请稍后再试";
                        }
                    }
                }
            }
            return res;
        }
 
        /// <summary>
        /// 判断是否登录
        /// </summary>
        /// <returns></returns>
        public string IsMemberLogin()
        {
            try
            {
                if (CurrentUser != null && !string.IsNullOrEmpty(CurrentUser.Name))
                    return "1";
                else
                    return "-1";
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                return "-2";
            }
        }
 
        #endregion
 
        #region 将意向客户导入合作客户
 
        /// <summary>
        /// 将意向客户导入合作客户
        /// </summary>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public string IntInfoIntoCorInfo(int? Keyid)
        {
            string msg = "";
            if (Keyid > 0)
            {
                OA_IntentionCustomer m_OA_IntentionCustomer = bll_OA_IntentionCustomerBLL.getSingleIntentionCustomer(Keyid.ToString2());
                if (m_OA_IntentionCustomer != null && m_OA_IntentionCustomer.Keyid > 0)
                {
                    OA_CorporateClients m_OA_CorporateClients = new OA_CorporateClients();
                    OA_CustomerCommunications m_OA_CustomerCommunications = new OA_CustomerCommunications();
                    EC_AcceptWayByCustomers m_EC_AcceptWayByCustomers = new EC_AcceptWayByCustomers();
 
                    #region 初始合作客户基础信息
                    m_OA_CorporateClients.CompanyName = m_OA_IntentionCustomer.CompanyName ?? "";
                    m_OA_CorporateClients.CustomerIndustriesId = m_OA_IntentionCustomer.CustomerIndustriesId ?? 0;
                    m_OA_CorporateClients.CustomerTypeId = m_OA_IntentionCustomer.CustomerTypeId ?? 0;
                    m_OA_CorporateClients.SourcesInfoId = m_OA_IntentionCustomer.SourcesInfoId ?? 0;
                    m_OA_CorporateClients.DegreeImportanId = m_OA_IntentionCustomer.DegreeImportanId ?? 0;
                    m_OA_CorporateClients.AccountManagerId = m_OA_IntentionCustomer.AccountManagerId ?? 0;
                    m_OA_CorporateClients.BusinessManagerId = m_OA_IntentionCustomer.BusinessManagerId ?? 0;
 
                    m_OA_CorporateClients.CreditId = 0;
                    m_OA_CorporateClients.LoginPhone = "";
                    m_OA_CorporateClients.LoginPwd = "";
                    m_OA_CorporateClients.CorporateWebsite = "";
                    m_OA_CorporateClients.BusinessAnalysisId = 0;
                    m_OA_CorporateClients.IsLoginCorporateWeb = false;
                    m_OA_CorporateClients.Credit = 0;
                    m_OA_CorporateClients.Bank = "";
                    m_OA_CorporateClients.TaxID = "";
                    m_OA_CorporateClients.AccountID = "";
                    m_OA_CorporateClients.OrderCount = 0;
                    m_OA_CorporateClients.OrderMoney = 0;
 
                    m_OA_CorporateClients.Prepayments = 0;
                    m_OA_CorporateClients.IsOutsourcing = false;
                    m_OA_CorporateClients.OutVendorName = CurrentUser.Name;
                    m_OA_CorporateClients.IsPriority = false;
                    m_OA_CorporateClients.CumulativePrepayments = 0;
                    m_OA_CorporateClients.LastUpdateTime = DateTime.Now;
                    m_OA_CorporateClients.Operator = CurrentUser.ShortName;
                    m_OA_CorporateClients.Remark = m_OA_IntentionCustomer.Remark ?? "";
                    m_OA_CorporateClients.OutRate = 1;
                    #endregion
 
                    #region 初始合作客户通讯信息
                    m_OA_CustomerCommunications.Province = m_OA_IntentionCustomer.Province;
                    m_OA_CustomerCommunications.City = m_OA_IntentionCustomer.City;
                    m_OA_CustomerCommunications.County = m_OA_IntentionCustomer.County;
                    m_OA_CustomerCommunications.DetailedAddress = m_OA_IntentionCustomer.DetailedAddress;
                    m_OA_CustomerCommunications.CompanyPhone = m_OA_IntentionCustomer.PhoneNum;
                    m_OA_CustomerCommunications.Postcode = m_OA_IntentionCustomer.Postcode;
                    m_OA_CustomerCommunications.Mobile = m_OA_IntentionCustomer.MobileNum;
                    m_OA_CustomerCommunications.Fax = "";
                    m_OA_CustomerCommunications.Email = m_OA_IntentionCustomer.Email;
                    m_OA_CustomerCommunications.QQ = m_OA_IntentionCustomer.QQ;
                    m_OA_CustomerCommunications.LegalRepresentative = "";
                    m_OA_CustomerCommunications.LegalMobile = "";
                    m_OA_CustomerCommunications.LegalQQ = "";
                    m_OA_CustomerCommunications.BusinessManagers = m_OA_IntentionCustomer.BusinessManagers;
                    m_OA_CustomerCommunications.ManagersMobile = "";
                    m_OA_CustomerCommunications.ManagersQQ = "";
                    m_OA_CustomerCommunications.FinancialOfficers = "";
                    m_OA_CustomerCommunications.OfficersMobile = "";
                    m_OA_CustomerCommunications.OfficersQQ = "";
                    m_OA_CustomerCommunications.Remark = "";
                    m_OA_CustomerCommunications.LastUpdateTime = DateTime.Now;
                    m_OA_CustomerCommunications.Operator = CurrentUser.ShortName;
                    #endregion
 
                    #region 初始合作客户收货地址
                    m_EC_AcceptWayByCustomers.AcceptTypeId = 0;
                    m_EC_AcceptWayByCustomers.InvoiceDemand = "";
                    m_EC_AcceptWayByCustomers.Remark = "";
                    m_EC_AcceptWayByCustomers.LastUpdateTime = DateTime.Now;
                    m_EC_AcceptWayByCustomers.Operator = CurrentUser.ShortName;
 
                    m_EC_AcceptWayByCustomers.City = "";
                    m_EC_AcceptWayByCustomers.Accepter = "";
                    m_EC_AcceptWayByCustomers.AccepterPhone = "";
                    m_EC_AcceptWayByCustomers.AccepterAddress = "";
                    m_EC_AcceptWayByCustomers.AccepterPhoneNum = "";
                    m_EC_AcceptWayByCustomers.AcceptContacts = "";
                    m_EC_AcceptWayByCustomers.FetchAddress = "";
                    m_EC_AcceptWayByCustomers.FetchPhoneNum = "";
                    m_EC_AcceptWayByCustomers.FetchContacts = "";
                    m_EC_AcceptWayByCustomers.AppointCourierCompany = "";
                    #endregion
 
                    m_OA_CorporateClients.Keyid = Guid.NewGuid();
                    m_OA_CorporateClients.CreateTime = DateTime.Now;
                    m_OA_CorporateClients.CustomerId = bll_OA_CorporateClientsBLL.GetLastIdByFirmId(CurrentUser.MemberId) + 1;
                    m_OA_CorporateClients.FirmId = CurrentUser.MemberId;
                    m_OA_CorporateClients.InquiryId = CurrentUser.InquiryId;
 
                    m_OA_CorporateClients.MemberId = m_OA_CorporateClients.Keyid;
                    m_OA_CustomerCommunications.Keyid = m_OA_CorporateClients.Keyid;
                    m_EC_AcceptWayByCustomers.TargetId = m_OA_CorporateClients.Keyid;
 
                    bool result = bll_OA_CorporateClientsBLL.IntIntoModel(m_OA_CorporateClients, m_OA_CustomerCommunications, m_EC_AcceptWayByCustomers, m_OA_IntentionCustomer);
                    if (result)
                        msg = "-1";
                    else
                        msg = "1";
                }
                else
                    msg = "2";
            }
            else
                msg = "3";
            return msg;
        }
 
        #endregion
 
        #region 检测域名是否重复
 
        /// <summary>
        /// 检测域名是否重复
        /// </summary>
        /// <param name="Url"></param>
        /// <returns></returns>
        public int IsExitsDomain(string Url, Guid MemberId)
        {
            return bll_EC_MemberBasicBLL.IsExitsDomain(Url, MemberId);
        }
 
        #endregion
 
        #region 检测员工姓名是否重复
 
        /// <summary>
        /// 检测员工姓名是否重复
        /// </summary>
        /// <param name="Name"></param>
        /// <returns></returns>
        public int IsExitsStaffName(string Name)
        {
            return bll_OA_StaffBLL.IsExitsName(Name, CurrentUser.MemberId);
        }
 
        #endregion
 
        #region 检测部门名称是否重复
 
        /// <summary>
        /// 检测部门名称是否重复
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public int IsExitsDepartmentName(string Name, int? Keyid)
        {
            return bll_OA_DepartmentBll.IsExitsName(Name, CurrentUser.MemberId, Keyid);
        }
 
        #endregion
 
        #region 上传
        public string UploadImage()
        {
            string WebDomain = "http://" + WebInfo.Instance.WebDomain.ToString().Trim('/').Replace("http://", "");
            //根目录路径,相对路径
            String savePath = "/images/Upload/" + DateTime.Now.ToString("yyyyMMdd") + "/";
            //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
            String saveUrl = WebInfo.Instance.WebDomain.ToString2().TrimEnd('/') + "/images/Upload/" + DateTime.Now.ToString("yyyyMMdd") + "/";
 
            string fileTypes = "gif,jpg,jpeg,png,bmp";
            double maxSize = Convert.ToDouble(WebInfo.Instance.UploadFileSize) * 1024 * 1024;
            //Convert.ToDouble(file.ContentLength) > Convert.ToDouble(ConfigInfo<UploadInfo>.Instance().UploadSize) * 1024 * 1024
            Hashtable hash = new Hashtable();
 
            HttpPostedFile file = Request.Files["imgFile"];
 
            if (file == null)
            {
                hash = new Hashtable();
                hash["error"] = 0;
                hash["url"] = "请选择文件";
                return JsonHelper.GetJsonStringByObject(hash);
            }
 
            string dirPath = Server.MapPath("~" + savePath);
            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }
 
            string fileName = file.FileName;
            string fileExt = Path.GetExtension(fileName).ToLower();
 
            ArrayList fileTypeList = ArrayList.Adapter(fileTypes.Split(','));
 
            if (file.InputStream == null || file.InputStream.Length > maxSize)
            {
                hash = new Hashtable();
                hash["error"] = 0;
                hash["url"] = "上传文件大小超过限制";
                return JsonHelper.GetJsonStringByObject(hash);
            }
 
            if (string.IsNullOrEmpty(fileExt) || Array.IndexOf(fileTypes.Split(','), fileExt.Substring(1).ToLower()) == -1)
            {
                hash = new Hashtable();
                hash["error"] = 0;
                hash["url"] = "上传文件扩展名是不允许的扩展名";
                return JsonHelper.GetJsonStringByObject(hash);
            }
 
            string newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt;
            string filePath = dirPath + newFileName;
            file.SaveAs(filePath);
            string fileUrl =saveUrl + newFileName;
 
            hash = new Hashtable();
            hash["error"] = 0;
            hash["url"] = fileUrl;
 
            return JsonHelper.GetJsonStringByObject(hash);
        }
        #endregion
 
        #region 浏览
        public string ProcessRequest()
        {
            //String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1);
 
            //根目录路径,相对路径
            String rootPath = "/images/Upload/" + DateTime.Now.ToString("yyyyMMdd") + "/";
            //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
            String rootUrl = WebInfo.Instance.WebDomain.ToString2().TrimEnd('/') + "/images/Upload/" + DateTime.Now.ToString("yyyyMMdd") + "/";
            //图片扩展名
            String fileTypes = "gif,jpg,jpeg,png,bmp";
 
            String currentPath = "";
            String currentUrl = "";
            String currentDirPath = "";
            String moveupDirPath = "";
 
            //根据path参数,设置各路径和URL
            String path = Request.QueryString["path"];
            path = String.IsNullOrEmpty(path) ? "" : path;
            if (path == "")
            {
                currentPath = Server.MapPath(rootPath);
                currentUrl = rootUrl;
                currentDirPath = "";
                moveupDirPath = "";
            }
            else
            {
                currentPath = Server.MapPath(rootPath) + path;
                currentUrl = rootUrl + path;
                currentDirPath = path;
                moveupDirPath = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1");
            }
 
            //排序形式,name or size or type
            String order = Request.QueryString["order"];
            order = String.IsNullOrEmpty(order) ? "" : order.ToLower();
 
            //不允许使用..移动到上一级目录
            if (Regex.IsMatch(path, @"\.\."))
            {
                Response.Write("Access is not allowed.");
                Response.End();
            }
            //最后一个字符不是/
            if (path != "" && !path.EndsWith("/"))
            {
                Response.Write("Parameter is not valid.");
                Response.End();
            }
            //目录不存在或不是目录
            if (!Directory.Exists(currentPath))
            {
                Response.Write("Directory does not exist.");
                Response.End();
            }
 
            //遍历目录取得文件信息
            string[] dirList = Directory.GetDirectories(currentPath);
            string[] fileList = Directory.GetFiles(currentPath);
 
            switch (order)
            {
                case "size":
                    Array.Sort(dirList, new NameSorter());
                    Array.Sort(fileList, new SizeSorter());
                    break;
                case "type":
                    Array.Sort(dirList, new NameSorter());
                    Array.Sort(fileList, new TypeSorter());
                    break;
                case "name":
                default:
                    Array.Sort(dirList, new NameSorter());
                    Array.Sort(fileList, new NameSorter());
                    break;
            }
 
            Hashtable result = new Hashtable();
            result["moveup_dir_path"] = moveupDirPath;
            result["current_dir_path"] = currentDirPath;
            result["current_url"] = currentUrl;
            result["total_count"] = dirList.Length + fileList.Length;
            List<Hashtable> dirFileList = new List<Hashtable>();
            result["file_list"] = dirFileList;
            for (int i = 0; i < dirList.Length; i++)
            {
                DirectoryInfo dir = new DirectoryInfo(dirList[i]);
                Hashtable hash = new Hashtable();
                hash["is_dir"] = true;
                hash["has_file"] = (dir.GetFileSystemInfos().Length > 0);
                hash["filesize"] = 0;
                hash["is_photo"] = false;
                hash["filetype"] = "";
                hash["filename"] = dir.Name;
                hash["datetime"] = dir.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
                dirFileList.Add(hash);
            }
            for (int i = 0; i < fileList.Length; i++)
            {
                FileInfo file = new FileInfo(fileList[i]);
                Hashtable hash = new Hashtable();
                hash["is_dir"] = false;
                hash["has_file"] = false;
                hash["filesize"] = file.Length;
                hash["is_photo"] = (Array.IndexOf(fileTypes.Split(','), file.Extension.Substring(1).ToLower()) >= 0);
                hash["filetype"] = file.Extension.Substring(1);
                hash["filename"] = file.Name;
                hash["datetime"] = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss");
                dirFileList.Add(hash);
            }
            //Response.AddHeader("Content-Type", "application/json; charset=UTF-8");
            //context.Response.Write(JsonMapper.ToJson(result));
            //context.Response.End();
            return JsonHelper.GetJsonStringByObject(result);
        }
 
        public class NameSorter : IComparer
        {
            public int Compare(object x, object y)
            {
                if (x == null && y == null)
                {
                    return 0;
                }
                if (x == null)
                {
                    return -1;
                }
                if (y == null)
                {
                    return 1;
                }
                FileInfo xInfo = new FileInfo(x.ToString());
                FileInfo yInfo = new FileInfo(y.ToString());
 
                return xInfo.FullName.CompareTo(yInfo.FullName);
            }
        }
 
        public class SizeSorter : IComparer
        {
            public int Compare(object x, object y)
            {
                if (x == null && y == null)
                {
                    return 0;
                }
                if (x == null)
                {
                    return -1;
                }
                if (y == null)
                {
                    return 1;
                }
                FileInfo xInfo = new FileInfo(x.ToString());
                FileInfo yInfo = new FileInfo(y.ToString());
 
                return xInfo.Length.CompareTo(yInfo.Length);
            }
        }
 
        public class TypeSorter : IComparer
        {
            public int Compare(object x, object y)
            {
                if (x == null && y == null)
                {
                    return 0;
                }
                if (x == null)
                {
                    return -1;
                }
                if (y == null)
                {
                    return 1;
                }
                FileInfo xInfo = new FileInfo(x.ToString());
                FileInfo yInfo = new FileInfo(y.ToString());
 
                return xInfo.Extension.CompareTo(yInfo.Extension);
            }
        }
 
        public bool IsReusable
        {
            get
            {
                return true;
            }
        }
        #endregion
 
        #region 申请转换线上客户
 
        /// <summary>
        /// 申请转换线上客户
        /// </summary>
        /// <param name="keyid"></param>
        /// <returns></returns>
        public string ChangeCustom(Guid keyid)
        {
            int isExit = bll_OA_CustomerApplyBLL.IsAlreadyApplication(keyid);
            switch (isExit)
            {
                case -1:
                    return "申请失败";
                case 1:
                    return "此客户已是线上客户,请勿重复申请";
                case 2:
                    return "不存在与此客户名匹配的会员,请检查客户名称是否正确";
                case 3:
                    return "此客户已申请转换,请勿重复申请";
                case 0:
                    OA_CorporateClients m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(keyid);
                    EC_MemberBasic m_EC_MemberBasic = bll_EC_MemberBasicBLL.SelectModleMemberByCompanyName(m_OA_CorporateClients.CompanyName);
 
                    OA_CustomerApply m_OA_CustomerApply = new OA_CustomerApply();
                    m_OA_CustomerApply.CustomId = keyid.ToString2();
                    m_OA_CustomerApply.CustomName = m_OA_CorporateClients.CompanyName;
                    m_OA_CustomerApply.FirmId = CurrentUser.MemberId;
                    m_OA_CustomerApply.FirmName = CurrentUser.Name;
                    m_OA_CustomerApply.LastUpdateTime = DateTime.Now;
                    m_OA_CustomerApply.MemberId = m_EC_MemberBasic.MemberId;
                    m_OA_CustomerApply.MemberName = m_EC_MemberBasic.Name;
                    m_OA_CustomerApply.Operator = CurrentUser.ShortName;
                    m_OA_CustomerApply.Remark = "";
                    m_OA_CustomerApply.Status = "申请中";
                    if (bll_OA_CustomerApplyBLL.InsertModel(m_OA_CustomerApply))
                        return "申请成功,请等待回复";
                    else
                        return "申请失败";
                default:
                    return "操作失败";
            }
        }
 
        #endregion
 
        #region 根据路径和角色编号去除用例
 
        /// <summary>
        /// 根据路径和角色编号去除用例
        /// </summary>
        /// <param name="MenuPath"></param>
        /// <returns></returns>
        public string GetNoExitCaseList(string MenuPath)
        {
            try
            {
                if (CurrentUser.MemberType == "管理员")
                {
                    return "";
                }
                else
                {
                    Sys_Permissions_UserRoleRelation m_Sys_Permissions_UserRoleRelation = bll_Sys_Permissions_RoleBLL.SelectSys_Permissions_UserRoleRelation(CurrentUser.MemberId);
                    return JsonHelper.GetJsonStringByObject(bll_Sys_Permissions_UserCaseBLL.GetNoExitCaseList(MenuPath, m_Sys_Permissions_UserRoleRelation.RoleId));
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                return "";
            }
        }
 
        #endregion
 
        #region 创建用例
 
        /// <summary>
        /// 创建用例
        /// </summary>
        /// <param name="menupath"></param>
        /// <param name="attrs"></param>
        /// <param name="texts"></param>
        /// <returns></returns>
        public string CreatUserCase(string menupath, string attrs, string texts)
        {
            bll_Sys_Permissions_UserCaseBLL.CreatUserCaseByPage(menupath, attrs, texts);
            return "";
        }
 
        #endregion
 
        #region 增加商业信函访问数量
 
        /// <summary>
        /// 增加商业信函访问数量
        /// </summary>
        public string PrintAddRecord()
        {
            string[] Numbers = Request["number"].ToString2().Split(',');
            if (Numbers.Length > 0)
            {
                OA_CustomerAccessRecord m_OA_CustomerAccessRecord = new OA_CustomerAccessRecord();
                m_OA_CustomerAccessRecord.AccessContent = "";
                m_OA_CustomerAccessRecord.AccesserId = CurrentUser.StaffId ?? 0;
                m_OA_CustomerAccessRecord.AccessTypeId = 5;
                m_OA_CustomerAccessRecord.CreateTime = DateTime.Now;
                m_OA_CustomerAccessRecord.CustomerId = "";
                m_OA_CustomerAccessRecord.CutomerType = (Request["sendfrom"] == "corporate");
                m_OA_CustomerAccessRecord.EndTime = DateTime.Now;
                m_OA_CustomerAccessRecord.LastUpdateTime = DateTime.Now;
                m_OA_CustomerAccessRecord.Operator = CurrentUser.ShortName;
                m_OA_CustomerAccessRecord.Receiver = "";
                m_OA_CustomerAccessRecord.Remark = CurrentUser.MemberId.ToString2();
                m_OA_CustomerAccessRecord.StartTime = DateTime.Now;
                m_OA_CustomerAccessRecord.StuffId = CurrentUser.StaffId ?? 0;
                m_OA_CustomerAccessRecord.TurnoverIntention = "";
                OA_CustomerAccessRecordBLL bll_OA_CustomerAccessRecordBLL = new OA_CustomerAccessRecordBLL();
                bll_OA_CustomerAccessRecordBLL.InsertModelList(Request["number"].ToString2().Trim(',').Split(','), m_OA_CustomerAccessRecord);
            }
            return "";
        }
 
        #endregion
 
        #region 检测车牌号是否重复
 
        /// <summary>
        /// 检测车牌号是否重复
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public int IsExitsCarName(string Name, string Keyid)
        {
            return bll_OA_CarManageBll.IsExitsName(Name, CurrentUser.MemberId, Keyid);
        }
 
        #endregion
 
        #region 检测行政物品分类是否重复
 
        /// <summary>
        /// 检测行政物品分类是否重复
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public int IsExitsPropertyCateName(string Name, string Keyid)
        {
            return bll_OA_PropertyCateBLL.IsExitsName(Name, CurrentUser.MemberId, Keyid);
        }
 
        #endregion
 
        #region 检测行政物品是否重复
 
        /// <summary>
        /// 检测行政物品是否重复
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public int IsExitsPropertyNameCateName(string Name, string Keyid)
        {
            return bll_OA_PropertyManageBLL.IsExitsName(Name, CurrentUser.MemberId, Keyid);
        }
 
        #endregion
 
        #region 根据职位类别获取全部职位
 
        public string GetPostListByCateId(int? cateId, int? Num)
        {
            string postHtml = "";
            if (cateId > 0)
            {
                Pagination pa = new Pagination();
                pa.PageSize = 500;
                pa.PageIndex = 1;
                List<OA_StaffPost> m_OA_StaffPostList = bll_OA_StaffPostBLL.SelectModelPage(pa, AdminAccount.MemberId, "", null, cateId, null, null, null, "") as List<OA_StaffPost>;
                OA_StaffResumeIntention m_OA_StaffResumeIntention = bll_OA_StaffResumeBLL.GetOA_StaffResumeIntentionByKeyid(CurrentUser.MemberId);
                int i = 1;
                foreach (var item in m_OA_StaffPostList)
                {
                    string CheckedClass = "";
                    if (m_OA_StaffResumeIntention != null && !string.IsNullOrEmpty(m_OA_StaffResumeIntention.R_I_PostName))
                    {
                        foreach (var m_var in m_OA_StaffResumeIntention.R_I_PostName.Split(','))
                        {
                            if (m_var == item.P_Name)
                            {
                                CheckedClass = "checked=\"checked\"";
                                break;
                            }
                        }
                    }
 
                    postHtml = postHtml + "<span style=\"width:125px;display:inline-block; \"><input id=\"Post_id_" + i + "\" " + CheckedClass + "  type=\"checkbox\" name=\"Post_id\" value=\"" + item.P_Name + "\" /><label for=\"Post_id_" + i + "\" >&nbsp;" + item.P_Name + "</label>&nbsp;&nbsp;&nbsp;</span>" + (i % Num == 0 ? "<br />" : "");
                    i++;
                }
            }
            return postHtml;
        }
 
        #endregion
 
        #region 投递简历
 
        public int DeliveryPost(string hi)
        {
            int result = 0;
            if (!string.IsNullOrEmpty(hi))
            {
                List<int> deleteKeyIdList = new List<int>();
                string deleteKeyIds = Request["hi"].ToString().Trim(',');
                string[] keyIdArry = deleteKeyIds.Split(',');
                foreach (string keyId in keyIdArry)
                {
                    InsertDeliveryPost(keyId.ToInt32());
                    System.Threading.Thread.Sleep(20); //休眠20毫秒
                }
            }
            return result;
        }
 
        public bool InsertDeliveryPost(int? PostId)
        {
            bool IsSuccess = true;
            try
            {
                OA_StaffRecruitments m_OA_StaffRecruitments = bll_OA_StaffRecruitmentsBLL.GetModelByKeyid(PostId);
                OA_StaffResume m_OA_StaffResume = bll_OA_StaffResumeBLL.GetModelByMemberid(CurrentUser.MemberId);
                OA_StaffFirmProfile m_OA_StaffFirmProfile = bll_OA_StaffFirmProfileBLL.GetModelByFirmId(m_OA_StaffRecruitments.FirmId);
                DateTime nowTime = DateTime.Now;
 
                Model.OA_StaffPostLog m_OA_StaffPostLog = new OA_StaffPostLog();
                m_OA_StaffPostLog.FirmId = m_OA_StaffRecruitments.FirmId;
                m_OA_StaffPostLog.MemberId = CurrentUser.MemberId;
                m_OA_StaffPostLog.Resume_id = m_OA_StaffResume.Keyid;
                m_OA_StaffPostLog.Recruitments_id = PostId;
                m_OA_StaffPostLog.PL_Status = 0;
                m_OA_StaffPostLog.PL_CreatTime = nowTime;
                m_OA_StaffPostLog.PL_LookStatus = 0;
                m_OA_StaffPostLog.PL_LookTime = nowTime;
                m_OA_StaffPostLog.PL_ReplyStatus = 0;
                m_OA_StaffPostLog.PL_ReplyTime = nowTime;
                m_OA_StaffPostLog.PL_ReplyContent = "";
                m_OA_StaffPostLog.PL_InviteStatus = 0;
                m_OA_StaffPostLog.PL_InviteCreatTime = nowTime;
                m_OA_StaffPostLog.PL_InviteTime = "";
                m_OA_StaffPostLog.PL_InvitePlace = m_OA_StaffFirmProfile.MP_ResumePlace;
                m_OA_StaffPostLog.PL_InvitePeople = m_OA_StaffFirmProfile.MP_ResumePeople;
                m_OA_StaffPostLog.PL_InvitePhone = m_OA_StaffFirmProfile.MP_ResumePhone;
                m_OA_StaffPostLog.PL_InviteRemark = "";
                m_OA_StaffPostLog.PL_InviteCar = m_OA_StaffFirmProfile.MP_ResumeCarWay;
                m_OA_StaffPostLog.LastUpdateTime = nowTime;
                m_OA_StaffPostLog.Operator = CurrentUser.ShortName;
                m_OA_StaffPostLog.Remark = "";
 
                IsSuccess = bll_OA_StaffPostLogBLL.InsertModel(m_OA_StaffPostLog);
 
                m_OA_StaffRecruitments.R_ResumeAllCount += 1;
                m_OA_StaffRecruitments.R_ResumeNewCount += 1;
 
                IsSuccess = bll_OA_StaffRecruitmentsBLL.UpdateModel(m_OA_StaffRecruitments);
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                return false;
            }
            return IsSuccess;
        }
 
        #endregion
 
        #region 检测会员工资工序是否重复
 
        /// <summary>
        /// 检测会员工资工序是否重复
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public int IsExitsWageProcessName(string Name, int? Keyid)
        {
            return bll_OA_WageProcessBLL.IsExitsName(Name, CurrentUser.MemberId, Keyid);
        }
 
        #endregion
 
        #region 增加在线顾问访问量
 
        /// <summary>
        /// 增加在线顾问访问量
        /// </summary>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public string AddOnlineAdviserClick(int? Keyid)
        {
            string result = "";
            try
            {
                EC_OnlineAdviser m_EC_OnlineAdviser = bll_EC_OnlineAdviserBLL.GetModelByKeyid(Keyid);
                m_EC_OnlineAdviser.Quantity += 1;
                bll_EC_OnlineAdviserBLL.UpdateModel(m_EC_OnlineAdviser);
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
            }
            finally
            {
                result = "";
            }
            return result;
        }
 
        #endregion
 
        #region 计件工资工资计算
 
        /// <summary>
        /// 计件工资工资计算
        /// </summary>
        /// <param name="WageSetPieceId"></param>
        /// <param name="Quantity"></param>
        /// <returns></returns>
        public string CalculateWagePiece(int? WageSetPieceId, int? Quantity)
        {
            string res = "0";
            try
            {
                OA_WageSetPiece m_OA_WageSetPiece = bll_OA_WageSetPieceBLL.GetModelByKeyid(WageSetPieceId);
                if (m_OA_WageSetPiece != null)
                {
                    //int? AllCount = Quantity * (m_OA_WageSetPiece.SPS_Unit == "万张" ? 10000 : m_OA_WageSetPiece.SPS_Unit == "千张" ? 1000 : 100);
                    int? AllCount = Quantity;
                    if (AllCount > m_OA_WageSetPiece.SPS_OvercapacityStandard)
                    {
                        if (m_OA_WageSetPiece.SPS_OvercapacityAccounting == "全部产量")
                        {
                            res = (m_OA_WageSetPiece.SPS_OvercapacityWages * AllCount).Value.ToString("0.00");
                        }
                        else
                        {
                            res = ((m_OA_WageSetPiece.SPS_Wages * m_OA_WageSetPiece.SPS_OvercapacityStandard) + (m_OA_WageSetPiece.SPS_OvercapacityWages * (AllCount - m_OA_WageSetPiece.SPS_OvercapacityStandard))).Value.ToString("0.00");
                        }
                    }
                    else
                    {
                        res = (m_OA_WageSetPiece.SPS_Wages * AllCount).Value.ToString("0.00");
                    }
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                res = "0";
            }
            return res;
        }
 
        #endregion
 
        #region 根据客户编号获取客户信息
 
        /// <summary>
        /// 根据客户编号获取客户信息
        /// </summary>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public string GetClientInfo(string Keyid)
        {
            OA_CorporateClients m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(Keyid.ToGuid2());
            return JsonHelper.GetJsonStringByObject(m_OA_CorporateClients);
        }
 
        #endregion
 
        #region 初始员工密码
 
        /// <summary>
        /// 初始员工密码
        /// </summary>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public string RestStaffPwd(int? Keyid)
        {
            try
            {
                string res = "0";
                OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByKeyid(Keyid);
                if (m_OA_Staff.FirmId == CurrentUser.MemberId)
                {
                    EC_MemberBasic m_EC_MemberBasic = bll_EC_MemberBasicBLL.GetMemberByMemberId(m_OA_Staff.MemberId);
                    m_EC_MemberBasic.Password = DESEncrypt.Encrypt("123456+");
                    if (bll_EC_MemberBasicBLL.UpdateModel(m_EC_MemberBasic))
                    {
                        res = "1";
                    }
                }
                return res;
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                return "0";
            }
        }
 
        #endregion
 
        #region 根据员工ID和月份统计员工工资
 
        /// <summary>
        /// 根据员工ID和月份统计员工工资
        /// </summary>
        /// <param name="types"></param>
        /// <param name="staffId"></param>
        /// <param name="calculateTime"></param>
        /// <returns></returns>
        public string CalculateStaffWages(string types, Guid staffId, string calculateTimeString)
        {
            OA_WagesRecord m_OA_WagesRecord = new OA_WagesRecord();
            OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByMemberId(staffId);
            OA_WageManage m_OA_WageManage = bll_OA_WageManageBLL.GetModelByMemberId(staffId);
            DateTime? calculateTimeStart = (calculateTimeString.Replace("年", "-").Replace("月", "-") + "1").ToDateTime2();
            DateTime? calculateTimeEnd = calculateTimeStart.Value.AddMonths(1);
 
            //奖励和罚款
            Pagination pa = new Pagination();
            pa.PageSize = 500;
            pa.PageIndex = 1;
            List<OA_WageAwardPunish> m_OA_WageAwardPunishList = bll_OA_WageAwardPunishBLL.SelectModelPageByWage(pa, CurrentUser.MemberId, null, m_OA_Staff.Name, calculateTimeString).ToList();
            if (m_OA_WageAwardPunishList != null && m_OA_WageAwardPunishList.Count == 1)
            {
                m_OA_WagesRecord.RewardMoney = m_OA_WageAwardPunishList[0].RewardMoney ?? 0;
                m_OA_WagesRecord.PunishmentMoney = m_OA_WageAwardPunishList[0].PushMoney ?? 0;
            }
 
            //社保缴纳金额
            m_OA_WagesRecord.Unit = m_OA_Staff.SM_SocialSecurityFirmMoney ?? 0;
            m_OA_WagesRecord.Personal = m_OA_Staff.SM_SocialSecuritySelfMoney ?? 0;
 
            if (m_OA_WageManage != null)
            {
                //业务提成
                OA_CustomerAccessRecord m_OA_CustomerAccessRecord = bll_OA_CustomerAccessRecordBLL.SumAccoutingWages(pa, CurrentUser.MemberId, m_OA_Staff.Name, "", calculateTimeStart, calculateTimeEnd);
                if (m_OA_CustomerAccessRecord != null &&  m_OA_WageManage.SW_MissionMoney > 0 && m_OA_WageManage.SW_MissionRate > 0 && m_OA_CustomerAccessRecord.NowMoney > m_OA_WageManage.SW_MissionMoney)
                {
                    m_OA_WagesRecord.Outputcommission = (m_OA_CustomerAccessRecord.NowMoney - m_OA_WageManage.SW_MissionMoney) * m_OA_WageManage.SW_MissionRate / 100;
                }
            }
 
            return JsonHelper.GetJsonStringByObject(m_OA_WagesRecord);
        }
 
        /// <summary>
        /// 统计员工金额
        /// </summary>
        /// <param name="types">参数判断</param>
        /// <param name="staffId">员工编号</param>
        /// <param name="AggregatePaychecks">合计工资(不含基本工资以及工龄工资)</param>
        /// <param name="EducedTotal">应扣工资合计</param>
        /// <param name="Personal">社保个人应缴纳金额</param>
        /// <returns></returns>
        public string StatisticsStaffWages(string types, Guid staffId, decimal? AggregatePaychecks, decimal? EducedTotal, decimal? Personal)
        {
            OA_WagesRecord m_OA_WagesRecord = new OA_WagesRecord();
            OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByMemberId(staffId);
            OA_WageManage m_OA_WageManage = bll_OA_WageManageBLL.GetModelByMemberId(staffId);
 
            decimal? AllMoney = 0;
            if (m_OA_WageManage != null)
            {
                if (m_OA_WageManage.SW_BasicSalaryType == "基本工资")
                {
                    AllMoney = AggregatePaychecks - EducedTotal - Personal;
                    if (m_OA_WageManage.SW_WorkAge.ToInt32() > 0 && m_OA_WageManage.SW_WorkAgeMoney > 0)
                    {
                        AllMoney = AllMoney + m_OA_WageManage.SW_WorkAge.ToInt32() * m_OA_WageManage.SW_WorkAgeMoney;
                    }
                }
                else if (m_OA_WageManage.SW_BasicSalaryType == "保底工资")
                {
                    AllMoney = AggregatePaychecks - m_OA_WageManage.SW_BasicSalary - EducedTotal - Personal;
                    if (m_OA_WageManage.SW_BasicSalary > AllMoney)
                    {
                        AllMoney = m_OA_WageManage.SW_BasicSalary;
                    }
                    else
                    {
                        AllMoney = AllMoney;
                    }
 
                    if (m_OA_WageManage.SW_WorkAge.ToInt32() > 0 && m_OA_WageManage.SW_WorkAgeMoney > 0)
                    {
                        AllMoney = AllMoney + m_OA_WageManage.SW_WorkAge.ToInt32() * m_OA_WageManage.SW_WorkAgeMoney;
                    }
                }
            }
 
            if (AllMoney > 0)
            {
                decimal AfterTaxoney = Config.TaxCalculator.GetAfterTaxByMoney(AllMoney ?? 0);
                m_OA_WagesRecord.WillPayTax = AllMoney - AfterTaxoney;
                m_OA_WagesRecord.AmountWagCards = AfterTaxoney;
            }
            return JsonHelper.GetJsonStringByObject(m_OA_WagesRecord);
        }
 
        #endregion
    }
}