public string GetTopFunctionList() { string sql = "SELECT * FROM dbo.FunctionList WHERE parentId IS NULL ORDER BY orderFlag"; IList<Function> TopFunctionList = new List<Function>(); using (DataTable table = SqlHelper.ExecuteDataset(CommonInfo.ConQJVRMS, CommandType.Text, sql).Tables[0]) { foreach (DataRow row in table.Rows) { Function f = new Function(); f.Description = row["Description"].ToString(); f.FunctionName = row["FunctionName"].ToString(); f.UrlPath = row["UrlPath"].ToString(); f.FunctionID = new Guid(row["FunctionId"].ToString()); f.OrderFlag = int.Parse(row["orderFlag"].ToString()); if (row["parentid"] == DBNull.Value) { f.ParentFunctionId = null; } else { f.ParentFunctionId = new Guid(row["parentId"].ToString()); } TopFunctionList.Add(f); } } SerializeObjectFactory sof = new SerializeObjectFactory(); return sof.SerializeToBase64(TopFunctionList); }
public static bool AddADUserToDB(System.Collections.ArrayList userList, Guid groupId) { QJVRMS.Business.MemWS.MemberShipService mss = new QJVRMS.Business.MemWS.MemberShipService(); QJVRMS.Common.SerializeObjectFactory sof = new QJVRMS.Common.SerializeObjectFactory(); string userListStr = sof.SerializeToBase64(userList); return mss.AddADUsersToDB(userListStr, groupId); }
public static bool AddADUserToDB(System.Collections.ArrayList userList, Guid groupId) { QJVRMS.Business.MemWS.MemberShipService mss = new QJVRMS.Business.MemWS.MemberShipService(); QJVRMS.Common.SerializeObjectFactory sof = new QJVRMS.Common.SerializeObjectFactory(); string userListStr = sof.SerializeToBase64(userList); return(mss.AddADUsersToDB(userListStr, groupId)); }
// public static void CheckRules( public static void CheckRules(List <ObjectRule> rules) { QJVRMS.Common.SerializeObjectFactory sof = new QJVRMS.Common.SerializeObjectFactory(); string rulesStr = sof.SerializeToBase64(rules); QJVRMS.Business.ObjectRuleWS.ObjectRuleService ors = new QJVRMS.Business.ObjectRuleWS.ObjectRuleService(); string ruleResult = ors.CheckRules(rulesStr); object o = sof.DesializeFromBase64(ruleResult); List <ObjectRule> result = (List <ObjectRule>)o; for (int i = 0; i < result.Count; i++) { rules[i].IsValidate = result[i].IsValidate; } //StringBuilder sqlQuery = new StringBuilder(); //string sql = "CREATE TABLE #RuleList(ruleId uniqueidentifier);"; //sqlQuery.Append(sql); //foreach (IRule rule in rules) //{ // sqlQuery.Append(rule.GetSqlQuery()); //} //sql = "select * from #RuleList"; //sqlQuery.Append(sql); //using (DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.SqlCon_QJVRMS, CommandType.Text, sqlQuery.ToString()).Tables[0]) //{ // foreach (IRule rule in rules) // { // DataRow[] rows = dt.Select("ruleId='" + rule.RuleId.ToString() + "'"); // if (rows.Length > 0) rule.IsValidate = true; // } //} }
public static List<User> CheckUsers(string domainName, string OU, string adminId, string adminPwd, List<string> userIdList) { List<User> userList = new List<User>(); // ADHelper.SearchUser(domainName, OU, adminId, adminPwd, userIdList, userList); QJVRMS.Business.MemWS.MemberShipService mss = new QJVRMS.Business.MemWS.MemberShipService(); SerializeObjectFactory sof = new SerializeObjectFactory(); //System.Collections.ArrayList al = new System.Collections.ArrayList(userIdList.Count); //foreach (string var in userIdList) //{ // al.Add(var); //} string idString = sof.SerializeToBase64(userIdList); string returnUserList = mss.CheckUsers(domainName, OU, adminId, adminPwd, idString); object o = sof.DesializeFromBase64(returnUserList); List<User> users = (List<User>)o; //foreach (IADsUser adUser in adList) //{ // User user = new User(); // user.Email = adUser.EmailAddress; // user.UserLoginName = adUser.Name; // user.UserId = new Guid(adUser.GUID); // user.Telphone = adUser.TelephoneNumber.ToString(); // userList.Add(user); //} return users; }
public string GetFunctionList() { List<Function> FunctionListAll = new List<Function>(); using (DataTable table = SqlHelper.ExecuteDataset(CommonInfo.ConQJVRMS, CommandType.StoredProcedure, "Function_GetFunction").Tables[0]) { foreach (DataRow row in table.Rows) { Function f = new Function(); f.Description = row["Description"].ToString(); f.FunctionName = row["FunctionName"].ToString(); f.UrlPath = row["UrlPath"].ToString(); f.FunctionID = new Guid(row["FunctionId"].ToString()); f.OrderFlag = int.Parse(row["orderFlag"].ToString()); if (row["parentid"] == DBNull.Value) { f.ParentFunctionId = null; } else { f.ParentFunctionId = new Guid(row["parentId"].ToString()); } FunctionListAll.Add(f); } } SerializeObjectFactory sof = new SerializeObjectFactory(); return sof.SerializeToBase64(FunctionListAll); }
/// <summary> /// ÉèÖÃRule /// </summary> /// <param name="rules"></param> public static bool SetRules(List <ObjectRule> rules, SecurityObject secObj, System.Collections.ArrayList opers) { QJVRMS.Common.SerializeObjectFactory sof = new QJVRMS.Common.SerializeObjectFactory(); string rulesStr = sof.SerializeToBase64(rules); string secObjStr = sof.SerializeToBase64(secObj); string opersStr = sof.SerializeToBase64(opers); return(SetRules(rulesStr, secObjStr, opersStr)); //string sqlRuleFormat = "insert into AccessControlLIst (ObjectId,ObjectType,OperatorId,OperatorMethod)" // + " values ('{0}',{1},'{2}',{3});"; //StringBuilder sqlBuilder = new StringBuilder(); //sqlBuilder.Append("Begin Tran Begin try {0}"); //string sqlRuleDelFormat = "Delete from AccessControlLIst Where ObjectId='{0}' and OperatorId='{1}';"; //StringBuilder sqlDelBuilder = new StringBuilder(); //if (rules.Count != 0) //{ // foreach (IRule rule in rules) // { // string sqlTemp = string.Empty; // string objId = rule.SecurityObject.ObjectId.ToString(); // string objType = ((int)rule.SecurityObject.ObjectType).ToString(); // string operId = rule.Operator.OperatorId.ToString(); // string method = ((int)rule.Method).ToString(); // sqlTemp = string.Format(sqlRuleFormat, objId, objType, operId, method); // sqlBuilder.Append(sqlTemp); // sqlTemp = string.Format(sqlRuleDelFormat, objId, operId); // sqlDelBuilder.Append(sqlTemp); // } //} //else //{ // foreach (IOperator oper in opers) // { // sqlDelBuilder.Append(string.Format(sqlRuleDelFormat, secObj.ObjectId.ToString(), oper.OperatorId.ToString())); // } //} //sqlBuilder.Append(" Commit End Try Begin Catch IF @@TRANCOUNT > 0 Rollback DECLARE @ErrMsg nvarchar(4000), @ErrSeverity int" // + " SELECT @ErrMsg = ERROR_MESSAGE()," // + " @ErrSeverity = ERROR_SEVERITY()" // + " RAISERROR(@ErrMsg, @ErrSeverity, 1)" // + " End Catch"); //string finalSql = sqlBuilder.ToString(); //finalSql = string.Format(finalSql, sqlDelBuilder.ToString()); //try //{ // SqlHelper.ExecuteNonQuery(SqlHelper.SqlCon_QJVRMS, CommandType.Text, finalSql); // return true; //} //catch(Exception ex) //{ // LogWriter.WriteExceptionLog(ex); // return false; //} }
/// <summary> /// ÉèÖÃRule /// </summary> /// <param name="rules"></param> public static bool SetRules(List<ObjectRule> rules, SecurityObject secObj, System.Collections.ArrayList opers) { QJVRMS.Common.SerializeObjectFactory sof = new QJVRMS.Common.SerializeObjectFactory(); string rulesStr = sof.SerializeToBase64(rules); string secObjStr = sof.SerializeToBase64(secObj); string opersStr = sof.SerializeToBase64(opers); return SetRules(rulesStr, secObjStr, opersStr); //string sqlRuleFormat = "insert into AccessControlLIst (ObjectId,ObjectType,OperatorId,OperatorMethod)" // + " values ('{0}',{1},'{2}',{3});"; //StringBuilder sqlBuilder = new StringBuilder(); //sqlBuilder.Append("Begin Tran Begin try {0}"); //string sqlRuleDelFormat = "Delete from AccessControlLIst Where ObjectId='{0}' and OperatorId='{1}';"; //StringBuilder sqlDelBuilder = new StringBuilder(); //if (rules.Count != 0) //{ // foreach (IRule rule in rules) // { // string sqlTemp = string.Empty; // string objId = rule.SecurityObject.ObjectId.ToString(); // string objType = ((int)rule.SecurityObject.ObjectType).ToString(); // string operId = rule.Operator.OperatorId.ToString(); // string method = ((int)rule.Method).ToString(); // sqlTemp = string.Format(sqlRuleFormat, objId, objType, operId, method); // sqlBuilder.Append(sqlTemp); // sqlTemp = string.Format(sqlRuleDelFormat, objId, operId); // sqlDelBuilder.Append(sqlTemp); // } //} //else //{ // foreach (IOperator oper in opers) // { // sqlDelBuilder.Append(string.Format(sqlRuleDelFormat, secObj.ObjectId.ToString(), oper.OperatorId.ToString())); // } //} //sqlBuilder.Append(" Commit End Try Begin Catch IF @@TRANCOUNT > 0 Rollback DECLARE @ErrMsg nvarchar(4000), @ErrSeverity int" // + " SELECT @ErrMsg = ERROR_MESSAGE()," // + " @ErrSeverity = ERROR_SEVERITY()" // + " RAISERROR(@ErrMsg, @ErrSeverity, 1)" // + " End Catch"); //string finalSql = sqlBuilder.ToString(); //finalSql = string.Format(finalSql, sqlDelBuilder.ToString()); //try //{ // SqlHelper.ExecuteNonQuery(SqlHelper.SqlCon_QJVRMS, CommandType.Text, finalSql); // return true; //} //catch(Exception ex) //{ // LogWriter.WriteExceptionLog(ex); // return false; //} }
// public static void CheckRules( public static void CheckRules(List<ObjectRule> rules) { QJVRMS.Common.SerializeObjectFactory sof = new QJVRMS.Common.SerializeObjectFactory(); string rulesStr = sof.SerializeToBase64(rules); QJVRMS.Business.ObjectRuleWS.ObjectRuleService ors = new QJVRMS.Business.ObjectRuleWS.ObjectRuleService(); string ruleResult = ors.CheckRules(rulesStr); object o = sof.DesializeFromBase64(ruleResult); List<ObjectRule> result = (List<ObjectRule>)o; for (int i = 0; i < result.Count; i++) { rules[i].IsValidate = result[i].IsValidate; } //StringBuilder sqlQuery = new StringBuilder(); //string sql = "CREATE TABLE #RuleList(ruleId uniqueidentifier);"; //sqlQuery.Append(sql); //foreach (IRule rule in rules) //{ // sqlQuery.Append(rule.GetSqlQuery()); //} //sql = "select * from #RuleList"; //sqlQuery.Append(sql); //using (DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.SqlCon_QJVRMS, CommandType.Text, sqlQuery.ToString()).Tables[0]) //{ // foreach (IRule rule in rules) // { // DataRow[] rows = dt.Select("ruleId='" + rule.RuleId.ToString() + "'"); // if (rows.Length > 0) rule.IsValidate = true; // } //} }
public string CheckRules(string rulesStr) { SerializeObjectFactory sof = new SerializeObjectFactory(); StringBuilder sqlQuery = new StringBuilder(); List<ObjectRule> rules = null; try { rules = (List<ObjectRule>)sof.DesializeFromBase64(rulesStr); string sql = "CREATE TABLE #RuleList(ruleId uniqueidentifier);"; sqlQuery.Append(sql); foreach (IRule rule in rules) { sqlQuery.Append(rule.GetSqlQuery()); } sql = "select * from #RuleList"; sqlQuery.Append(sql); using (DataTable dt = SqlHelper.ExecuteDataset(CommonInfo.ConQJVRMS, CommandType.Text, sqlQuery.ToString()).Tables[0]) { foreach (IRule rule in rules) { DataRow[] rows = dt.Select("ruleId='" + rule.RuleId.ToString() + "'"); if (rows.Length > 0) rule.IsValidate = true; } } } catch (Exception ex) { QJVRMS.Common.LogWriter.WriteExceptionLog(ex); return null; } return sof.SerializeToBase64(rules); }