/// <summary> /// 更新服务器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int id = 0; String wheresql = "编号=" + txtId.Text; String valuesql = "名称='" + txtName.Text + "',地址='" + txtAddress.Text + "',文件夹='" + txtFolder.Text + "',端口=" + txtPort.Text + ",用户='" + txtUser.Text + "',密码='" + txtPassword.Text + "'"; if (db.SetFTPServer(0, 1, "", wheresql, valuesql, out id) && id == 1) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0022I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0023I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0019I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// FTP服务器测试 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTest_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { if (txtTestTo.Text == "") { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0019I", db.Language); MessageBox.Show(msg); return; } NCFTP ftp = new NCFTP(); String filename = txtTestTo.Text; String url = "ftp://" + txtAddress.Text + "/" + txtFolder.Text + "/" + System.IO.Path.GetFileName(filename); if (ftp.uploadFile(url, filename, txtUser.Text, txtPassword.Text)) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0027I", db.Language); MessageBox.Show(msg); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0028I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0019I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 增加服务器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { int id = 0; int port = 0; try { port = Convert.ToInt32(txtPort.Text); } catch {} String fieldlist = "名称,地址,文件夹,端口,用户,密码,UserID"; String valuelist = "'" + txtName.Text + "','" + txtAddress.Text + "','" + txtFolder.Text + "'," + port.ToString() + ",'" + txtUser.Text + "','" + txtPassword.Text + "','" + db.UserID + "'"; if (db.SetFTPServer(0, 0, fieldlist, "", valuelist, out id)) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0020I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0021I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 增加期刊发行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { int id = 0; String fieldlist = "期刊编号,发行期号,发行日期,文件链接,本地文件,FTP文件,图片链接,本地图片,FTP图片,文本内容,邮件内容,期刊状态,UserID,S期刊编号,S发行编号"; String valuelist = MagId + ",'" + txtPublish.Text + "','" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "','" + txtFileLink.Text + "','" + txtFileLocal.Text + "','" + txtFileFTP.Text + "','" + txtPicLink.Text + "','" + txtPicLocal.Text + "','" + txtPicFTP.Text + "','" + txtText.Text + "','" + txtMail.Text + "','新建','" + db.UserID + "','" + SMagId + "','" + (Guid.NewGuid()).ToString() + "'"; if (db.SetPublish(0, 0, fieldlist, "", valuelist, out id)) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0070I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0071I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 杂志编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEditor_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int PublishID = Convert.ToInt32(txtId.Text); String PublishName = txtPublish.Text; int magId = Convert.ToInt32(MagId); String Content = txtText.Text; string url = txtFileLink.Text; String jpgfile = txtPicLocal.Text; string pdffileLocal = txtFileLocal.Text; string pdffileFtp = txtFileFTP.Text; FormEditor form = new FormEditor(db, magId, MagName, PublishID, PublishName, Content, url, jpgfile, pdffileLocal, pdffileFtp); if (form.ShowDialog() == DialogResult.OK) { txtText.Text = form.PreText; txtMail.Text = CreateHtml(txtText.Text); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0069I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 期刊发行测试,将期刊内容发给测试用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTest_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { DataSet ds = new DataSet(); String wheresql = "subscripted='T'"; if (db.GetCustomer(0, 0, "*", wheresql, "", ref ds)) { DataSet ds_Server = new DataSet(); if (db.GetMailServer(0, 0, "*", "", "", ref ds_Server) && ds_Server.Tables[0].Rows.Count > 0) { Random rdm = new Random(); foreach (DataRow dr in ds.Tables[0].Rows) { int idx = rdm.Next(0, ds_Server.Tables[0].Rows.Count - 1); String name = ds_Server.Tables[0].Rows[idx]["名称"].ToString(); String address = ds_Server.Tables[0].Rows[idx]["地址"].ToString(); String port = ds_Server.Tables[0].Rows[idx]["端口"].ToString(); String user = ds_Server.Tables[0].Rows[idx]["用户"].ToString(); String password = ds_Server.Tables[0].Rows[idx]["密码"].ToString(); String from = ds_Server.Tables[0].Rows[idx]["送信人地址"].ToString(); String attachement = ds_Server.Tables[0].Rows[idx]["添付文件"].ToString(); String isHtml = ds_Server.Tables[0].Rows[idx]["HTML"].ToString(); String servertype = ds_Server.Tables[0].Rows[idx]["服务器类型"].ToString().Trim(); String to = dr["mail"].ToString(); String pdffile = txtFileLink.Text; String body = txtText.Text; String picfile = txtPicLocal.Text; String htmlbody = txtMail.Text; if (isHtml != "Y") { htmlbody = null; } if (attachement != "Y") { picfile = null; } String subject = MagName + txtPublish.Text + "[" + txtDate.Text + "] By " + name; NCMail.SendEmail(subject, body, htmlbody, picfile, address, user, password, from, to, servertype); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0078I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0079I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0069I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 更新用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int id = 0; String wheresql = "ToolID='" + txtId.Text + "' and UserID='" + db.UserID + "'"; String valuesql = "ToolName='" + txtToolName.Text + "',ToolLanguange='" + cmbLanguageType.Text + "',ToolFile='" + txtToolFile.Text + "',ToolSerialNo='" + txtSerialNo.Text + "',ToolComment='" + txtOther.Text + "'"; if (db.SetToolConfig(0, 1, "", wheresql, valuesql, out id) && id == 1) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0155I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0156I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0152I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// executeCjwScriptを実行する。 /// </summary> private bool executeCjwScript(string dbName, string scriptFile) { string strConnectionString = string.Format( "Data Source={0};Initial Catalog={1};User ID={2};Password={3}", txtDataSource.Text, dbName, txtUser.Text, txtPwd.Text); SqlConnection conn = new SqlConnection(strConnectionString); try { FileInfo file = new FileInfo(scriptFile); string script = file.OpenText().ReadToEnd(); conn.Open(); IEnumerable <string> commands = Regex.Split(script, @"^\s*GO\s*$", RegexOptions.Multiline | RegexOptions.IgnoreCase); foreach (string command in commands) { if (command.Trim() != "") { new SqlCommand(command, conn).ExecuteNonQuery(); } } lblInfor.Text = NCMessage.GetInstance(db.Language).GetMessageById("CM0163I", db.Language); Application.DoEvents(); conn.Close(); } catch (Exception ex) { NCLogger.GetInstance().WriteExceptionLog(ex); lblInfor.Text = NCMessage.GetInstance(db.Language).GetMessageById("CM0163E", db.Language); Application.DoEvents(); conn.Close(); return(false); } return(true); }
/// <summary> /// 内容追加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { int id = 0; String fieldlist = @"[LessonId],[ContentType],[Contents],[AudioFile], [block1], [block2_1],[block2_2],[block2_3],[block2_4], [block3_1],[block3_2],[block3_3],[block3_4], [block4_1],[block4_2],[block4_3],[block4_4], [block5_1],[block5_2],[block5_3],[block5_4], [block6_1],[block6_2],[block6_3],[block6_4], UserId"; String valuelist = "" + lessonid + ",'" + txtContentType.Text + "','" + txtContents.Text + "','" + txtAudioFile.Text + "','" + txtBlock1.Text + "','" + txtBlock2_1.Text + "','" + txtBlock2_2.Text + "','" + txtBlock2_3.Text + "','" + txtBlock2_4.Text + "','" + "','" + txtBlock3_1.Text + "','" + txtBlock3_2.Text + "','" + txtBlock3_3.Text + "','" + txtBlock3_4.Text + "','" + "','" + txtBlock4_1.Text + "','" + txtBlock4_2.Text + "','" + txtBlock4_3.Text + "','" + txtBlock4_4.Text + "','" + "','" + txtBlock5_1.Text + "','" + txtBlock5_2.Text + "','" + txtBlock5_3.Text + "','" + txtBlock5_4.Text + "','" + "','" + txtBlock6_1.Text + "','" + txtBlock6_2.Text + "','" + txtBlock6_3.Text + "','" + txtBlock6_4.Text + "','" + db.db.UserID + "'"; if (db.SetContent(0, 0, fieldlist, "", valuelist, out id)) { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0180I", db.db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0181I", db.db.Language); MessageBox.Show(msg); } }
/// <summary> /// 更新媒体数据库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int id = 0; String valueList = "MediaType='" + cmbMediaType.Text + "',MediaURL='" + txtMediaURL.Text + "',MediaAppKey='" + txtUserName.Text + "',MediaAppPassword='******',MediaUser='******',MediaPassword='******',other='" + txtOther.Text + "',published='" + cmbPublish.Text + "'"; if (db.SetMedia(0, 1, "", "id=" + txtId.Text, valueList, out id) && id == 1) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0053I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0054I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0050I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 更新用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { string usertype = getUserType(cmbType.Text); if (usertype == null) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0049I", db.Language); MessageBox.Show(msg); return; } int id = 0; String wheresql = "UserId='" + txtUser.Text + "' and UpperUserID='" + db.UserID + "'"; String valuesql = "UserName='******',UserPwd='" + NCCryp.Encrypto(txtPassword.Text) + "',UserRight='" + usertype + "'"; if (db.SetUser(0, 1, "", wheresql, valuesql, out id) && id == 1) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0045I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0046I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0042I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 增加用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { string usertype = getUserType(cmbType.Text); if (usertype == null) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0049I", db.Language); MessageBox.Show(msg); return; } int id = 0; String fieldlist = "UserID,UserName,UserPwd,UserRight,UpperUserID"; String valuelist = "'" + txtUser.Text + "','" + txtName.Text + "','" + NCCryp.Encrypto(txtPassword.Text) + "','" + usertype + "','" + db.UserID + "'"; if (db.SetUser(0, 0, fieldlist, "", valuelist, out id)) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0043I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0044I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 执行文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStart_Click(object sender, EventArgs e) { string toolfile = txtToolFile.Text; string toolSerialNo = ""; if (File.Exists(toolfile)) { if (Path.GetExtension(toolfile).ToLower() == ".dll") { string space = Path.GetFileNameWithoutExtension(toolfile); Invoke(toolfile, space, "FormMain", "GetInstance", new object[] { db, toolSerialNo }); } else { ExecuteCommand(toolfile, "", "", false); } } else { Form frm = (Form)FormFactory.GetInstance(toolfile, db); if (frm != null) { frm.ShowDialog(); } else { string msg = string.Format(NCMessage.GetInstance(db.Language).GetMessageById("CM0159E", db.Language), toolfile); MessageBox.Show(msg); } } }
/// <summary> /// 仕事履歴管更新 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int id = 0; String wheresql = "id=" + txtId.Text; String valuesql = "StartDate='" + txtStartDate.Text + "',EndDate='" + txtEndDate.Text + "',Country='" + txtCountry.Text + "',content='" + txtContent.Text + "',Tool='" + txtTool.Text + "',Role='" + txtRole.Text + "',Range='" + txtRange.Text + "',Company='" + txtCompany.Text + "',PriceType='" + txtPriceType.Text + "',Price=" + txtPrice.Text ; if (db.SetWork(0, 1, "", wheresql, valuesql, out id) && id == 1) { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0192I", db.db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0193I", db.db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0189I", db.db.Language); MessageBox.Show(msg); } }
/// <summary> /// 仕事履歴管更新 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int id = 0; String wheresql = "id=" + txtId.Text; String valuesql = "StartDate='" + txtStartDate.Text + "',EndDate='" + txtEndDate.Text + "',School='" + txtSchool.Text + "',Special='" + txtSpecial.Text + "',Graduation='" + txtGraduation.Text + "'" ; if (db.SetSchool(0, 1, "", wheresql, valuesql, out id) && id == 1) { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0182I", db.db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0183I", db.db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0179I", db.db.Language); MessageBox.Show(msg); } }
/// <summary> /// 选择行下移 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDown_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int selectedRowNum = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[3].Value.ToString()); if (selectedRowNum > 0 && selectedRowNum < getLastRowNum()) { int id = 0; int downSelectedFileId = Convert.ToInt32(dataGridView1.Rows[dataGridView1.SelectedRows[0].Index + 1].Cells[0].Value.ToString()); String wheresql = "文件编号=" + selectedFileId.ToString(); String valuesql = "文件序号=文件序号+1"; if (db.SetFile(0, 1, "", wheresql, valuesql, out id) && id == 1) { wheresql = "文件编号=" + downSelectedFileId.ToString(); valuesql = "文件序号=文件序号-1"; if (db.SetFile(0, 1, "", wheresql, valuesql, out id) && id == 1) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0096I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0097I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0097I", db.Language); MessageBox.Show(msg); } } } }
public void OnClientMessageRecieved(NCMessage msg, short msgType) { // Don't double do things from yourself if (msg.SourceClient == _myConnectionId) { return; } LogWarning("Got message from " + msg.SourceClient + " - " + msg.Message); // DO STUFF WITH THE MESSAGE // TODO - giant case statement here switch (msgType) { case (short)NetcodeMsgType.ChatMessage: Servicer.Instance.ChatManager.ChatMessageReceived(msg.Message, msg.SourceClient); break; case (short)NetcodeMsgType.BatchedPositionUpdate: Servicer.Instance.TrackedObjects.SetPositions(msg.Message); break; case (short)NetcodeMsgType.PositionUpdateRequest: Servicer.Instance.TrackedObjects.ProcessPositionRequestBatch(msg.Message); break; case (short)NetcodeMsgType.SpawnDummyPlayer: Servicer.Instance.Spawn.SpawnDummy(msg.Message); break; } }
/// <summary> /// 配置値设定 /// </summary> private Boolean SetDatabaseConfig() { NdnXmlConfig xmlConfig; xmlConfig = new NdnXmlConfig(NCConst.CONFIG_FILE_DIR + NCUtility.GetAppConfig()); string strConnectionString = string.Format( "Data Source={0};Initial Catalog={1};User ID={2};Password={3}", txtDataSource.Text, txtDatabase.Text, txtUser.Text, NCCryp.Encrypto(txtPwd.Text)); string str = "ConnectionString"; if (!xmlConfig.WriteValue("database", str, strConnectionString)) { string msg = string.Format(NCMessage.GetInstance(db.Language).GetMessageById("CM0450E", db.Language), str); NCLogger.GetInstance().WriteErrorLog(msg); return(false); } strConnectionString = string.Format( "Data Source={0};Initial Catalog={1};User ID={2};Password={3}", txtDataSource.Text, "master", txtUser.Text, NCCryp.Encrypto(txtPwd.Text)); str = "MConnectionString"; if (!xmlConfig.WriteValue("database", str, strConnectionString)) { string msg = string.Format(NCMessage.GetInstance(db.Language).GetMessageById("CM0450E", db.Language), str); NCLogger.GetInstance().WriteErrorLog(msg); return(false); } return(SetDatabaseConfig2()); }
/// <summary> /// 创建数据库 /// </summary> private Boolean restoreDatabase(string dbName, string dbFile) { string strConnectionString = string.Format( "Data Source={0};Initial Catalog={1};User ID={2};Password={3}", txtDataSource.Text, "master", txtUser.Text, txtPwd.Text); SqlConnection RestoreCon = new SqlConnection(strConnectionString); try { RestoreCon.Open(); SqlCommand RestoreCmd1 = new SqlCommand(); RestoreCmd1.CommandText = string.Format("RESTORE DATABASE [{0}] FROM DISK=N'{1}' with FILE = 1, NOUNLOAD, REPLACE, STATS = 10", dbName, dbFile); RestoreCmd1.Connection = RestoreCon; RestoreCmd1.CommandTimeout = 300000; RestoreCmd1.ExecuteNonQuery(); lblInfor.Text = NCMessage.GetInstance(db.Language).GetMessageById("CM0162I", db.Language); Application.DoEvents(); RestoreCon.Close(); } catch (Exception ex) { NCLogger.GetInstance().WriteExceptionLog(ex); RestoreCon.Close(); lblInfor.Text = NCMessage.GetInstance(db.Language).GetMessageById("CM0162E", db.Language); Application.DoEvents(); return(false); } return(true); }
/// <summary> /// 更新期刊发行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int id = 0; String wheresql = "发行编号=" + txtId.Text; String valuesql = "发行期号='" + txtPublish.Text + "',期刊状态='" + "新建" + "',文件链接='" + txtFileLink.Text + "',本地文件='" + txtFileLocal.Text + "',FTP文件='" + txtFileFTP.Text + "',图片链接='" + txtPicLink.Text + "',本地图片='" + txtPicLocal.Text + "',FTP图片='" + txtPicFTP.Text + "',文本内容='" + txtText.Text + "',邮件内容='" + txtMail.Text + "'"; if (db.SetPublish(0, 1, "", wheresql, valuesql, out id) && id == 1) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0072I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0073I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0069I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 增加服务器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { int id = 0; int port = 0; try { port = Convert.ToInt32(txtPort.Text); } catch {} String fieldlist = "名称,地址,端口,用户,密码,送信人地址,服务器类型,UserID,添付文件,HTML"; String valuelist = "'" + txtName.Text + "','" + txtAddress.Text + "'," + port.ToString() + ",'" + txtUser.Text + "','" + txtPassword.Text + "','" + txtSender.Text + "','" + cmbType.Text + "','" + db.UserID + "','" + cmbAttachment.Text + "','" + cmbISHtml.Text + "'"; if (db.SetMailServer(0, 0, fieldlist, "", valuelist, out id)) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0060I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0061I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 更新服务器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int id = 0; String wheresql = "编号=" + txtId.Text; String valuesql = "名称='" + txtName.Text + "',地址='" + txtAddress.Text + "',端口=" + txtPort.Text + ",用户='" + txtUser.Text + "',密码='" + txtPassword.Text + "',送信人地址='" + txtSender.Text + "',服务器类型='" + cmbType.Text + "',添付文件='" + cmbAttachment.Text + "',HTML='" + cmbISHtml.Text + "'" ; if (db.SetMailServer(0, 1, "", wheresql, valuesql, out id) && id == 1) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0062I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0063I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0059I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 文件加密 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEncrpt_Click(object sender, EventArgs e) { if (txtMagPDF.Text == "") { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0085I", db.Language); MessageBox.Show(msg); return; } string password = getPassword(); if (string.IsNullOrEmpty(password)) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0116I", db.Language); MessageBox.Show(msg); return; } string destFile = Path.Combine(Path.GetDirectoryName(txtMagPDF.Text), "_" + Path.GetFileName(txtMagPDF.Text)); try { NCPDF.DecriptPdfDoc(txtMagPDF.Text, destFile, password); File.Delete(txtMagPDF.Text); File.Move(destFile, txtMagPDF.Text); string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0117I", db.Language); MessageBox.Show(msg); } catch (Exception ex) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0118I", db.Language); MessageBox.Show(msg); NCLogger.GetInstance().WriteExceptionLog(ex); } }
/// <summary> /// 增加媒体数据库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { int id = 0; String valueList = "'" + cmbMediaType.Text + "','" + txtMediaURL.Text + "','" + txtAppKey.Text + "','" + txtAppPassword.Text + "','" + txtUserName.Text + "','" + txtPassword.Text + "','" + txtOther.Text + "','" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "','" + cmbPublish.Text + "','" + db.UserID + "'"; if (db.SetMedia(0, 0, "MediaType,MediaURL,MediaAppKey,MediaAppPassword,MediaUser,MediaPassword,other,createtime,published,UserID", "", valueList, out id)) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0051I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0052I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 语言变化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cboxLanguage_SelectedIndexChanged(object sender, EventArgs e) { if (isInital) { return; } if (cboxLanguage.Text == "中文") { Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("zh-CN"); SetLanguageValue("zh-CN"); } else if (cboxLanguage.Text == "日本語") { Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("ja-JP"); SetLanguageValue("ja-JP"); } else { Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("en"); SetLanguageValue("en"); } string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0012I", db.Language); if (MessageBox.Show(msg, "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Application.Exit(); } }
/// <summary> /// 更新客户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int id = 0; String valueList = "Cname='" + txtCname.Text + "',name='" + txtName.Text + "',postcode='" + txtPostCode.Text + "',address='" + txtAddress.Text + "',tel='" + txtTel.Text + "',fax='" + txtFax.Text + "',kind='" + cmbKind.Text + "',format='" + cmbFormat.Text + "',scale='" + txtScale.Text + "',CYMD='" + txtCYMD.Text + "',other='" + txtOther.Text + "',mail='" + txtMail.Text + "',web='" + txtWeb.Text + "',jCName='" + txtJCname.Text + "',createtime='" + txtCreateTime.Text + "',subscripted='" + cmbSubscript.Text + "'"; if (db.SetCustomer(0, 1, "", "id=" + txtId.Text, valueList, out id) && id == 1) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0003I", db.Language); MessageBox.Show(msg); init("", "", ""); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0004I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0000I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 删除ツール /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUnInstall_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { int id = 0; String wheresql = "ToolName='" + txtToolName.Text + "' AND ToolLanguange='" + txtLanguageType.Text + "' and UserID='" + db.UserID + "'"; if (db.SetToolConfig(0, 2, "", wheresql, "", out id) && id == 2) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0157I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0158I", db.Language); MessageBox.Show(msg); } } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0152I", db.Language); MessageBox.Show(msg); } }
/// <summary> /// 仕事履歴追加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { int id = 0; string fieldList = "EmpId,"; fieldList += "[StartDate],"; fieldList += "[EndDate],"; fieldList += "[Country],"; fieldList += "[Content],"; fieldList += "[Tool],"; fieldList += "[Role],"; fieldList += "[Range],"; fieldList += "[Company],"; fieldList += "[Sender],"; fieldList += "[Customer],"; fieldList += "[Address],"; fieldList += "[Tel],"; fieldList += "[PriceType],"; fieldList += "[Price],"; fieldList += "[UpTime],"; fieldList += "[UpPrice],"; fieldList += "[DownTime],"; fieldList += "[DownPrice],"; fieldList += "[PaymentDay],UserId"; String valuelist = "" + resumeid + ",'" + txtStartDate.Text + "','" + txtEndDate.Text + "','" + txtCountry.Text + "','" + txtContent.Text + "','" + txtTool.Text + "','" + txtRole.Text + "','" + txtRange.Text + "','" + txtCompany.Text + "','" + txtSender.Text + "','" + txtCustomer.Text + "','" + txtAddress.Text + "','" + txtTel.Text + "','" + txtPriceType.Text + "'," + txtPrice.Text + "," + txtUpTime.Text + "," + txtUpPrice.Text + "," + txtDownTime.Text + "," + txtDownPrice.Text + ",'" + txtPaymentDay.Text + "','" + db.db.UserID + "'"; if (db.SetSend(0, 0, fieldList, "", valuelist, out id)) { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0180I", db.db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.db.Language).GetMessageById("CM0181I", db.db.Language); MessageBox.Show(msg); } }
/// <summary> /// 创建封底 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddBotom_Click(object sender, EventArgs e) { OpenFileDialog opendlg = new OpenFileDialog(); opendlg.Filter = "PPT file|*.pptx"; if (opendlg.ShowDialog() == DialogResult.OK) { String pptfile = opendlg.FileName; SaveFileDialog savedlg = new SaveFileDialog(); savedlg.Filter = "PDF file|*.pdf"; if (savedlg.ShowDialog() == DialogResult.OK) { NCPPT ppt = new NCPPT(); if (!ppt.PPTOpen(pptfile)) { string msg = String.Format(NCMessage.GetInstance(db.Language).GetMessageById("CM0098I", db.Language), pptfile); MessageBox.Show(msg); return; } String[] txtText = new String[3]; txtText[0] = PublishName; txtText[1] = System.DateTime.Now.ToString("yyyy年MM月dd日"); txtText[2] = Url; if (!ppt.WriteList(txtText)) { string msg = String.Format(NCMessage.GetInstance(db.Language).GetMessageById("CM0099I", db.Language), pptfile); MessageBox.Show(msg); ppt.PPTClose(); return; } string pdffile = savedlg.FileName; if (!ppt.PPTSaveAsPDF(pdffile)) { string msg = String.Format(NCMessage.GetInstance(db.Language).GetMessageById("CM0100I", db.Language), pptfile); MessageBox.Show(msg); ppt.PPTClose(); return; } ppt.PPTClose(); int id = 0; String fieldlist = "期刊编号,发行编号,文件序号,文件栏目,文件名称,文件页数,UserID"; String valuelist = MagId.ToString() + "," + PublishId.ToString() + "," + BottomNum.ToString() + ",'','" + pdffile + "',1,'" + db.UserID + "'"; if (db.SetFile(0, 0, fieldlist, "", valuelist, out id)) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0094I", db.Language); MessageBox.Show(msg); init(); } else { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0095I", db.Language); MessageBox.Show(msg); } } } }
/// <summary> /// 启动数据库安装程序 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnInstall_Click(object sender, EventArgs e) { string filepath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"db\SqlSetup.exe"); string exepath = "{0}"; string parapath = "/qb username='******' companyname='chojo' addlocal=ALL disablenetworkprotocols='0' instancename='{0}' SECURITYMODE='SQL' SAPWD='{1}'"; string cmd = null; string para = null; int OSbits = getOSArchitecture(); string instance = txtDataSource.Text; instance = instance.Substring(instance.IndexOf(@"\") + 1); string toolPath = null; for (int i = 3; i < 26; i++) { toolPath = Convert.ToChar('A' + i) + @":\SQLEXPRESS"; if (Directory.Exists(toolPath)) { break; } toolPath = null; } if (toolPath == null) { string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0164I", db.Language); MessageBox.Show(msg); return; } if (db.Language == "zh-CN") { if (OSbits == 32) { cmd = string.Format(exepath, Path.Combine(toolPath, "SQLEXPR_CHS.EXE")); } else { cmd = string.Format(exepath, Path.Combine(toolPath, "SQLEXPR_x64_CHS.EXE")); } } else if (db.Language == "ja-JP") { if (OSbits == 32) { cmd = string.Format(exepath, Path.Combine(toolPath, "SQLEXPR_ADV_JPN.EXE")); } else { cmd = string.Format(exepath, Path.Combine(toolPath, "SQLEXPRADV_x64_JPN.EXE")); } para = string.Format(parapath, instance, txtPwd.Text); FormMain.ExecuteCommand(cmd, para, toolPath, true); } else { FormMain.ExecuteCommand(filepath, "", "", false); } }