Exemplo n.º 1
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                CodeProjectInfo codeProjectInfo = FormHelp.GetEntityByControls <CodeProjectInfo>(this.panel1);
                codeProjectInfo.ID = this.codeProjectInfo.ID;
                VerifyMessage verifyMessage = VerifyUtil.Verify(codeProjectInfo);
                if (verifyMessage.ExistError)
                {
                    MessageBox.Show(verifyMessage.ErrorInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                R r = codeProjectInfoBLL.SaveOrUpdateBySelf(codeProjectInfo, null, false);

                if (r.Successful)
                {
                    MessageBox.Show("操作成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadData();
                    //更新列表页
                    if (this.Owner is CodeProjectList)
                    {
                        ((CodeProjectList)this.Owner).LoadData();
                    }
                }
                else
                {
                    MessageBox.Show(r.ResultHint, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                CodeProjectDbConfigInfo saveItem = FormHelp.GetEntityByControls <CodeProjectDbConfigInfo>(this.panel1);
                saveItem.ID        = codeProjectDbConfigInfo.ID;
                saveItem.ProjectId = codeProjectInfo.ID;

                VerifyMessage verifyMessage = VerifyUtil.Verify(saveItem);
                if (verifyMessage.ExistError)
                {
                    MessageBox.Show(verifyMessage.ErrorInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                R r = codeProjectDbConfigInfoBLL.SaveOrUpdate(saveItem, null, false, null);

                if (r.Successful)
                {
                    string msg = saveItem.ID <= 0 ? "新增" : "修改";
                    MessageBox.Show($"{msg}成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadData();
                }
                else
                {
                    MessageBox.Show(r.ResultHint, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 生成配置文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                CodeProjectInfo codeProjectInfo = FormHelp.GetEntityByControls <CodeProjectInfo>(this.panel1);
                VerifyMessage   verifyMessage   = VerifyUtil.Verify(codeProjectInfo);
                if (verifyMessage.ExistError)
                {
                    MessageBox.Show(verifyMessage.ErrorInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                Type type = codeProjectInfo.GetType();
                System.Reflection.PropertyInfo[] propertyInfos = type.GetProperties();
                StringBuilder sbf = new StringBuilder();
                for (int i = 0; i < propertyInfos.Length; i++)
                {
                    if (propertyInfos[i].Name != "ID")
                    {
                        if (propertyInfos[i].Name == "JAVAFODER" ||
                            propertyInfos[i].Name == "VIEWFOLDER" ||
                            propertyInfos[i].Name == "PRO_SITE")
                        {
                            sbf.Append($"{propertyInfos[i].Name}={propertyInfos[i].GetValue(codeProjectInfo).ToString().Replace("\\","\\\\")}\r\n");
                        }
                        else if (propertyInfos[i].Name == "TEMPLATE_FOLDER")
                        {
                            sbf.Append($"{propertyInfos[i].Name}={propertyInfos[i].GetValue(codeProjectInfo).ToString().Replace("\\", "\\\\")+"\\\\"}\r\n");
                        }
                        else
                        {
                            sbf.Append($"{propertyInfos[i].Name}={propertyInfos[i].GetValue(codeProjectInfo)}\r\n");
                        }
                    }
                }
                string configPath = Path.Combine(@System.AppDomain.CurrentDomain.BaseDirectory, autoConfigPath);
                configPath = Path.Combine(configPath, "basic.properties");
                File.WriteAllText(configPath, sbf.ToString());

                //调用bat命令
                string  targetDir = Path.Combine(@System.AppDomain.CurrentDomain.BaseDirectory, autoPath);
                Process proc      = new Process();
                proc.StartInfo.WorkingDirectory = targetDir;
                proc.StartInfo.FileName         = "命令.bat";
                proc.StartInfo.Arguments        = string.Format("30");
                //proc.StartInfo.CreateNoWindow = true;
                //proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;//这里设置DOS窗口不显示,经实践可行
                proc.Start();
                proc.WaitForExit();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///  获取顶部信息
        /// </summary>

        public CodeProjectInfo GetTopTextBoxInfo()
        {
            CodeProjectInfo codeProjectInfo1 = null;

            try
            {
                codeProjectInfo1 = FormHelp.GetEntityByControls <CodeProjectInfo>(this.panel1);
            }
            catch (Exception ex)
            {
                MessageHelper.ShowError(ex);
            }
            return(codeProjectInfo1);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 密码加密
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                AppAccountMgn saveItem = FormHelp.GetEntityByControls <AppAccountMgn>(this.panel1);
                if (!string.IsNullOrEmpty(appAccountMgn.MGNPWD))
                {
                    DialogResult dialogResult = MessageBox.Show("是否以原管理密码保存", "温馨提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    if (dialogResult == DialogResult.OK)
                    {
                        saveItem.MGNPWD = appAccountMgn.MGNPWD;
                    }
                }

                VerifyMessage verifyMessage = VerifyUtil.Verify(saveItem);


                if (saveItem.JiaoyanPwd != saveItem.InputPwd)
                {
                    verifyMessage.ExistError = true;
                    verifyMessage.ErrorInfo += "\n两次输入密码不一致,请重新输入";
                }


                if (verifyMessage.ExistError)
                {
                    MessageBox.Show(verifyMessage.ErrorInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //string iv = saveItem.ACCOUNT.ToString().PadLeft(8, 'u');
                string enc = DesHelper.DESEncrypt(saveItem.InputPwd, key, iv);
                this.ENCPWD.Text = enc;                  //真实密码
                saveItem.ENCPWD  = enc;                  //真实密码

                saveItem.PSEUDOCODE  = Md5Util.Md5(enc); //掩码
                this.PSEUDOCODE.Text = saveItem.PSEUDOCODE;

                R r = appAccountMgnBLL.SaveOrUpdateBySelf(saveItem, null, false);

                if (r.Successful)
                {
                    string msg = saveItem.ID <= 0 ? "新增" : "修改";
                    MessageBox.Show($"{msg}成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadData();

                    //更新列表页
                    if (this.Owner is AccoutEncFrmList)
                    {
                        ((AccoutEncFrmList)this.Owner).LoadData();
                    }
                    this.Hide();
                    this.Dispose(true);
                }
                else
                {
                    MessageBox.Show(r.ResultHint, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowError(ex);
            }
        }
Exemplo n.º 6
0
        private void txButton1_Click(object sender, EventArgs e)
        {
            try
            {
                OsZbPurchaseProjectInfo projectInfo = FormHelp.GetEntityByControls <OsZbPurchaseProjectInfo>(this.groupBox2);
                osZbPurchaseProjectInfo = osZbPurchaseProjectInfo ?? new OsZbPurchaseProjectInfo();

                ObjectUtil.CopyPop(projectInfo, ref osZbPurchaseProjectInfo, "Id");

                VerifyMessage verifyMessage = VerifyUtil.Verify(osZbPurchaseProjectInfo);

                if (!string.IsNullOrWhiteSpace(verifyMessage.ErrorInfo))
                {
                    MessageBox.Show(verifyMessage.ErrorInfo,
                                    "提示",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                    return;
                }
                else if (!string.IsNullOrWhiteSpace(verifyMessage.PromptInfo))
                {
                    MessageBox.Show(verifyMessage.PromptInfo,
                                    "提示",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                }


                R result = osZbPurchaseProjectInfoBLL.SaveOrUpdate(osZbPurchaseProjectInfo, null, true, null);

                if (!result.Successful)
                {
                    MessageBox.Show(result.ResultHint,
                                    "提示",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    MessageBox.Show("操作成功",
                                    "提示",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    if (RefeshParentWindow != null)
                    {
                        RefeshParentWindow.Invoke();
                    }
                    this.Hide();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                log.AddLog(ex.Message, null);

                MessageBox.Show(ex.Message,
                                "提示",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
        }