protected void Page_Load(object sender, System.EventArgs e) { prop_category = BookDBProvider.getDataSet("uspGetPropertyCategory", new List <SqlParameter>()); all_amenities = BookDBProvider.getDataSet("uspGetAllAmenity", new List <SqlParameter>()); allfurnitures = BookDBProvider.getDataSet("uspGetAllFurniture", new List <SqlParameter>()); json_allfurnitures = CommonProvider.getJsonStringFromDs(allfurnitures); allattractions = BookDBProvider.getDataSet("uspGetAllAttraction", new List <SqlParameter>()); //For new property if (propertyid == -1) { } else if (propertyid > 0) { //For the existed property propinfo = AjaxProvider.getPropertyDetailInfo(propertyid); List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter("@propid", propertyid)); prop_amenities = BookDBProvider.getDataSet("uspGetPropertyAmenity", param); json_amenity = CommonProvider.getJsonStringFromDs(prop_amenities); json_propinfo = new JavaScriptSerializer().Serialize(propinfo); param.Clear(); param.Add(new SqlParameter("@propid", propertyid)); json_roomfurnitures = CommonProvider.getJsonStringFromDs(BookDBProvider.getDataSet("uspGetRoomFurnitures", param)); param.Clear(); param.Add(new SqlParameter("@propid", propertyid)); json_attractions = CommonProvider.getJsonStringFromDs(BookDBProvider.getDataSet("uspGetPropertyAttractionByID", param)); } }
private async Task QueryLast() { if (SelectedItem == null) { return; } if (lastPage == 0) { if (LastNotes == null) { LastNotes = new ObservableCollection <TopicLastItem>(); } else { LastNotes.Clear(); } } CommonProvider common = new CommonProvider(); List <TopicLastResult> result = await common.QueryTopicLast(SelectedItem.Id.ToString(), lastPage); result.ForEach(x => LastNotes.Add(ConvertToTopicLastItem(x))); if (LastNotes?.Any() == true) { lastPage = LastNotes.Last().Id - 1; } }
public async Task QueryTopicLastTest() { CommonProvider common = new CommonProvider(); List <TopicLastResult> user = await common.QueryTopicLast("26293", 0); Assert.IsNotNull(user); }
public async Task QueryUserInfo() { CommonProvider common = new CommonProvider(); UserBaseInfo user = await common.QueryUserInfo("2e128e04325c"); Assert.IsNotNull(user); }
private async Task QueryComment(int noteid) { if (CommentIndex == 0) { if (CommentList == null) { CommentList = new ObservableCollection <CommentsResult>(); commentListView.ItemsSource = CommentList; } else { CommentList.Clear(); } } int index = 0; if (CommentList.Count != 0) { index = CommentList[CommentList.Count - 1].Id - 1; } List <CommentsResult> result = new List <CommentsResult>(); CommonProvider common = new CommonProvider(); result = await common.QueryComment(noteid.ToString(), index); result.ForEach(x => CommentList.Add(x)); CommentIndex++; }
public int UpdateFurnitureID(string req_room_str, string req_roomid) { List <SqlParameter> param = new List <SqlParameter>(); string[] req_room_furnitures = req_room_str.Split(new char[] { ',' }); foreach (string req_room_furnitureid in req_room_furnitures) { int index = 0; foreach (RoomInfoFurniture tmp_fur in room_furniture_list) { if (tmp_fur.RoomID == req_roomid && tmp_fur.FurnitureItemID == req_room_furnitureid) { room_furniture_list.RemoveAt(index); break; } index++; } if (index == room_furniture_list.Count)//New furniture { if (req_room_furnitureid != "") { param.Clear(); param.Add(new SqlParameter("@roomid", req_roomid)); param.Add(new SqlParameter("@furid", req_room_furnitureid)); CommonProvider.getScalarValueFromDB("uspUpdatePropertyFurnitureID", param); //if return value = -1 error } } } return(0); }
public bool WorkerOperation(UserSensitiveMailQueueInfo info) { ErrorCodeInfo error = new ErrorCodeInfo(); string message = string.Empty; string resultmessage = string.Empty; Guid transactionid = Guid.NewGuid(); string paramstr = string.Empty; paramstr += $"SensitiveID:{info.ID}"; paramstr += $"||Keywords:{info.Keywords}"; paramstr += $"||StartTime:{info.StartTime}"; paramstr += $"||EndTime:{info.EndTime}"; paramstr += $"||UserID:{info.UserID}"; bool bResult = true; try { do { Log4netHelper.Info($"RemoveSensitiveMail Begin: {paramstr}"); CommonProvider commonProvider = new CommonProvider(); DirectoryEntry userEntry = new DirectoryEntry(); SensitiveMailDBProvider provider = new SensitiveMailDBProvider(); if (!commonProvider.GetADEntryByGuid(info.UserID, out userEntry, out message)) { Log4netHelper.Error($"RemoveSensitiveMail GetADEntryByGuid ID:{info.UserID}, Error:{message}"); info.Status = SensitiveMailStatus.Failed; resultmessage = "用户不存在。"; provider.UpdateUserSensitiveMailQueue(transactionid, info, resultmessage, out error); bResult = false; break; } string userMail = userEntry.Properties["mail"].Value == null ? "" : Convert.ToString(userEntry.Properties["mail"].Value); ADManagerWebService.ManagerWebService webService = new ADManagerWebService.ManagerWebService(); webService.Timeout = -1; if (!webService.RemoveSensitiveMail(transactionid, userMail, info.Keywords, info.StartTime, info.EndTime, out resultmessage, out message)) { info.Status = SensitiveMailStatus.Failed; provider.UpdateUserSensitiveMailQueue(transactionid, info, resultmessage, out error); Log4netHelper.Error($"RemoveSensitiveMail ID:{info.ID}, Error:{message}"); bResult = false; break; } //记录执行日志 info.Status = SensitiveMailStatus.Success; provider.UpdateUserSensitiveMailQueue(transactionid, info, resultmessage, out error); Log4netHelper.Info($"RemoveSensitiveMail End: {paramstr}"); } while (false); } catch (Exception ex) { Log4netHelper.Error("RemoveSensitiveMail异常", paramstr, ex.ToString(), transactionid); bResult = false; } return(bResult); }
public int createNewCity(int stateid, string newcity) { int res = -1; List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter("@stateid", stateid)); param.Add(new SqlParameter("@city", newcity)); res = CommonProvider.getScalarValueFromDB("uspAddCity", param); return(res); }
public int createNewPropertyType(int catetype, string newtype) { int res = -1; List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter("@catid", catetype)); param.Add(new SqlParameter("@type", newtype)); res = CommonProvider.getScalarValueFromDB("uspAddPropertyType", param); return(res); }
public bool ModifyRecycleOu(Guid transactionid, AdminInfo admin, string recycleOuPath, string newOuName, out ErrorCodeInfo error) { bool result = false; error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"userID:{admin.UserID}"; paramstr += $"||UserAccount:{admin.UserAccount}"; paramstr += $"||recycleOuPath:{recycleOuPath}"; paramstr += $"||newOuName:{newOuName}"; DirectoryEntry ouRecycleEntry = new DirectoryEntry(); try { do { CommonProvider commonProvider = new CommonProvider(); if (!commonProvider.GetADEntryByPath(recycleOuPath, out ouRecycleEntry, out message)) { break; } DirectoryEntry newOuEntry = new DirectoryEntry(); if (commonProvider.GetOneLevelSigleOuEntry(ouRecycleEntry.Parent.Path, newOuName, out newOuEntry, out message)) { break; } ouRecycleEntry.Rename(string.Format("OU = {0}", newOuName)); ouRecycleEntry.Close(); result = true; } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Error("OuProvider调用ModifyRecycleOu异常", paramstr, ex.ToString(), transactionid); result = false; } finally { if (ouRecycleEntry != null) { ouRecycleEntry.Close(); } } return(result); }
public bool GetStaticGroupList(Guid transactionid, AdminInfo admin, int curpage, int pagesize, string searchstr, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"userID:{admin.UserID}"; paramstr += $"||UserAccount:{admin.UserAccount}"; paramstr += $"||curpage:{curpage}"; paramstr += $"||pagesize:{pagesize}"; paramstr += $"||searchstr:{searchstr}"; string funname = "GetStaticGroupList"; try { do { CommonProvider commonProvider = new CommonProvider(); BaseListInfo lists = new BaseListInfo(); if (!commonProvider.GetStaticGroupData(curpage, pagesize, searchstr, out lists, out message)) { error.Code = ErrorCode.Exception; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("StaticGroupManager调用GetStaticGroupData异常", paramstr, message, transactionid); result = false; break; } error.Code = ErrorCode.None; string json = JsonConvert.SerializeObject(lists); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), true, transactionid); strJsonResult = JsonHelper.ReturnJson(true, Convert.ToInt32(error.Code), error.Info, json); result = true; } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("StaticGroupManager调用GetStaticGroupData异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
public bool DeleteOu(Guid transactionid, AdminInfo admin, OuInfo ou, out ErrorCodeInfo error) { bool bResult = true; error = new ErrorCodeInfo(); string strError = string.Empty; string paramstr = string.Empty; paramstr += $"userID:{admin.UserID}"; paramstr += $"||UserAccount:{admin.UserAccount}"; paramstr += $"||Id:{ou.id}"; DirectoryEntry OuEntry = new DirectoryEntry(); try { do { CommonProvider commonProvider = new CommonProvider(); if (!commonProvider.GetADEntryByGuid(ou.id, out OuEntry, out strError)) { error.Code = ErrorCode.SearchADDataError; bResult = false; break; } // OuEntry.Parent.Children.Remove(OuEntry); OuEntry.DeleteTree(); OuEntry.CommitChanges(); OuEntry.Close(); } while (false); } catch (Exception ex) { LoggerHelper.Error("OuProvider调用DeleteOU异常", paramstr, ex.ToString(), transactionid); error.Code = ErrorCode.Exception; bResult = false; } finally { if (OuEntry != null) { OuEntry.Close(); } } return(bResult); }
public int UpdateAmenityInfo() { List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter("@propid", propid)); List <AmenityInfo> amenity_list = MainHelper.getListFromDB <AmenityInfo>("uspGetPropertyAmenity", param); List <string> amenity_arr = new List <string>(); foreach (AmenityInfo amenity in amenity_list) { amenity_arr.Add(amenity.AmenityID.ToString()); } char[] spliter = { ',' }; if (Request["propamenity"] != null && Request["propamenity"].ToString() != "") { string[] amenityval = Request["propamenity"].ToString().Split(spliter); //Check updated amenity id foreach (string req_amenity in amenityval) { if (!amenity_arr.Contains(req_amenity)) //New amenity id { param.Clear(); param.Add(new SqlParameter("@propid", propid)); param.Add(new SqlParameter("@amenityid", req_amenity)); CommonProvider.getScalarValueFromDB("uspUpdatePropertyAmenityID", param); //if return value = -1 error } else //Existed amenity { amenity_arr.Remove(req_amenity); } } } //For removed amenity id foreach (string removed_amenity in amenity_arr) { param.Clear(); param.Add(new SqlParameter("@propid", propid)); param.Add(new SqlParameter("@amenityid", removed_amenity)); param.Add(new SqlParameter("@method", 1)); CommonProvider.getScalarValueFromDB("uspUpdatePropertyAmenityID", param); //if return value = -1 error } return(0); }
public int createNewProperty() { int newid = CommonProvider.getScalarValueFromDB("uspGetPropertyMaxID", new List <SqlParameter>()) + 1; if (newid == 0) { return(-1); } try { List <SqlParameter> param = getParamListBasicInfo(newid); if (param == null || CommonProvider.getScalarValueFromDB("uspAddPropertyBasic", param) == -1) { return(-1); } } catch (Exception ex) { throw ex; return(-1); } return(newid); }
private async Task QueryBaseInfo() { if (IsSelf) { UserContentProvider user = new UserContentProvider(); baseInfo = await user.QueryBaseInfo(GlobalValue.CurrentUserContext.UserId, GlobalValue.CurrentUserContext.MobileToken); } else { CommonProvider common = new CommonProvider(); baseInfo = await common.QueryUserInfo(currentUserId); } Avatar = new Uri(baseInfo.Avatar); FollowerCount = baseInfo.FollowersCount; FollowingCount = baseInfo.FollowingCount; LikedNotesCount = baseInfo.LikedNotesCount; BookmarksCount = baseInfo.BookmarksCount; SubscribingCount = baseInfo.SubscribingCollectionsCount + baseInfo.SubscribingNotebooksCount; TotalWordage = baseInfo.TotalWordage; TotalLikesReceived = baseInfo.TotalLikesReceived; NotebooksCount = baseInfo.NotebooksCount; currentUserId = baseInfo.Id.ToString(); }
private async Task QueryTrending(DiscoverItem item) { CommonProvider common = new CommonProvider(); List <TrendingResult> result = new List <TrendingResult>(); if (pageIndex == 0) { if (TrendingList == null) { TrendingList = new ObservableCollection <TrendingResult>(); } else { TrendingList.Clear(); } } if (TypeSelectedItem.HotType != HotTopicType.None) { result = await common.QueryDiscover(TypeSelectedItem.HotType, pageIndex + 1, 20, new List <TrendingResult>(TrendingList)); } if (TypeSelectedItem.Type != TopicType.None) { int index = 0; if (TrendingList.Count != 0) { index = TrendingList[TrendingList.Count - 1].RecommendedAt - 1; } result = await common.QueryDiscover(TypeSelectedItem.Type, index, 20, 20); } result.ForEach(x => TrendingList.Add(x)); pageIndex++; }
public int UpdateLocalAttraction() { List <_AttractionInfo> list_attractionobjects = new List <_AttractionInfo>(); List <string> list_cur_attracts = new List <string>(); List <SqlParameter> param = new List <SqlParameter>(); param.Clear(); param.Add(new SqlParameter("@propid", propid)); DataSet ds_attraction = BookDBProvider.getDataSet("uspGetPropertyAttractionByID", param); if (ds_attraction.Tables.Count > 0) { foreach (DataRow row in ds_attraction.Tables[0].Rows) { _AttractionInfo tmp = new _AttractionInfo(); tmp.attrid = row["AttractionID"].ToString(); tmp.distanceid = row["DistanceID"].ToString(); list_attractionobjects.Add(tmp); list_cur_attracts.Add(tmp.attrid); } } ds_allattraction = BookDBProvider.getDataSet("uspGetAllAttraction", new List <SqlParameter>()); List <string> list_attraction = new List <string>(); foreach (DataRow row in ds_allattraction.Tables[0].Rows) { list_attraction.Add(row["ID"].ToString()); } if (Request["attractids"] != null && Request["attractids"].ToString() != "") { string[] req_attractionids = Request["attractids"].ToString().Split(new char[] { ',' }); string[] req_attractnear = Request["attract_near"].ToString().Split(new char[] { ',' }); foreach (string req_attractid in req_attractionids) { int index = list_attraction.IndexOf(req_attractid); if (index >= req_attractnear.Length) { return(-1); } string attract_distanceid = req_attractnear[index]; if (list_cur_attracts.Contains(req_attractid)) //Current attract { foreach (_AttractionInfo tmp in list_attractionobjects) { if (tmp.attrid == req_attractid && tmp.distanceid != attract_distanceid) //Modified { param.Clear(); param.Add(new SqlParameter("@propid", propid)); param.Add(new SqlParameter("@attrid", req_attractid)); param.Add(new SqlParameter("@distanceid", attract_distanceid)); param.Add(new SqlParameter("@method", 2)); CommonProvider.getScalarValueFromDB("uspUpdatePropertyAttractionByID", param); //if return value = -1 error break; } } list_cur_attracts.Remove(req_attractid); } else //New attract { param.Clear(); param.Add(new SqlParameter("@propid", propid)); param.Add(new SqlParameter("@attrid", req_attractid)); param.Add(new SqlParameter("@distanceid", attract_distanceid)); param.Add(new SqlParameter("@method", 0)); CommonProvider.getScalarValueFromDB("uspUpdatePropertyAttractionByID", param); //if return value = -1 error } } } foreach (string removed_attract in list_cur_attracts) { param.Clear(); param.Add(new SqlParameter("@propid", propid)); param.Add(new SqlParameter("@attrid", removed_attract)); param.Add(new SqlParameter("@method", 1)); CommonProvider.getScalarValueFromDB("uspUpdatePropertyAttractionByID", param); //if return value = -1 error } return(0); }
protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(Request["CountryID"].ToString(), out countryid)) { countryid = 0; } if (countryid == 0) { return; } List <SqlParameter> sparam = new List <SqlParameter>(); sparam.Add(new SqlParameter("@countryid", countryid)); ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCountry", sparam); markers = CommonProvider.getMarkersJsonString(ds_citylocations); /* * ClientScriptManager cs = Page.ClientScript; * string url = Request.Url.AbsoluteUri; * string[] token = url.Split('/'); * * //cs.RegisterStartupScript(Page.GetType(), "JSON", "alert(" + token.Length + ");", true); * if (Convert.ToInt32(Request.QueryString["StateProvinceID"]) != null && Convert.ToInt32(Request.QueryString["StateProvinceID"]) > 0) * { * SqlConnection con = CommonFunctions.GetConnection(); * CitiesAdapter = new SqlDataAdapter(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID, con);//CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int); * CitiesAdapter.SelectCommand.Parameters.Add("@StateId", SqlDbType.Int); * CitiesAdapter.SelectCommand.Parameters["@StateId"].Value = Convert.ToInt32(Request.QueryString["StateProvinceID"]); * * * //cs.RegisterStartupScript(Page.GetType(), "JSON", "alert(" + Convert.ToInt32(Request.QueryString["StateProvinceID"]) + ");", true); * * DataTable dt = new DataTable(); * CitiesAdapter.Fill(dt); * List<Location> eList = new List<Location>(); * string maxLat = ""; * string maxLong = ""; * foreach (DataRow dr in dt.Rows) * { * try * { * Location e1 = new Location(); * e1.title = dr["City"].ToString(); * e1.lat = Convert.ToDouble(dr["Latitude"]); * e1.lng = Convert.ToDouble(dr["Longitude"]); ; * e1.description = dr["City"].ToString(); * string temp = "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") + * "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/" + dr["City"].ToString().ToLower().Replace(" ", "_") + "/default.aspx"; * e1.URL = temp; * eList.Add(e1); * } * catch { } * } * // Response.Write(CitiesAdapter.SelectCommand.CommandText); * string ans = JsonConvert.SerializeObject(eList, Formatting.Indented); * * * * // ClientScriptManager cs = Page.ClientScript; * cs.RegisterStartupScript(Page.GetType(), "JSON", "initialize(" + ans + ");", true); * } * else * if (token.Length == 4) * { * SqlConnection con = CommonFunctions.GetConnection(); * CitiesAdapter = new SqlDataAdapter(STR_SELECTCitiesFROMCitiesWHERECitiesCountryId, con);//CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int); * CitiesAdapter.SelectCommand.Parameters.Add("@CountryID", SqlDbType.Int); * CitiesAdapter.SelectCommand.Parameters["@CountryID"].Value = Convert.ToInt32(Request.QueryString["CountryID"]); * * DataTable dt = new DataTable(); * CitiesAdapter.Fill(dt); * List<Location> eList = new List<Location>(); * string maxLat = ""; * string maxLong = ""; * foreach (DataRow dr in dt.Rows) * { * try * { * Location e1 = new Location(); * e1.title = dr["City"].ToString(); * e1.lat = Convert.ToDouble(dr["Latitude"]); * e1.lng = Convert.ToDouble(dr["Longitude"]); ; * e1.description = dr["City"].ToString(); * string temp = "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") + * "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/" + dr["City"].ToString().ToLower().Replace(" ", "_") + "/default.aspx"; * e1.URL = temp; * eList.Add(e1); * } * catch { } * } * // Response.Write(CitiesAdapter.SelectCommand.CommandText); * string ans = JsonConvert.SerializeObject(eList, Formatting.Indented); * * * * * cs.RegisterStartupScript(Page.GetType(), "JSON", "initialize(" + ans + ");", true); * } */ }
public static void setProvider(CommonProvider provider) { mProvider = provider; }
public ActionResult GetDistributorBaseInfo(string q) { return(Json(CommonProvider.GetDistributorBaseInfoByName(q))); }
public bool DeleteRecycleOu(Guid transactionid, AdminInfo admin, string recycleOuPath, out ErrorCodeInfo error) { bool result = false; error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"userID:{admin.UserID}"; paramstr += $"||UserAccount:{admin.UserAccount}"; paramstr += $"||recycleOuPath:{recycleOuPath}"; DirectoryEntry ouRecycleEntry = new DirectoryEntry(); try { do { CommonProvider commonProvider = new CommonProvider(); if (!commonProvider.GetADEntryByPath(recycleOuPath, out ouRecycleEntry, out message)) { LoggerHelper.Error("OuProvider调用DeleteRecycleOu异常", paramstr, message, transactionid); break; } List <DirectoryEntry> EntryList = new List <DirectoryEntry>(); if (!commonProvider.SearchEntryData(ouRecycleEntry.Path, SearchType.All, out EntryList, out message)) { LoggerHelper.Error("OuProvider调用DeleteRecycleOu异常", paramstr, message, transactionid); result = false; break; } if (EntryList.Count > 0) { break; } else { ouRecycleEntry.DeleteTree(); ouRecycleEntry.CommitChanges(); ouRecycleEntry.Close(); } result = true; } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Error("OuProvider调用DeleteRecycleOu异常", paramstr, ex.ToString(), transactionid); result = false; } finally { if (ouRecycleEntry != null) { ouRecycleEntry.Close(); } } return(result); }
public bool MoveRecycleOu(Guid transactionid, AdminInfo admin, string recycleOuPath, string targetRecycleOuPath, out ErrorCodeInfo error) { bool result = false; error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"userID:{admin.UserID}"; paramstr += $"||UserAccount:{admin.UserAccount}"; paramstr += $"||recycleOuPath:{recycleOuPath}"; paramstr += $"||targetRecycleOuPath:{targetRecycleOuPath}"; DirectoryEntry ouRecycleEntry = new DirectoryEntry(); DirectoryEntry targetOuRecycleEntry = new DirectoryEntry(); try { do { CommonProvider commonProvider = new CommonProvider(); if (!commonProvider.GetADEntryByPath(recycleOuPath, out ouRecycleEntry, out message)) { LoggerHelper.Error("MoveRecycleOu调用GetADEntryByPath异常", paramstr, message, transactionid); break; } if (!commonProvider.GetADEntryByPath(targetRecycleOuPath, out targetOuRecycleEntry, out message)) { LoggerHelper.Error("MoveRecycleOu调用GetADEntryByPath异常", paramstr, message, transactionid); break; } DirectoryEntry newOuEntry = new DirectoryEntry(); if (commonProvider.GetOneLevelSigleOuEntry(targetOuRecycleEntry.Path, Convert.ToString(ouRecycleEntry.Properties["name"].Value), out newOuEntry, out message)) { LoggerHelper.Error("MoveRecycleOu调用GetOneLevelSigleOuEntry异常", paramstr, message, transactionid); break; } ouRecycleEntry.MoveTo(targetOuRecycleEntry); ouRecycleEntry.CommitChanges(); ouRecycleEntry.Close(); result = true; } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Error("MoveRecycleOu异常", paramstr, ex.ToString(), transactionid); result = false; } finally { if (ouRecycleEntry != null) { ouRecycleEntry.Close(); } } return(result); }
public bool ChangeMailDataBase(Guid transactionid, AdminInfo admin, MailDataBaseInfo maildb, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string errormsg = string.Empty; string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"||AdminAccount:{admin.UserAccount}"; paramstr += $"||OuID:{maildb.OuID}"; paramstr += $"||MailboxDB:{maildb.MailboxDB}"; string funname = "ChangeMailDataBase"; try { do { DirectoryEntry ouEntry = new DirectoryEntry(); CommonProvider commonProvider = new CommonProvider(); if (!commonProvider.GetADEntryByGuid(maildb.OuID, out ouEntry, out errormsg)) { error.Code = ErrorCode.SearchADDataError; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("GetADEntryByGuid异常", paramstr, errormsg, transactionid); result = false; break; } maildb.OUdistinguishedName = ouEntry.Properties["distinguishedName"].Value == null ? string.Empty : Convert.ToString(ouEntry.Properties["distinguishedName"].Value); maildb.OuName = ouEntry.Properties["name"].Value == null ? string.Empty : Convert.ToString(ouEntry.Properties["name"].Value); MailDataBaseDBProvider Provider = new MailDataBaseDBProvider(); MailDataBaseInfo oldinfo = new MailDataBaseInfo(); oldinfo.ID = maildb.ID; if (!Provider.GetMailDataBaseInfo(transactionid, admin, ref oldinfo, out error)) { LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; break; } if (!Provider.ChangeMailDataBase(transactionid, admin, maildb, out error)) { LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; break; } error.Code = ErrorCode.None; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), true, transactionid); strJsonResult = JsonHelper.ReturnJson(true, Convert.ToInt32(error.Code), error.Info); //添加日志 #region 操作日志 LogInfo operateLog = new LogInfo(); operateLog.AdminID = admin.UserID; operateLog.AdminAccount = admin.UserAccount; operateLog.RoleID = admin.RoleID; operateLog.ClientIP = _clientip; operateLog.OperateResult = true; operateLog.OperateType = "修改邮箱数据库对应关系"; operateLog.OperateLog = $"{admin.UserAccount}于{DateTime.Now}修改邮箱数据库对应关系。" + $"原OU:{oldinfo.OUdistinguishedName},现OU:{maildb.OUdistinguishedName}," + $"原MailboxDataBase:{oldinfo.MailboxDB},现MailboxDataBase:{maildb.MailboxDB}"; LogManager.AddOperateLog(transactionid, operateLog); #endregion result = true; } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("MailDataBaseManager调用ChangeMailDataBase异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
protected void Page_Load(object sender, System.EventArgs e) { if ((Request.Params["CountryID"] != null) && (Request.Params["CountryID"].Length > 0)) { try { countryid = Convert.ToInt32(Request.Params["CountryID"]); } catch (Exception) { } } if (countryid == -1) { Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx")); } List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter("@countryid", countryid));//[uspGetCountry_Prop_StateInfo] ds_allinfo = BookDBProvider.getDataSet("uspGetCountry_Prop_StateInfo", param); if (ds_allinfo.Tables.Count != 4) { Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx")); } region = ds_allinfo.Tables[0].Rows[0]["Region"].ToString(); country = ds_allinfo.Tables[0].Rows[0]["Country"].ToString(); string vText = "Vacations-abroad.com is a " + country + " accommodation directory of " + country + " rentals by owner and privately owned " + country + " holiday accommodation. Our short term " + country + " rentals include luxury " + country + " holiday homes, " + country + " vacation homes and " + country + " vacation home rentals which are perfect for group or family vacation rentals in " + country + " " + region; if (!IsPostBack) { //For country description lblCountryInfo.Text = ds_allinfo.Tables[0].Rows[0]["countryText"].ToString().Replace(Environment.NewLine, "<br />"); txtCountryText.Text = ds_allinfo.Tables[0].Rows[0]["countryText"].ToString().Replace("<br />", Environment.NewLine); if (lblCountryInfo.Text == null || lblCountryInfo.Text == "") { lblCountryInfo.Text = vText; txtCountryText.Text = vText; } lblInfo2.Text = ds_allinfo.Tables[0].Rows[0]["countryText2"].ToString().Replace(Environment.NewLine, "<br />"); if (string.IsNullOrEmpty(lblInfo2.Text) || lblInfo2.Text == "") { OrangeTitle.Visible = false; } txtCountryText2.Text = ds_allinfo.Tables[0].Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine); } /* /////// common for postback and ! postback * List<string> vList = new List<string>(); * DataTable dt = new DataTable(); * DataFunctions obj = new DataFunctions(); * DataTable dtCategories = new DataTable(); * DBConnection obj1 = new DBConnection(); * * try * { * if (!IsPostBack) * { * dt = obj.PropertiesByCase(vList, countryid, "Country"); * DataView dv = dt.DefaultView; * dv.Sort = "category asc"; * dt = dv.ToTable(); * Session["dt"] = dt; * int[] i = new int[4]; * i = FindNumAmenities(dt); * * dtCategories = obj.FindNumCategories(dt); * DataView dvMax = dtCategories.DefaultView; * dvMax.Sort = "count desc"; * DataTable dtMax = dvMax.ToTable(); * int vCategoryCount = 0; * string firstCategory = ""; * string subCategory = ""; * foreach (DataRow row in dtMax.Rows) * { * int index = dtMax.Rows.IndexOf(row); * if (index == 0) * { * firstCategory = row["category"].ToString(); * subCategory = dt.Rows[0]["SubCategory"].ToString(); * } * string vTemp = row["category"].ToString() + " (" + row["count"].ToString() + ")"; * vTemp = vTemp.Replace(" ", " "); * vCategoryCount = vCategoryCount + Convert.ToInt32(row["count"].ToString()); * } * * if (!IsPostBack) * { * * //dtlStates.DataSource = dtCategories; * //dtlStates.DataBind(); * } * //numbedrooms filter * dtCategories = obj.FindNumBedrooms(dt); * int vBedCount = 0; * foreach (DataRow row in dtCategories.Rows) * { * vBedCount += Convert.ToInt32(row["count"]); * } * * Page page = (Page)HttpContext.Current.Handler; * if (Request.QueryString["category"] != null) * { * Response.Clear(); * Response.StatusCode = 404; * Response.End(); * } * if (dt.Rows.Count <= 10) * { * //Implement 404 logic less then 10 property with Prorerty in URL - Develop By Nimesh Sapovadiya * if(Request.QueryString["category"] != null) * { * Response.Clear(); * Response.StatusCode = 404; * Response.End(); * } * string dispString = ""; * string dispString2 = ""; * if (subCategory.Contains("_")) * { * string[] strSplit = subCategory.Split('_'); * dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s"; * } * else * { * dispString = UppercaseFirst(subCategory) + "s"; * } * firstCategory = dt.Rows[0]["category"].ToString(); * if (firstCategory.Contains("_")) * { * string[] strSplit = firstCategory.Split('_'); * dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s"; * } * else * { * dispString2 = UppercaseFirst(firstCategory) + "s"; * } * * altTag = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals"; * ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations"; * hyplnkBackLink.NavigateUrl = "/" + region.ToLower().Replace(" ", "_")+"/default.aspx"; * ltrBackText.Text = region + "<<"; * hyplnkAllProps.NavigateUrl = "/" + country.ToLower().Replace(" ", "_") + "/countryproperties.aspx"; * ltrAllProps.Text = " View all " + char.ToUpper(country[0]) + country.Substring(1) + " properties"; * string scountry=char.ToUpper(country[0]) + country.Substring(1); * country = scountry; * ltrHeading.Text = scountry + " Vacation Rentals and Boutique Hotels"; * * page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad"; * * string tempcountry1 = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") + * "/default.aspx"; * * /* HtmlMeta description = new HtmlMeta(); * description.Name = "description"; * description.Content = "Plan your next " + char.ToUpper(country[0]) + country.Substring(1) + " vacation: where to stay and places to visit "; * head.Controls.Add(description); * * } * else * { * * if (Request.QueryString["category"] != null) * { * firstCategory = Convert.ToString(Request.QueryString["category"]); * } * { * string dispString = ""; * string dispString2 = ""; * if (subCategory.Contains("_")) * { * string[] strSplit = subCategory.Split('_'); * dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1])+"s"; * } * else * { * dispString = UppercaseFirst(subCategory) + "s"; * } * if (firstCategory.Contains("_")) * { * string[] strSplit = firstCategory.Split('_'); * dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s"; * } * else * { * dispString2 = UppercaseFirst(firstCategory) + "s"; * } * altTag = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals"; * ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations"; * hyplnkBackLink.NavigateUrl = "/" + region.ToLower().Replace(" ", "_")+"/default.aspx"; * ltrBackText.Text = region + " Vacations <<"; * hyplnkAllProps.NavigateUrl = "/" + country.ToLower().Replace(" ", "_") + "/countryproperties.aspx"; * ltrAllProps.Text = " View all " + char.ToUpper(country[0]) + country.Substring(1) + " properties"; * string scountry = char.ToUpper(country[0]) + country.Substring(1); * country = scountry; * ltrHeading.Text = scountry + " Vacation Rentals and Boutique Hotels"; * * //ltrCountryThing.Text = char.ToUpper(country[0]) + country.Substring(1); * page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad"; * * } * if (firstCategory == "bandb") * { * firstCategory = "B&B"; * } * * * DataTable dtCategory = dt.Clone(); * foreach (DataRow dr in dt.Rows) * { * string vTemp = dr["Category"].ToString(); * if (vTemp.ToLower().Replace(" ", "").Trim() == firstCategory.ToLower().Replace("_", " ").Replace(" ", "")) * { * subCategory = dr["SubCategory"].ToString(); * dtCategory.ImportRow(dr); * } * } * DataView dv1 = dtCategory.DefaultView; * dv1.Sort = "MinNightRate desc"; * * if (Request.QueryString["category"] != null) * { * string dispString = ""; * if (firstCategory.Contains("_")) * { * string[] strSplit = firstCategory.Split('_'); * dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1])+"s"; * } * else * { * dispString = UppercaseFirst(firstCategory) + "s"; * } * ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations"; * page.Title = char.ToUpper(country[0]) + country.Substring(1) + "Vacation Rentals, Boutique Hotels | Vacations Abroad"; * altTag = subCategory + " in " + country; * Label3.Text = altTag; * } * else * { * string dispString = ""; * string dispString2 = ""; * if (subCategory.Contains("_")) * { * string[] strSplit = subCategory.Split('_'); * dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s"; * } * else * { * dispString = UppercaseFirst(subCategory) + "s"; * } * if (firstCategory.Contains("_")) * { * string[] strSplit = firstCategory.Split('_'); * dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s"; * } * else * { * dispString2 = UppercaseFirst(firstCategory) + "s"; * } * altTag = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals"; * ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations"; * page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad"; * * } * string tempcountry = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") + * "/default.aspx"; * * * } * * ViewState["firstCategory"] = firstCategory; * DataTable dt1 = new DataTable(); * try * { * dt1 = VADBCommander.CountryTextInd(countryid.ToString(), firstCategory); * } * catch (Exception ex) { lblInfo.Text = ex.Message; } * * string vText = "Vacations-abroad.com is a " + country + " accommodation directory of " + country + " rentals by owner and privately owned " + country + " holiday accommodation. Our short term " + country + " rentals include luxury " + * country + " holiday homes, " + country + " vacation homes and " + country + " vacation home rentals which are perfect for group or family vacation rentals in " + country + " " + region; * * if (dt1.Rows.Count > 0) * { * * if (dt1.Rows[0]["countryText"] != null) * { * if (!IsPostBack) * { * lblCountryInfo.Text = dt1.Rows[0]["countryText"].ToString(); * txtCountryText.Text = dt1.Rows[0]["countryText"].ToString().Replace("<br />", Environment.NewLine); * } * ////Editor.Value = dt.Rows[0]["cityText"].ToString(); * } * else * { * lblCountryInfo.Text = vText; * txtCountryText.Text = vText; * } * if (dt1.Rows[0]["countryText2"] != null) * { * if (!IsPostBack) * { * lblInfo2.Text = dt1.Rows[0]["countryText2"].ToString(); * if (string.IsNullOrEmpty(lblInfo2.Text) || lblInfo2.Text == "") * { * OrangeTitle.Visible = false; * } * txtCountryText2.Text = dt1.Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine); * } * } * else * { * OrangeTitle.Visible = false; * } * } * else * { * lblCountryInfo.Text = vText; * txtCountryText.Text = vText; * OrangeTitle.Visible = false; * } * } * } * catch (Exception ex) { lblInfo.Text = ex.Message; } * * DBConnection obj3 = new DBConnection(); * SqlDataReader reader = obj3.ExecuteRecordSetArtificial("SELECT Cities.* FROM Cities WHERE (Cities.StateProvinceID = " + stateprovinceid + ") " + "AND EXISTS ( SELECT * FROM Properties WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND " + "(Properties.CityID = Cities.ID) AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) ORDER " + "BY City"); * string states1 = ""; * string regionCountry = ""; * foreach (DataRow dr in MainDataSet.Tables["CountriesRegion"].Rows) * { * string temp = "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") + "/default.aspx"; * temp = temp.ToLower(); * temp = temp.Replace(' ', '_'); * rtLow3.Text += "<li><a href=\"" + temp + "\"><span class=\"tdNoSleeps\">" + dr["Country"].ToString().Replace(" ", " ") + ", </span></a></li>"; * states1 += "<a href=\"" + temp + "\"><span class=\"tdNoSleeps\" style=\"font-weight:normal;font-style:normal\">" + dr["Country"].ToString().Replace(" ", " ") + "</span></a>, "; * regionCountry = dr["Region"].ToString(); * } * states1 = ""; * foreach (DataRow dr in MainDataSet.Tables["StateProvinces"].Rows) * { * string temp = "/" + country.ToLower().Replace(" ", "_") + "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/default.aspx"; * states1 += "<a href=\"" + temp + "\"><span class=\"tdNoSleeps\" style=\"font-weight:normal;font-style:normal\">" + dr["StateProvince"].ToString().Replace(" ", " ") + "</span></a>, "; * } * * states1 = ""; * string str_states = ""; * * int ind = 0; * // string cls = " class='borderright' "; * string cls = "border-right:1px solid #0094ff;"; * string li = ""; * foreach (DataRow dr in MainDataSet.Tables["StateProvinces"].Rows) * { * DataFunctions objcate = new DataFunctions(); * DataTable dt1 = new DataTable(); * dt = obj.PropertiesByCase(vList, Convert.ToInt32(dr["id"]), "State"); * * //li =" style='"+ ((ind > 4) ? "border-top:0px;" : "")+ (((ind++ % 5) == 4) ? cls : "")+"'"; * * string temp = "/" + country.ToLower().Replace(" ", "_") + "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/default.aspx"; * states1 += "<li"+li +"><a href='" + temp + "' class='StateTitle'>" + dr["StateProvince"].ToString().Replace(" ", " ") + "</a><br/> "; * states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["StateProvince"]) +" ' title='" + Convert.ToString(dr["StateProvince"]) + "' /></div></a></li>"; * //states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["StateProvince"]) + " vacation rentals and boutique hotels in "+country+"' title='" + Convert.ToString(dr["StateProvince"]) + " vacation rentals and boutique hotels in " + country + "' /></div></a></li>"; * // states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' title='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' /></div></a></li>"; * //states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' title='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' /></div></a></li>"; * str_states += Convert.ToString(dr["StateProvince"]) + ", "; * str_keyword += Convert.ToString(dr["StateProvince"]) + " " + country + ", "; * } * //rtLow3.Text = rtLow3.Text.Remove(rtLow3.Text.Length - 1, 1); * rtHd3.InnerHtml = regionCountry + " Countries: "; * * * * * * Statesul.InnerHtml = states1; * //Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>")); * * * * //For the meta tag * str_meta = "(%number%) %country% vacation rentals and boutique hotels in %states% etc."; * str_meta = str_meta.Replace("%country%", country).Replace("%states%", str_states).Replace("%number%", Convert.ToString(num_properties)); * str_keyword = str_keyword + "etc."; */ //For meta tag int num_states = ds_allinfo.Tables[1].Rows.Count; string str_states = ""; for (int ind_state = 0; ind_state < num_states; ind_state++) { string comma = (ind_state == (num_states - 1)) ? "" : ", "; DataRow row = ds_allinfo.Tables[1].Rows[ind_state]; str_states += (row["StateProvince"].ToString() + comma); str_keyword += String.Format("{0} {1}{2}", row["StateProvince"].ToString(), country, comma); } string num_properties = ds_allinfo.Tables[3].Rows[0][0].ToString(); if (num_states == 0) { Response.Redirect("/default.aspx"); } // str_meta = String.Format("({0}) {1} vacation rentals and boutique hotels in {2} etc.", num_properties, country, str_states); str_meta = String.Format("Explore {0} while staying in our vacation rentals and boutique hotels.", country); str_keyword = str_keyword + " etc."; //For google map List <SqlParameter> sparam = new List <SqlParameter>(); sparam.Add(new SqlParameter("@countryid", countryid)); ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCountry", sparam); markers = CommonProvider.getMarkersJsonString(ds_citylocations); sparam.Clear(); sparam.Add(new SqlParameter("@country", country)); ds_airports = BookDBProvider.getDataSet("usp_list_airports_bycountry", sparam); airports_markers = CommonProvider.getMarkersJsonString(ds_airports, "airport"); }
public bool ModifyOu(Guid transactionid, AdminInfo admin, ref OuInfo ou, out ErrorCodeInfo error) { bool bResult = true; error = new ErrorCodeInfo(); string strError = string.Empty; string paramstr = string.Empty; paramstr += $"userID:{admin.UserID}"; paramstr += $"||UserAccount:{admin.UserAccount}"; paramstr += $"||Name:{ou.name}"; paramstr += $"||Description:{ou.description}"; paramstr += $"||Id:{ou.id}"; DirectoryEntry OuEntry = new DirectoryEntry(); try { do { CommonProvider commonProvider = new CommonProvider(); if (!commonProvider.GetADEntryByGuid(ou.id, out OuEntry, out strError)) { error.Code = ErrorCode.SearchADDataError; bResult = false; break; } OuEntry.Rename(string.Format("OU = {0}", ou.name)); if (string.IsNullOrEmpty(ou.description.Trim())) { OuEntry.Properties["description"].Clear(); } else { OuEntry.Properties["description"].Value = ou.description.Trim(); } OuEntry.Properties["st"].Value = ou.IsProfessionalGroups.ToString(); OuEntry.CommitChanges(); ou.distinguishedName = Convert.ToString(OuEntry.Properties["distinguishedName"].Value); OuEntry.Close(); } while (false); } catch (Exception ex) { LoggerHelper.Error("OuProvider调用ModifyOu异常", paramstr, ex.ToString(), transactionid); error.Code = ErrorCode.Exception; bResult = false; } finally { if (OuEntry != null) { OuEntry.Close(); } } return(bResult); }
public bool ModifyMailAudit(Guid transactionid, AdminInfo admin, MailAuditInfo mailAuditInfo, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"||AdminAccount:{admin.UserAccount}"; paramstr += $"||GroupID:{mailAuditInfo.Group.GroupID}"; for (int i = 0; i < mailAuditInfo.Audits.Count; i++) { paramstr += $"||AuditID:{mailAuditInfo.Audits[i].UserID}"; } string funname = "ModifyMailAudit"; try { do { error = mailAuditInfo.ChangeCheckProp(); if (error.Code != ErrorCode.None) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } MailAuditDBProvider provider = new MailAuditDBProvider(); MailAuditInfo oldMailAuditInfo = new MailAuditInfo(); oldMailAuditInfo.ID = mailAuditInfo.ID; if (!provider.GetMailAuditInfo(transactionid, admin, ref oldMailAuditInfo, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } //判断审批人有效性 DirectoryEntry entry = new DirectoryEntry(); CommonProvider commonProvider = new CommonProvider(); List <UserInfo> audits = new List <UserInfo>(); List <Guid> users = new List <Guid>(); if (mailAuditInfo.Audits.Count > 0) { for (int i = 0; i < mailAuditInfo.Audits.Count; i++) { if (!commonProvider.GetADEntryByGuid(mailAuditInfo.Audits[i].UserID, out entry, out message)) { continue; } mailAuditInfo.Audits[i].DisplayName = entry.Properties["cn"].Value == null ? "" : Convert.ToString(entry.Properties["cn"].Value); mailAuditInfo.Audits[i].UserAccount = entry.Properties["userPrincipalName"].Value == null ? "" : Convert.ToString(entry.Properties["userPrincipalName"].Value); mailAuditInfo.Audits[i].IsCreateMail = entry.Properties["mail"].Value == null ? false : true; if (!mailAuditInfo.Audits[i].IsCreateMail) { error.Code = ErrorCode.UserNotExchange; error.SetInfo(mailAuditInfo.Audits[i].DisplayName + "(" + mailAuditInfo.Audits[i].UserAccount + ")"); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } mailAuditInfo.AuditUsers += mailAuditInfo.Audits[i].DisplayName + "(" + mailAuditInfo.Audits[i].UserAccount + "),"; users.Add(mailAuditInfo.Audits[i].UserID); audits.Add(mailAuditInfo.Audits[i]); } } if (result) { mailAuditInfo.AuditUsers = string.IsNullOrEmpty(mailAuditInfo.AuditUsers) ? string.Empty : mailAuditInfo.AuditUsers.Remove(mailAuditInfo.AuditUsers.LastIndexOf(','), 1); DirectoryEntry groupEntry = new DirectoryEntry(); if (!commonProvider.GetADEntryByGuid(mailAuditInfo.Group.GroupID, out groupEntry, out message)) { error.Code = ErrorCode.SearchADDataError; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("ModifyMailAudit调用GetADEntryByGuid异常", paramstr, message, transactionid); result = false; break; } mailAuditInfo.Group.Account = groupEntry.Properties["mail"].Value == null ? "" : Convert.ToString(groupEntry.Properties["mail"].Value); mailAuditInfo.Group.DisplayName = groupEntry.Properties["cn"].Value == null ? "" : Convert.ToString(groupEntry.Properties["cn"].Value); ADManagerWebService.ManagerWebService webService = new ADManagerWebService.ManagerWebService(); webService.Timeout = -1; //Set Group Exchange webService.SetDistributionGroupModeratedBy(transactionid, mailAuditInfo.Group.GroupID.ToString(), false, new List <Guid>().ToArray(), out message); //Set Group Exchange if (!webService.SetDistributionGroupModeratedBy(transactionid, mailAuditInfo.Group.GroupID.ToString(), true, users.ToArray(), out message)) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("MailAuditManager调用AddMailAudit异常", paramstr, message, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; break; } if (!provider.ModifyMailAudit(transactionid, admin, mailAuditInfo, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } foreach (UserInfo u in audits) { if (!provider.AddMailAuditUsers(transactionid, mailAuditInfo, u, out error)) { continue; } } error.Code = ErrorCode.None; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), true, transactionid); strJsonResult = JsonHelper.ReturnJson(true, Convert.ToInt32(error.Code), error.Info); #region 操作日志 LogInfo operateLog = new LogInfo(); operateLog.AdminID = admin.UserID; operateLog.AdminAccount = admin.UserAccount; operateLog.RoleID = admin.RoleID; operateLog.ClientIP = _clientip; operateLog.OperateResult = true; operateLog.OperateType = "修改邮件审批规则"; operateLog.OperateLog = $"{admin.UserAccount}于{DateTime.Now}修改邮件审批规则。" + $"原对象:{oldMailAuditInfo.Group.DisplayName},现对象:{mailAuditInfo.Group.DisplayName};" + $"原审批人:{oldMailAuditInfo.AuditUsers},现审批人:{mailAuditInfo.AuditUsers}"; LogManager.AddOperateLog(transactionid, operateLog); #endregion result = true; } } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("MailAuditManager调用ModifySensitiveMail异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
public int UpdatePropertyInfo(int step) { if (step == 0) { try { List <SqlParameter> param = getParamListBasicInfo(propid); if (param == null || CommonProvider.getScalarValueFromDB("uspUpdatePropertyBasic", param) == -1) { return(-1); } } catch (Exception ex) { throw ex; return(-1); } } else if (step == 1) //Amenities { try { List <SqlParameter> param = getParamListDescriptionInfo(propid); if (param == null || CommonProvider.getScalarValueFromDB("uspUpdatePropertyDescriptionAmenity", param) == -1) { return(-1); } if (UpdateAmenityInfo() == -1) { return(-1); } if (!hotel_type.Contains(propinfo.CategoryID)) //If the rental type { if (UpdateRoomInfo() == -1) { } } } catch (Exception ex) { throw ex; return(-1); } } else if (step == 2) { try { List <SqlParameter> param = getParamListLocalAttraction(propid); CommonProvider.getScalarValueFromDB("uspUpdatePropertyAttraction", param); if (UpdateLocalAttraction() == -1) { return(-1); } } catch (Exception ex) { throw ex; } } else if (step == 3) { try { List <SqlParameter> param = getParamRates(propid); CommonProvider.getScalarValueFromDB("uspUpdatePropertyRates", param); } catch (Exception ex) { throw ex; } } return(0); }
public bool AddUserSensitiveMailQueue(Guid transactionid, SensitiveMailInfo sensitiveMailInfo, out ErrorCodeInfo error) { bool bResult = true; error = new ErrorCodeInfo(); string message = string.Empty; try { do { SensitiveMailDBProvider provider = new SensitiveMailDBProvider(); UserProvider userProvider = new UserProvider(); DirectoryEntry ouEntry = new DirectoryEntry(); DirectoryEntry item = new DirectoryEntry(); CommonProvider commonProvider = new CommonProvider(); for (int j = 0; j < sensitiveMailInfo.Objects.Count; j++) { if (sensitiveMailInfo.Objects[j].ObjectType == NodeType.organizationalUnit) { if (!commonProvider.GetADEntryByGuid(sensitiveMailInfo.Objects[j].ObjectID, out ouEntry, out message)) { Log4netHelper.Error($"ID:{sensitiveMailInfo.Objects[j].ObjectID},ObjectName:{sensitiveMailInfo.Objects[j].ObjectName},ObjectType:{sensitiveMailInfo.Objects[j].ObjectType.ToString()},GetADEntryByGuid Error:{message}"); continue; } DirectoryEntry de = null; de = new DirectoryEntry(ouEntry.Path); DirectorySearcher deSearch = new DirectorySearcher(de); deSearch.SearchRoot = de; string strFilter = commonProvider.GetSearchType(SearchType.MailUser, string.Empty); deSearch.Filter = strFilter; deSearch.SearchScope = SearchScope.Subtree; deSearch.SizeLimit = 20000; deSearch.ServerTimeLimit = TimeSpan.FromSeconds(600); deSearch.ClientTimeout = TimeSpan.FromSeconds(600); SearchResultCollection results = deSearch.FindAll(); if (results != null && results.Count > 0) { foreach (SearchResult Result in results) { item = Result.GetDirectoryEntry(); UserInfo user = new UserInfo(); user.UserID = item.Guid; user.UserAccount = item.Properties["userPrincipalName"].Value == null ? "" : Convert.ToString(item.Properties["userPrincipalName"].Value); user.SAMAccountName = item.Properties["sAMAccountName"].Value == null ? "" : Convert.ToString(item.Properties["sAMAccountName"].Value); provider.AddUserSensitiveMailQueue(transactionid, sensitiveMailInfo, user, out error); } } } else if (sensitiveMailInfo.Objects[j].ObjectType == NodeType.user) { if (!commonProvider.GetADEntryByGuid(sensitiveMailInfo.Objects[j].ObjectID, out item, out message)) { Log4netHelper.Error($"ID:{sensitiveMailInfo.Objects[j].ObjectID},ObjectName:{sensitiveMailInfo.Objects[j].ObjectName},ObjectType:{sensitiveMailInfo.Objects[j].ObjectType.ToString()},GetADEntryByGuid Error:{message}"); continue; } UserInfo user = new UserInfo(); user.UserID = item.Guid; provider.AddUserSensitiveMailQueue(transactionid, sensitiveMailInfo, user, out error); } } } while (false); } catch (Exception ex) { Log4netHelper.Error($"RemoveSensitiveMailQueue Exception: {ex.ToString()}"); } return(bResult); }
public bool ModifySensitiveMail(Guid transactionid, AdminInfo admin, SensitiveMailInfo sensitiveMailInfo, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"||AdminAccount:{admin.UserAccount}"; paramstr += $"||ID:{sensitiveMailInfo.ID}"; paramstr += $"||Keywords:{sensitiveMailInfo.Keywords}"; paramstr += $"||StartTime:{sensitiveMailInfo.StartTime}"; paramstr += $"||EndTime:{sensitiveMailInfo.EndTime}"; string funname = "ModifySensitiveMail"; try { do { error = sensitiveMailInfo.ChangeCheckProp(); if (error.Code != ErrorCode.None) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } SensitiveMailDBProvider provider = new SensitiveMailDBProvider(); SensitiveMailInfo oldSensitiveMailInfo = new SensitiveMailInfo(); oldSensitiveMailInfo.ID = sensitiveMailInfo.ID; if (!provider.GetSensitiveMailInfo(transactionid, admin, ref oldSensitiveMailInfo, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } if (oldSensitiveMailInfo.Status == SensitiveMailStatus.Executing) { error.Code = ErrorCode.SensitiveMailIsExecuting; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } #region DirectoryEntry entry = new DirectoryEntry(); CommonProvider commonProvider = new CommonProvider(); List <SensitiveMailObject> members = new List <SensitiveMailObject>(); List <string> distinguishedNames = new List <string>(); for (int i = 0; i < sensitiveMailInfo.Objects.Count; i++) { if (!commonProvider.GetADEntryByGuid(sensitiveMailInfo.Objects[i].ObjectID, out entry, out message)) { LoggerHelper.Error("ModifiedSensitiveMail调用GetADEntryByGuid异常", paramstr, message, transactionid); continue; } SensitiveMailObject mailObject = new SensitiveMailObject(); mailObject.ObjectID = sensitiveMailInfo.Objects[i].ObjectID; mailObject.ObjectType = (NodeType)Enum.Parse(typeof(NodeType), entry.SchemaClassName); mailObject.ObjectName = Convert.ToString(entry.Properties["name"].Value); members.Add(mailObject); distinguishedNames.Add(Convert.ToString(entry.Properties["distinguishedName"].Value)); } if (!CheckdistinguishedNames(transactionid, distinguishedNames, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("SensitiveMailManager调用ModifiedSensitiveMail异常", paramstr, error.Info, transactionid); result = false; break; } #endregion sensitiveMailInfo.Status = SensitiveMailStatus.Enable; if (!provider.ModifySensitiveMail(transactionid, admin, sensitiveMailInfo, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } for (int i = 0; i < members.Count; i++) { members[i].SensitiveMailID = sensitiveMailInfo.ID; if (!provider.AddSensitiveMailObjects(transactionid, admin, members[i], out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } } error.Code = ErrorCode.None; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), true, transactionid); strJsonResult = JsonHelper.ReturnJson(true, Convert.ToInt32(error.Code), error.Info); #region 操作日志 LogInfo operateLog = new LogInfo(); operateLog.AdminID = admin.UserID; operateLog.AdminAccount = admin.UserAccount; operateLog.RoleID = admin.RoleID; operateLog.ClientIP = _clientip; operateLog.OperateResult = true; operateLog.OperateType = "修改敏感邮件规则"; operateLog.OperateLog = $"{admin.UserAccount}于{DateTime.Now}修改敏感邮件规则。" + $"原关键字:{oldSensitiveMailInfo.Keywords},现关键字:{sensitiveMailInfo.Keywords};" + $"原开始时间:{oldSensitiveMailInfo.StartTime},现开始时间:{sensitiveMailInfo.StartTime};" + $"原结束时间:{oldSensitiveMailInfo.EndTime},现结束时间:{sensitiveMailInfo.EndTime}"; LogManager.AddOperateLog(transactionid, operateLog); #endregion result = true; } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("SensitiveMailManager调用ModifySensitiveMail异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
public JsonResult processRequest() { JsonResult jsonresult = new JsonResult(); if (!AuthenticationManager.IfAuthenticated || !User.Identity.IsAuthenticated) { jsonresult.error = "Not Signed"; return(jsonresult); } else if (HttpContext.Current.Request.HttpMethod != "POST") { jsonresult.error = "The function works in POST method"; return(jsonresult); } //else{} //If the user is signed if (!Int32.TryParse(Request["propid"], out propid)) { propid = -1; } //Validate parameters from the request int wizard_step = -1; if (!Int32.TryParse(Request["wizardstep"], out wizard_step)) { wizard_step = -1; } if (wizard_step == -1) { jsonresult.error = "Wizard Step is not set."; return(jsonresult); } if (!ValdateWizardStep(wizard_step)) //Valdation for step parameters by step number { jsonresult.error = "Wizard Step is not set."; return(jsonresult); } if (wizard_step == 0 && (propid == -1 || propid == 0)) { propid = createNewProperty(); if (propid == -1) { jsonresult.error = "Server something wrong error: get new property id"; return(jsonresult); } } else //For the existed property { if (propid == -1 || propid == 0) { jsonresult.error = "Server something wrong error: step is not 0, and propid is -1"; return(jsonresult); } propinfo = AjaxProvider.getPropertyDetailInfo(propid); if (propinfo.UserID != userid && !AuthenticationManager.IfAdmin) { jsonresult.error = "You are trying to do malicious action. Property doesn't include to you."; return(jsonresult); } if (UpdatePropertyInfo(wizard_step) == -1) { jsonresult.error = "Server something wrong error: update property info step " + wizard_step; return(jsonresult); } } List <SqlParameter> param = new List <SqlParameter>(); if (propid > 0) { propinfo = AjaxProvider.getPropertyDetailInfo(propid); //Get the property id jsonresult.propinfo = propinfo; if (wizard_step == 1) { param.Add(new SqlParameter("@propid", propid)); amenity_list = MainHelper.getListFromDB <AmenityInfo>("uspGetPropertyAmenity", param); jsonresult.amenity_list = amenity_list; param.Clear(); param.Add(new SqlParameter("@propid", propid)); jsonresult.room_furniture = CommonProvider.getJsonStringFromDs(BookDBProvider.getDataSet("uspGetRoomFurnitures", param)); } else if (wizard_step == 2) { param.Clear(); param.Add(new SqlParameter("@propid", propid)); jsonresult.attractions = CommonProvider.getJsonStringFromDs(BookDBProvider.getDataSet("uspGetPropertyAttractionByID", param)); } } jsonresult.propid = propid; if (propid == propinfo.ID) { jsonresult.status = 0; } return(jsonresult); }
public int UpdateRoomInfo() { //Get Current room info List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter("@propid", propid)); DataSet ds_roomfurniture = BookDBProvider.getDataSet("uspGetRoomFurnitures", param); roomid_list.Clear(); room_furniture_list.Clear(); if (ds_roomfurniture.Tables.Count > 0) { foreach (DataRow row in ds_roomfurniture.Tables[0].Rows) { if (!roomid_list.Contains(row["RoomID"].ToString())) //if existed roomid { roomid_list.Add(row["RoomID"].ToString()); } RoomInfoFurniture tmp = new RoomInfoFurniture(); tmp.RoomID = row["RoomID"].ToString(); tmp.FurnitureItemID = row["FurnitureItemID"].ToString(); if (!room_furniture_list.Contains(tmp)) { room_furniture_list.Add(tmp); } } } //For requested room infos char[] spliter = { ',' }; if (Request["_roomids"] != null && Request["_roomids"].ToString() != "") { string[] req_roomid_list = Request["_roomids"].ToString().Split(spliter); string[] req_roomnames = Request["_roomnames"].ToString().Split(new char[] { ',' }); int index = 0; foreach (string req_roomid in req_roomid_list) { string req_roomname = req_roomnames[index++]; if (roomid_list.Contains(req_roomid))//For existed room , furniture changes { //Update RoomTitle param.Clear(); param.Add(new SqlParameter("@id", req_roomid)); param.Add(new SqlParameter("@title", req_roomname)); param.Add(new SqlParameter("@method", 2)); //update method CommonProvider.getScalarValueFromDB("uspUpdateRoomInfo", param); //if return value = -1 error UpdateFurnitureID(Request["room" + req_roomid].ToString(), req_roomid); roomid_list.Remove(req_roomid); } else // New Room Info { param.Clear(); param.Add(new SqlParameter("@title", req_roomname)); param.Add(new SqlParameter("@propid", propid)); param.Add(new SqlParameter("@method", 0)); //add method string newroomid = CommonProvider.getScalarValueFromDB("uspUpdateRoomInfo", param).ToString(); //if return value = -1 error UpdateFurnitureID(Request["room" + req_roomid].ToString(), newroomid); } } } //For removed room info and furniture changes; foreach (string removed_roomid in roomid_list) { param.Clear(); param.Add(new SqlParameter("@id", removed_roomid)); param.Add(new SqlParameter("@method", 1)); //delete method string newroomid = CommonProvider.getScalarValueFromDB("uspUpdateRoomInfo", param).ToString(); } foreach (RoomInfoFurniture removed_furniture in room_furniture_list)//Removed furniture changes; { if (removed_furniture.FurnitureItemID != null && removed_furniture.FurnitureItemID != "") { param.Clear(); param.Add(new SqlParameter("@roomid", removed_furniture.RoomID)); param.Add(new SqlParameter("@furid", removed_furniture.FurnitureItemID)); param.Add(new SqlParameter("@method", 1)); CommonProvider.getScalarValueFromDB("uspUpdatePropertyFurnitureID", param); //if return value = -1 error } } return(0); }