Exemple #1
0
        static void loginf_OnLoginSuccess(string UserName)
        {
            loginf.Hide();
            #region
            WeixinRobotLib.Linq.dbDataContext db = new WeixinRobotLib.Linq.dbDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[GlobalParam.DataSourceName].ConnectionString);
            //db.ExecuteCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
            //db.ObjectTrackingEnabled = false;

            string ActiveCode = WeixinRobotLib.Linq.Util_Services.GetServicesSetting().ActiveCode;

            DateTime?EndDate = null;
            bool     Success = NetFramework.Util_MD5.MD5Success(ActiveCode, out EndDate, GlobalParam.UserKey);
            Success = true;
            EndDate = Convert.ToDateTime("2020-01-01");
            if (Success == false)
            {
                MessageBox.Show("激活码异常");
                Environment.Exit(0);
            }
            else
            {
                DateTime Now = db.ExecuteQuery <DateTime>("select getdate()").First();
                if (Now >= EndDate)
                {
                    MessageBox.Show("激活码已过期");
                    UpdateActiveCode uac = new UpdateActiveCode();
                    uac.ShowDialog();
                    MessageBox.Show("激活码已保存,重新启动");
                    Environment.Exit(0);
                }
            }
            #endregion
            StartForm sf = new StartForm();


            if (UserName == "sysadmin")
            {
                sf.SetMode("Admin", "");
            }
            else
            {
                sf.SetMode("User", "");
            }
            if (GlobalParam.DataSourceName != "Admin" && GlobalParam.DataSourceName != "User")
            {
                WeixinRobotLib.Linq.aspnet_UsersNewGameResultSend wsr = WeixinRobotLib.Linq.Util_Services.GetServicesSetting();
                sf.SetMode("EasyRobot", wsr.OpenMode == null ? "" : wsr.OpenMode);
            }



            sf.Show();
        }
        public void ReloadMembers(string GroupOwnerName, DataTable ToJoinIn, string WX_SourceType, WeixinRobotLib.Linq.dbDataContext db, IntPtr hwnd)
        {
            XmlDocument doc = new XmlDocument();

            StartGetAccessibleObjects(_QqWindowHandle, out FindOwner, out FindOwnerParent, GroupOwnerName, out doc);

            object[] CHILDS = GetAccessibleChildren(FindOwnerParent);

            WeixinRobotLib.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)
                {
                    WeixinRobotLib.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)
                    {
                        WeixinRobotLib.Linq.WX_UserReply newr = new WeixinRobotLib.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;
                    }
                }
            }
        }