|
|
@@ -793,108 +793,94 @@ namespace WOSBusineSupporter
|
|
793
|
793
|
/// <returns></returns>
|
|
794
|
794
|
protected string[] GetOwners(string arrrole, string arrdept, string arrpost, string arruser,string creater)
|
|
795
|
795
|
{
|
|
796
|
|
- string[] res = null;
|
|
|
796
|
+ string[] array = null;
|
|
797
|
797
|
try
|
|
798
|
798
|
{
|
|
799
|
|
- StringBuilder strSql = new StringBuilder();
|
|
800
|
|
-
|
|
801
|
|
- strSql.Append(" select F_UserId from T_Sys_UserAccount ");
|
|
802
|
|
- strSql.Append("where 1=1 ");
|
|
803
|
|
- bool bl = false;
|
|
804
|
|
- string sqlrole = "";
|
|
|
799
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
800
|
+ stringBuilder.Append(" select F_UserId from T_Sys_UserAccount ");
|
|
|
801
|
+ stringBuilder.Append("where 1=1 ");
|
|
|
802
|
+ bool flag = false;
|
|
|
803
|
+ string str = "";
|
|
805
|
804
|
if (arrrole != "")
|
|
806
|
805
|
{
|
|
807
|
|
- bl = true;
|
|
808
|
|
- sqlrole = " and ( F_UserId in (select F_UserId from T_Sys_UserAccount where F_RoleId in (" + arrrole + ")) ";
|
|
|
806
|
+ flag = true;
|
|
|
807
|
+ str = " and ( F_RoleId in (" + arrrole + ") ";
|
|
809
|
808
|
}
|
|
810
|
|
-
|
|
811
|
|
- string sqldept = "";
|
|
|
809
|
+ string str2 = "";
|
|
812
|
810
|
if (arrdept != "")
|
|
813
|
811
|
{
|
|
814
|
|
- if (bl)
|
|
|
812
|
+ if (flag)
|
|
815
|
813
|
{
|
|
816
|
|
- sqldept = " or F_DeptId in (" + arrdept + ") ";
|
|
|
814
|
+ str2 = " or F_DeptId in (" + arrdept + ") ";
|
|
817
|
815
|
}
|
|
818
|
816
|
else
|
|
819
|
817
|
{
|
|
820
|
|
- bl = true;
|
|
821
|
|
- sqldept = " and ( F_DeptId in (" + arrdept + ") ";
|
|
|
818
|
+ flag = true;
|
|
|
819
|
+ str2 = " and ( F_DeptId in (" + arrdept + ") ";
|
|
822
|
820
|
}
|
|
823
|
821
|
}
|
|
824
|
|
-
|
|
825
|
|
- string sqlpost = "";
|
|
|
822
|
+ string str3 = "";
|
|
826
|
823
|
if (arrpost != "")
|
|
827
|
824
|
{
|
|
828
|
|
- if (bl)
|
|
829
|
|
- {
|
|
830
|
|
- //sqlpost = " or F_PostId in (" + arrpost + ") ";
|
|
831
|
|
- }
|
|
832
|
|
- else
|
|
|
825
|
+ if (!flag)
|
|
833
|
826
|
{
|
|
834
|
|
- bl = true;
|
|
835
|
|
- //sqlpost = " and ( F_PostId in (" + arrpost + ") ";
|
|
|
827
|
+ flag = true;
|
|
836
|
828
|
}
|
|
837
|
829
|
}
|
|
838
|
|
-
|
|
839
|
|
- string sqluser = "";
|
|
|
830
|
+ string str4 = "";
|
|
840
|
831
|
if (arruser != "")
|
|
841
|
832
|
{
|
|
842
|
|
- if (bl)
|
|
|
833
|
+ if (flag)
|
|
843
|
834
|
{
|
|
844
|
|
- sqluser = " or F_UserId in (" + arruser + ") ";
|
|
|
835
|
+ str4 = " or F_UserId in (" + arruser + ") ";
|
|
845
|
836
|
}
|
|
846
|
837
|
else
|
|
847
|
838
|
{
|
|
848
|
|
- bl = true;
|
|
849
|
|
- sqluser = " and ( F_UserId in (" + arruser + ") ";
|
|
|
839
|
+ flag = true;
|
|
|
840
|
+ str4 = " and ( F_UserId in (" + arruser + ") ";
|
|
850
|
841
|
}
|
|
851
|
842
|
}
|
|
852
|
|
-
|
|
853
|
|
- //区域限制
|
|
854
|
|
-
|
|
855
|
|
- if (bl)
|
|
|
843
|
+ if (flag)
|
|
856
|
844
|
{
|
|
857
|
|
- strSql.Append(sqlrole + sqldept + sqlpost + sqluser);
|
|
858
|
|
- strSql.Append(" ) ");
|
|
|
845
|
+ stringBuilder.Append(str + str2 + str3 + str4);
|
|
|
846
|
+ stringBuilder.Append(" ) ");
|
|
859
|
847
|
}
|
|
860
|
848
|
else
|
|
861
|
849
|
{
|
|
862
|
|
- strSql.Append(" and 1<>1 ");
|
|
|
850
|
+ stringBuilder.Append(" and 1<>1 ");
|
|
863
|
851
|
}
|
|
864
|
|
-
|
|
865
|
|
- strSql.Append(" and f_deleteflag=0 and f_stateflag=0 and F_DeptId in (select F_DeptId from T_Sys_UserAccount where F_UserId=" + creater + " ) ");
|
|
866
|
|
-
|
|
867
|
|
- DataSet ds = new DataSet();
|
|
868
|
|
- using (SqlConnection connection = new SqlConnection(ConnectionString))
|
|
|
852
|
+ stringBuilder.Append(" and f_deleteflag=0 ");
|
|
|
853
|
+ DataSet dataSet = new DataSet();
|
|
|
854
|
+ using (SqlConnection sqlConnection = new SqlConnection(this.ConnectionString))
|
|
869
|
855
|
{
|
|
870
|
856
|
try
|
|
871
|
857
|
{
|
|
872
|
|
- connection.Open();
|
|
873
|
|
- SqlDataAdapter command = new SqlDataAdapter(strSql.ToString(), connection);
|
|
874
|
|
- command.Fill(ds, "ds");
|
|
|
858
|
+ sqlConnection.Open();
|
|
|
859
|
+ SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(stringBuilder.ToString(), sqlConnection);
|
|
|
860
|
+ sqlDataAdapter.Fill(dataSet, "ds");
|
|
875
|
861
|
}
|
|
876
|
|
- catch (System.Data.SqlClient.SqlException ex)
|
|
|
862
|
+ catch (SqlException ex)
|
|
877
|
863
|
{
|
|
878
|
864
|
throw new Exception(ex.Message);
|
|
879
|
865
|
}
|
|
880
|
866
|
}
|
|
881
|
|
- if (ds != null)
|
|
|
867
|
+ if (dataSet != null)
|
|
882
|
868
|
{
|
|
883
|
|
- int count = ds.Tables[0].Rows.Count;
|
|
|
869
|
+ int count = dataSet.Tables[0].Rows.Count;
|
|
884
|
870
|
if (count > 0)
|
|
885
|
871
|
{
|
|
886
|
|
-
|
|
887
|
|
- res = new string[count];
|
|
|
872
|
+ array = new string[count];
|
|
888
|
873
|
for (int i = 0; i < count; i++)
|
|
889
|
874
|
{
|
|
890
|
|
- res[i] = ds.Tables[0].Rows[i]["F_UserId"].ToString();
|
|
|
875
|
+ array[i] = dataSet.Tables[0].Rows[i]["F_UserId"].ToString();
|
|
891
|
876
|
}
|
|
892
|
877
|
}
|
|
893
|
878
|
}
|
|
894
|
879
|
}
|
|
895
|
880
|
catch
|
|
896
|
|
- { }
|
|
897
|
|
- return res;
|
|
|
881
|
+ {
|
|
|
882
|
+ }
|
|
|
883
|
+ return array;
|
|
898
|
884
|
}
|
|
899
|
885
|
|
|
900
|
886
|
/// <summary>
|