private void btn_Save_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; ep_wf.Clear(); RobotWebAdmin.SysadminServices adws = new RobotWebAdmin.SysadminServices(); adws.CookieContainer = GlobalParam.LoginCookie; RobootWeb.WebService usrws = new RobootWeb.WebService(); if (fd_BossUserName.Text != "") { //string checkbossid = Membership.GetUser(fd_BossUserName.Text); //if (checkboss == null) //{ // ep_wf.SetError(fd_BossUserName, "老板号找不到"); // return; // } } switch (_Mode) { case "New": try { JObject usr = JObject.Parse(adws.CreateUser(fd_username.Text, fd_password.Text)); Linq.aspnet_UsersNewGameResultSend newGameResultSend = new Linq.aspnet_UsersNewGameResultSend(); newGameResultSend.aspnet_UserID = Guid.Parse(usr["ProviderUserKey"].ToString()); newGameResultSend.IsNewSend = fd_NewGameSend.Checked; newGameResultSend.IsBlock = Fd_IsBlock.Checked; newGameResultSend.IsSendPIC = FD_SendPIC.Checked; newGameResultSend.IsReceiveOrder = FD_ReceiveOrder.Checked; newGameResultSend.MaxPlayerCount = Convert.ToInt32(fd_MaxPlayerCount.Text); if (fd_activecode.Text == "" || fd_EndDate.Value.Date == DateTime.Today) { fd_EndDate.Value = DateTime.Today.AddMonths(3); Btn_Build_Click(null, null); } newGameResultSend.ActiveCode = fd_activecode.Text; newGameResultSend.BlockStartHour = 3; newGameResultSend.BlockStartMinute = 11; newGameResultSend.BlockEndHour = 7; newGameResultSend.BlockEndMinute = 9; //MembershipUser boss = Membership.GetUser(fd_BossUserName.Text); //newGameResultSend.bossaspnet_UserID = (boss == null ? Guid.Empty : (Guid)boss.ProviderUserKey); newGameResultSend.SendImageStart = Convert.ToInt32(fd_SendTimeStart1.Text); newGameResultSend.SendImageEnd = Convert.ToInt32(fd_SendTimeEnd1.Text); newGameResultSend.SendImageStart2 = Convert.ToInt32(fd_SendTimeStart2.Text); newGameResultSend.SendImageEnd2 = Convert.ToInt32(fd_SendTimeEnd2.Text); newGameResultSend.SendImageStart3 = Convert.ToInt32(fd_SendTimeStart3.Text); newGameResultSend.SendImageEnd3 = Convert.ToInt32(fd_SendTimeEnd3.Text); newGameResultSend.SendImageStart4 = Convert.ToInt32(fd_SendTimeStart4.Text); newGameResultSend.SendImageEnd4 = Convert.ToInt32(fd_SendTimeEnd4.Text); newGameResultSend.ImageTopText = fd_ImageTopText.Text; newGameResultSend.ImageEndText = fd_ImageEndText.Text;; newGameResultSend.OpenMode = (Cb_OpenMode.SelectedItem == null ? "" : Cb_OpenMode.SelectedItem.ToString()); newGameResultSend.SuperUser = cb_SuperUser.Checked; newGameResultSend.BlockStartHour = Convert.ToInt32(tb_StartHour.Text); newGameResultSend.BlockStartMinute = Convert.ToInt32(tb_StartMinute.Text); newGameResultSend.BlockEndHour = Convert.ToInt32(tb_EndHour.Text); newGameResultSend.BlockEndMinute = Convert.ToInt32(tb_EndMinute.Text); newGameResultSend.TwoTreeNotSingle = cb_TwoTreeNotSingle.Checked; newGameResultSend.FuliRatio = Convert.ToDecimal(tb_fuliratio.Text); newGameResultSend.LiuShuiRatio = Convert.ToDecimal(tb_liushuiratio.Text); newGameResultSend.Thread_AoZhouCai = T_AoZhouCai.Checked; newGameResultSend.Thread_VRChongqing = T_VRChongQingShiShiCai.Checked; newGameResultSend.Thread_TengXunShiFen = T_TengXunShiFen.Checked; newGameResultSend.Thread_TengXunWuFen = T_TengXunWuFen.Checked; newGameResultSend.Thread_WuFen = T_WuFenCai.Checked; newGameResultSend.Thread_XinJiangShiShiCai = T_XinJiangShiShiCai.Checked; newGameResultSend.Thread_ChongQingShiShiCai = T_chongqingshishicai.Checked; newGameResultSend.Thread_TengXunShiFenXin = T_TengXunShiFenXin.Checked; newGameResultSend.Thread_TengXunWuFenXin = T_TengXunWuFenXin.Checked; newGameResultSend.Thread_HeNeiWuFen = T_HeNeiWuFen.Checked; Linq.Util_Services.SaveServicesSetting(newGameResultSend); Linq.Game_BasicRatio[] CopyRatio = (Linq.Game_BasicRatio[])JsonConvert.DeserializeObject(usrws.GetTemplateRatios(), typeof(Linq.Game_BasicRatio[])); if (CopyRatio.Count() != 0) { foreach (var item in CopyRatio) { Linq.Game_BasicRatio newr = new Linq.Game_BasicRatio(); newr.aspnet_UserID = Guid.Parse(usr["ProviderUserKey"].ToString()); newr.BasicRatio = item.BasicRatio; newr.BuyType = item.BuyType; newr.BuyValue = item.BuyValue; newr.GameType = item.GameType; newr.IncludeMin = item.IncludeMin; newr.MaxBuy = item.MaxBuy; newr.MinBuy = item.MinBuy; newr.BonusBuyValueCondition = item.BonusBuyValueCondition; newr.WX_SourceType = item.WX_SourceType; newr.Enable = item.Enable; newr.OrderIndex = item.OrderIndex; db.Game_BasicRatio.InsertOnSubmit(newr); db.SubmitChanges(); } } Linq.WX_BounsConfig[] BounsConfig = (Linq.WX_BounsConfig[])JsonConvert.DeserializeObject(usrws.GetTemplateBonus(), typeof(Linq.WX_BounsConfig[])); if (BounsConfig.Count() != 0) { foreach (var item in BounsConfig) { Linq.WX_BounsConfig newr = new Linq.WX_BounsConfig(); newr.aspnet_UserID = Guid.Parse(usr["ProviderUserKey"].ToString()); newr.RowNumber = item.RowNumber; newr.StartBuyPeriod = item.StartBuyPeriod; newr.EndBuyPeriod = item.EndBuyPeriod; newr.StartBuyAverage = item.StartBuyAverage; newr.EndBuyAverage = item.EndBuyAverage; newr.FixNumber = item.FixNumber; newr.FlowPercent = item.FlowPercent; newr.IfDivousPercent = item.IfDivousPercent; db.WX_BounsConfig.InsertOnSubmit(newr); db.SubmitChanges(); } } MessageBox.Show("保存成功"); } catch (Exception anyerror) { ep_wf.SetError(btn_Save, anyerror.Message + Environment.NewLine + anyerror.StackTrace); fd_password.Enabled = true; } break; case "Modify": try { bool success = true; JObject juser = JObject.Parse(adws.GetUserInfo(fd_username.Text)); //MembershipUser user = System.Web.Security.Membership.GetUser(fd_username.Text); if (fd_password.Text != "") { //string NewPassword = user.ResetPassword(); //user.ChangePassword(NewPassword, fd_password.Text); usrws.ChangePassword(Guid.Parse(juser["ProviderUserKey"].ToString()), fd_password.Text); } if (fd_IsLock.Checked == false) { //user.UnlockUser(); success &= adws.SetUserLock(fd_username.Text, false); } //System.Web.Security.Membership.UpdateUser(user); if (fd_IsLock.Checked == true) { //Linq.aspnet_Users aspnet_Users = db.aspnet_Users.SingleOrDefault(t => t.UserId == new Guid(user.ProviderUserKey.ToString())); //aspnet_Users.aspnet_Membership.IsLockedOut = true; //db.SubmitChanges(); success &= adws.SetUserLock(fd_username.Text, true); } #region 开奖立即发送设置 Linq.aspnet_UsersNewGameResultSend finds = Linq.Util_Services.GetServicesSetting(Guid.Parse(juser["ProviderUserKey"].ToString())); if (finds == null) { Linq.aspnet_UsersNewGameResultSend newGameResultSend = new Linq.aspnet_UsersNewGameResultSend(); newGameResultSend.aspnet_UserID = Guid.Parse(juser["ProviderUserKey"].ToString()); //(Guid)userguid.ProviderUserKey; newGameResultSend.IsNewSend = fd_NewGameSend.Checked; newGameResultSend.ActiveCode = fd_activecode.Text; newGameResultSend.IsBlock = Fd_IsBlock.Checked; newGameResultSend.IsSendPIC = FD_SendPIC.Checked; newGameResultSend.IsReceiveOrder = FD_ReceiveOrder.Checked; newGameResultSend.MaxPlayerCount = Convert.ToInt32(fd_MaxPlayerCount.Text); //MembershipUser boss = Membership.GetUser(fd_BossUserName.Text); //newGameResultSend.bossaspnet_UserID = (boss == null ? Guid.Empty : (Guid)boss.ProviderUserKey); newGameResultSend.SendImageStart = Convert.ToInt32(fd_SendTimeStart1.Text); newGameResultSend.SendImageEnd = Convert.ToInt32(fd_SendTimeEnd1.Text); newGameResultSend.SendImageStart2 = Convert.ToInt32(fd_SendTimeStart2.Text); newGameResultSend.SendImageEnd2 = Convert.ToInt32(fd_SendTimeEnd2.Text); newGameResultSend.SendImageStart3 = Convert.ToInt32(fd_SendTimeStart3.Text); newGameResultSend.SendImageEnd3 = Convert.ToInt32(fd_SendTimeEnd3.Text); newGameResultSend.SendImageStart4 = Convert.ToInt32(fd_SendTimeStart4.Text); newGameResultSend.SendImageEnd4 = Convert.ToInt32(fd_SendTimeEnd4.Text); newGameResultSend.ImageTopText = fd_ImageTopText.Text; newGameResultSend.ImageEndText = fd_ImageEndText.Text; newGameResultSend.BlockStartHour = 3; newGameResultSend.BlockStartMinute = 11; newGameResultSend.BlockEndHour = 7; newGameResultSend.BlockEndMinute = 9; newGameResultSend.OpenMode = (Cb_OpenMode.SelectedItem == null ? "" : Cb_OpenMode.SelectedItem.ToString()); newGameResultSend.SuperUser = cb_SuperUser.Checked; newGameResultSend.BlockStartHour = Convert.ToInt32(tb_StartHour.Text); newGameResultSend.BlockStartMinute = Convert.ToInt32(tb_StartMinute.Text); newGameResultSend.BlockEndHour = Convert.ToInt32(tb_EndHour.Text); newGameResultSend.BlockEndMinute = Convert.ToInt32(tb_EndMinute.Text); newGameResultSend.TwoTreeNotSingle = cb_TwoTreeNotSingle.Checked; newGameResultSend.FuliRatio = Convert.ToDecimal(tb_fuliratio.Text); newGameResultSend.LiuShuiRatio = Convert.ToDecimal(tb_liushuiratio.Text); newGameResultSend.Thread_AoZhouCai = T_AoZhouCai.Checked; newGameResultSend.Thread_VRChongqing = T_VRChongQingShiShiCai.Checked; newGameResultSend.Thread_TengXunShiFen = T_TengXunShiFen.Checked; newGameResultSend.Thread_TengXunWuFen = T_TengXunWuFen.Checked; newGameResultSend.Thread_WuFen = T_WuFenCai.Checked; newGameResultSend.Thread_XinJiangShiShiCai = T_XinJiangShiShiCai.Checked; newGameResultSend.Thread_ChongQingShiShiCai = T_chongqingshishicai.Checked; newGameResultSend.Thread_TengXunShiFenXin = T_TengXunShiFenXin.Checked; newGameResultSend.Thread_TengXunWuFenXin = T_TengXunWuFenXin.Checked; newGameResultSend.Thread_HeNeiWuFen = T_HeNeiWuFen.Checked; Linq.Util_Services.SaveServicesSetting(newGameResultSend); } else { finds.IsNewSend = fd_NewGameSend.Checked; finds.IsBlock = fd_IsLock.Checked; finds.IsSendPIC = FD_SendPIC.Checked; finds.IsReceiveOrder = FD_ReceiveOrder.Checked; finds.MaxPlayerCount = Convert.ToInt32(fd_MaxPlayerCount.Text); finds.ActiveCode = fd_activecode.Text; finds.IsBlock = Fd_IsBlock.Checked; finds.IsSendPIC = FD_SendPIC.Checked; finds.IsReceiveOrder = FD_ReceiveOrder.Checked; finds.MaxPlayerCount = Convert.ToInt32(fd_MaxPlayerCount.Text); //MembershipUser boss = Membership.GetUser(fd_BossUserName.Text); //finds.bossaspnet_UserID = (boss == null ? Guid.Empty : (Guid)boss.ProviderUserKey); finds.SendImageStart = Convert.ToInt32(fd_SendTimeStart1.Text); finds.SendImageEnd = Convert.ToInt32(fd_SendTimeEnd1.Text); finds.SendImageStart2 = Convert.ToInt32(fd_SendTimeStart2.Text); finds.SendImageEnd2 = Convert.ToInt32(fd_SendTimeEnd2.Text); finds.SendImageStart3 = Convert.ToInt32(fd_SendTimeStart3.Text); finds.SendImageEnd3 = Convert.ToInt32(fd_SendTimeEnd3.Text); finds.SendImageStart4 = Convert.ToInt32(fd_SendTimeStart4.Text); finds.SendImageEnd4 = Convert.ToInt32(fd_SendTimeEnd4.Text); finds.ImageTopText = fd_ImageTopText.Text; finds.ImageEndText = fd_ImageEndText.Text;; finds.OpenMode = (Cb_OpenMode.SelectedItem == null ? "" : Cb_OpenMode.SelectedItem.ToString()); finds.SuperUser = cb_SuperUser.Checked; finds.BlockStartHour = Convert.ToInt32(tb_StartHour.Text); finds.BlockStartMinute = Convert.ToInt32(tb_StartMinute.Text); finds.BlockEndHour = Convert.ToInt32(tb_EndHour.Text); finds.BlockEndMinute = Convert.ToInt32(tb_EndMinute.Text); finds.TwoTreeNotSingle = cb_TwoTreeNotSingle.Checked; finds.FuliRatio = Convert.ToDecimal(tb_fuliratio.Text); finds.LiuShuiRatio = Convert.ToDecimal(tb_liushuiratio.Text); finds.Thread_AoZhouCai = T_AoZhouCai.Checked; finds.Thread_VRChongqing = T_VRChongQingShiShiCai.Checked; finds.Thread_TengXunShiFen = T_TengXunShiFen.Checked; finds.Thread_TengXunWuFen = T_TengXunWuFen.Checked; finds.Thread_WuFen = T_WuFenCai.Checked; finds.Thread_XinJiangShiShiCai = T_XinJiangShiShiCai.Checked; finds.Thread_ChongQingShiShiCai = T_chongqingshishicai.Checked; finds.Thread_TengXunShiFenXin = T_TengXunShiFenXin.Checked; finds.Thread_TengXunWuFenXin = T_TengXunWuFenXin.Checked; finds.Thread_HeNeiWuFen = T_HeNeiWuFen.Checked; Linq.Util_Services.SaveServicesSetting(finds); } #endregion fd_SendTimeStart1.Enabled = false; fd_SendTimeEnd1.Enabled = false; MessageBox.Show("保存成功"); } catch (Exception anyerror) { ep_wf.SetError(btn_Save, anyerror.Message + Environment.NewLine + anyerror.StackTrace); } break; case "MyData": //MembershipUser usermydata = System.Web.Security.Membership.GetUser(fd_username.Text); if (fd_password.Text != "") { //string NewPassword = usermydata.ResetPassword(); //usermydata.ChangePassword(NewPassword, fd_password.Text); usrws.ChangePassword(GlobalParam.UserKey, fd_password.Text); } // System.Web.Security.Membership.UpdateUser(usermydata); Linq.aspnet_UsersNewGameResultSend findsmydata = Linq.Util_Services.GetServicesSetting(GlobalParam.UserKey); if (findsmydata == null) { Linq.aspnet_UsersNewGameResultSend newGameResultSend = new Linq.aspnet_UsersNewGameResultSend(); newGameResultSend.aspnet_UserID = GlobalParam.UserKey; newGameResultSend.IsNewSend = fd_NewGameSend.Checked; newGameResultSend.ActiveCode = fd_activecode.Text; newGameResultSend.IsBlock = Fd_IsBlock.Checked; newGameResultSend.IsSendPIC = FD_SendPIC.Checked; newGameResultSend.IsReceiveOrder = FD_ReceiveOrder.Checked; newGameResultSend.MaxPlayerCount = Convert.ToInt32(fd_MaxPlayerCount.Text); //MembershipUser boss = Membership.GetUser(fd_BossUserName.Text); //newGameResultSend.bossaspnet_UserID = (boss == null ? Guid.Empty : (Guid)boss.ProviderUserKey); newGameResultSend.SendImageStart = Convert.ToInt32(fd_SendTimeStart1.Text); newGameResultSend.SendImageEnd = Convert.ToInt32(fd_SendTimeEnd1.Text); newGameResultSend.SendImageStart2 = Convert.ToInt32(fd_SendTimeStart2.Text); newGameResultSend.SendImageEnd2 = Convert.ToInt32(fd_SendTimeEnd2.Text); newGameResultSend.SendImageStart3 = Convert.ToInt32(fd_SendTimeStart3.Text); newGameResultSend.SendImageEnd3 = Convert.ToInt32(fd_SendTimeEnd3.Text); newGameResultSend.SendImageStart4 = Convert.ToInt32(fd_SendTimeStart4.Text); newGameResultSend.SendImageEnd4 = Convert.ToInt32(fd_SendTimeEnd4.Text); newGameResultSend.ImageTopText = fd_ImageTopText.Text; newGameResultSend.ImageEndText = fd_ImageEndText.Text;; newGameResultSend.BlockStartHour = 3; newGameResultSend.BlockStartMinute = 11; newGameResultSend.BlockEndHour = 7; newGameResultSend.BlockEndMinute = 9; newGameResultSend.BlockStartHour = Convert.ToInt32(tb_StartHour.Text); newGameResultSend.BlockStartMinute = Convert.ToInt32(tb_StartMinute.Text); newGameResultSend.BlockEndHour = Convert.ToInt32(tb_EndHour.Text); newGameResultSend.BlockEndMinute = Convert.ToInt32(tb_EndMinute.Text); newGameResultSend.TwoTreeNotSingle = cb_TwoTreeNotSingle.Checked; newGameResultSend.FuliRatio = Convert.ToDecimal(tb_fuliratio.Text); newGameResultSend.LiuShuiRatio = Convert.ToDecimal(tb_liushuiratio.Text); newGameResultSend.Thread_AoZhouCai = T_AoZhouCai.Checked; newGameResultSend.Thread_VRChongqing = T_VRChongQingShiShiCai.Checked; newGameResultSend.Thread_TengXunShiFen = T_TengXunShiFen.Checked; newGameResultSend.Thread_TengXunWuFen = T_TengXunWuFen.Checked; newGameResultSend.Thread_WuFen = T_WuFenCai.Checked; newGameResultSend.Thread_XinJiangShiShiCai = T_XinJiangShiShiCai.Checked; newGameResultSend.Thread_ChongQingShiShiCai = T_chongqingshishicai.Checked; newGameResultSend.Thread_TengXunShiFenXin = T_TengXunShiFenXin.Checked; newGameResultSend.Thread_TengXunWuFenXin = T_TengXunWuFenXin.Checked; newGameResultSend.Thread_HeNeiWuFen = T_HeNeiWuFen.Checked; Linq.Util_Services.SaveServicesSetting(newGameResultSend); } else { findsmydata.IsNewSend = fd_NewGameSend.Checked; findsmydata.IsBlock = fd_IsLock.Checked; findsmydata.IsSendPIC = FD_SendPIC.Checked; findsmydata.IsReceiveOrder = FD_ReceiveOrder.Checked; findsmydata.MaxPlayerCount = Convert.ToInt32(fd_MaxPlayerCount.Text); findsmydata.ActiveCode = fd_activecode.Text; //MembershipUser boss = Membership.GetUser(fd_BossUserName.Text); //findsmydata.bossaspnet_UserID = (boss == null ? Guid.Empty : (Guid)boss.ProviderUserKey); findsmydata.SendImageStart = Convert.ToInt32(fd_SendTimeStart1.Text); findsmydata.SendImageEnd = Convert.ToInt32(fd_SendTimeEnd1.Text); findsmydata.SendImageStart2 = Convert.ToInt32(fd_SendTimeStart2.Text); findsmydata.SendImageEnd2 = Convert.ToInt32(fd_SendTimeEnd2.Text); findsmydata.SendImageStart3 = Convert.ToInt32(fd_SendTimeStart3.Text); findsmydata.SendImageEnd3 = Convert.ToInt32(fd_SendTimeEnd3.Text); findsmydata.SendImageStart4 = Convert.ToInt32(fd_SendTimeStart4.Text); findsmydata.SendImageEnd4 = Convert.ToInt32(fd_SendTimeEnd4.Text); findsmydata.ImageTopText = fd_ImageTopText.Text; findsmydata.ImageEndText = fd_ImageEndText.Text; findsmydata.BlockStartHour = Convert.ToInt32(tb_StartHour.Text); findsmydata.BlockStartMinute = Convert.ToInt32(tb_StartMinute.Text); findsmydata.BlockEndHour = Convert.ToInt32(tb_EndHour.Text); findsmydata.BlockEndMinute = Convert.ToInt32(tb_EndMinute.Text); findsmydata.TwoTreeNotSingle = cb_TwoTreeNotSingle.Checked; findsmydata.FuliRatio = Convert.ToDecimal(tb_fuliratio.Text); findsmydata.LiuShuiRatio = Convert.ToDecimal(tb_liushuiratio.Text); findsmydata.Thread_AoZhouCai = T_AoZhouCai.Checked; findsmydata.Thread_VRChongqing = T_VRChongQingShiShiCai.Checked; findsmydata.Thread_TengXunShiFen = T_TengXunShiFen.Checked; findsmydata.Thread_TengXunWuFen = T_TengXunWuFen.Checked; findsmydata.Thread_WuFen = T_WuFenCai.Checked; findsmydata.Thread_XinJiangShiShiCai = T_XinJiangShiShiCai.Checked; findsmydata.Thread_ChongQingShiShiCai = T_chongqingshishicai.Checked; findsmydata.Thread_TengXunShiFenXin = T_TengXunShiFenXin.Checked; findsmydata.Thread_TengXunWuFenXin = T_TengXunWuFenXin.Checked; findsmydata.Thread_HeNeiWuFen = T_HeNeiWuFen.Checked; Linq.Util_Services.SaveServicesSetting(findsmydata); } sf.LoadUserSetting(); break; default: break; }//按模式操作 fd_password.Text = ""; fd_password.Enabled = false; fd_IsLock.Checked = false; fd_IsLock.Enabled = false; db.SubmitChanges(); fd_ImageEndText.Enabled = false; fd_ImageTopText.Enabled = false; MessageBox.Show("保存成功"); }//函数结束