|
|
@@ -14,6 +14,7 @@ namespace CallCenterApi.DAL
|
|
14
|
14
|
/// </summary>
|
|
15
|
15
|
public partial class T_Call_CallRecords
|
|
16
|
16
|
{
|
|
|
17
|
+ private static readonly object Global_Lock = new object();
|
|
17
|
18
|
public T_Call_CallRecords()
|
|
18
|
19
|
{ }
|
|
19
|
20
|
#region BasicMethod
|
|
|
@@ -747,19 +748,22 @@ namespace CallCenterApi.DAL
|
|
747
|
748
|
public bool UpdateCallInRingTelRecord(Model.T_Call_CallRecords model)
|
|
748
|
749
|
{
|
|
749
|
750
|
StringBuilder strSql = new StringBuilder();
|
|
750
|
|
- strSql.Append("update T_Call_CallRecords set ");
|
|
751
|
|
- //strSql.Append("IvrLongTime=datediff(second,IvrStartTime,IvrEndTime),");
|
|
752
|
|
- //strSql.Append("WaitEndTime=getdate(),");
|
|
753
|
|
- //strSql.Append("WaitLongTime=datediff(second,WaitStartTime,getdate()),");
|
|
754
|
|
- //strSql.Append("RingStartTime=getdate(),");
|
|
755
|
|
- //strSql.Append("UserId=@UserId,");
|
|
756
|
|
- //strSql.Append("UserCode=@UserCode,");
|
|
757
|
|
- //strSql.Append("UserName=@UserName,");
|
|
758
|
|
- //strSql.Append("ExtNumber=@ExtNumber,");
|
|
759
|
|
- //strSql.Append("NoCallState=3,");//未接状态为振铃
|
|
760
|
|
- strSql.Append("DealType=@DealType");
|
|
761
|
|
- strSql.Append(" where CallId=@CallId ");
|
|
762
|
|
- SqlParameter[] parameters = {
|
|
|
751
|
+
|
|
|
752
|
+ lock (DAL.T_Call_CallRecords.Global_Lock)
|
|
|
753
|
+ {
|
|
|
754
|
+ strSql.Append("update T_Call_CallRecords set ");
|
|
|
755
|
+ //strSql.Append("IvrLongTime=datediff(second,IvrStartTime,IvrEndTime),");
|
|
|
756
|
+ //strSql.Append("WaitEndTime=getdate(),");
|
|
|
757
|
+ //strSql.Append("WaitLongTime=datediff(second,WaitStartTime,getdate()),");
|
|
|
758
|
+ //strSql.Append("RingStartTime=getdate(),");
|
|
|
759
|
+ //strSql.Append("UserId=@UserId,");
|
|
|
760
|
+ //strSql.Append("UserCode=@UserCode,");
|
|
|
761
|
+ //strSql.Append("UserName=@UserName,");
|
|
|
762
|
+ //strSql.Append("ExtNumber=@ExtNumber,");
|
|
|
763
|
+ //strSql.Append("NoCallState=3,");//未接状态为振铃
|
|
|
764
|
+ strSql.Append("DealType=@DealType");
|
|
|
765
|
+ strSql.Append(" where CallId=@CallId ");
|
|
|
766
|
+ SqlParameter[] parameters = {
|
|
763
|
767
|
//new SqlParameter("@UserId", SqlDbType.Int,4),
|
|
764
|
768
|
//new SqlParameter("@UserCode", SqlDbType.VarChar,50),
|
|
765
|
769
|
//new SqlParameter("@UserName", SqlDbType.NVarChar,20),
|
|
|
@@ -767,20 +771,31 @@ namespace CallCenterApi.DAL
|
|
767
|
771
|
new SqlParameter("@CallId", SqlDbType.VarChar,50),
|
|
768
|
772
|
new SqlParameter("@DealType", SqlDbType.Int,4)};
|
|
769
|
773
|
|
|
770
|
|
- //parameters[0].Value = model.UserId;
|
|
771
|
|
- //parameters[1].Value = model.UserCode;
|
|
772
|
|
- //parameters[2].Value = model.UserName;
|
|
773
|
|
- //parameters[3].Value = model.ExtNumber;
|
|
774
|
|
- parameters[0].Value = model.CallId;
|
|
775
|
|
- parameters[1].Value = model.DealType;
|
|
776
|
|
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
777
|
|
- if (rows > 0)
|
|
778
|
|
- {
|
|
779
|
|
- return true;
|
|
780
|
|
- }
|
|
781
|
|
- else
|
|
782
|
|
- {
|
|
783
|
|
- return false;
|
|
|
774
|
+ //parameters[0].Value = model.UserId;
|
|
|
775
|
+ //parameters[1].Value = model.UserCode;
|
|
|
776
|
+ //parameters[2].Value = model.UserName;
|
|
|
777
|
+ //parameters[3].Value = model.ExtNumber;
|
|
|
778
|
+ parameters[0].Value = model.CallId;
|
|
|
779
|
+ parameters[1].Value = model.DealType;
|
|
|
780
|
+ try
|
|
|
781
|
+ {
|
|
|
782
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
783
|
+
|
|
|
784
|
+ if (rows > 0)
|
|
|
785
|
+ {
|
|
|
786
|
+ return true;
|
|
|
787
|
+ }
|
|
|
788
|
+ else
|
|
|
789
|
+ {
|
|
|
790
|
+ return false;
|
|
|
791
|
+ }
|
|
|
792
|
+ }
|
|
|
793
|
+ catch (Exception)
|
|
|
794
|
+ {
|
|
|
795
|
+
|
|
|
796
|
+ return false;
|
|
|
797
|
+ }
|
|
|
798
|
+
|
|
784
|
799
|
}
|
|
785
|
800
|
}
|
|
786
|
801
|
|
|
|
@@ -794,28 +809,31 @@ namespace CallCenterApi.DAL
|
|
794
|
809
|
public bool UpdateCallInAnswerTelRecord(Model.T_Call_CallRecords model)
|
|
795
|
810
|
{
|
|
796
|
811
|
StringBuilder strSql = new StringBuilder();
|
|
797
|
|
- strSql.Append("update T_Call_CallRecords set ");
|
|
798
|
|
- strSql.Append("CallState=@CallState,");
|
|
799
|
|
- //strSql.Append("RingEndTime=getdate(),");
|
|
800
|
|
- //strSql.Append("RingLongTime=datediff(second,RingStartTime,getdate()),");
|
|
801
|
|
- //strSql.Append("TalkStartTime=getdate(),");
|
|
802
|
|
- strSql.Append("DealType=@DealType");
|
|
803
|
|
- strSql.Append(" where CallId=@CallId");
|
|
804
|
|
- SqlParameter[] parameters = {
|
|
|
812
|
+ lock (DAL.T_Call_CallRecords.Global_Lock)
|
|
|
813
|
+ {
|
|
|
814
|
+ strSql.Append("update T_Call_CallRecords set ");
|
|
|
815
|
+ strSql.Append("CallState=@CallState,");
|
|
|
816
|
+ //strSql.Append("RingEndTime=getdate(),");
|
|
|
817
|
+ //strSql.Append("RingLongTime=datediff(second,RingStartTime,getdate()),");
|
|
|
818
|
+ //strSql.Append("TalkStartTime=getdate(),");
|
|
|
819
|
+ strSql.Append("DealType=@DealType");
|
|
|
820
|
+ strSql.Append(" where CallId=@CallId");
|
|
|
821
|
+ SqlParameter[] parameters = {
|
|
805
|
822
|
new SqlParameter("@CallId", SqlDbType.VarChar,50),
|
|
806
|
823
|
new SqlParameter("@CallState", SqlDbType.Int,4),
|
|
807
|
824
|
new SqlParameter("@DealType", SqlDbType.Int,4)};
|
|
808
|
|
- parameters[0].Value = model.CallId;
|
|
809
|
|
- parameters[1].Value = model.CallState;
|
|
810
|
|
- parameters[2].Value = model.DealType;
|
|
811
|
|
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
812
|
|
- if (rows > 0)
|
|
813
|
|
- {
|
|
814
|
|
- return true;
|
|
815
|
|
- }
|
|
816
|
|
- else
|
|
817
|
|
- {
|
|
818
|
|
- return false;
|
|
|
825
|
+ parameters[0].Value = model.CallId;
|
|
|
826
|
+ parameters[1].Value = model.CallState;
|
|
|
827
|
+ parameters[2].Value = model.DealType;
|
|
|
828
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
829
|
+ if (rows > 0)
|
|
|
830
|
+ {
|
|
|
831
|
+ return true;
|
|
|
832
|
+ }
|
|
|
833
|
+ else
|
|
|
834
|
+ {
|
|
|
835
|
+ return false;
|
|
|
836
|
+ }
|
|
819
|
837
|
}
|
|
820
|
838
|
}
|
|
821
|
839
|
|
|
|
@@ -829,20 +847,23 @@ namespace CallCenterApi.DAL
|
|
829
|
847
|
public bool UpdateCallInHookTelRecord(string p_CallId)
|
|
830
|
848
|
{
|
|
831
|
849
|
StringBuilder strSql = new StringBuilder();
|
|
832
|
|
- strSql.Append("update T_Call_CallRecords SET DealType=(case CallState when 1 then 6 else DealType end)");
|
|
833
|
|
- strSql.Append(" where CallId=@CallId");
|
|
834
|
|
- SqlParameter[] parameters = {
|
|
|
850
|
+ lock (DAL.T_Call_CallRecords.Global_Lock)
|
|
|
851
|
+ {
|
|
|
852
|
+ strSql.Append("update T_Call_CallRecords SET DealType=(case CallState when 1 then 6 else DealType end)");
|
|
|
853
|
+ strSql.Append(" where CallId=@CallId");
|
|
|
854
|
+ SqlParameter[] parameters = {
|
|
835
|
855
|
new SqlParameter("@CallId", SqlDbType.VarChar,50)};
|
|
836
|
|
- parameters[0].Value = p_CallId;
|
|
|
856
|
+ parameters[0].Value = p_CallId;
|
|
837
|
857
|
|
|
838
|
|
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
839
|
|
- if (rows > 0)
|
|
840
|
|
- {
|
|
841
|
|
- return true;
|
|
842
|
|
- }
|
|
843
|
|
- else
|
|
844
|
|
- {
|
|
845
|
|
- return false;
|
|
|
858
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
859
|
+ if (rows > 0)
|
|
|
860
|
+ {
|
|
|
861
|
+ return true;
|
|
|
862
|
+ }
|
|
|
863
|
+ else
|
|
|
864
|
+ {
|
|
|
865
|
+ return false;
|
|
|
866
|
+ }
|
|
846
|
867
|
}
|
|
847
|
868
|
}
|
|
848
|
869
|
|
|
|
@@ -856,28 +877,31 @@ namespace CallCenterApi.DAL
|
|
856
|
877
|
public bool UpdateCallInPathTelRecord(Model.T_Call_CallRecords model)
|
|
857
|
878
|
{
|
|
858
|
879
|
StringBuilder strSql = new StringBuilder();
|
|
859
|
|
- strSql.Append("update T_Call_CallRecords set ");
|
|
860
|
|
- strSql.Append("CallState=@CallState,");
|
|
861
|
|
- //strSql.Append("FilePath=@FilePath,");
|
|
862
|
|
- strSql.Append("DealType=@DealType");
|
|
863
|
|
- strSql.Append(" where CallId=@CallId");
|
|
864
|
|
- SqlParameter[] parameters = {
|
|
|
880
|
+ lock (DAL.T_Call_CallRecords.Global_Lock)
|
|
|
881
|
+ {
|
|
|
882
|
+ strSql.Append("update T_Call_CallRecords set ");
|
|
|
883
|
+ strSql.Append("CallState=@CallState,");
|
|
|
884
|
+ //strSql.Append("FilePath=@FilePath,");
|
|
|
885
|
+ strSql.Append("DealType=@DealType");
|
|
|
886
|
+ strSql.Append(" where CallId=@CallId");
|
|
|
887
|
+ SqlParameter[] parameters = {
|
|
865
|
888
|
new SqlParameter("@CallId", SqlDbType.VarChar,50),
|
|
866
|
889
|
new SqlParameter("@CallState", SqlDbType.Int,4),
|
|
867
|
890
|
//new SqlParameter("@FilePath", SqlDbType.VarChar,200),
|
|
868
|
891
|
new SqlParameter("@DealType", SqlDbType.Int,4)};
|
|
869
|
|
- parameters[0].Value = model.CallId;
|
|
870
|
|
- parameters[1].Value = model.CallState;
|
|
871
|
|
- //parameters[2].Value = model.FilePath;
|
|
872
|
|
- parameters[2].Value = model.DealType;
|
|
873
|
|
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
874
|
|
- if (rows > 0)
|
|
875
|
|
- {
|
|
876
|
|
- return true;
|
|
877
|
|
- }
|
|
878
|
|
- else
|
|
879
|
|
- {
|
|
880
|
|
- return false;
|
|
|
892
|
+ parameters[0].Value = model.CallId;
|
|
|
893
|
+ parameters[1].Value = model.CallState;
|
|
|
894
|
+ //parameters[2].Value = model.FilePath;
|
|
|
895
|
+ parameters[2].Value = model.DealType;
|
|
|
896
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
897
|
+ if (rows > 0)
|
|
|
898
|
+ {
|
|
|
899
|
+ return true;
|
|
|
900
|
+ }
|
|
|
901
|
+ else
|
|
|
902
|
+ {
|
|
|
903
|
+ return false;
|
|
|
904
|
+ }
|
|
881
|
905
|
}
|
|
882
|
906
|
}
|
|
883
|
907
|
|
|
|
@@ -960,24 +984,27 @@ namespace CallCenterApi.DAL
|
|
960
|
984
|
public bool UpdateCallInRecordDealType(string callid, int type)
|
|
961
|
985
|
{
|
|
962
|
986
|
StringBuilder strSql = new StringBuilder();
|
|
963
|
|
- strSql.Append("update T_Call_CallRecords set ");
|
|
964
|
|
- strSql.Append("DealType=@DealType");
|
|
965
|
|
- strSql.Append(" where CallId=@CallId ");
|
|
966
|
|
- SqlParameter[] parameters = {
|
|
|
987
|
+ lock (DAL.T_Call_CallRecords.Global_Lock)
|
|
|
988
|
+ {
|
|
|
989
|
+ strSql.Append("update T_Call_CallRecords set ");
|
|
|
990
|
+ strSql.Append("DealType=@DealType");
|
|
|
991
|
+ strSql.Append(" where CallId=@CallId ");
|
|
|
992
|
+ SqlParameter[] parameters = {
|
|
967
|
993
|
new SqlParameter("@CallId", SqlDbType.VarChar,50),
|
|
968
|
994
|
new SqlParameter("@DealType", SqlDbType.Int,4)};
|
|
969
|
995
|
|
|
970
|
996
|
|
|
971
|
|
- parameters[0].Value = callid;
|
|
972
|
|
- parameters[1].Value = type;
|
|
973
|
|
- int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
974
|
|
- if (rows > 0)
|
|
975
|
|
- {
|
|
976
|
|
- return true;
|
|
977
|
|
- }
|
|
978
|
|
- else
|
|
979
|
|
- {
|
|
980
|
|
- return false;
|
|
|
997
|
+ parameters[0].Value = callid;
|
|
|
998
|
+ parameters[1].Value = type;
|
|
|
999
|
+ int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
1000
|
+ if (rows > 0)
|
|
|
1001
|
+ {
|
|
|
1002
|
+ return true;
|
|
|
1003
|
+ }
|
|
|
1004
|
+ else
|
|
|
1005
|
+ {
|
|
|
1006
|
+ return false;
|
|
|
1007
|
+ }
|
|
981
|
1008
|
}
|
|
982
|
1009
|
}
|
|
983
|
1010
|
|