private void 编辑图片ToolStripMenuItem_Click(object sender, EventArgs e) { var oids = GetOrderIdsBySelectedGridCell(); var row = dataGridView.Rows[Rowindex]; selcetitem = new clsFile_Managermentinfo(); var model = row.DataBoundItem as clsFile_Managermentinfo; selcetitem = model; if (selcetitem != null) { if (oids.Count < 1) { oids.Add(""); } var form = new frmPicEdit(oids[0], selcetitem); if (form.ShowDialog() == DialogResult.OK) { } } else { MessageBox.Show("请选择条目"); } }
private void toolStripDropDownButton1_Click(object sender, EventArgs e) { var row = dataGridView.Rows[Rowindex]; selcetitem = new clsFile_Managermentinfo(); var model = row.DataBoundItem as clsFile_Managermentinfo; selcetitem = model; var oids = GetOrderIdsBySelectedGridCell(); if (oids.Count > 0 && selcetitem != null && oids[0] != null) { var form = new frmPicEdit(oids[0].ToString(), selcetitem); if (form.ShowDialog() == DialogResult.OK) { } } else { MessageBox.Show("请选择类目再次尝试!"); } }
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { DataGridViewColumn column = dataGridView.Columns[Cloumn_index]; var row = dataGridView.Rows[Rowindex]; selcetitem = new clsFile_Managermentinfo(); var model = row.DataBoundItem as clsFile_Managermentinfo; selcetitem = model; }
private void 编辑属性ToolStripMenuItem_Click(object sender, EventArgs e) { DataGridViewColumn column = dataGridView.Columns[Cloumn_index]; var row = dataGridView.Rows[Rowindex]; selcetitem = new clsFile_Managermentinfo(); var model = row.DataBoundItem as clsFile_Managermentinfo; selcetitem = model; if (selcetitem != null) { var form = new frmNewCreate("", tree_Current_row, selcetitem); if (form.ShowDialog() == DialogResult.OK) { InitializeDataSource(); } } }
private void button1_Click(object sender, EventArgs e) { try { File_Result = new List <clsFile_Managermentinfo>(); clsFile_Managermentinfo iitem = new clsFile_Managermentinfo(); //iitem.T_id = "1"; iitem.wenjianbiaohao = this.txname.Text; iitem.biaoti = textBox1.Text; iitem.wenhao = textBox2.Text; iitem.zhiwendanwei = textBox3.Text; iitem.xingwendanwei = textBox4.Text; iitem.dengjiriqi = this.dateTimePicker1.Value.AddDays(0).Date.ToString("MM/dd/yyyy");; iitem.miji = textBox6.Text; iitem.wenjianleibie = textBox7.Text; iitem.NodeID = tree_Current_row["NodeID"].ToString(); iitem.yeshu = textBox8.Text; iitem.fenshu = textBox9.Text; iitem.wenjianqiriqi = this.dateTimePicker3.Value.AddDays(0).Date.ToString("MM/dd/yyyy");; iitem.wenjianzhiriqi = this.dateTimePicker2.Value.AddDays(0).Date.ToString("MM/dd/yyyy");; iitem.baoguanqixian = this.comboBox1.Text; //备注 iitem.beizhu1 = textBox5.Text; iitem.beizhu2 = textBox10.Text; iitem.beizhu3 = textBox12.Text; iitem.beizhu4 = textBox13.Text; iitem.beizhu5 = textBox14.Text; string ACCid = clsCommHelp.RandomID(); if (filename.Count > 0) { iitem.accfile_id = ACCid; } else { iitem.accfile_id = ""; } List <clsAccFileinfo> accFile_Result = new List <clsAccFileinfo>(); for (int i = 0; i < filename.Count; i++) { clsAccFileinfo temp = new clsAccFileinfo(); if (i != 0) { temp.mark1 += "," + filename[i]; } else { temp.mark1 += filename[i]; } temp.File_name = System.IO.Path.GetFileName(temp.mark1); temp.accfile_id = ACCid; // var strs = System.IO.Directory.GetFiles(temp.mark1.Replace(System.IO.Path.GetFileName(temp.mark1), "")).Where(file => file.ToLower().EndsWith("jpg") || file.ToLower().EndsWith("gif") || file.ToLower().EndsWith("jpeg") || file.ToLower().EndsWith("png")).ToList(); //foreach (string file in strs) { //System.IO.FileInfo fi = new System.IO.FileInfo(file); string serverimg = temp.mark1.Replace(temp.mark1 + "\\", ""); string copyToPath = clsCommHelp.LocationImagePath(temp); //if (File.Exists(copyToPath)) { File.Copy(temp.mark1.Replace(",", ""), copyToPath, true); } temp.mark1 = copyToPath; } accFile_Result.Add(temp); } iitem.beizhu = textBox11.Text; if (iitem1 != null) { iitem.T_id = iitem1.T_id; } File_Result.Add(iitem); clsAllnew BusinessHelp = new clsAllnew(); if (iitem1 != null) { BusinessHelp.Update_File_detail_Server(File_Result); BusinessHelp.deleteaccFil(ACCid); } else { BusinessHelp.InsterFile_detail_Server(File_Result); } BusinessHelp.InsteraccFile_Server(accFile_Result); MessageBox.Show("成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { MessageBox.Show("错误!" + ex.Message, "信息", MessageBoxButtons.OK, MessageBoxIcon.Error); return; throw; } }
public frmNewCreate(string ty, DataRow tree_Current_row1, clsFile_Managermentinfo iitem) { InitializeComponent(); iitem1 = new clsFile_Managermentinfo(); iitem1 = iitem; tree_Current_row = tree_Current_row1; if (iitem == null) { try { textBox7.Text = tree_Current_row["Description"].ToString(); } catch { } this.comboBox1.SelectedIndex = 0; } else { this.txname.Text = iitem.wenjianbiaohao; textBox1.Text = iitem.biaoti; textBox2.Text = iitem.wenhao; textBox3.Text = iitem.zhiwendanwei; textBox4.Text = iitem.xingwendanwei; this.dateTimePicker1.Value = Convert.ToDateTime(iitem.dengjiriqi); textBox6.Text = iitem.miji; textBox7.Text = tree_Current_row["Description"].ToString(); textBox8.Text = iitem.yeshu; textBox9.Text = iitem.fenshu; if (iitem.wenjianqiriqi != null) { this.dateTimePicker3.Value = Convert.ToDateTime(iitem.wenjianqiriqi); } if (iitem.wenjianzhiriqi != null) { this.dateTimePicker2.Value = Convert.ToDateTime(iitem.wenjianzhiriqi); } this.comboBox1.Text = iitem.baoguanqixian; textBox5.Text = iitem.beizhu1; textBox10.Text = iitem.beizhu2; textBox12.Text = iitem.beizhu3; textBox13.Text = iitem.beizhu4; textBox14.Text = iitem.beizhu5; clsAllnew BusinessHelp = new clsAllnew(); List <clsAccFileinfo> dailyResult = new List <clsAccFileinfo>(); if (iitem.accfile_id != null) { string conditions = ""; conditions = "select * from AccFile where accfile_id='" + iitem.accfile_id + "'"; dailyResult = BusinessHelp.find_ACCFile(conditions); listBox1.Items.Clear(); } filename = new List <string>(); foreach (clsAccFileinfo s in dailyResult) { filename.Add(s.mark1); listBox1.Items.Add(System.IO.Path.GetFileName(s.mark1)); } } }
public List <clsFile_Managermentinfo> find_File_Managerment(ref BackgroundWorker bgWorker, string text) { bgWorker1 = bgWorker; OleDbConnection aConnection = new OleDbConnection(ConStr); try { List <clsFile_Managermentinfo> dailyResult = new List <clsFile_Managermentinfo>(); if (aConnection.State == ConnectionState.Closed) { aConnection.Open(); } OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(text, aConnection); OleDbCommandBuilder mybuilder = new OleDbCommandBuilder(myDataAdapter); DataSet ds = new DataSet(); myDataAdapter.Fill(ds, "File_Managerment"); foreach (DataRow emp in ds.Tables["File_Managerment"].Rows) { clsFile_Managermentinfo tempnote = new clsFile_Managermentinfo(); //定义返回值 if (emp["T_id"].ToString() != "") { tempnote.T_id = emp["T_id"].ToString(); } if (emp["wenjianbiaohao"].ToString() != "") { tempnote.wenjianbiaohao = emp["wenjianbiaohao"].ToString(); } if (emp["biaoti"].ToString() != "") { tempnote.biaoti = emp["biaoti"].ToString(); } if (emp["wenhao"].ToString() != "") { tempnote.wenhao = emp["wenhao"].ToString(); } if (emp["zhiwendanwei"].ToString() != "") { tempnote.zhiwendanwei = emp["zhiwendanwei"].ToString(); } if (emp["xingwendanwei"].ToString() != "") { tempnote.xingwendanwei = emp["xingwendanwei"].ToString(); } if (emp["dengjiriqi"].ToString() != "") { tempnote.dengjiriqi = emp["dengjiriqi"].ToString(); } if (emp["miji"].ToString() != "") { tempnote.miji = emp["miji"].ToString(); } if (emp["wenjianleibie"].ToString() != "") { tempnote.wenjianleibie = emp["wenjianleibie"].ToString(); } if (emp["yeshu"].ToString() != "") { tempnote.yeshu = emp["yeshu"].ToString(); } if (emp["fenshu"].ToString() != "") { tempnote.fenshu = emp["fenshu"].ToString(); } if (emp["accfile_id"].ToString() != "") { tempnote.accfile_id = emp["accfile_id"].ToString(); } if (emp["beizhu"].ToString() != "") { tempnote.beizhu = emp["beizhu"].ToString(); } if (emp["NodeID"].ToString() != "") { tempnote.NodeID = emp["NodeID"].ToString(); } if (emp["wenjianqiriqi"].ToString() != "") { tempnote.wenjianqiriqi = emp["wenjianqiriqi"].ToString(); } if (emp["baoguanqixian"].ToString() != "") { tempnote.baoguanqixian = emp["baoguanqixian"].ToString(); } if (emp["beizhu1"].ToString() != "") { tempnote.beizhu1 = emp["beizhu1"].ToString(); } if (emp["beizhu2"].ToString() != "") { tempnote.beizhu1 = emp["beizhu2"].ToString(); } if (emp["beizhu3"].ToString() != "") { tempnote.beizhu1 = emp["beizhu3"].ToString(); } if (emp["beizhu4"].ToString() != "") { tempnote.beizhu1 = emp["beizhu4"].ToString(); } if (emp["beizhu5"].ToString() != "") { tempnote.baoguanqixian = emp["beizhu5"].ToString(); } dailyResult.Add(tempnote); } return(dailyResult); } catch (Exception ex) { if (aConnection.State == ConnectionState.Open) { aConnection.Close(); } aConnection.Dispose(); // bgWorker1.ReportProgress(0, "读取失败 ,请刷新后重新读取!"); return(null); throw ex; } finally { if (aConnection.State == ConnectionState.Open) { aConnection.Close(); } aConnection.Dispose(); } }