public UserInfo GetUserInfoById(int userId) { Hashtable ht = new Hashtable(); ht["id"] = userId; DataRow dr = comm.GetOneRow("select * from users where id=@id", ht); return(ConvertDataRowToInfo(dr)); }
private int CopyFromHead(string billno) { int insertId = 0; string sql = "select top 1 SHIP_ID,VOYAGE_NO,BILL_NO,I_E_FLAG,PACK_NO,I_E_DATE,DEC_TYPE from EHS_SCAN_HEAD where BILL_NO=@BILL_NO"; Hashtable ht = new Hashtable(); ht["BILL_NO"] = billno; DataRow dr = comm.GetOneRow(sql, ht); if (dr != null) { Hashtable htparm = DataRowToHashtable(dr); htparm["Multi_Pack_No"] = 1; htparm["SCAN_NO"] = maxScanNo + 1; htparm["SEND_TYPE"] = dr["DEC_TYPE"]; insertId = comm.InsertByHashtable("EHS_SCAN_TMP1", htparm, true); SendComData(insertId, htparm); UpdateList2(dr["VOYAGE_NO"].ToString(), true); UpdateHead(billno); } else { DataRow drLast = GetLastScanDataInTmp(); if (drLast != null) { ht["SHIP_ID"] = drLast["SHIP_ID"].ToString(); ht["VOYAGE_NO"] = drLast["VOYAGE_NO"].ToString(); ht["I_E_FLAG"] = drLast["I_E_FLAG"].ToString(); ht["I_E_DATE"] = drLast["I_E_DATE"]; ht["PACK_NO"] = 1; ht["DEC_TYPE"] = 1; ht["SCAN_NO"] = maxScanNo + 1; ht["Multi_Pack_No"] = 1; ht["SEND_TYPE"] = 2; insertId = comm.InsertByHashtable("EHS_SCAN_TMP1", ht, true); SendComData(insertId, ht); UpdateList2(drLast["VOYAGE_NO"].ToString(), true); } else { ht["SHIP_ID"] = "111111"; ht["VOYAGE_NO"] = "111111"; ht["I_E_FLAG"] = "I"; ht["I_E_DATE"] = DateTime.Now; ht["PACK_NO"] = 1; ht["DEC_TYPE"] = 1; ht["SCAN_NO"] = maxScanNo + 1; ht["Multi_Pack_No"] = 1; ht["SEND_TYPE"] = 2; insertId = comm.InsertByHashtable("EHS_SCAN_TMP1", ht, true); SendComData(insertId, ht); UpdateList2("111111", true); } } return(insertId); }
public bool GetStatus(string billNo, ref bool[] s) { bool rs = false; string sql = "select top 1 RSK_FLAG,GJ_FLAG,OP_TYPE,READ_FLAG from LH_V2 where BILL_NO =@BILL_NO and HY_NAME = @HY_NAME"; string sql2 = "update LH_V2 set send_flag =3 where BILL_NO =@BILL_NO and HY_NAME = @HY_NAME"; Hashtable ht = new Hashtable(); ht["BILL_NO"] = billNo; ht["HY_NAME"] = _HYNAME; int i = 0; int loop = Convert.ToInt32(loopTimes); while (true) { if (i == loop) { comm.UID(sql2, ht); return(false); } DataRow dr = comm.GetOneRow(sql, ht); if (dr != null && dr[3].ToString() == "1") { s[0] = dr[0].ToString() == "False" && dr[1].ToString() == "False" ? true : false; s[1] = dr[0].ToString() == "False" && dr[1].ToString() == "True" ? true : false; s[2] = dr[0].ToString() == "True"? true : false; s[3] = dr[2].ToString() == "04" ? true : false; rs = true; break; } i++; Thread.Sleep(1000); } return(rs); }
public V1Info GetV1Info(string voyageNo, string sType, string tradeCode) { V1Info info = new V1Info(); if (sType.Equals("普货", StringComparison.CurrentCultureIgnoreCase) || sType.Equals("D", StringComparison.CurrentCultureIgnoreCase)) { return(info); } //string sql = "select count(1) from " + v1Head + " where voyage_no=@voyage_no and ENTRY_TYPE=@Trade_Type"; Hashtable ht = new Hashtable(); ht["voyage_no"] = voyageNo; ht["ENTRY_TYPE"] = sType; //int ticket = comm2.GetIntData(sql, ht); //info.Ticket = ticket; string sql = "select count(1) allcount, ISNULL(SUM(PACK_NO),0) packno,ISNULL(SUM(GROSS_WT),0) wt from " + v1Head + " where VOYAGE_NO=@voyage_no and ENTRY_TYPE=@ENTRY_TYPE"; string newConnstr = tradeCode.Equals(DUNHAOTradeCode, StringComparison.CurrentCultureIgnoreCase) ? DUNHAOconnstring : connstring2; DbHelperSQL.connectionString = newConnstr; DataRow dr = comm.GetOneRow(sql, ht); if (dr != null) { info.PackNo = Convert.ToInt32(dr["packno"]); info.Weight = Convert.ToDouble(dr["wt"]); info.Ticket = Convert.ToInt32(dr["allcount"]); } DbHelperSQL.connectionString = defaultConnString; return(info); }
private void AddNewGridRow(int insertId) { if (insertId == 0) { MessageBox.Show("扫描条码错误,请检查!"); return; } string sql = "select top 1 a.SCAN_NO,a.BILL_NO,a.PACK_NO,a.VOYAGE_NO,b.BILL_SUM,b.PACK_SUM," + " b.SCAN_BILL_SUM as ALLSCANBILL,b.SCAN_PACK_SUM as ALLSCANPACK," + " (case a.DEC_TYPE when 0 then 1 else 0 end) as FANGXING," + " (case a.DEC_TYPE when 1 then 1 else 0 end) as CHAYAN," + " (case a.SEND_TYPE when 2 then 1 else 0 end) as NODATA" + " from EHS_SCAN_TMP1 a left" + " join EHS_SCAN_LIST2 b on a.VOYAGE_NO = b.VOYAGE_NO where a.id=@id "; Hashtable ht = new Hashtable(); ht["id"] = insertId; DataRow dr = comm.GetOneRow(sql, ht); if (dr != null) { superGrid1.Rows.Insert(0, dr.ItemArray); superGrid1.Rows[0].Selected = true; superGrid1.FirstDisplayedScrollingRowIndex = 0; if (dr["FANGXING"].ToString() == "1") { labFangXing.BackColor = Color.Red; } if (dr["CHAYAN"].ToString() == "1") { labChaYan.BackColor = Color.Red; } if (dr["NODATA"].ToString() == "1") { labWuShuJu.BackColor = Color.Red; } if (tbNo.Focused) { tbNo.Text = ""; } } }
public UserInfo GetUserInfoById(int userId) { Hashtable ht = new Hashtable(); ht["id"] = userId; DataRow dr = comm.GetOneRow("select * from users where id=@id", ht); if (dr != null) { UserInfo info = new UserInfo(); info.id = userId; info.HY_NAME = dr["HY_NAME"].ToString(); info.UserName = dr["User_name"].ToString(); info.Lever = dr["Lever"].ToString(); return(info); } return(null); }
private void login() { string userName = tbUser.Text.Trim(); if (string.IsNullOrEmpty(userName)) { MessageBox.Show("用户名不能为空"); return; } string pwd = tbPWD.Text.Trim(); if (string.IsNullOrEmpty(pwd)) { MessageBox.Show("密码不能为空"); return; } Hashtable ht = new Hashtable(); ht["user_name"] = userName; DataRow dr = common.GetOneRow("select top 1 id,user_pass from Users where user_name= @user_name", ht); if (dr != null) { string enPwd = dr["user_pass"].ToString(); pwd = StringHelper.Sha256(pwd); if (pwd.Equals(enPwd)) { this.Hide(); int id = Convert.ToInt32(dr["id"]); Main mainForm = new Main(id); mainForm.Show(); } else { MessageBox.Show("密码错误"); } } else { MessageBox.Show("用户名错误"); } }