private void LoginIn_Load(object sender, EventArgs e) { try { TUN.Text = XmlOper.getusername(); TPW.Focus(); } catch (Exception err) { MessageBox.Show(err.ToString()); } }
private void LG_Click_1(object sender, EventArgs e) { string aa, bb; aa = TUN.Text.Trim(); bb = TPW.Text.Trim(); if (aa == "" || bb == "") { MessageBox.Show("用户名和密码都不能为空!"); return; } try { WSR.PPSPLLogin rlong = new WSR.PPSPLLogin(); string flag = rlong.ValidateLogin(aa, bb); //flag = rlong.ValidateLogin(aa, bb); if (flag == "1") { MainForm f1 = new MainForm(); //setXML(aa); XmlOper.setXML(aa); this.Hide(); f1.Show(); } else { MessageBox.Show("登录失败,输入密码或者用户名错误!"); return; } } catch (Exception err) { string flag = User.CheckLogin(aa, bb); //flag = rlong.ValidateLogin(aa, bb); if (flag == "1") { MainForm f1 = new MainForm(); //setXML(aa); XmlOper.setXML(aa); this.Hide(); f1.Show(); } else { MessageBox.Show("登录失败,输入密码或者用户名错误!"); return; } //MessageBox.Show(err.ToString()); } }
private void menuItem5_Click(object sender, EventArgs e) { if (this.dataGrid1.CurrentRowIndex >= 0) { WSR.PPSPLLogin ppspl = new CIMCPPSPL.WSR.PPSPLLogin(); int rowcount = dataGrid1.VisibleRowCount; if (rowcount == 0) { return; } string CheckFlag = "NO"; for (int i = 0; i < rowcount; i++) { if (dataGrid1.IsSelected(i)) { CheckFlag = "YES"; } } if (CheckFlag == "NO") { MessageBox.Show("请选择要取消的数据行!", "操作提示"); return; } for (int i = 0; i < rowcount; i++) { if (dataGrid1.IsSelected(i)) { string projectid = dataGrid1[i, 0].ToString(); string spoolname = dataGrid1[i, 1].ToString(); string orastr = "update spool_tab t set t.locked = 0 " + "where t.spoolname = '" + spoolname + "' and t.projectid = '" + projectid + "' and t.flowstatus = 7 " + "and t.locked= 1 and t.flag='Y'"; string orastrlog = "insert into spflowlog_tab(spoolname,username,flowstatus,remark,projectid) values('" + spoolname + "','" + XmlOper.getusername() + "',12,'此数据已取消在手机端处理','" + projectid + "') "; string[] updatestr = new string[2]; updatestr[0] = orastr; updatestr[1] = orastrlog; //更新锁定数据之前检查数据是否已经被处理 try { string aaa = ppspl.UpdateDs(updatestr); } catch (Exception err) { MessageBox.Show("请检查手机是否已经正确连接至电脑!!"); return; } //将数据下载从手机端的SQLITE数据库删除 string p_proName = dataGrid1[i, 0].ToString(); string p_SpoolName = dataGrid1[i, 1].ToString(); string sqlstr = "delete from SPOOL_TAB where projectid='" + p_proName + "' and spoolname ='" + p_SpoolName + "'"; int flag = User.RUNSQLCommon(sqlstr); if (flag > 0) { } else { MessageBox.Show("取消下载数据失败!", "提示消息"); return; } } } MessageBox.Show("取消下载数据成功", "提示消息"); projectStr = comboBox1.Text.Trim(); spoolnameStr = textBox1.Text.Trim(); string sqlString = "SELECT PROJECTID AS 项目号, SPOOLNAME AS 小票号, SYSTEMID AS 系统号, SYSTEMNAME AS 系统名, PIPEGRADE AS 管路等级, SURFACETREATMENT AS 表面处理, WORKINGPRESSURE AS 工作压力, PRESSURETESTFIELD AS 压力测试场所, PIPECHECKFIELD AS 校管场所 , SPOOLWEIGHT AS 小票重量, PAINTCOLOR AS 油漆颜色, CABINTYPE AS 舱室种类, REVISION AS 小票版本, SPOOLMODIFYTYPE AS 小票修改种类,ELBOWTYPE AS 弯头形式, WELDTYPE AS 点焊件, DRAWINGNO AS 图号, BLOCKNO AS 分段号, MODIFYDRAWINGNO AS 修改通知单号, REMARK AS 备注, FLAG AS 版本标识, LOGNAME AS 登录名, SYSTEMTIME AS 系统时间, LINENAME AS 线号, (SELECT NAME FROM spflowstatus_tab s WHERE s.ID=FLOWSTATUS) AS 流程状态标识, (SELECT NAME FROM QCSTATTUS_TAB s WHERE s.ID=LOCKED) as 锁定状态 from spool_tab t where t.projectid like '%" + projectStr + "%' and t.spoolname like '%" + spoolnameStr + "%' and t.flowstatus =12 and t.locked=1"; DataSet Ds = User.GetDataSetCommon(sqlString, "spool_tab"); dataGrid1.DataSource = Ds.Tables[0].DefaultView; } }
private void menuItem2_Click(object sender, EventArgs e) { if (this.dataGrid1.CurrentRowIndex >= 0) { WSR.PPSPLLogin ppspl = new CIMCPPSPL.WSR.PPSPLLogin(); int rowcount = dataGrid1.VisibleRowCount; if (rowcount == 0) { return; } string CheckFlag = "NO"; for (int i = 0; i < rowcount; i++) { if (dataGrid1.IsSelected(i)) { CheckFlag = "YES"; } } if (CheckFlag == "NO") { MessageBox.Show("请选择要下载的数据行!", "操作提示"); return; } for (int i = 0; i < rowcount; i++) { if (dataGrid1.IsSelected(i)) { string projectid = dataGrid1[i, 0].ToString(); string spoolname = dataGrid1[i, 1].ToString(); string orastr = "update spool_tab t set t.locked = 1 " + "where t.spoolname = '" + spoolname + "' and t.projectid = '" + projectid + "' and t.flowstatus = 12 " + "and t.locked= 0"; string orastrlog = "insert into spflowlog_tab(spoolname,username,flowstatus,remark,projectid) values('" + spoolname + "','" + XmlOper.getusername() + "',12,'此数据已下载到手机端处理','" + projectid + "') "; string[] updatestr = new string[2]; updatestr[0] = orastr; updatestr[1] = orastrlog; //更新锁定数据之前检查数据是否已经被处理 try { if (ppspl.GetSpoolStatus(spoolname) != "12") { MessageBox.Show("你所选数据已经被另一用户处理。请重新选择", "提示消息"); return; } } catch (Exception err) { MessageBox.Show(err.ToString() + ":请检查手机是否已经正确连接至电脑!!"); return; } //锁定数据 string eflag = ppspl.UpdateDs(updatestr); //将数据下载写入至手机端的SQLITE数据库 string p_proName = dataGrid1[i, 0].ToString(); string p_SpoolName = dataGrid1[i, 1].ToString(); string p_SysID = dataGrid1[i, 2].ToString(); string p_SysName = dataGrid1[i, 3].ToString(); string p_PipeClass = dataGrid1[i, 4].ToString(); string p_Surface = dataGrid1[i, 5].ToString(); string p_Pressure = dataGrid1[i, 6].ToString(); string p_TestPlace = dataGrid1[i, 7].ToString(); string p_PipeCheck = dataGrid1[i, 8].ToString(); string p_SpoolWeight = dataGrid1[i, 9].ToString(); string p_PaintColor = dataGrid1[i, 10].ToString(); string p_Canbin = dataGrid1[i, 11].ToString(); string p_Rev = dataGrid1[i, 12].ToString(); string p_ModifyType = dataGrid1[i, 13].ToString(); string p_ElbowType = dataGrid1[i, 14].ToString(); string p_WeldType = dataGrid1[i, 15].ToString(); string p_DrawingNo = dataGrid1[i, 16].ToString(); string p_BlockNo = dataGrid1[i, 17].ToString(); string p_ModifyDrawingNO = dataGrid1[i, 18].ToString(); string p_Remark = dataGrid1[i, 19].ToString(); string p_LogName = dataGrid1[i, 21].ToString(); string p_LogTime = dataGrid1[i, 22].ToString(); string p_LineName = dataGrid1[i, 23].ToString(); string sqlstr = "insert into SPOOL_TAB(PROJECTID,SPOOLNAME,SYSTEMID,SYSTEMNAME,PIPEGRADE,SURFACETREATMENT,WORKINGPRESSURE,PRESSURETESTFIELD,PIPECHECKFIELD,SPOOLWEIGHT," + "PAINTCOLOR,CABINTYPE,REVISION,SPOOLMODIFYTYPE,ELBOWTYPE,WELDTYPE,DRAWINGNO,BLOCKNO,MODIFYDRAWINGNO,REMARK,LOGNAME,SYSTEMTIME,LINENAME,FLOWSTATUS,LOCKED)" + " values('" + p_proName + "','" + p_SpoolName + "','" + p_SysID + "','" + p_SysName + "','" + p_PipeClass + "','" + p_Surface + "','" + p_Pressure + "','" + p_TestPlace + "','" + p_PipeCheck + "','" + p_SpoolWeight + "','" + p_PaintColor + "','" + p_Canbin + "','" + p_Rev + "','" + p_ModifyType + "','" + p_ElbowType + "','" + p_WeldType + "','" + p_DrawingNo + "','" + p_BlockNo + "','" + p_ModifyDrawingNO + "','" + p_Remark + "','" + p_LogName + "','" + p_LogTime + "','" + p_LineName + "',12,1)"; int flag = User.RUNSQLCommon(sqlstr); if (flag > 0) { } else { MessageBox.Show("下载数据失败!", "提示消息"); return; } } } MessageBox.Show("下载数据成功", "提示消息"); projectStr = comboBox1.Text.Trim(); spoolnameStr = textBox1.Text.Trim().ToUpper(); string sqlString = "SELECT PROJECTID AS 项目号, SPOOLNAME AS 小票号, SYSTEMID AS 系统号, SYSTEMNAME AS 系统名, PIPEGRADE AS 管路等级, SURFACETREATMENT AS 表面处理, WORKINGPRESSURE AS 工作压力, PRESSURETESTFIELD AS 压力测试场所, PIPECHECKFIELD AS 校管场所 , SPOOLWEIGHT AS 小票重量, PAINTCOLOR AS 油漆颜色, CABINTYPE AS 舱室种类, REVISION AS 小票版本, SPOOLMODIFYTYPE AS 小票修改种类,ELBOWTYPE AS 弯头形式, WELDTYPE AS 点焊件, DRAWINGNO AS 图号, BLOCKNO AS 分段号, MODIFYDRAWINGNO AS 修改通知单号, REMARK AS 备注, FLAG AS 版本标识, LOGNAME AS 登录名, SYSTEMTIME AS 系统时间, LINENAME AS 线号, (SELECT NAME FROM spflowstatus_tab s WHERE s.ID=FLOWSTATUS) AS 流程状态标识, (SELECT NAME FROM QCSTATTUS_TAB s WHERE s.ID=LOCKED) as 锁定状态 from spool_tab t where t.projectid like '%" + projectStr + "%' and upper(t.spoolname) like '%" + spoolnameStr + "%' and t.flowstatus =12 and t.flag='Y' and t.locked=0"; //DataSet Ds = User.GetDataSetCommon(sqlString, "spool_tab"); //WSR.PPSPLLogin ppsplnew = new CIMCPPSPL.WSR.PPSPLLogin(); try { DataSet Ds = ppspl.DatagridDs(sqlString, "spool_tab"); dataGrid1.DataSource = Ds.Tables[0].DefaultView; } catch (Exception err) { MessageBox.Show("请检查手机是否已经正确连接至电脑!!"); } } }
private void menuItem1_Click(object sender, EventArgs e) { if (this.dataGrid1.CurrentRowIndex >= 0) { int rowcount = dataGrid1.VisibleRowCount; if (rowcount == 0) { return; } string CheckFlag = "NO"; for (int i = 0; i < rowcount; i++) { if (dataGrid1.IsSelected(i)) { CheckFlag = "YES"; } } if (CheckFlag == "NO") { MessageBox.Show("请选择要上传的数据行!", "操作提示"); return; } try { for (int i = 0; i < rowcount; i++) { if (dataGrid1.IsSelected(i)) { string projectid = dataGrid1[i, 0].ToString(); string spoolname = dataGrid1[i, 1].ToString(); string flowstatus = dataGrid1[i, 24].ToString(); string flowstatusremark = dataGrid1[i, 26].ToString(); string lockresult = "2"; string flowtag = "13"; string remarkstr = "手机上传安装结果:安装完毕待调试"; string orastr = "update spool_tab t set t.locked = " + lockresult + ", t.flowstatusremark='" + remarkstr + "',t.flowstatus=" + flowtag + " where t.spoolname = '" + spoolname + "' and t.projectid = '" + projectid + "' and t.flowstatus = 12 " + "and t.locked= 1"; string pdastr = "update spool_tab set locked =2 where spoolname = '" + spoolname + "' and flowstatus= 13 and projectid = '" + projectid + "'" + "and locked= 1"; string orastrlog = "insert into spflowlog_tab(spoolname,username,flowstatus,remark,projectid) values('" + spoolname + "','" + XmlOper.getusername() + "'," + flowtag + ",'" + remarkstr + "','" + projectid + "') "; string[] updatestr = new string[2]; updatestr[0] = orastr; updatestr[1] = orastrlog; WSR.PPSPLLogin ppspl = new CIMCPPSPL.WSR.PPSPLLogin(); //检查数据是否已经成功处理 if (User.RUNSQLCommon(pdastr) < 0) { MessageBox.Show("你所选数据上传失败。请重新选择上传", "提示消息"); return; } string eflag = ppspl.UpdateDs(updatestr); if (eflag != "aaa") { MessageBox.Show("你所选数据上传失败。请重新选择上传", "提示消息"); return; } } } MessageBox.Show("上传安装结果成功。", "提示消息"); projectStr = comboBox1.Text.Trim(); spoolnameStr = textBox1.Text.Trim().ToUpper(); string sqlString = "SELECT PROJECTID AS 项目号, SPOOLNAME AS 小票号, SYSTEMID AS 系统号, SYSTEMNAME AS 系统名, PIPEGRADE AS 管路等级, SURFACETREATMENT AS 表面处理, WORKINGPRESSURE AS 工作压力, PRESSURETESTFIELD AS 压力测试场所, PIPECHECKFIELD AS 校管场所 , SPOOLWEIGHT AS 小票重量, PAINTCOLOR AS 油漆颜色, CABINTYPE AS 舱室种类, REVISION AS 小票版本, SPOOLMODIFYTYPE AS 小票修改种类,ELBOWTYPE AS 弯头形式, WELDTYPE AS 点焊件, DRAWINGNO AS 图号, BLOCKNO AS 分段号, MODIFYDRAWINGNO AS 修改通知单号, REMARK AS 备注, FLAG AS 版本标识, LOGNAME AS 登录名, SYSTEMTIME AS 系统时间, LINENAME AS 线号, (SELECT NAME FROM spflowstatus_tab s WHERE s.ID=FLOWSTATUS) AS 流程状态标识, (SELECT NAME FROM QCSTATTUS_TAB s WHERE s.ID=LOCKED) as 锁定状态,flowstatusremark as 流程备注 from spool_tab t where t.projectid like '%" + projectStr + "%' and upper(t.spoolname) like '%" + spoolnameStr + "%' and t.flowstatus =13 and t.locked=1"; DataSet Ds = User.GetDataSetCommon(sqlString, "spool_tab"); dataGrid1.DataSource = Ds.Tables[0].DefaultView; } catch (Exception err) { MessageBox.Show("请检查手机是否已经正确连接至电脑!!"); } } }
private void btn_confirm_Click(object sender, EventArgs e) { string aa, bb, cc; aa = TCP.Text.Trim(); bb = TPW.Text.Trim(); cc = TCNP.Text.Trim(); if (aa == "") { MessageBox.Show("请输入原密码!!"); return; } if (bb == "") { MessageBox.Show("请输入新密码!!"); return; } if (cc == "") { MessageBox.Show("请输入确认新密码!!"); return; } if (cc != bb) { MessageBox.Show("两次输入新密码不一致!!"); return; } //string[]sqlarray = new string[1]; string username; WSR.PPSPLLogin rlogin = new WSR.PPSPLLogin(); //string file = "/Storage Card/Input.xml";//从ppc共享文档中读取xml文档 //string file = "c:\\Input.xml";//从openFileDialog中读取xml文档 //string file = "\\My Documents\\Input.xml"; //XmlDocument doc = new XmlDocument(); //doc.Load(file); //XmlNode person = doc.SelectSingleNode("/Project/Person/Name"); //if (person != null) //{ //// username = person.FirstChild.Value.ToString(); //} //else //{ // return; //} username = XmlOper.getusername(); string flag = User.GetDataSetCommon("select * from online_user_tab where username ='******' and password ='******'", "online_user_tab").Tables[0].Rows.Count.ToString(); //MessageBox.Show(flag); if (flag == "1") { //sqlarray[0] = "update user_tab set pass ='******' where name='" + username + "'"; //MessageBox.Show(sqlarray[0]); string updatestr = "update online_user_tab set password ='******' where username='******'"; int flagnew = User.RUNSQLCommon(updatestr); if (flagnew > 0) { MessageBox.Show("更新成功!"); } else { MessageBox.Show("更新失败!"); return; } } else { MessageBox.Show("更新失败,当前密码不对!"); return; } }