private void btn_save_Click(object sender, EventArgs e) { if (GV_PicSendSetting.SelectedRows.Count > 0) { Linq.WX_PCSendPicSetting data = ((Linq.WX_PCSendPicSetting)GV_PicSendSetting.SelectedRows[0].DataBoundItem); }//有选择才执行新加 foreach (var Injectitem in SF.InjectWins) { #region 步采集模式勾 DataRow[] rs = SF.RunnerF.MemberSource.Select("User_ContactTEMPID='" + Injectitem.WX_UserTMPID + "'"); foreach (var rowitem in rs) { rowitem.SetField("User_ChongqingMode", Injectitem.ChongqingMode); rowitem.SetField("User_FiveMinuteMode", Injectitem.FiveMinuteMode); rowitem.SetField("User_HkMode", Injectitem.HkMode); rowitem.SetField("User_AozcMode", Injectitem.AozcMode); rowitem.SetField("User_TengXunShiFen", Injectitem.Tengxunshifen); rowitem.SetField("User_TengXunWuFen", Injectitem.Tengxunwufen); rowitem.SetField("User_XinJiangShiShiCai", Injectitem.XinJiangMode); //UserRow.SetField("User_ChongqingMode", false); //UserRow.SetField("User_FiveMinuteMode", false); //UserRow.SetField("User_HkMode", false); //UserRow.SetField("User_AozcMode", false); //UserRow.SetField("User_TengXunShiFen", false); //UserRow.SetField("User_TengXunWuFen", true); //UserRow.SetField("User_XinJiangShiShiCai", false); } #endregion } SF.winsdb.SubmitChanges(); btn_refresh_Click(sender, e); }
public void ReloadMembers(string GroupOwnerName, DataTable ToJoinIn, string WX_SourceType, Linq.dbDataContext db, IntPtr hwnd) { XmlDocument doc = new XmlDocument(); StartGetAccessibleObjects(_QqWindowHandle, out FindOwner, out FindOwnerParent, GroupOwnerName, out doc); object[] CHILDS = GetAccessibleChildren(FindOwnerParent); Linq.WX_PCSendPicSetting pcset = db.WX_PCSendPicSetting.SingleOrDefault(t => t.WX_UserTMPID == hwnd.ToString()); foreach (var CHILDITEM in CHILDS) { if (CHILDITEM.GetType().ToString().ToUpper().Contains("INT") == false) { continue; } string NewName = ((IAccessible)FindOwnerParent).get_accName(CHILDITEM); DataRow[] testexit = ToJoinIn.Select( "User_ContactID= '" + NewName.Replace("'", "''") + "' and User_SourceType = '" + WX_SourceType + "'" ); if (testexit.Length == 0) { Linq.WX_UserReply userreply = db.WX_UserReply.SingleOrDefault(t => t.aspnet_UserID == GlobalParam.UserKey && t.WX_UserName == NewName && t.WX_SourceType == WX_SourceType ); DataRow usr = ToJoinIn.AsEnumerable().SingleOrDefault (t => t.Field <object>("User_ContactID").ToString() == NewName && t.Field <object>("User_SourceType").ToString() == WX_SourceType ); if (userreply == null) { Linq.WX_UserReply newr = new Linq.WX_UserReply(); newr.aspnet_UserID = GlobalParam.UserKey; newr.WX_SourceType = WX_SourceType; newr.WX_UserName = NewName; newr.IsCaculateFuli = true; db.WX_UserReply.InsertOnSubmit(newr); db.SubmitChanges(); } if (usr == null && userreply == null) { DataRow newset = ToJoinIn.NewRow(); newset.SetField("User_ContactID", NewName); newset.SetField("User_ContactTEMPID", hwnd.ToString()); newset.SetField("User_SourceType", WX_SourceType); newset.SetField("User_Contact", NewName); newset.SetField("User_ChongqingMode", pcset.ChongqingMode); newset.SetField("User_FiveMinuteMode", pcset.FiveMinuteMode); newset.SetField("User_HkMode", pcset.HkMode); newset.SetField("User_AozcMode", pcset.AozcMode); ToJoinIn.Rows.Add(newset); usr = newset; } else if (usr == null && userreply != null) { DataRow newset = ToJoinIn.NewRow(); newset.SetField("User_ContactID", userreply.WX_UserName); newset.SetField("User_ContactTEMPID", hwnd.ToString()); newset.SetField("User_SourceType", userreply.WX_SourceType); newset.SetField("User_Contact", userreply.WX_UserName); newset.SetField("User_IsAdmin", userreply.IsAdmin); newset.SetField("User_IsCaculateFuli", userreply.IsCaculateFuli); newset.SetField("User_ChongqingMode", pcset.ChongqingMode); newset.SetField("User_FiveMinuteMode", pcset.FiveMinuteMode); newset.SetField("User_HkMode", pcset.HkMode); newset.SetField("User_AozcMode", pcset.AozcMode); ToJoinIn.Rows.Add(newset); usr = newset; } } } }