/// <summary> /// 验证登录在线 /// </summary> /// <returns></returns> private void CheckLoginInOnLine(string usercode, string userpwd) { // InitProcessBar(true); try { string strsql = "select stafcode,stafname,deptcode,userstate from staff where UserCode='" + usercode + "' and UserPwd='" + userpwd + "'"; DataSet ds = SQLHelper.Query(strsql); if (ds.Tables[0].Rows.Count == 0) { Func.PublicFuncProc.MsgBoxError("帐号或密码错误。"); progressBar1.Visible = false; return; } DataRow drs = ds.Tables[0].Rows[0]; if (drs["userstate"].ToString().Trim() == "N") { Func.PublicFuncProc.MsgBoxError("帐号已经被禁用,请更换帐号。"); progressBar1.Visible = false; return; } Func.PublicFuncProc.Globe.ZsbStrUserCode = usercode; //用户名 Func.PublicFuncProc.Globe.ZsbStrUser = drs["stafcode"].ToString().Trim() + "/" + drs["stafname"].ToString().Trim(); //用户 Func.PublicFuncProc.Globe.ZsbStrDept = drs["deptcode"].ToString().Trim(); //部门 LoadSaveUserCode(false); //2014年3月26日 08:49:55 人员信息表的部门信息就是代号加名称 //string tempDentCode=drs["deptcode"].ToString().Trim(); //string tempDeptName = ""; //if (comboBox1.SelectedIndex == 0) //仓库 //{ // tempDeptName = SQLHelper.QueryForOneField("select DepotName from Depot where DepotCode='" + tempDentCode + "'", "DepotName"); //} //else//其他科室 //{ // tempDeptName = SQLHelper.QueryForOneField("select DeptName from Department where DeptCode='" + tempDentCode + "'", "DeptName"); //} //if (tempDeptName == "") //{ // Func.PublicFuncProc.MsgBoxError("登录失败,请更换操作类型或帐号后重新登录。"); // comboBox1.Focus(); // return; //} //Func.PublicFuncProc.Globe.ZsbStrDept = tempDentCode+"/"+tempDeptName;//部门 } catch (Exception ee) { Func.PublicFuncProc.MsgBoxError("系统异常:" + ee.Message); return; } Func.PublicFuncProc.Globe.ZsbBOnLine = true; csMain csmain = new csMain(); // InitProcessBar(false); csmain.Show(); this.Hide(); }
/// <summary> /// 验证登录 离线 /// </summary> /// <returns></returns> private void CheckLoginInOffLine() { try { Func.PublicFuncProc.Globe.ZsbBOnLine = false; Func.PublicFuncProc.Globe.ZsbStrUser = txtUserCode.Text.Trim(); //用户名 Func.PublicFuncProc.Globe.ZsbStrDept = ""; //部门 csMain csmain = new csMain(); csmain.Show(); this.Hide(); int i = Convert.ToInt16("aa"); } catch (Exception ee) { string str = ee.ToString(); SaveMessage(str); MessageBox.Show(str); } }