using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using Pub_Class;
|
|
namespace OAM
|
{
|
public partial class frmSMsg : Form
|
{
|
public frmSMsg()
|
{
|
InitializeComponent();
|
}
|
//´«ËÍ
|
public const int HFileNameCol = 0;//huan
|
public const int HFilePathCol = 1;
|
public const int HUpManCol = 2;
|
public const int HROperatorCol = 3;
|
public const int iFileIDCSCol = 4;
|
public const int LoadDateCol = 5;
|
public const int HBillStatusCol = 6;
|
//½ÓÊÕ
|
public const int HFileNameJSCol = 0;//huan
|
public const int HFilePathJSCol = 1;
|
public const int HUpManJSCol = 2;
|
public const int HROperatorJSCol = 3;
|
public const int iFileIDJSCol = 4;
|
public const int LoadDateJSCol = 5;
|
public const int HBillStatusJSCol = 6;
|
|
public long ID;
|
//public const int MainType = 5;
|
|
|
public string fromoperator; //×Ô¼º
|
public string tooperator;
|
|
|
//public const string ModCaption = fromoperator; //µ¥¾ÝÃû³Æ
|
private void button3_Click(object sender, EventArgs e)
|
{
|
DBUtility.ClsPub.SaveGridView(grdmain, this.Name, DBUtility.ClsPub.AppPath);
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
if (txtMsg.Text == "")
|
{
|
MessageBox.Show("ÇëÌîд»Ø¸´ÄÚÈÝ£¡");
|
}
|
string Context = txtMsg.Text.Replace("'", "¡®");
|
int Rows = grdmain.Rows.Count + 1;
|
oCn.RunProc("Insert into oa_msg(fromoperator,tooperator,context,opdate,isview) values('" + fromoperator + "','" + tooperator + "','" + txtMsg.Text.Trim() + "','" + DateTime.Now.ToString() + "'," + 0 + ")");
|
txtMsg.Text = "";
|
Display();
|
}
|
//ÏÔʾ´«Ë͸½¼þ
|
private void DisplayCSFJ()//huan
|
{
|
SQLHelper.ClsCNK3 oCn = new SQLHelper.ClsCNK3();
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("Select top 5 MainID,sPath,sFileName,operator,ROperator,LoadDate,HBillStatus from oa_PicBill where operator='" + fromoperator + "' and ROperator='" + tooperator + "'", "oa_PicBill");
|
if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
{
|
return;
|
}
|
for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
|
{
|
grdCSFJ.Rows.Add();
|
grdCSFJ.Rows[i].Cells[HFileNameCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["sFileName"]);
|
grdCSFJ.Rows[i].Cells[HFilePathCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["sPath"]);
|
grdCSFJ.Rows[i].Cells[HUpManCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["operator"]);
|
grdCSFJ.Rows[i].Cells[HROperatorCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["ROperator"]);
|
grdCSFJ.Rows[i].Cells[iFileIDCSCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["MainID"]);
|
grdCSFJ.Rows[i].Cells[LoadDateCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["LoadDate"]);
|
grdCSFJ.Rows[i].Cells[HBillStatusCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["HBillStatus"]);
|
string HBillStatus = grdCSFJ.Rows[i].Cells[HBillStatusCol].Value.ToString();
|
if (HBillStatus == "0")
|
{
|
grdCSFJ.Rows[i].Cells[HBillStatusCol].Value = "δÏÂÔØ";
|
}
|
else
|
{
|
if (HBillStatus == "1")
|
{
|
grdCSFJ.Rows[i].Cells[HBillStatusCol].Value = "ÒÑÏÂÔØ";
|
}
|
else
|
{
|
grdCSFJ.Rows[i].Cells[HBillStatusCol].Value = "¶Ô·½ÒѾܾø";
|
}
|
}
|
}
|
}
|
//ÏÔʾ½ÓÊÕ¸½¼þ
|
private void DisplayJSFJ()//huan
|
{
|
SQLHelper.ClsCNK3 oCn = new SQLHelper.ClsCNK3();
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("Select top 5 ID,MainID,sPath,sFileName,operator,ROperator,LoadDate,HBillStatus from oa_PicBill where operator='" + tooperator + "' and ROperator='" + fromoperator + "'", "oa_PicBill");
|
if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
{
|
return;
|
}
|
for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
|
{
|
grdJSFJ.Rows.Add();
|
grdJSFJ.Rows[i].Cells[HFileNameJSCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["sFileName"]);
|
grdJSFJ.Rows[i].Cells[HFilePathJSCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["sPath"]);
|
grdJSFJ.Rows[i].Cells[HUpManJSCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["operator"]);
|
grdJSFJ.Rows[i].Cells[HROperatorJSCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["ROperator"]);
|
grdJSFJ.Rows[i].Cells[iFileIDJSCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["ID"]);
|
grdJSFJ.Rows[i].Cells[LoadDateCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["LoadDate"]);
|
grdJSFJ.Rows[i].Cells[HBillStatusCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["HBillStatus"]);
|
string HBillStatus = grdJSFJ.Rows[i].Cells[HBillStatusCol].Value.ToString();
|
if (HBillStatus == "0")
|
{
|
grdJSFJ.Rows[i].Cells[HBillStatusCol].Value = "δÏÂÔØ";
|
}
|
else
|
{
|
|
if (HBillStatus == "1")
|
{
|
grdCSFJ.Rows[i].Cells[HBillStatusCol].Value = "ÒÑÏÂÔØ";
|
}
|
else
|
{
|
grdCSFJ.Rows[i].Cells[HBillStatusCol].Value = "ÒѾܾø";
|
}
|
}
|
}
|
}
|
public void Display()
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet Ds;
|
string sSQL;
|
sSQL = "Select top 50 id hid,fromoperator Óû§,opdate ʱ¼ä,context ÄÚÈÝ from oa_msg where fromoperator='" + tooperator + "' and tooperator='" + fromoperator + "' or tooperator='" + tooperator + "' and fromoperator='" + fromoperator + "' order by ʱ¼ä desc ";
|
//Select id hid,fromoperator Óû§,opdate ʱ¼ä,context ÄÚÈÝ from oa_msg where fromoperator='ÄÚÏú²¿¾Àí' or fromoperator= '¾°»ÀÕÂ' and tooperator='¾°»ÀÕÂ' or tooperator='ÄÚÏú²¿¾Àí'
|
Ds = oCn.RunProcReturn(sSQL, "oa_msg", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (Ds == null)
|
{
|
MessageBox.Show("ÏÔʾʧ°Ü£¡ÔÒò£º" + DBUtility.ClsPub.sExeReturnInfo);
|
return;
|
}
|
grdmain.DataSource = Ds.Tables[0].DefaultView;
|
|
DBUtility.Xt_BaseBillFun.DisplayGrid(grdmain, this.Name, "", 0);
|
//¸½¼þ huan
|
DisplayCSFJ();
|
//DBUtility.ClsPub.GetGridView(grdMain, this.Name, DBUtility.ClsPub.AppPath);
|
DBUtility.ClsPub.GetGridView(grdCSFJ, this.Name + "grdCSFJ", DBUtility.ClsPub.AppPath);
|
|
//½ÓÊÕ¸½¼þ huan
|
DisplayJSFJ();
|
//DBUtility.ClsPub.GetGridView(grdMain, this.Name, DBUtility.ClsPub.AppPath);
|
DBUtility.ClsPub.GetGridView(grdJSFJ, this.Name + "grdJSFJ", DBUtility.ClsPub.AppPath);
|
//
|
// SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
|
|
// DataSet Ds;
|
// DataSet Ds2;
|
// Ds = oCn.RunProcReturn("Select * from oa_msg where fromoperator='" + fromoperator + "' and tooperator='" + tooperator + "' and isview=0 order by opdate", "oa_msg", ref DBUtility.ClsPub.sExeReturnInfo);
|
// if (Ds == null)
|
// {
|
// MessageBox.Show("ÏÔʾʧ°Ü£¡ÔÒò£º" + DBUtility.ClsPub.sExeReturnInfo);
|
// return;
|
// }
|
|
//// Do While Not oRs.EOF
|
//grdmain.AddItem ""
|
//If IIf(IsNull(oRs!isxt), False, oRs!isxt) = True Then
|
// grdmain.TextMatrix(grdmain.Rows - 1, 0) = "ϵͳÏûÏ¢£º " & oRs!context
|
// grdmain.Cell(flexcpForeColor, grdmain.Rows - 1, 0, grdmain.Rows - 1, 0) = vbRed
|
////Else
|
//// grdmain.TextMatrix(grdmain.Rows - 1, 0) = oRs!fromoperator & " ˵£º " & oRs!context
|
//// grdmain.Cell(flexcpForeColor, grdmain.Rows - 1, 0, grdmain.Rows - 1, 0) = vbBlue
|
////End If
|
////oCn.Execute "update oa_msg set isview=1 where id=" & oRs!ID
|
////oRs.MoveNext
|
// grdmain.ColumnHeadersVisible = false;
|
// //grdmain.Columns[0].Visible = false;
|
// //grdMain.Columns[0].Width = 100;
|
// //grdMain.Columns[1].Width = 1000;
|
// DBUtility.ClsPub.GetGridView(grdmain, this.Name, DBUtility.ClsPub.AppPath);
|
}
|
|
private void grdmain_Scroll(object sender, ScrollEventArgs e)
|
{
|
|
grdmain.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True;
|
}
|
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
timer1.Enabled = false;
|
//timer1.Interval = 60000;
|
//SetOperator();
|
Display();
|
}
|
private void SetOperator()
|
{
|
SQLHelper.ClsCNK3 oCn = new SQLHelper.ClsCNK3();
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("Select top 5 ID,MainID,sPath,sFileName,operator,ROperator,LoadDate,HBillStatus from oa_PicBill where operator='" + tooperator + "' and ROperator='" + fromoperator + "'", "oa_PicBill");
|
if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
{
|
return;
|
}
|
for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
|
{
|
grdJSFJ.Rows[i].Cells[HBillStatusCol].Value = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["HBillStatus"]);
|
string HBillStatus = grdJSFJ.Rows[i].Cells[HBillStatusCol].Value.ToString();
|
if (HBillStatus == "0")
|
{
|
pictureBox1.Visible = false;
|
pictureBox1.Visible = true;
|
grdJSFJ.Rows[i].Cells[HBillStatusCol].Value = "δÏÂÔØ";
|
}
|
else
|
{
|
if (HBillStatus == "1")
|
{
|
pictureBox1.Visible = true;
|
grdJSFJ.Rows[i].Cells[HBillStatusCol].Value = "ÒÑÏÂÔØ";
|
}
|
else
|
{
|
pictureBox1.Visible = true;
|
grdCSFJ.Rows[i].Cells[HBillStatusCol].Value = "ÒѾܾø";
|
}
|
}
|
}
|
}
|
|
|
private void cmdCancel_Click(object sender, EventArgs e)
|
{
|
Close();
|
}
|
|
private void button2_Click(object sender, EventArgs e)
|
{
|
frmUserset ofrmUserset = new frmUserset();
|
ofrmUserset.UserName = tooperator;
|
ofrmUserset.Show();
|
}
|
|
private void cmdQMsgList_Click(object sender, EventArgs e)
|
{
|
QMsgList oQMsgList = new QMsgList();
|
|
oQMsgList.fromoperator=fromoperator;
|
oQMsgList.tooperator = tooperator;
|
oQMsgList.Show();
|
}
|
|
private void frmSMsg_Load(object sender, EventArgs e)
|
{
|
|
string ModCaption = tooperator; //µ¥¾ÝÃû³Æ
|
initGridFJ();
|
initGridJSFJ();
|
|
this.Text = "Óë " + tooperator + "ÁÄÌìÖÐ";
|
}
|
private void initGridFJ()//huan
|
{
|
grdCSFJ.ColumnCount = 7; //×ÜÁÐÊý
|
DBUtility.Xt_BaseBillFun.initGridFst(grdCSFJ, this.Name + "grdCSFJ");
|
grdCSFJ.ReadOnly = true;
|
grdCSFJ.RowCount = 0;
|
//=
|
grdCSFJ.Columns[HFileNameCol].HeaderText = "ÎļþÃû³Æ";
|
grdCSFJ.Columns[HFilePathCol].HeaderText = "Îļþ·¾¶";
|
grdCSFJ.Columns[HUpManCol].HeaderText = "ÉÏ´«ÈË";
|
grdCSFJ.Columns[HROperatorCol].HeaderText = "½ÓÊÕÈË";
|
grdCSFJ.Columns[LoadDateCol].HeaderText = "´«ËÍʱ¼ä";
|
grdCSFJ.Columns[HBillStatusCol].HeaderText = "״̬";
|
grdCSFJ.Columns[iFileIDCSCol].HeaderText = "ID";
|
|
grdCSFJ.Columns[HFilePathCol].Visible = false;
|
grdCSFJ.Columns[HUpManCol].Visible = false;
|
grdCSFJ.Columns[HROperatorCol].Visible = false;
|
grdCSFJ.Columns[iFileIDCSCol].Visible = false;
|
DBUtility.ClsPub.GetGridView(grdCSFJ, this.Name + "grdCSFJ", DBUtility.ClsPub.AppPath);
|
}
|
private void initGridJSFJ()//huan
|
{
|
grdJSFJ.ColumnCount = 7; //×ÜÁÐÊý
|
DBUtility.Xt_BaseBillFun.initGridFst(grdJSFJ, this.Name + "grdJSFJ");
|
grdJSFJ.ReadOnly = true;
|
grdJSFJ.RowCount = 0;
|
//=
|
grdJSFJ.Columns[HFileNameJSCol].HeaderText = "ÎļþÃû³Æ";
|
grdJSFJ.Columns[HFilePathJSCol].HeaderText = "Îļþ·¾¶";
|
grdJSFJ.Columns[HUpManJSCol].HeaderText = "ÉÏ´«ÈË";
|
grdJSFJ.Columns[HROperatorJSCol].HeaderText = "½ÓÊÕÈË";
|
grdJSFJ.Columns[LoadDateJSCol].HeaderText = "´«ËÍʱ¼ä";
|
grdJSFJ.Columns[HBillStatusCol].HeaderText = "״̬";
|
grdJSFJ.Columns[iFileIDJSCol].HeaderText = "ID";
|
|
grdJSFJ.Columns[HFilePathCol].Visible = false;
|
grdJSFJ.Columns[HUpManCol].Visible = false;
|
grdJSFJ.Columns[HROperatorCol].Visible = false;
|
grdJSFJ.Columns[iFileIDJSCol].Visible = false;
|
DBUtility.ClsPub.GetGridView(grdJSFJ, this.Name + "grdJSFJ", DBUtility.ClsPub.AppPath);
|
}
|
private void button5_Click(object sender, EventArgs e)
|
{
|
OpenFileDialog oDlg = new OpenFileDialog();
|
oDlg.Filter = "ËùÓÐÎļþ|*.*";
|
if (oDlg.ShowDialog() == DialogResult.OK)
|
{
|
if (oDlg.FileName != "")
|
{
|
//ÉÏ´«¸½¼þ huanxin
|
BLL.ClsXt_FileCtrl oFile = new BLL.ClsXt_FileCtrl();
|
string LoadDate = DateTime.Now.ToString();
|
grdCSFJ.Rows.Add();
|
grdCSFJ.Rows[grdCSFJ.Rows.Count - 1].Cells[HFileNameCol].Value = oDlg.SafeFileName;
|
grdCSFJ.Rows[grdCSFJ.Rows.Count - 1].Cells[HFilePathCol].Value = oDlg.FileName;
|
grdCSFJ.Rows[grdCSFJ.Rows.Count - 1].Cells[HUpManCol].Value = DBUtility.ClsPub.CurUserName;
|
grdCSFJ.Rows[grdCSFJ.Rows.Count - 1].Cells[HROperatorCol].Value = tooperator;
|
grdCSFJ.Rows[grdCSFJ.Rows.Count - 1].Cells[LoadDateJSCol].Value = LoadDate;
|
|
grdCSFJ.Rows[grdCSFJ.Rows.Count - 1].Cells[HBillStatusCol].Value = "δÏÂÔØ";
|
|
if (oFile.LoadUpFile2(iFileIDCSCol, oDlg.FileName, 0, oDlg.SafeFileName, DBUtility.ClsPub.CurUserName, tooperator, LoadDate,0) == false)
|
{
|
MessageBox.Show("ÉÏ´«Îļþʱʧ°Ü!");
|
}
|
|
|
}
|
}
|
}
|
|
private void button6_Click(object sender, EventArgs e)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
if (grdJSFJ.CurrentRow == null)
|
{
|
|
return;
|
}
|
//ÏÂÔØ¸½¼þµ½±¾µØ£¬²¢Ö´ÐÐ
|
BLL.ClsXt_FileCtrl oFile2 = new BLL.ClsXt_FileCtrl();
|
SQLHelper.ClsCNK3 oCNK32 = new SQLHelper.ClsCNK3();
|
if (oFile2.WriteFile2("Pic"
|
, DBUtility.ClsPub.AppPath + @"\a\" + DBUtility.ClsPub.isStrNull(grdJSFJ.Rows[grdJSFJ.CurrentRow.Index].Cells[HFileNameCol].Value)
|
, DBUtility.ClsPub.isLong(grdJSFJ.Rows[grdJSFJ.CurrentRow.Index].Cells[iFileIDJSCol].Value), oCNK32) == false)
|
{
|
MessageBox.Show("¶ÁÈ¡Îļþʱʧ°Ü!");
|
return;
|
}
|
System.Diagnostics.Process.Start(DBUtility.ClsPub.AppPath + @"\a\" + DBUtility.ClsPub.isStrNull(grdJSFJ.Rows[grdJSFJ.CurrentRow.Index].Cells[HFileNameCol].Value));
|
|
}
|
|
private void button8_Click(object sender, EventArgs e)
|
{
|
SQLHelper.ClsCNK3 oCn = new SQLHelper.ClsCNK3();
|
|
if (grdJSFJ.CurrentRow == null)
|
{
|
|
return;
|
}
|
oCn.RunProc("Update oa_PicBill set " +
|
"HBillStatus= 2 Where ID =" + DBUtility.ClsPub.isLong(grdJSFJ.Rows[grdJSFJ.CurrentRow.Index].Cells[iFileIDJSCol].Value), ref DBUtility.ClsPub.sExeReturnInfo);
|
//if (DBUtility.ClsPub.isStrNull(grdJSFJ.Rows[grdJSFJ.CurrentRow.Index].Cells[HUpManCol].Value) != DBUtility.ClsPub.CurUserName)
|
//{
|
//MessageBox.Show("Ö»ÄÜɾ³ý×Ô¼ºÉÏ´«µÄ¸½¼þ£¡");
|
//return;
|
//}
|
//DialogResult dr = MessageBox.Show("È·¶¨ÒªÉ¾³ý´Ëµ¥¾ÝÂð£¿", "Ìáʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
//if (dr == DialogResult.Yes)
|
//{
|
//if (!DBUtility.ClsPub.Security_Log("OA_Manager", 1, true, DBUtility.ClsPub.CurUserName))
|
//{
|
// return;
|
//}
|
//ɾ³ý¸½¼þ
|
//BLL.ClsXt_FileCtrl oFile = new BLL.ClsXt_FileCtrl();
|
//SQLHelper.ClsCNK3 oCNK3 = new SQLHelper.ClsCNK3();
|
//if (oFile.DeleteFile3(DBUtility.ClsPub.isLong(grdJSFJ.Rows[grdJSFJ.CurrentRow.Index].Cells[iFileIDJSCol].Value), ref DBUtility.ClsPub.sExeReturnInfo, oCNK3) == false)
|
//{
|
// MessageBox.Show("ɾ³ýÎļþʱʧ°Ü!");
|
//}
|
//
|
//grdJSFJ.Rows.RemoveAt(grdJSFJ.CurrentRow.Index);
|
//}
|
//else
|
//{
|
//}
|
}
|
|
private void button7_Click(object sender, EventArgs e)
|
{
|
if (grdJSFJ.CurrentRow == null)
|
{
|
|
return;
|
}
|
//FolderBrowserDialog fbd = new FolderBrowserDialog();
|
//fbd.ShowDialog();
|
//string folderName = fbd.SelectedPath; //»ñµÃÑ¡ÔñµÄÎļþ¼Ð·¾¶
|
|
SaveFileDialog sfd = new SaveFileDialog();
|
sfd.FileName = DBUtility.ClsPub.isStrNull(grdJSFJ.Rows[grdJSFJ.CurrentRow.Index].Cells[HFileNameCol].Value);
|
//sfd.Filter = "all|*.*"; //ɾѡ¡¢É趨ÎļþÏÔʾÀàÐÍ
|
sfd.AddExtension = false;
|
sfd.ShowDialog();
|
string path = sfd.FileName;
|
//ÏÂÔØ¸½¼þµ½±¾µØ£¬²¢Ö´ÐÐ
|
BLL.ClsXt_FileCtrl oFile2 = new BLL.ClsXt_FileCtrl();
|
SQLHelper.ClsCNK3 oCNK32 = new SQLHelper.ClsCNK3();
|
if (oFile2.WriteFile2("Pic"
|
, path
|
, DBUtility.ClsPub.isLong(grdJSFJ.Rows[grdJSFJ.CurrentRow.Index].Cells[iFileIDJSCol].Value), oCNK32) == false)
|
{
|
MessageBox.Show("¶ÁÈ¡Îļþʱʧ°Ü!");
|
return;
|
}
|
MessageBox.Show("±£´æ³É¹¦!");
|
//System.Diagnostics.Process.Start(folderName + @"\" + DBUtility.ClsPub.isStrNull(grdJSFJ.Rows[grdJSFJ.CurrentRow.Index].Cells[HFileNameCol].Value));
|
|
}
|
|
|
|
|
|
}
|
}
|