/// <summary> /// 合并操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCombine_Click(object sender, EventArgs e) { string path = txtCombinePath.Text.Trim(); pdfCount = 0; photoCount = 0; currentpdfIndex = 0; getPath(path); level = CombineToPDF.GetDirLevel(path); string levelName = level == 2 ? "组级别" : "村级别"; if ( MessageBox.Show(@"已选择【" + levelName + "】目录\r\n操作路径【" + path + "】\r\n包含【" + pdfCount + "】个pdf文件,【" + photoCount + "】个图片文件\r\n是否合并处理为pdf?", "提示信息-操作前请做好备份", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { PublicCode.Log("【自动合并生成PDF文件操作】操作路径【" + path + "】级别 【" + levelName + "】包含【" + pdfCount + "】个pdf文件,【" + photoCount + "】个图片文件"); processTotalCount = pdfCount + photoCount; if (pdfCount == 0 && photoCount == 0) { MessageBox.Show("未包含任何文件,当前操作终止!"); return; } this.backgroundWorker1.RunWorkerAsync(); // 运行 backgroundWorker 组件 ProcessForm form = new ProcessForm(this.backgroundWorker1); // 显示进度条窗体 form.ShowDialog(this); form.Close(); } }
public LogInfo() { InitializeComponent(); string log = PublicCode.GetLog(); txtLog.Text = log; }
private void InitUI() { if (PublicCode.CheckRegCode()) { label3.Visible = false; txtRegCode.Visible = false; label4.Visible = false; } }
public Form1() { InitializeComponent(); if (string.IsNullOrEmpty(PublicCode.UserType) && !PublicCode.CheckRegCode()) { MessageBox.Show("非法访问!"); return; } if (PublicCode.UserType == "admin")//管理员允许查看操作日志 { btnQueryHistory.Visible = true; } }
private void btnLogin_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtRegCode.Text.Trim())) { //先验证注册码,如果正确则保存 if (PublicCode.CheckRegCode(txtRegCode.Text.Trim())) { UpdateConfigRegCode(txtRegCode.Text.Trim()); } } else { //先验证注册码,如果正确则保存 if (!PublicCode.CheckRegCode()) { MessageBox.Show("注册码不正确,请联系管理员索取!"); return; } } string userId = txtUser.Text.Trim(); string pwd = txtPwd.Text.Trim(); if (userId == "admin" && pwd == "admin778899") { PublicCode.UserType = "admin"; } else { PublicCode.UserType = "user"; } this.Hide(); Form1 mainFrom = new Form1(); mainFrom.ShowDialog(); }
private void btnMakeDir_Click(object sender, EventArgs e) { string makePath = txtWorkPath.Text.Trim();//生成路径 string countryName = txtCountryName.Text.Trim(); makePath = Path.Combine(makePath, countryName); string fbfCode = txtFBFCode.Text.Trim(); int generCount = 0; if (ddlAddMoudel.SelectedIndex == 0) { generCount = txtGroupInfo.GetLineFromCharIndex(txtGroupInfo.TextLength); } else { generCount = dataGridView1.Rows.Count - 1; } //确认填写信息 if (MessageBox.Show(@"村名称 【" + countryName + "】\r\n发包方代码【" + fbfCode + "】\r\n本次将生成【" + generCount + "】个组信息", "确认生成信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { if (!Directory.Exists(makePath)) { Directory.CreateDirectory(makePath); } string logGroupInfo = string.Empty; for (int i = 0; i < generCount; i++) { string fbfName = "", cbfBigCode = "", groupNum = ""; if (ddlAddMoudel.SelectedIndex == 0) { string[] arr = txtGroupInfo.Text.Split('\n'); var row = arr[i].TrimEnd('\r'); var rows = row.Split('\t'); fbfName = rows[0]; groupNum = rows[1]; cbfBigCode = rows[2].PadLeft(4, '0'); } else { var row = dataGridView1.Rows[i]; fbfName = row.Cells[0].Value.ToString(); groupNum = row.Cells[1].Value.ToString(); cbfBigCode = row.Cells[2].Value.ToString(); } fbfCode = txtFBFCode.Text.Trim() + groupNum; logGroupInfo += string.Format("【({0}) 组名称:{1},组号:{2},承包方最大编码:{3}】", i + 1, fbfName, groupNum, cbfBigCode); CreateDir(makePath, groupNum, fbfCode, cbfBigCode); } #region 操作完毕 给予提示 PublicCode.Log("【自动生成文件夹操作】 村名称【" + countryName + "】发包方代码【" + fbfCode + "】" + (dataGridView1.Rows.Count - 1) + "个组信息: { " + logGroupInfo + " }"); if (MessageBox.Show(@"是否需要打开生成目录", "操作成功", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { if (Directory.Exists(makePath)) { System.Diagnostics.Process.Start(makePath); } } #endregion } }