Exemplo n.º 1
0
        private void uiButton9_Click(object sender, EventArgs e)
        {
            if (!checkTableSelected(MinerStatusTable))
            {
                UIMessageBox.ShowError("请选择矿机");
                return;
            }
            RemoteOtherOptions remoteOtherOptions = new RemoteOtherOptions();

            remoteOtherOptions.function       = "otherOption";
            remoteOtherOptions.autoLogin      = loginStart.Checked;
            remoteOtherOptions.autoMining     = autoMining.Checked;
            remoteOtherOptions.autoMiningTime = autoMiningTime.Text;
            remoteOtherOptions.autoOv         = autoOverclock.Checked;
            string msg = JsonConvert.SerializeObject(remoteOtherOptions);

            var i = 0;

            for (; i < MinerStatusTable.Rows.Count; i++)
            {
                if (MinerStatusTable.Rows[i].Cells[2].Value == null)
                {
                    continue;
                }
                if (MinerStatusTable.Rows[i].Cells[2].Value.ToString() == "True")
                {
                    UDPHelper.Send(msg, MinerStatusTable.Rows[i].Cells[12].Value.ToString());
                    UIMessageBox.Show("设置完成", "提示");
                    return;
                }
            }
        }
Exemplo n.º 2
0
        private void uiButton2_Click(object sender, EventArgs e)
        {
            RemoteOverclock remoteOverclock = new RemoteOverclock();

            remoteOverclock.function = "overclock";
            GPUOverClock gPUOverClock = new GPUOverClock();

            remoteOverclock.OVData             = gPUOverClock;
            remoteOverclock.OVData.Name        = selectGPU.Text;
            remoteOverclock.OVData.Power       = "0";
            remoteOverclock.OVData.TempLimit   = "0";
            remoteOverclock.OVData.CoreClock   = "0";
            remoteOverclock.OVData.MemoryClock = "0";
            if (selectGPU.Text.Contains("NVIDIA"))
            {
                remoteOverclock.OVData.CV = "N/A";
                remoteOverclock.OVData.MV = "N/A";
            }
            else
            {
                remoteOverclock.OVData.CV = "0";
                remoteOverclock.OVData.MV = "0";
            }
            remoteOverclock.OVData.Fan = "0";
            string msg = JsonConvert.SerializeObject(remoteOverclock);

            for (int i = 0; i < remoteMinerStatusList.Count; i++)
            {
                UDPHelper.Send(msg, remoteMinerStatusList[i].IP);
            }
            UIMessageBox.Show("设置完成", "提示");
        }
Exemplo n.º 3
0
        private void uiButton8_Click(object sender, EventArgs e)
        {
            if (!checkTableSelected(MinerStatusTable))
            {
                UIMessageBox.ShowError("请选择矿机");
                return;
            }
            RemoteReboot remoteReboot = new RemoteReboot();

            remoteReboot.function       = "setreboot";
            remoteReboot.hourReboot     = timeRestart.Text;
            remoteReboot.hashrateReboot = lowHashrateRestart.Text;
            string msg = JsonConvert.SerializeObject(remoteReboot);

            var i = 0;

            for (; i < MinerStatusTable.Rows.Count; i++)
            {
                if (MinerStatusTable.Rows[i].Cells[2].Value == null)
                {
                    continue;
                }
                if (MinerStatusTable.Rows[i].Cells[2].Value.ToString() == "True")
                {
                    UDPHelper.Send(msg, MinerStatusTable.Rows[i].Cells[12].Value.ToString());
                    UIMessageBox.Show("设置完成", "提示");
                    return;
                }
            }
        }
Exemplo n.º 4
0
        public static void InitResetButton(UIBuildMenu __instance)
        {
            buildMenu = __instance;

            GameObject buttonPrefab = RebindBuildBarPlugin.resources.bundle.LoadAsset <GameObject>("Assets/RebindBuildBar/UI/buildmenu-button.prefab");
            GameObject buttonGo     = Object.Instantiate(buttonPrefab, __instance.childGroup.transform, false);

            ((RectTransform)buttonGo.transform).anchoredPosition = new Vector2(-300, 5);

            UIButton button = buttonGo.GetComponent <UIButton>();

            button.onClick += _ =>
            {
                bool   heldCtrl = CustomKeyBindSystem.GetKeyBind("ReassignBuildBar").keyValue;
                string msg      = (heldCtrl ? "ResetBuildMenuQuestion1" : "ResetBuildMenuQuestion2").Translate();

                UIMessageBox.Show("ResetBuildMenuQuestionTitle".Translate(), msg, "否".Translate(), "是".Translate(),
                                  UIMessageBox.QUESTION,
                                  null, () =>
                {
                    ResetBuildBarItems(heldCtrl);
                    buildMenu.SetCurrentCategory(buildMenu.currentCategory);
                    VFAudio.Create("ui-click-0", null, Vector3.zero, true);
                });
            };
        }
Exemplo n.º 5
0
        public void CheckDismantle()
        {
            foreach (int objId in selectObjIds)
            {
                PrefabDesc desc = GetPrefabDesc(objId);

                if (!BuildTool_Dismantle.showDemolishContainerQuery)
                {
                    continue;
                }
                if (objId <= 0)
                {
                    continue;
                }

                EntityData data = factory.entityPool[objId];

                if (desc.isStorage)
                {
                    int storageId = data.storageId;
                    if (!factory.factoryStorage.TryTakeBackItems_Storage(player.package, storageId))
                    {
                        dismantleQueryBox = UIMessageBox.Show("拆除储物仓标题".Translate(), "拆除储物仓文字".Translate(), "否".Translate(),
                                                              "是".Translate(), 0, DismantleQueryCancel, DismantleQueryConfirm);
                        waitingForPlayerInput = true;
                        return;
                    }
                }

                if (desc.isTank)
                {
                    int tankId = data.tankId;
                    if (!factory.factoryStorage.TryTakeBackItems_Tank(player.package, tankId))
                    {
                        dismantleQueryBox = UIMessageBox.Show("拆除储液罐标题".Translate(), "拆除储液罐文字".Translate(), "否".Translate(),
                                                              "是".Translate(), 0, DismantleQueryCancel, DismantleQueryConfirm);
                        waitingForPlayerInput = true;
                        return;
                    }
                }

                if (desc.isStation)
                {
                    int stationId = data.stationId;
                    if (factory.transport.stationPool[stationId] != null)
                    {
                        dismantleQueryBox = UIMessageBox.Show("拆除物流站标题".Translate(), "拆除物流站文字".Translate(), "否".Translate(),
                                                              "是".Translate(), 0, DismantleQueryCancel, DismantleQueryConfirm);
                        waitingForPlayerInput = true;
                        return;
                    }
                }
            }

            DismantleAction();
        }
Exemplo n.º 6
0
        public MainWindow()
        {
            InitializeComponent();

            // 初始化主窗口
            InitializeMainWindow();

            // 设置通知栏图标
            InitailizeNotifyIcon();
            try {
                // 开发电脑上面就不用自启了
                // 设置开机自启
                if (!YUtil.GetWindowsUserName().ToUpper().Contains("SOMIAR"))
                {
                    YUtil.SetAppAutoStart("PanyuVisualSystem", true);
                }
                else
                {
                    UIMessageBox.Show("提示", "开发电脑无需自启", 5000);
                }
            } catch {
                UIMessageBox.Show("异常", "设置启动异常", 5000);
                // ignored
            }
            try {
                // 番禺的防火墙服务默认是禁用
                // 这样就会封掉所有端口,所以只能打开防火墙服务,然后关闭防火墙才行
                // 当然防火墙的状态是设置的为关闭
                YUtil.SetWinServiceStartupType("MpsSvc", ServiceStartMode.Automatic);
                YUtil.StartWinService("MpsSvc");
            } catch {
                // ignored
            }
            // 检查网络连接
            if (OnlineDataCenter.IsNetwork2ServerOK())
            {
                InitAndSetupMachineWindow();
                try {
                    // 同步服务器时间
                    var time = YUtil.GetNtpTime(Configuration.ServerIp);
                    if (Math.Abs((DateTime.Now - time).TotalSeconds) > 10)
                    {
                        YUtil.SetLoadTimeByDateTime(time);
                    }
                } catch {
                    // ignored
                }
            }
            else
            {
                Task.Run(() => {
                    SustainedNetworkTest(null);
                });
            }
        }
Exemplo n.º 7
0
 private void uiButton7_Click(object sender, EventArgs e)
 {
     if (!MinerOptions.updateMiner(MinerStatusTable))
     {
         UIMessageBox.ShowError("请选择矿机");
     }
     else
     {
         UIMessageBox.Show("更新完成");
     }
 }
Exemplo n.º 8
0
 private void uiButton11_Click(object sender, EventArgs e)
 {
     if (!MinerOptions.amdOffCalc(MinerStatusTable))
     {
         UIMessageBox.ShowError("请选择矿机");
     }
     else
     {
         UIMessageBox.Show("设置完成");
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 异步从服务器下载 PDF 文件
 /// </summary>
 /// <param name="filename"></param>
 private async void downloadWorkSheetPDFAsync(string filename)
 {
     await Task.Run(() => {
         if (YUtil.DownloadFtpFile($"ftp://{Configuration.ServerIp}/{filename}", PdfDirPath + filename))
         {
             OnChangeProductionProcessPdf(filename);
         }
         else
         {
             UIMessageBox.Show("错误", $"下载工艺文件失败,请检查 [{filename}] 是否存在于服务器", 5000);
         }
     });
 }
Exemplo n.º 10
0
 private void uiButton6_Click(object sender, EventArgs e)
 {
     if (UIMessageBox.ShowAsk("你真的要重启吗"))
     {
         if (!MinerOptions.rebootMiner(MinerStatusTable))
         {
             UIMessageBox.ShowError("请选择矿机");
         }
         else
         {
             UIMessageBox.Show("重启完成");
         }
     }
 }
Exemplo n.º 11
0
        private void yes_Click(object sender, EventArgs e)
        {
            string sql = "insert into recommand(name,author,publish,type,reason) values('" + name.Text + "','" + author.Text + "','" + type.Text + "','" + publish.Text + "','" + reason.Text + "')";
            int    s   = SqlHelper.ExecuteNonQuery(sql);

            if (s > 0)
            {
                UIMessageBox.Show("推荐成功,等待管理员审核");
            }
            else
            {
                UIMessageBox.Show("推荐失败");
            }
        }
Exemplo n.º 12
0
 private void uiButton5_Click(object sender, EventArgs e)
 {
     if (UIMessageBox.ShowAsk("你真的要关机吗"))
     {
         if (!MinerOptions.shutdownMiner(MinerStatusTable))
         {
             UIMessageBox.ShowError("请选择矿机");
         }
         else
         {
             UIMessageBox.Show("关机完成");
         }
     }
 }
Exemplo n.º 13
0
 void UpdateQuit()
 {
     if ((Application.platform == RuntimePlatform.Android ||
          Application.platform == RuntimePlatform.WindowsPlayer ||
          Application.platform == RuntimePlatform.WindowsEditor) && (Input.GetKeyDown(KeyCode.Escape)))
     {
         {
             UIMessageBox.Show(1000006, () =>
             {
                 LogicManager.Instance.QuitGame();
                 Debug.Log("save data");
             }, null);
         }
     }
 }
Exemplo n.º 14
0
 // 下一页
 private void uiButton2_Click(object sender, EventArgs e)
 {
     index += 10;
     if (index > 10 && index < rowcount + 10)
     {
         int    temp = index - 10;
         string sql  = "select top 10 id 编号,userid 用户账号,date 留言日期,message 留言 from messageB where id not in (select top " + temp + " id from messageB)";
         SqlHelper.setGDV(sql, uiDataGridView1);
     }
     else if (index > rowcount)
     {
         UIMessageBox.Show("已经是最后一页");
         index -= 10;
     }
 }
Exemplo n.º 15
0
        private void delete_Click(object sender, EventArgs e)
        {
            string sql = "delete from seat where id='" + label1.Text + "'";
            int    s   = SqlHelper.ExecuteNonQuery(sql);

            if (s > 0)
            {
                UIMessageBox.Show("删除成功!");
                bind();
            }
            else
            {
                UIMessageBox.Show("删除失败!"); bind();
            }
        }
Exemplo n.º 16
0
 private void uiLinkLabel2_Click(object sender, EventArgs e)
 {
     if (UIMessageBox.Show("1、使用数据线将手机连接电脑\n2、手机开启调试模式\n3、程序将使用adb tcpip 5555命令修改无线调试端口号\n4、点击确定后若看到一只狗头,则表示设置端口号成功", "请确认", setting.DarkMode ? UIStyle.Black : UIStyle.Gray, UIMessageBoxButtons.OKCancel, false))
     {
         var batPath = scrcpyPath + "SetProt.bat";
         if (!File.Exists(batPath))
         {
             //提取嵌入资源
             FileHelper.ExtractResFile("FreeControl.SetProt.bat", batPath);
         }
         if (File.Exists(batPath))
         {
             System.Diagnostics.Process.Start(batPath, scrcpyVersion);
         }
     }
 }
Exemplo n.º 17
0
        private static void MoveToDir(UIBlueprintBrowser browser, string targetPath)
        {
            string sourcePath     = drag.displayFile.fullPath;
            string sourceFileName = sourcePath.Split('/').Last();
            string destPath       = targetPath.SlashDirectory() + sourceFileName;

            if (!drag.displayFile.isDirectory)
            {
                try
                {
                    File.Move(sourcePath, destPath);
                }
                catch (IOException e)
                {
                    bool exists = File.Exists(destPath);
                    if (exists)
                    {
                        UIMessageBox.Show("FileAlreadyExistsTitle".Translate(), "FileAlreadyExistsDesc".Translate(), "确定".Translate(), UIMessageBox.WARNING);
                    }
                    BlueprintTweaksPlugin.logger.LogWarning($"Error moving files: {e.Message}");
                    return;
                }
            }
            else if (drag.displayFile.isDirectory)
            {
                if (targetPath.Equals(drag.displayFile.fullPath))
                {
                    return;
                }

                try
                {
                    Directory.Move(sourcePath, destPath);
                }
                catch (IOException e)
                {
                    bool exists = Directory.Exists(destPath);
                    if (exists)
                    {
                        UIMessageBox.Show("FileAlreadyExistsTitle".Translate(), "FileAlreadyExistsDesc".Translate(), "确定".Translate(), UIMessageBox.WARNING);
                    }
                    BlueprintTweaksPlugin.logger.LogWarning($"Error moving files: {e.Message}");
                    return;
                }
            }
            browser.SetCurrentDirectory(browser.currentDirectoryInfo.FullName);
        }
Exemplo n.º 18
0
        private void uiSymbolButton2_Click(object sender, EventArgs e)
        {
            string beChecked = uiRadioButton1.Checked ? uiRadioButton1.Text : uiRadioButton2.Text;

            if (name.Text != null && pwd.Text != null && beChecked != null && email.Text != null && cbb.Text.ToString() != null)
            {
                string newpwd = SqlHelper.MD5Hash(pwd.Text);
                string sql    = "insert into users (name, pwd, sex, email, role) values ('" + name.Text + "','" + newpwd + "','" + beChecked + "','" + email.Text + "','" + cbb.Text.ToString() + "')";
                SqlHelper.ExecuteNonQuery(sql);
                string loginNumber = SqlHelper.ExecuteScalar("select * from users where name='" + name.Text.Trim() + "'").ToString();
                UIMessageBox.Show("注册成功!您的登录账号是:" + loginNumber);
                this.Visible = false;
                new Login().Show();
            }
            else
            {
                UIMessageBox.Show("请填写完整信息!");
            }
        }
Exemplo n.º 19
0
        // 添加用户
        private void uiSymbolButton2_Click(object sender, EventArgs e)
        {
            string beChecked = uiRadioButton1.Checked ? uiRadioButton1.Text : uiRadioButton2.Text;

            if (name.Text != null && pwd.Text != null && beChecked != null && email.Text != null && cbb.SelectedText.ToString() != null)
            {
                string newpwd = SqlHelper.MD5Hash(pwd.Text);
                string sql    = "insert into users (name, pwd, sex, email, role) values ('" + name.Text + "','" + newpwd + "','" + beChecked + "','" + email.Text + "','" + cbb.SelectedValue + "')";
                SqlHelper.ExecuteNonQuery(sql);
                UIMessageBox.Show("注册成功!");
            }
            else
            {
                UIMessageBox.Show("请填写完整信息!");
            }
            name.Text  = "";
            pwd.Text   = "";
            email.Text = "";
        }
Exemplo n.º 20
0
        // 添加管理员
        private void uiSymbolButton6_Click(object sender, EventArgs e)
        {
            string beChecked = uiRadioButton6.Checked ? uiRadioButton6.Text : uiRadioButton5.Text;

            if (uiTextBox6.Text != null && uiTextBox5.Text != null && beChecked != null && uiTextBox4.Text != null)
            {
                string pwd = SqlHelper.MD5Hash(uiTextBox5.Text.ToString());
                string sql = "insert into admin(name,pwd,sex,email) values('" + uiTextBox6.Text.ToString() + "','" + pwd + "','" + beChecked + "','" + uiTextBox4.Text.ToString().Trim() + "') ";
                SqlHelper.ExecuteNonQuery(sql);
                UIMessageBox.Show("添加成功!");
            }
            else
            {
                UIMessageBox.Show("请填写完整信息!");
            }
            uiTextBox6.Text = "";
            uiTextBox5.Text = "";
            uiTextBox4.Text = "";
        }
Exemplo n.º 21
0
        static void Main()
        {
            try
            {
                //获得当前登录的Windows用户标示
                System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();
                //创建Windows用户主题
                Application.EnableVisualStyles();

                System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity);
                //判断当前登录用户是否为管理员
                if (principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator))
                {
                    //如果是管理员,则直接运行
                    AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler((obj, args) => dumpHelper.TryDump("error.dmp"));
                    Application.EnableVisualStyles();
                    Application.Run(new MainForm());
                }
                else
                {
                    //创建启动对象
                    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                    //设置运行文件
                    startInfo.FileName = System.Windows.Forms.Application.ExecutablePath;
                    //设置启动动作,确保以管理员身份运行
                    startInfo.Verb = "runas";
                    //如果不是管理员,则启动UAC
                    System.Diagnostics.Process.Start(startInfo);
                    //退出
                    System.Windows.Forms.Application.Exit();
                }
            }
            catch (Exception ex)
            {
                UIMessageBox.Show("程序发生严重错误!错误:" + ex.ToString(), "程序崩溃");
                LOG.WriteLog("程序发生严重错误!错误:" + ex.ToString());
                if (UIMessageBox.ShowAsk("程序崩溃,是否要发送服务信息给作者,以帮助作者更好的完善软件?"))
                {
                    sendMail.sendmail("*****@*****.**", "松之宅矿工", "*****@*****.**", "松之宅矿工QQ", "dump文件提交", string.Concat(System.AppDomain.CurrentDomain.BaseDirectory, "error.dmp"), "error.dmp", "smtp.126.com", "*****@*****.**", "VEABHRROROCBHXNQ");
                }
            }
        }
Exemplo n.º 22
0
 private void uiButton3_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "")
     {
         UIMessageBox.Show("留言不能为空!");
     }
     else
     {
         string sql = "insert into messageB(userid,date,message) values('" + global.username + "','" + DateTime.Now.ToString().Substring(0, 10) + "','" + textBox1.Text.Trim() + "')";
         if (SqlHelper.ExecuteNonQuery(sql) > 0)
         {
             UIMessageBox.Show("发布成功!");
             textBox1.Text = "";
         }
         else
         {
             UIMessageBox.Show("发布失败!");
         }
     }
 }
Exemplo n.º 23
0
        public void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo)
        {
            Console.WriteLine($"Disconnected from server: {disconnectInfo.Reason}");
            serverConnection = null;
            IsConnected      = false;
            IsSessionJoined  = false;

            UIMessageBox.Show(
                "Connection Lost",
                $"You have been disconnect of the server.\nReason{disconnectInfo.Reason}",
                "Quit",
                "Reconnect",
                0,
                new UIMessageBox.Response(() => {
                MultiplayerSession.instance.LeaveGame();
            }),
                new UIMessageBox.Response(() => {
                MultiplayerSession.instance.TryToReconnect();
            }));
        }
Exemplo n.º 24
0
    /// <summary>
    ///     只提供信息显示功能和yes/no选项
    /// </summary>
    public static UIMessageBox ShowMessageBox(string caption, string msg,
                                              string yesText, string noText, CallBack callBack)
    {
        UIMessageBox msgBox = UIMessageBoxManager.Inst.CreateMessageBox();

        if (null != msgBox)
        {
            msgBox.caption = caption;
            msgBox.msg     = msg;
            msgBox.style   = Style.YesNo;
            msgBox.SetButtonText(ButtonId.Yes, yesText);
            msgBox.SetButtonText(ButtonId.No, noText);
            msgBox.callBack = callBack;

            msgBox.Show();

            return(msgBox);
        }

        return(null);
    }
Exemplo n.º 25
0
        private void uiButton1_Click(object sender, EventArgs e)
        {
            string sql = "delete from borrowmsg where caseid='" + caseid.Text + "'";

            bookid1 = bookid.Text;
            int com = SqlHelper.ExecuteNonQuery(sql);

            if (com > 0)
            {
                UIMessageBox.Show("归还成功");
                string s    = "可供借阅";
                string sql3 = "update bookcase set state='" + s + "' where id='" + bookid1 + "'";
                SqlHelper.ExecuteNonQuery(sql3);
                string sql1 = "select caseid 索书号,bookid 图书编号,bookname 图书名称,userid 用户账号,username 用户名,borrowtime 借书时间,isbacktime 归还时间 from borrowmsg where userid='" + global.username + "'";
                SqlHelper.setGDV(sql1, borrowmsgGV);
            }
            else
            {
                UIMessageBox.Show("归还失败");
            }
        }
Exemplo n.º 26
0
        private void borrow_Click(object sender, EventArgs e)
        {
            string sqln = "select count(*) from borrowmsg where userid='" + global.username + "'";
            int    num  = Convert.ToInt32(SqlHelper.ExecuteScalar(sqln));
            string d    = global.nowdate;
            int    y    = global.days;
            string date = SqlHelper.ReTime(d, y);

            if (global.borrowingnum <= num)
            {
                UIMessageBox.Show("借阅数量已达上限");
            }
            else
            {
                string sql2  = "select state from bookcase where caseid='" + bookcid.Text + "'";
                string state = (string)SqlHelper.ExecuteScalar(sql2);
                if (state == "可供借阅")
                {
                    string sql = "insert into borrowmsg(caseid,bookid,bookname,userid,username,borrowtime,isbacktime) values('" + bookcid.Text + "','" + bookid.Text.Trim() + "','" + bookcname.Text.Trim() + "','" + global.username + "','" + global.name + "','" + global.nowdate + "','" + date + "')";
                    int    n   = SqlHelper.ExecuteNonQuery(sql);
                    if (n > 0)
                    {
                        UIMessageBox.Show("借阅成功");
                        string s    = date + "应还";
                        string sql3 = "update bookcase set state='" + s + "' where caseid='" + bookcid.Text + "'";
                        SqlHelper.ExecuteNonQuery(sql3);
                        string sql4 = "select caseid 索书号,id 图书编号,address 馆藏地址,state 借阅状态 from bookcase where caseid='" + bookcid.Text + "'";
                        SqlHelper.setGDV(sql4, bookcase);
                    }
                    else
                    {
                        UIMessageBox.Show("借阅失败");
                    }
                }
                else
                {
                    UIMessageBox.Show("该图书已被借阅");
                }
            }
        }
Exemplo n.º 27
0
    /// <summary>
    ///     只提供信息显示功能和一个关闭按钮.
    /// </summary>
    public static UIMessageBox ShowMessageBox(string caption, string msg, string yesText = null)
    {
        UIMessageBox msgBox = UIMessageBoxManager.Inst.CreateMessageBox();

        if (null != msgBox)
        {
            msgBox.caption = caption;
            msgBox.msg     = msg;
            msgBox.style   = Style.Yes;

            if (null != yesText)
            {
                msgBox.SetButtonText(ButtonId.Yes, yesText);
            }

            msgBox.Show();

            return(msgBox);
        }

        return(null);
    }
        private void btnUpd_Click(object sender, EventArgs e)
        {
            bool dr = UIMessageBox.Show("是否确认修改员工信息?", "修改提醒", UIStyle.Green, UIMessageBoxButtons.OKCancel);

            if (dr == true)
            {
                string NewTel = Md5LockedUtil.MD5Encrypt32(WorkerTel.Text.ToString());
                #region 员工信息代码块
                Worker worker = new Worker
                {
                    WorkerId        = WorkerNo.Text.Trim(),
                    WorkerName      = WorkerName.Text.Trim(),
                    WorkerNation    = cbWorkerNation.SelectedValue == null ? "N-00001" : cbWorkerNation.SelectedValue.ToString(),
                    WorkerTel       = NewTel,
                    WorkerAddress   = txtAddress.Text,
                    WorkerFace      = cboWorkerFace.Text,
                    WorkerEducation = cboEducation.SelectedValue.ToString() == null ? "E-00001" : cboEducation.SelectedValue.ToString(),
                    datachg_usr     = AdminInfo.Account,
                    datachg_date    = DateTime.Now
                };
                bool i = new WorkerService().UpdateWorker(worker);
                if (i == true)
                {
                    UIMessageBox.ShowSuccess("信息修改成功!");
                    return;
                }
                else
                {
                    UIMessageBox.ShowError("服务器繁忙!");
                    return;
                }
                #endregion
            }
            else
            {
                UIMessageBox.ShowWarning("修改操作已取消!");
                return;
            }
        }
Exemplo n.º 29
0
        private void uiSymbolButton1_Click(object sender, EventArgs e)
        {
            if (this.Text == "新增订单")
            {
                // 写入采购单上部分
                string sql = "insert into buyOrder(date,time,totalMoney,originAddress) values('" + uiDatetimePicker1.Value.ToString("yyyy/MM/dd") + "','" + uiTimePicker1.Text + "','" + uiTBsum.Text + "','" + uiTBaddress.Text + "')";
                SqlHelper.ExecuteNonQuery(sql);

                // 写入下部分
                string sql1 = "";
                for (int i = 0; i < uiDataGridView1.Rows.Count - 1; i++)
                {
                    string commodity = uiDataGridView1.Rows[i].Cells[0].Value.ToString();
                    string unitPrice = uiDataGridView1.Rows[i].Cells[1].Value.ToString();
                    string amount    = uiDataGridView1.Rows[i].Cells[2].Value.ToString();
                    string Price     = (Convert.ToDecimal(unitPrice) * Convert.ToDecimal(amount)).ToString();
                    sql1 += "insert into buyDetail(orderID,commodity,unitPrice,amount,Price,state) values((select top 1 id from buyOrder order by id desc), '" + commodity + "','" + unitPrice + "','" + amount + "','" + Price + "', '未入仓')";
                }
                SqlHelper.ExecuteNonQuery(sql1);
                UIMessageBox.Show("新增采购表成功");
            }
        }
Exemplo n.º 30
0
        //预约
        private void uiImageButton1_Click(object sender, EventArgs e)
        {
            string sql1 = "select count(*) from reseat where userid= '" + global.username + "'";
            int    n    = Convert.ToInt32(SqlHelper.ExecuteScalar(sql1));

            if (n > 0)
            {
                UIMessageBox.ShowInfo("您已预约了座位,无法再预约");
            }
            else
            {
                string sql4 = "select state from seat where seatno='" + id + "' and location='" + location + "'";
                if (SqlHelper.ExecuteScalar(sql4).ToString() == "True")
                {
                    UIMessageBox.Show("该座位已经被预约!");
                }
                else
                {
                    string sql2 = "insert into reseat(seatid,location,userid,username,retime,isbacktime) values('" + id + "','" + location + "','" + global.username + "','" + global.name + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + SqlHelper.ReTime(DateTime.Now.ToString("yyyy-MM-dd"), 1) + "')";
                    string sql  = "update seat set state = 1 where seatno='" + id + "' and location='" + location + "'";
                    if (SqlHelper.ExecuteNonQuery(sql) > 0)
                    {
                        if (SqlHelper.ExecuteNonQuery(sql2) > 0)
                        {
                            UIMessageBox.ShowSuccess("预约成功!");
                            string        sql3 = "select * from reseat where userid= '" + global.username + "'";
                            SqlDataReader sdr  = SqlHelper.ExecuteReader(sql3);
                            if (sdr.Read())
                            {
                                loc.Text    = sdr["location"].ToString();
                                seatno.Text = sdr["seatid"].ToString();
                            }
                        }
                    }
                }
                SqlHelper.setGDV("select id 编号,seatno 座位号,location 位置,state 预约状态 from seat", uiDataGridView1);
            }
        }