private void btn_download_Click(object sender, EventArgs e)
        {
            Linq.dbDataContext db = new Linq.dbDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[GlobalParam.DataSourceName].ConnectionString);
            //db.ExecuteCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
            //db.ObjectTrackingEnabled = false;
            bool SendImage = false;
            //StartF.DownLoad163CaiPiaoV_kaijiangwang(ref SendImage, Dtp_DownloadDate.Value, true,true);
            //StartF.DownLoad163CaiPiaoV_aozc(ref SendImage, Dtp_DownloadDate.Value, true, true);


            string LastPeriod = db.Game_Result.Where(t => t.aspnet_UserID == GlobalParam.UserKey).OrderByDescending(t => t.GamePeriod).First().GamePeriod;

            StartF.ShiShiCaiDealGameLogAndNotice(Linq.ProgramLogic.ShiShiCaiMode.重庆时时彩, true);
            db.SubmitChanges();
            Download163AndDeal_Load(null, null);

            SendImage = true;
            #region "有新的就通知,以及处理结果"
            if (SendImage == true)
            {
                DataRow[] dr = RunnerF.MemberSource.Select("User_IsReply='true'");

                foreach (var Rowitem in dr)
                {
                    #region  多人同号不到ID跳过
                    #endregion

                    string TEMPUserName  = dr[0].Field <string>("User_ContactTEMPID");
                    string WXUserName    = dr[0].Field <string>("User_ContactID");
                    string WX_SourceType = dr[0].Field <string>("User_SourceType");

                    Linq.WX_WebSendPICSetting webpcset = db.WX_WebSendPICSetting.SingleOrDefault(t => t.aspnet_UserID == GlobalParam.UserKey &&
                                                                                                 t.WX_SourceType == WX_SourceType &&
                                                                                                 t.WX_UserName == WXUserName
                                                                                                 );
                    if (webpcset == null)
                    {
                        continue;
                    }

                    if (dr[0].Field <string>("User_SourceType") == "微")
                    {
                        if ((webpcset.dragonpic == true))
                        {
                            StartF.SendRobotContent(StartForm.ReadVirtualFile("Data3" + GlobalParam.UserName + "_" + (Enum.GetName(typeof(Linq.ProgramLogic.ShiShiCaiMode), Linq.ProgramLogic.GetMode(dr))) + ".txt", db), TEMPUserName, WX_SourceType);
                        }
                    }

                    if (dr[0].Field <string>("User_SourceType") == "易")
                    {
                        if ((webpcset.dragonpic == true))
                        {
                            StartF.SendRobotContent(StartForm.ReadVirtualFile("Data3_yixin" + GlobalParam.UserName + "_" + (Enum.GetName(typeof(Linq.ProgramLogic.ShiShiCaiMode), Linq.ProgramLogic.GetMode(dr))) + ".txt", db), TEMPUserName, WX_SourceType);
                        }
                    }

                    if ((webpcset.NumberPIC == true))
                    {
                        StartF.SendRobotImage(Application.StartupPath + "\\Data" + GlobalParam.UserName + ".jpg", TEMPUserName, WX_SourceType);
                        Thread.Sleep(500);
                    }

                    //if ((Mode == "All" && webpcset.NumberAndDragonPIC == true) || (Mode == "图3"))
                    //{
                    //    SendRobotImage(Application.StartupPath + "\\Data" + GlobalParam.UserName + "_v3.jpg", TEMPUserName, SourceType);
                    //}

                    if ((webpcset.NumberAndDragonPIC == true))
                    {
                        StartF.SendRobotContent(StartForm.ReadVirtualFile("Data数字龙虎" + GlobalParam.UserName + "_" + (Enum.GetName(typeof(Linq.ProgramLogic.ShiShiCaiMode), Linq.ProgramLogic.GetMode(dr))) + ".txt", db), TEMPUserName, WX_SourceType);
                    }

                    if (webpcset.shishicailink == true)
                    {
                        StartF.SendRobotLink("查询开奖网地址", "https://h5.13322.com/kaijiang/ssc_cqssc_history_dtoday.html", TEMPUserName, WX_SourceType);
                    }
                } //设置为自动监听的用户
            }     //新开奖

            #endregion
        }
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                Linq.dbDataContext db = new Linq.dbDataContext(System.Configuration.ConfigurationManager.ConnectionStrings[GlobalParam.DataSourceName].ConnectionString);
                //db.ExecuteCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
                //db.ObjectTrackingEnabled = false;
                var data = db.WX_WebSendPICSetting.SingleOrDefault(t => t.aspnet_UserID == GlobalParam.UserKey &&
                                                                   t.WX_SourceType == WX_SourceType &&
                                                                   t.WX_UserName == WX_UserName
                                                                   );
                if (data != null)
                {
                    data.ballinterval   = Convert.ToInt32(tb_ballinterval.Text);
                    data.footballPIC    = cb_footballPIC.Checked;
                    data.bassketballpic = cb_bassketballpic.Checked;
                    data.balluclink     = cb_balluclink.Checked;

                    data.card               = cb_card.Checked;
                    data.cardname           = tb_cardname.Text;
                    data.shishicailink      = cb_shishicailink.Checked;
                    data.NumberPIC          = cb_NumberPIC.Checked;
                    data.dragonpic          = cb_dragonpic.Checked;
                    data.numericlink        = cb_numericlink.Checked;
                    data.dragonlink         = cb_dragonlink.Checked;
                    data.NumberAndDragonPIC = cb_numericanddragon.Checked;

                    data.ballstart = cb_ballstart.Checked;
                    data.ballend   = cb_ballend.Checked;

                    data.balllivepoint = cb_balllivepoint.Checked;
                    data.HKSixResult   = cb_SixResult.Checked;


                    data.NumberDragonTxt           = cb_NumberDragonTxt.Checked;
                    data.NiuNiuPic                 = cb_NiuNiuPic.Checked;
                    data.NoBigSmallSingleDoublePIC = cb_NoBigSmallSingleDoublePIC.Checked;

                    data.IsSendPIC = cb_IsSendPIC.Checked;

                    data.PIC_StartHour   = Convert.ToInt32(tb_StartHour.Text);
                    data.PIC_StartMinute = Convert.ToInt32(tb_StartMinute.Text);
                    data.PIC_EndHour     = Convert.ToInt32(tb_EndHour.Text);
                    data.Pic_EndMinute   = Convert.ToInt32(tb_EndMinute.Text);
                    db.SubmitChanges();
                }
                else
                {
                    Linq.WX_WebSendPICSetting newd = new Linq.WX_WebSendPICSetting();

                    newd.aspnet_UserID = GlobalParam.UserKey;
                    newd.WX_UserName   = WX_UserName;
                    newd.WX_SourceType = WX_SourceType;


                    newd.ballinterval   = Convert.ToInt32(tb_ballinterval.Text);
                    newd.footballPIC    = cb_footballPIC.Checked;
                    newd.bassketballpic = cb_bassketballpic.Checked;
                    newd.balluclink     = cb_balluclink.Checked;

                    newd.card          = cb_card.Checked;
                    newd.cardname      = tb_cardname.Text;
                    newd.shishicailink = cb_shishicailink.Checked;
                    newd.NumberPIC     = cb_NumberPIC.Checked;
                    newd.dragonpic     = cb_dragonpic.Checked;
                    newd.numericlink   = cb_numericlink.Checked;
                    newd.dragonlink    = cb_dragonlink.Checked;
                    newd.balllivepoint = cb_balllivepoint.Checked;

                    newd.NumberAndDragonPIC = cb_numericanddragon.Checked;

                    newd.ballstart   = cb_ballstart.Checked;
                    newd.ballend     = cb_ballend.Checked;
                    newd.HKSixResult = cb_SixResult.Checked;


                    newd.NumberDragonTxt           = cb_NumberDragonTxt.Checked;
                    newd.NiuNiuPic                 = cb_NiuNiuPic.Checked;
                    newd.NoBigSmallSingleDoublePIC = cb_NoBigSmallSingleDoublePIC.Checked;

                    newd.IsSendPIC = cb_IsSendPIC.Checked;

                    newd.PIC_StartHour   = Convert.ToInt32(tb_StartHour.Text);
                    newd.PIC_StartMinute = Convert.ToInt32(tb_StartMinute.Text);
                    newd.PIC_EndHour     = Convert.ToInt32(tb_EndHour.Text);
                    newd.Pic_EndMinute   = Convert.ToInt32(tb_EndMinute.Text);

                    db.WX_WebSendPICSetting.InsertOnSubmit(newd);
                    db.SubmitChanges();
                }
                DataRow[] list = RunnerF.MemberSource.Select("User_ContactID='" + WX_UserName + "'");
                foreach (var rowitem in list)
                {
                    rowitem.SetField <Boolean?>("User_IsSendPic", cb_IsSendPIC.Checked);
                }

                foreach (var item in subsource)
                {
                    var datasub = db.WX_WebSendPICSettingMatchClass.SingleOrDefault(t =>
                                                                                    t.aspnet_UserID == GlobalParam.UserKey &&
                                                                                    t.WX_SourceType == WX_SourceType &&
                                                                                    t.WX_UserName == WX_UserName &&
                                                                                    t.MatchBallType == item.MatchBallType &&
                                                                                    t.MatchClassName == item.MatchClassName
                                                                                    );
                    if (datasub != null)
                    {
                        datasub.SendAny = item.SendAny;
                        db.SubmitChanges();
                    }
                    else
                    {
                        Linq.WX_WebSendPICSettingMatchClass newsub = new Linq.WX_WebSendPICSettingMatchClass();

                        newsub.SendAny = item.SendAny;

                        newsub.aspnet_UserID  = GlobalParam.UserKey;
                        newsub.WX_SourceType  = WX_SourceType;
                        newsub.WX_UserName    = WX_UserName;
                        newsub.MatchBallType  = item.MatchBallType;
                        newsub.MatchClassName = item.MatchClassName;


                        db.WX_WebSendPICSettingMatchClass.InsertOnSubmit(newsub);
                        db.SubmitChanges();
                    }
                }

                MessageBox.Show("保存成功");
            }
            catch (Exception anyerror)
            {
                MessageBox.Show("保存失败" + anyerror.Message);
            }
        }