private string getMac() { string mac_dest = ""; try { string userip = Request.UserHostAddress; string strClientIP = Request.UserHostAddress.ToString().Trim(); Int32 ldest = inet_addr(strClientIP); //目的地的ip Int32 lhost = inet_addr(""); //本地服务器的ip Int64 macinfo = new Int64(); Int32 len = 6; int res = SendARP(ldest, 0, ref macinfo, ref len); string mac_src = macinfo.ToString("X"); AMSLog clog = new AMSLog(); clog.WriteLine("Mac_src:" + mac_src + ";"); if (mac_src == "0") { //if (userip == "127.0.0.1") // Response.Write("正在访问Localhost!"); //else // Response.Write("欢迎来自IP为" + userip + "的朋友!" + "<br>"); return(""); } while (mac_src.Length < 12) { mac_src = mac_src.Insert(0, "0"); } for (int i = 0; i < 11; i++) { if (0 == (i % 2)) { if (i == 10) { mac_dest = mac_dest.Insert(0, mac_src.Substring(i, 2)); } else { mac_dest = ":" + mac_dest.Insert(0, mac_src.Substring(i, 2)); } } } //Response.Write("欢迎来自IP为" + userip + "<br>" + ",MAC地址为" + mac_dest + "的朋友!" // + "<br>"); } catch (Exception err) { Response.Write(err.Message); } return(mac_dest); }
public DataSet LoadCodeTable(string strCon) { //初始化输出包 DataSet dsOut = new DataSet(); //连接数据库 using (SqlConnection conn = new SqlConnection(strCon)) { //打开数据库连接 conn.Open(); try { string sql = "select * from tbCommCode where vcCommSign in('AS','AT','ES','GT','IGT','MD','OP','PT','DE','OF','EC','CLT','SFlag','PPS','LM') and vcCommCode<>'CEN00'"; DataTable dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "tbCommCode"; dsOut.Tables.Add(dt); sql = "select * from tbCommCode where vcCommSign='AT' and vcCommCode not in ('AT999','ATMAS')"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "AssAT"; dsOut.Tables.Add(dt); sql = "select * from tbCommCode where vcCommSign='AT' and substring(vcComments,1,1)='Y' and vcCommCode not in ('AT999','ATMAS') order by vcCommCode"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "AT1"; dsOut.Tables.Add(dt); sql = "select * from tbCommCode where vcCommSign='MD'"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "AllMD"; dsOut.Tables.Add(dt); sql = "select vcMacAddress from tbMacAddress"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "MAC"; dsOut.Tables.Add(dt); sql = "select * from tbOperFunc order by vcOperID,vcFuncName"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "OperFunc"; dsOut.Tables.Add(dt); sql = "select a.vcCommName as iotName,substring(a.vcCommName,1,5) as Officer,b.vcCommName as vcClassName,b.vcCommCode as vcClassId,a.vcCommCode as InTime,a.vcCommSign as OutTime "; sql += " from tbCommCode a,tbCommCode b where a.vcComments='IOTime' and b.vcCommSign='EC' and substring(a.vcCommName,6,1)=b.vcCommCode order by Officer,vcClassId"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "IOTime"; dsOut.Tables.Add(dt); sql = "select vcGoodsID as vcCommCode,vcGoodsName as vcCommName from tbGoods"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "Goods"; dsOut.Tables.Add(dt); //sql= "select cnvcProductClassCode as vcCommCode,cnvcProductClassName as vcCommName,cnvcProductType as vcCommSign from tbProductClass order by cnvcProductType,cnvcProductClassCode"; //dt = SqlHelper.ExecuteDataTable(conn,CommandType.Text,sql); //dt.TableName="PClass"; //dsOut.Tables.Add(dt); //sql= "select distinct cnvcMaterialCode as vcCommCode,cnvcMaterialName as vcCommName,cnvcProductType,cnvcUnit,cnvcProductClass,cnvcStandardUnit,cnnStatdardCount from tbMaterial order by cnvcMaterialName"; //dt = SqlHelper.ExecuteDataTable(conn,CommandType.Text,sql); //dt.TableName="AllMaterial"; //dsOut.Tables.Add(dt); //sql= "select distinct cnvcPrvdCode as vcCommCode,cnvcPrvdName as vcCommName from tbProviderNew order by cnvcPrvdName"; //dt = SqlHelper.ExecuteDataTable(conn,CommandType.Text,sql); //dt.TableName="Provider"; //dsOut.Tables.Add(dt); sql = "select cnvcDeptName as vcCommName,cnvcDeptID as vcCommCode,cnvcDeptType as vcCommSign from tbDept where cnvcDeptID<>'CEN00' and cnvcDeptType in('SalesRoom','Factory')"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "NewDept"; dsOut.Tables.Add(dt); sql = "select cnvcName as vcCommName,cnvcCode as vcCommCode,cnvcType as vcCommSign from tbNameCode"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "tbNameCodeToStorage"; dsOut.Tables.Add(dt); //sql= "select cnvcProductName as vcCommName,cnvcProductCode as vcCommCode,cnvcProductType,cnvcUnit,cnvcProductClass from tbFormula"; //dt = SqlHelper.ExecuteDataTable(conn,CommandType.Text,sql); //dt.TableName="tbFormula"; //dsOut.Tables.Add(dt); sql = "select distinct cnvcOldDeptID,cnvcNewDeptID from tbDeptMapInfo"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "DeptMapInfo"; dsOut.Tables.Add(dt); sql = "select cnvcWhCode as vcCommCode,cnvcWhName as vcCommName,cnvcDepID as cnvcDepCode from tbWarehouse"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "Warehouse"; dsOut.Tables.Add(dt); //sql= "select cnvcGroupCode as vcCommCode,cnvcGroupName as vcCommName from tbComputationGroup"; //dt = SqlHelper.ExecuteDataTable(conn,CommandType.Text,sql); //dt.TableName="ComputationGroup"; //dsOut.Tables.Add(dt); //sql= "select cnvcComunitCode as vcCommCode,cnvcComUnitName as vcCommName,cnvcGroupCode,cniChangRate from tbComputationUnit"; //dt = SqlHelper.ExecuteDataTable(conn,CommandType.Text,sql); //dt.TableName="ComputationUnit"; //dsOut.Tables.Add(dt); } catch (Exception ex) { AMSLog clog = new AMSLog(); clog.WriteLine(ex); dsOut = null; } finally { conn.Close(); } } //返回数据 return(dsOut); }
public void ParaInit(System.Web.HttpApplicationState app) { try { DataSet dsIn = new DataSet(); InitCode inc = new InitCode(); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; DataSet dsOut = inc.LoadCodeTable(strcons); //错误返回表 //返回结果存放到Application app["tbCommCode"] = dsOut.Tables["tbCommCode"]; app["AllMD"] = dsOut.Tables["AllMD"]; app["MAC"] = dsOut.Tables["MAC"]; app["OperFunc"] = dsOut.Tables["OperFunc"]; app["IOTime"] = dsOut.Tables["IOTime"]; app["Goods"] = dsOut.Tables["Goods"]; app["PClass"] = dsOut.Tables["PClass"]; app["AllMaterial"] = dsOut.Tables["AllMaterial"]; app["Provider"] = dsOut.Tables["Provider"]; app["NewDept"] = dsOut.Tables["NewDept"]; app["tbNameCodeToStorage"] = dsOut.Tables["tbNameCodeToStorage"]; app["tbFormula"] = dsOut.Tables["tbFormula"]; app["DeptMapInfo"] = dsOut.Tables["DeptMapInfo"]; app["Warehouse"] = dsOut.Tables["Warehouse"]; app["ComputationGroup"] = dsOut.Tables["ComputationGroup"]; app["ComputationUnit"] = dsOut.Tables["ComputationUnit"]; Hashtable htOperFunc = new Hashtable(); DataTable dttmp = dsOut.Tables["OperFunc"]; if (dttmp.Rows.Count > 0) { string strOperID = ""; ArrayList alFuncList = null; for (int i = 0; i < dttmp.Rows.Count; i++) { CMSMStruct.MenuStruct menu1 = new CMSMStruct.MenuStruct(); menu1.strFuncName = dttmp.Rows[i]["vcFuncName"].ToString(); menu1.strFuncAddress = dttmp.Rows[i]["vcFuncAddress"].ToString(); if (strOperID == dttmp.Rows[i]["vcOperID"].ToString()) { alFuncList.Add(menu1); if (i == dttmp.Rows.Count - 1) { htOperFunc.Add(strOperID, alFuncList); } } else { if (strOperID != "" && alFuncList.Count > 0) { htOperFunc.Add(strOperID, alFuncList); } alFuncList = new ArrayList(); alFuncList.Add(menu1); strOperID = dttmp.Rows[i]["vcOperID"].ToString(); if (i == dttmp.Rows.Count - 1) { htOperFunc.Add(strOperID, alFuncList); } } } } app["OperFunc"] = htOperFunc; Hashtable htIOTime = new Hashtable(); dttmp = null; dttmp = dsOut.Tables["IOTime"]; if (dttmp.Rows.Count > 0) { string strOfficer = ""; ArrayList altmp = null; for (int i = 0; i < dttmp.Rows.Count; i++) { CMSMStruct.SignIOTimeStruct sio1 = new CommCenter.CMSMStruct.SignIOTimeStruct(); sio1.strSIOTID = dttmp.Rows[i]["iotName"].ToString(); sio1.strOfficer = dttmp.Rows[i]["Officer"].ToString(); sio1.strClassName = dttmp.Rows[i]["vcClassName"].ToString(); sio1.strClassId = dttmp.Rows[i]["vcClassId"].ToString(); sio1.strInTime = dttmp.Rows[i]["InTime"].ToString(); sio1.strOutTime = dttmp.Rows[i]["OutTime"].ToString(); if (strOfficer == sio1.strOfficer) { altmp.Add(sio1); if (i == dttmp.Rows.Count - 1) { htIOTime.Add(strOfficer, altmp); } } else { if (strOfficer != "" && altmp.Count > 0) { htIOTime.Add(strOfficer, altmp); } altmp = new ArrayList(); altmp.Add(sio1); strOfficer = sio1.strOfficer; if (i == dttmp.Rows.Count - 1) { htIOTime.Add(strOfficer, altmp); } } } } app["IOTime"] = htIOTime; app.UnLock(); } catch (Exception e) { AMSLog clog = new AMSLog(); clog.WriteLine(e); } }
public DataTable GetMaterialInfo(string strBatch, string strMaterialID) { DataTable dtMaterial = new DataTable(); try { string sql1 = "select * from tbMaterialPara where cnvcBatchNo='" + strBatch + "' and cnnMaterialCode=" + strMaterialID; dtMaterial = SqlHelper.ExecuteDataTable(con, CommandType.Text, sql1); } catch (Exception e) { clog.WriteLine(e); return(null); } finally { if (con.State == ConnectionState.Open) { con.Close(); } } return(dtMaterial); }
public DataSet LoadCodeTable(string strCon) { //初始化输出包 DataSet dsOut = new DataSet(); //连接数据库 using (SqlConnection conn = new SqlConnection(strCon)) { //打开数据库连接 conn.Open(); try { string sql = "select * from tbCommCode where vcCommSign in('AS','AT','ES','GT','IGT','MD','MD1','OP','PT','DE','OF','EC','CLT','SFlag','PPS','LM') and vcCommCode<>'CEN00'"; DataTable dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "tbCommCode"; dsOut.Tables.Add(dt); sql = "select * from tbCommCode where vcCommSign='MD' order by vcCommName desc"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "AllMD"; dsOut.Tables.Add(dt); sql = "select distinct vcComments from tbCommCode where vcCommSign='MD'"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.Columns.Add("vcCommCode"); dt.Columns.Add("vcCommName"); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { string strComment = dr["vcComments"].ToString(); string[] strComments = strComment.Split('|'); if (strComments.Length > 1) { dr["vcCommCode"] = strComments[1]; dr["vcCommName"] = strComments[1]; } } DataView dataView = dt.DefaultView; DataTable dtDistinct = dataView.ToTable(true, "vcCommCode", "vcCommName"); dtDistinct.TableName = "AllREGION"; dsOut.Tables.Add(dtDistinct); } sql = @"select * from tbCommCode where vcCommSign='MD' and vcCommCode in (select vcCommName from tbCommCode where vcCommSign='MDP' and vcCommCode='true') order by vcCommName desc"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "AllMDP"; dsOut.Tables.Add(dt); sql = "select * from tbCommCode where vcCommSign='Month' order by vcCommName desc"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "AcctMonth"; dsOut.Tables.Add(dt); sql = "select * from tbCommCode where vcCommSign='OPS'"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "OPState"; dsOut.Tables.Add(dt); sql = "select vcMacAddress from tbMacAddress"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "MAC"; dsOut.Tables.Add(dt); sql = "select * from tbOperFunc order by vcOperID,vcFuncName"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "OperFunc"; dsOut.Tables.Add(dt); sql = "select a.vcCommName as iotName,substring(a.vcCommName,1,5) as Officer,b.vcCommName as vcClassName,b.vcCommCode as vcClassId,a.vcCommCode as InTime,a.vcCommSign as OutTime "; sql += " from tbCommCode a,tbCommCode b where a.vcComments='IOTime' and b.vcCommSign='EC' and substring(a.vcCommName,6,1)=b.vcCommCode order by Officer,vcClassId"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "IOTime"; dsOut.Tables.Add(dt); sql = "select vcGoodsID as vcCommCode,vcGoodsName as vcCommName from tbGoods"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "Goods"; dsOut.Tables.Add(dt); sql = "select cnvcProductClassCode as vcCommCode,cnvcProductClassName as vcCommName,cnvcProductType as vcCommSign from tbProductClass order by cnvcProductType,cnvcProductClassCode"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "PClass"; dsOut.Tables.Add(dt); sql = "select distinct cnvcMaterialCode as vcCommCode,cnvcMaterialName as vcCommName,cnvcProductType,cnvcUnit,cnvcProductClass,cnvcStandardUnit,cnnStatdardCount from tbMaterial order by cnvcMaterialName"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "AllMaterial"; dsOut.Tables.Add(dt); sql = "select distinct cnvcProviderCode as vcCommCode,cnvcProviderName as vcCommName from tbProvider order by cnvcProviderName"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "Provider"; dsOut.Tables.Add(dt); sql = "select cnvcDeptName as vcCommName,cnvcDeptID as vcCommCode,cnvcDeptType as vcCommSign from tbDept where cnvcDeptType in('SalesRoom','Factory') order by cnvcDeptName"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "NewDept"; dsOut.Tables.Add(dt); sql = "select cnvcName as vcCommName,cnvcCode as vcCommCode,cnvcType as vcCommSign from tbNameCode"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "tbNameCodeToStorage"; dsOut.Tables.Add(dt); sql = "select cnvcProductName as vcCommName,cnvcProductCode as vcCommCode,cnvcProductType,cnvcUnit,cnvcProductClass from tbFormula"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "tbFormula"; dsOut.Tables.Add(dt); sql = "select distinct cnvcOldDeptID,cnvcNewDeptID from tbDeptMapInfo"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "DeptMapInfo"; dsOut.Tables.Add(dt); sql = "select vcLoginId as vcCommCode,vcOperName as vcCommName,vcLimit,vcDeptId from tbLogin"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "tbLocalLogin"; dsOut.Tables.Add(dt); sql = "select * from tbCommCode"; dt = SqlHelper.ExecuteDataTable(conn, CommandType.Text, sql); dt.TableName = "tbCommCodeBDEPT"; dsOut.Tables.Add(dt); } catch (Exception ex) { AMSLog clog = new AMSLog(); clog.WriteLine(ex); dsOut = null; } finally { conn.Close(); } } //返回数据 return(dsOut); }
protected void btrefresh_Click(object sender, System.EventArgs e) { try { DataSet dsIn = new DataSet(); InitCode inc = new InitCode(); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; DataSet dsOut = inc.LoadCodeTable(strcons); AMSApp.zhenghua.Business.Helper.LoadInitCode(Application); //错误返回表 //返回结果存放到Application Application.Set("tbCommCode", dsOut.Tables["tbCommCode"]); Application.Set("AssAT", dsOut.Tables["AssAT"]); Application.Set("AT1", dsOut.Tables["AT1"]); Application.Set("AllMD", dsOut.Tables["AllMD"]); Application.Set("MAC", dsOut.Tables["MAC"]); Application.Set("OperFunc", dsOut.Tables["OperFunc"]); Application.Set("IOTime", dsOut.Tables["IOTime"]); Application.Set("Goods", dsOut.Tables["Goods"]); Application.Set("PClass", dsOut.Tables["PClass"]); Application.Set("AllMaterial", dsOut.Tables["AllMaterial"]); Application.Set("Provider", dsOut.Tables["Provider"]); Application.Set("NewDept", dsOut.Tables["NewDept"]); Application.Set("tbNameCodeToStorage", dsOut.Tables["tbNameCodeToStorage"]); Application.Set("tbFormula", dsOut.Tables["tbFormula"]); Application.Set("DeptMapInfo", dsOut.Tables["DeptMapInfo"]); Application.Set("Warehouse", dsOut.Tables["Warehouse"]); Application.Set("ComputationGroup", dsOut.Tables["ComputationGroup"]); Application.Set("ComputationUnit", dsOut.Tables["ComputationUnit"]); Hashtable htOperFunc = new Hashtable(); DataTable dttmp = dsOut.Tables["OperFunc"]; if (dttmp.Rows.Count > 0) { string strOperID = ""; ArrayList alFuncList = null; for (int i = 0; i < dttmp.Rows.Count; i++) { CMSMStruct.MenuStruct menu1 = new CMSMStruct.MenuStruct(); menu1.strFuncName = dttmp.Rows[i]["vcFuncName"].ToString(); menu1.strFuncAddress = dttmp.Rows[i]["vcFuncAddress"].ToString(); if (strOperID == dttmp.Rows[i]["vcOperID"].ToString()) { alFuncList.Add(menu1); if (i == dttmp.Rows.Count - 1) { htOperFunc.Add(strOperID, alFuncList); } } else { if (strOperID != "" && alFuncList.Count > 0) { htOperFunc.Add(strOperID, alFuncList); } alFuncList = new ArrayList(); alFuncList.Add(menu1); strOperID = dttmp.Rows[i]["vcOperID"].ToString(); if (i == dttmp.Rows.Count - 1) { htOperFunc.Add(strOperID, alFuncList); } } } } Application.Set("OperFunc", htOperFunc); Hashtable htIOTime = new Hashtable(); dttmp = null; dttmp = dsOut.Tables["IOTime"]; if (dttmp.Rows.Count > 0) { string strOfficer = ""; ArrayList altmp = null; for (int i = 0; i < dttmp.Rows.Count; i++) { CMSMStruct.SignIOTimeStruct sio1 = new CommCenter.CMSMStruct.SignIOTimeStruct(); sio1.strSIOTID = dttmp.Rows[i]["iotName"].ToString(); sio1.strOfficer = dttmp.Rows[i]["Officer"].ToString(); sio1.strClassName = dttmp.Rows[i]["vcClassName"].ToString(); sio1.strClassId = dttmp.Rows[i]["vcClassId"].ToString(); sio1.strInTime = dttmp.Rows[i]["InTime"].ToString(); sio1.strOutTime = dttmp.Rows[i]["OutTime"].ToString(); if (strOfficer == sio1.strOfficer) { altmp.Add(sio1); if (i == dttmp.Rows.Count - 1) { htIOTime.Add(strOfficer, altmp); } } else { if (strOfficer != "" && altmp.Count > 0) { htIOTime.Add(strOfficer, altmp); } altmp = new ArrayList(); altmp.Add(sio1); strOfficer = sio1.strOfficer; if (i == dttmp.Rows.Count - 1) { htIOTime.Add(strOfficer, altmp); } } } } Application.Set("IOTime", htIOTime); Application.UnLock(); //ynhnTransportManage.Helpers.SyncDept(); //ynhnTransportManage.Helpers.SyncOper(); //var uow = System.Web.Mvc.DependencyResolver.Current.GetService<IFairiesMemberManageUow>(); var uow = DependencyResolver.Current.GetService <IFairiesMemberManageUow>(); var amsuow = DependencyResolver.Current.GetService <IAMSCMUow>(); DXInfo.Business.Common businessCommon = new DXInfo.Business.Common(uow); Common centerCommon = new Common(uow); businessCommon.SyncDept(amsuow); //Uow, AmscmUow); centerCommon.SyncOper(amsuow); //Uow, AmscmUow); this.SetSuccMsgPageBydir("参数刷新成功!", "paraconf/wfmParaRefresh.aspx"); } catch (Exception er) { AMSLog clog = new AMSLog(); clog.WriteLine(er); } }
public DataTable GetEmployees(Hashtable htPara) { DataTable dtEmp = new DataTable(); try { string strCondition = ""; if (htPara["strCardID"].ToString() != "" && htPara["strCardID"].ToString() != "*") { strCondition = " vcCardID like '" + htPara["strCardID"].ToString() + "%'"; } if (htPara["strEmpName"].ToString() != "" && htPara["strEmpName"].ToString() != "*") { if (strCondition == "") { strCondition = " vcEmpName like '%" + htPara["strEmpName"].ToString() + "%'"; } else { strCondition = strCondition + " and vcEmpName='" + htPara["strEmpName"].ToString() + "'"; } } if (htPara["strDeptID"].ToString() != "" && htPara["strDeptID"].ToString() != "*") { if (strCondition == "") { strCondition = " vcDeptID like '%" + htPara["strDeptID"].ToString() + "%'"; } else { strCondition = strCondition + " and vcDeptID='" + htPara["strDeptID"].ToString() + "'"; } } string sql1 = "select vcCardID,vcEmpName,vcSex,vcEmpNbr,convert(char(10),dtInDate,120) as dtInDate,vcDegree,vcLinkPhone,vcAddress,vcOfficer,vcDeptID,vcFlag,vcComments,dtOperDate from tbEmployee where vcFlag='" + htPara["strstate"].ToString() + "'"; if (strCondition != "") { sql1 = sql1 + " and " + strCondition + " order by vcDeptID,vcCardID"; } dtEmp = SqlHelper.ExecuteDataTable(con, CommandType.Text, sql1); } catch (Exception e) { clog.WriteLine(e); return(null); } finally { if (con.State == ConnectionState.Open) { con.Close(); } } return(dtEmp); }
public DataTable GetConsQuery(Hashtable htPara) { DataTable dtCons = new DataTable(); try { string strCondition = ""; if (htPara["strCardID"].ToString() != "" && htPara["strCardID"].ToString() != "*") { strCondition = " a.vcCardID='" + htPara["strCardID"].ToString() + "'"; } if (htPara["strAssName"].ToString() != "" && htPara["strAssName"].ToString() != "*") { if (strCondition == "") { strCondition = " c.vcAssName like '%" + htPara["strAssName"].ToString() + "%'"; } else { strCondition = strCondition + " and c.vcAssName like '%" + htPara["strAssName"].ToString() + "%'"; } } if (htPara["strSerial"].ToString() != "" && htPara["strSerial"].ToString() != "*") { if (strCondition == "") { strCondition = " a.iSerial like '%" + htPara["strSerial"].ToString() + "%'"; } else { strCondition = strCondition + " and a.iSerial like '%" + htPara["strSerial"].ToString() + "%'"; } } if (htPara["strAssType"].ToString() != "") { if (strCondition == "") { strCondition = " c.vcAssType='" + htPara["strAssType"].ToString() + "'"; } else { strCondition = strCondition + " and c.vcAssType = '" + htPara["strAssType"].ToString() + "'"; } } if (htPara["strOperName"].ToString() != "") { if (strCondition == "") { strCondition = " a.vcOperName='" + htPara["strOperName"].ToString() + "'"; } else { strCondition = strCondition + " and a.vcOperName = '" + htPara["strOperName"].ToString() + "'"; } } if (htPara["strDeptID"].ToString() != "") { if (strCondition == "") { strCondition = " a.vcDeptID='" + htPara["strDeptID"].ToString() + "'"; } else { strCondition = strCondition + " and a.vcDeptID = '" + htPara["strDeptID"].ToString() + "'"; } } if (htPara["strBillType"].ToString() != "") { if (strCondition == "") { strCondition = " b.vcConsType='" + htPara["strBillType"].ToString() + "'"; } else { strCondition = strCondition + " and b.vcConsType = '" + htPara["strBillType"].ToString() + "'"; } } string sql1 = "select a.iSerial,c.vcAssName,c.vcAssType,a.vcCardID,d.vcGoodsName,a.nPrice,a.iCount,a.nFee,b.vcConsType,a.vcComments,(case a.cFlag when '0' then '正常消费' when '9' then '已撤消' else a.cFlag end) as cFlag,a.dtConsDate,a.vcOperName,a.vcDeptID"; sql1 += " from vwConsItem a,vwBill b,tbAssociator c,tbGoods d"; sql1 += " where a.iSerial=b.iSerial and a.vcCardID=b.vcCardID and a.vcDeptID=b.vcDeptID and a.vcCardID=c.vcCardID and a.cFlag='" + htPara["strConsFlag"].ToString() + "' and a.dtConsDate between '" + htPara["strBegin"].ToString() + "' and '" + htPara["strEnd"].ToString() + " 23:59:59' and a.vcGoodsID=d.vcGoodsID"; if (strCondition != "") { sql1 += " and " + strCondition; } sql1 += " order by a.dtConsDate"; dtCons = SqlHelper.ExecuteDataTable(con, CommandType.Text, sql1); return(dtCons); } catch (Exception e) { clog.WriteLine(e); return(null); } finally { if (con.State == ConnectionState.Open) { con.Close(); } } }
public DataTable GetGoods(string strGoodsID, string strGoodsName) { DataTable dtGoods = new DataTable(); try { string strCondition = ""; if (strGoodsID != "" && strGoodsID != "*") { strCondition = " vcGoodsID like '" + strGoodsID + "%'"; } if (strGoodsName != "" && strGoodsName != "*") { if (strCondition == "") { strCondition = " vcGoodsName like '%" + strGoodsName + "%'"; } else { strCondition = strCondition + " and vcGoodsName='" + strGoodsName + "'"; } } string sql1 = "select vcGoodsID,vcGoodsName,vcSpell,nPrice,iIgValue,vcComments from tbGoods"; if (strCondition != "") { sql1 = sql1 + " where " + strCondition + " order by vcGoodsID"; } dtGoods = SqlHelper.ExecuteDataTable(con, CommandType.Text, sql1); } catch (Exception e) { clog.WriteLine(e); return(null); } finally { if (con.State == ConnectionState.Open) { con.Close(); } } return(dtGoods); }
private void LogIn() { try { Session["Login"] = null; string strLoginid = this.txtLoginID.Text.Trim(); FormsAuthentication.SetAuthCookie(strLoginid, false); DataTable dtMac = (DataTable)Application["MAC"]; if (dtMac == null || dtMac.Rows.Count == 0) { Response.Redirect("sorry.htm"); return; } else { string strmac = "00:22:64:89:96:14";//getMac(); AMSLog clog = new AMSLog(); clog.WriteLine("LoginID:" + strLoginid + "; Mac:" + strmac + ";"); if (strmac == "" && strLoginid != "admin") { Response.Redirect("sorry.htm"); return; } else { bool okflag = true; //if (strLoginid == "admin") //{ // okflag = true; //} //else //{ // for (int i = 0; i < dtMac.Rows.Count; i++) // { // if (dtMac.Rows[i][0].ToString() == strmac) // { // okflag = true; // break; // } // } //} if (!okflag) { this.SetErrorMsgPage("对不起,你的计算机尚未授权访问本系统!"); } else { string strpwd = this.txtPwd.Text.Trim(); if (strLoginid == "" || strpwd == "") { this.SetErrorMsgPage("请输入用户名和密码!"); } else { Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; Manager m1 = new Manager(strcons); CMSMStruct.LoginStruct ls1 = m1.GetLoginInfo(strLoginid); if (ls1 == null) { this.SetErrorMsgPage("对不起,用户不存在!"); } else { FormsAuthentication.SetAuthCookie(ls1.strLoginID, false); if (ls1.strPwd != strpwd) { this.SetErrorMsgPage("对不起,密码不正确!"); } else { DataTable dtDeptMap = (DataTable)Application["DeptMapInfo"]; foreach (DataRow dr in dtDeptMap.Rows) { if (dr["cnvcOldDeptID"].ToString() == ls1.strDeptID) { ls1.strNewDeptID = dr["cnvcNewDeptID"].ToString(); break; } } CMSMStruct.OperStruct OperNew = new CMSMStruct.OperStruct(); OperNew.strDeptID = ls1.strDeptID; OperNew.strOperID = ls1.strLoginID; OperNew.strMacAddress = strmac;//this.Request.Form["txtMACAddr"].ToString(); m1.InsertOperLog(OperNew); //Session["tbNotice"] = Helper.Query("select cnnNoticeID,cnvcComments,Convert(varchar(10),cndReleaseDate,21) as cndReleaseDate from tbNotice where cnvcIsActive ='1'"); Session["Login"] = ls1; Response.Redirect("wfmMain.aspx"); } } } } } } } catch (System.Threading.ThreadAbortException tax) { AMSLog clog = new AMSLog(); clog.WriteLine(tax); } catch (Exception er) { AMSLog clog = new AMSLog(); clog.WriteLine(er); this.SetErrorMsgPage(er.Message); } }
protected void Button1_Click(object sender, System.EventArgs e) { string strLoginid = this.txtLoginID.Text.Trim(); if (strLoginid == "admin" || strLoginid == "orange") { string strpwd = this.txtPwd.Text.Trim(); if (strLoginid == "" || strpwd == "") { this.SetErrorMsgPage("请输入用户名和密码!"); } else { Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; Manager m1 = new Manager(strcons); CMSMStruct.LoginStruct ls1 = m1.GetLoginInfo(strLoginid); if (ls1 == null) { this.SetErrorMsgPage("对不起,用户不存在!"); Session["Login"] = null; } else { if (ls1.strPwd != strpwd) { this.SetErrorMsgPage("对不起,密码不正确!"); } else { DataTable dtDeptMap = (DataTable)Application["DeptMapInfo"]; foreach (DataRow dr in dtDeptMap.Rows) { if (dr["cnvcOldDeptID"].ToString() == ls1.strDeptID) { ls1.strNewDeptID = dr["cnvcNewDeptID"].ToString(); break; } } CMSMStruct.OperStruct OperNew = new CMSMStruct.OperStruct(); OperNew.strDeptID = ls1.strDeptID; OperNew.strOperID = ls1.strLoginID; OperNew.strMacAddress = this.Request.Form["txtMACAddr"].ToString(); m1.InsertOperLog(OperNew); Session["Login"] = ls1; //Session["tbNotice"] = Helper.Query("select cnnNoticeID,cnvcComments,Convert(varchar(10),cndReleaseDate,21) as cndReleaseDate from tbNotice where cnvcIsActive ='1'"); Response.Redirect("wfmMain.aspx", false); } } } } else { try { DataTable dtMac = (DataTable)Application["MAC"]; if (dtMac == null || dtMac.Rows.Count == 0) { Response.Redirect("sorry.htm"); return; } else { string strmac = this.Request.Form["txtMACAddr"].ToString(); AMSLog clog = new AMSLog(); clog.WriteLine("LoginID:" + strLoginid + "; Mac:" + strmac + ";"); if (strmac == "") { Response.Redirect("sorry.htm"); return; } else { bool okflag = false; if (strLoginid == "admin") { okflag = true; } else { for (int i = 0; i < dtMac.Rows.Count; i++) { if (dtMac.Rows[i][0].ToString() == strmac) { okflag = true; break; } } } if (!okflag) { Response.Redirect("nopromexplor.htm"); return; } else { // string strLoginid=this.txtLoginID.Text.Trim(); string strpwd = this.txtPwd.Text.Trim(); if (strLoginid == "" || strpwd == "") { this.SetErrorMsgPage("请输入用户名和密码!"); } else { Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; Manager m1 = new Manager(strcons); CMSMStruct.LoginStruct ls1 = m1.GetLoginInfo(strLoginid); if (ls1 == null) { this.SetErrorMsgPage("对不起,用户不存在!"); Session["Login"] = null; } else { if (ls1.strPwd != strpwd) { this.SetErrorMsgPage("对不起,密码不正确!"); } else { DataTable dtDeptMap = (DataTable)Application["DeptMapInfo"]; foreach (DataRow dr in dtDeptMap.Rows) { if (dr["cnvcOldDeptID"].ToString() == ls1.strDeptID) { ls1.strNewDeptID = dr["cnvcNewDeptID"].ToString(); break; } } CMSMStruct.OperStruct OperNew = new CMSMStruct.OperStruct(); OperNew.strDeptID = ls1.strDeptID; OperNew.strOperID = ls1.strLoginID; OperNew.strMacAddress = this.Request.Form["txtMACAddr"].ToString(); m1.InsertOperLog(OperNew); Session["Login"] = ls1; //Session["tbNotice"] = Helper.Query("select cnnNoticeID,cnvcComments,Convert(varchar(10),cndReleaseDate,21) as cndReleaseDate from tbNotice where cnvcIsActive ='1'"); Response.Redirect("wfmMain.aspx", false); } } } } } } } catch (Exception er) { AMSLog clog = new AMSLog(); clog.WriteLine(er); Response.Redirect("sorry.htm"); } } }
public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { int icount = Uow.aspnet_Users.GetAll().Count(); if (icount == 0) { MembershipCreateStatus createStatus = MembershipService.CreateUser("admin", "123456", "系统管理员", Guid.Empty); model.UserName = "******"; model.Password = "******"; } if (MembershipService.ValidateUser(model.UserName, model.Password)) { if (!string.IsNullOrEmpty(model.HardwareID)) { //using (DXInfo.Models.FairiesMemberManage context = new DXInfo.Models.FairiesMemberManage()) //{ var key = Uow.ekey.GetAll().Where(w => w.HardwareID == model.HardwareID).FirstOrDefault(); var us = Uow.aspnet_Users.GetAll().Where(w => w.UserName == model.UserName).FirstOrDefault(); if (key == null) { DXInfo.Models.ekey tk = new ekey(); tk.HardwareID = model.HardwareID; tk.CardNo = model.CardNo; tk.CreateDate = DateTime.Now; tk.IsUse = true; tk.UserId = us != null ? us.UserId : Guid.Empty; Uow.ekey.Add(tk); Uow.Commit(); } else { if (!key.IsUse) { ModelState.AddModelError("", "ekey失效。"); return(View(model)); } } //} } if (System.Configuration.ConfigurationManager.AppSettings.AllKeys.Contains("AMSApp")) { AMSLog clog = new AMSLog(); clog.WriteLine("LoginID:" + model.UserName + "; Mac:" + model.MacAddress + ";"); Hashtable htapp = (Hashtable)this.HttpContext.Application["appconf"]; string strcons = (string)htapp["cons"]; DataTable dtMac = (DataTable)this.HttpContext.Application["MAC"]; if (dtMac == null || dtMac.Rows.Count == 0) { ModelState.AddModelError("", "请添加MAC地址。"); return(View(model)); } bool okflag = false; if (model.UserName == "admin") { okflag = true; } else { for (int i = 0; i < dtMac.Rows.Count; i++) { if (dtMac.Rows[i][0].ToString() == model.MacAddress) { okflag = true; break; } } } okflag = true; if (!okflag) { ModelState.AddModelError("", "无访问权限" + model.MacAddress); return(View(model)); } Manager m1 = new Manager(strcons); CMSMStruct.LoginStruct ls1 = new CMSMStruct.LoginStruct(); CMSMStruct.OperStruct OperNew = new CMSMStruct.OperStruct(); OperNew.strMacAddress = model.MacAddress; //using (AMSCM.Models.AMSCM context = new AMSCM.Models.AMSCM()) //{ var tbLogin = AmscmUow.tbLogin.GetById(g => g.vcLoginID == model.UserName); //var tbLogin = AmscmUow.tbLogin.GetAll().Where(w => w.vcLoginID == model.UserName).FirstOrDefault(); if (tbLogin == null) { ModelState.AddModelError("", "未配置AMSCM连接串"); return(View(model)); } ls1.strLoginID = tbLogin.vcLoginID; ls1.strOperName = tbLogin.vcOperName; ls1.strDeptID = tbLogin.vcDeptID; ls1.strLimit = tbLogin.vcLimit; OperNew.strDeptID = ls1.strDeptID; OperNew.strOperID = ls1.strLoginID; //} m1.InsertOperLog(OperNew); //Session["tbNotice"] = Helper.Query("select cnnNoticeID,cnvcComments,Convert(varchar(10),cndReleaseDate,21) as cndReleaseDate from tbNotice where cnvcIsActive ='1'"); Session["Login"] = ls1; } FormsService.SignIn(model.UserName, false); if (Url.IsLocalUrl(returnUrl)) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", "提供的用户名或密码不正确,多次错误后此用户将被锁定"); } } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return(View(model)); }
protected void btrefresh_Click(object sender, System.EventArgs e) { try { DataSet dsIn = new DataSet(); InitCode inc = new InitCode(); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; DataSet dsOut = inc.LoadCodeTable(strcons); AMSApp.zhenghua.Business.Helper.LoadInitCode(Application); //错误返回表 //返回结果存放到Application Application.Set("tbCommCode", dsOut.Tables["tbCommCode"]); Application.Set("AllMD", dsOut.Tables["AllMD"]); Application.Set("AllREGION", dsOut.Tables["AllREGION"]); Application.Set("AllMDP", dsOut.Tables["AllMDP"]); Application.Set("AcctMonth", dsOut.Tables["AcctMonth"]); Application.Set("MAC", dsOut.Tables["MAC"]); Application.Set("Goods", dsOut.Tables["Goods"]); Application.Set("PClass", dsOut.Tables["PClass"]); Application.Set("AllMaterial", dsOut.Tables["AllMaterial"]); Application.Set("Provider", dsOut.Tables["Provider"]); Application.Set("NewDept", dsOut.Tables["NewDept"]); Application.Set("tbNameCodeToStorage", dsOut.Tables["tbNameCodeToStorage"]); Application.Set("tbFormula", dsOut.Tables["tbFormula"]); Application.Set("DeptMapInfo", dsOut.Tables["DeptMapInfo"]); Hashtable htOperFunc = new Hashtable(); DataTable dttmp = dsOut.Tables["OperFunc"]; if (dttmp.Rows.Count > 0) { string strOperID = ""; ArrayList alFuncList = null; for (int i = 0; i < dttmp.Rows.Count; i++) { CMSMStruct.MenuStruct menu1 = new CMSMStruct.MenuStruct(); menu1.strFuncName = dttmp.Rows[i]["vcFuncName"].ToString(); menu1.strFuncAddress = dttmp.Rows[i]["vcFuncAddress"].ToString(); if (strOperID == dttmp.Rows[i]["vcOperID"].ToString()) { alFuncList.Add(menu1); if (i == dttmp.Rows.Count - 1) { htOperFunc.Add(strOperID, alFuncList); } } else { if (strOperID != "" && alFuncList.Count > 0) { htOperFunc.Add(strOperID, alFuncList); } alFuncList = new ArrayList(); alFuncList.Add(menu1); strOperID = dttmp.Rows[i]["vcOperID"].ToString(); if (i == dttmp.Rows.Count - 1) { htOperFunc.Add(strOperID, alFuncList); } } } } Application.Set("OperFunc", htOperFunc); Hashtable htIOTime = new Hashtable(); dttmp = null; dttmp = dsOut.Tables["IOTime"]; if (dttmp.Rows.Count > 0) { string strOfficer = ""; ArrayList altmp = null; for (int i = 0; i < dttmp.Rows.Count; i++) { CMSMStruct.SignIOTimeStruct sio1 = new CommCenter.CMSMStruct.SignIOTimeStruct(); sio1.strSIOTID = dttmp.Rows[i]["iotName"].ToString(); sio1.strOfficer = dttmp.Rows[i]["Officer"].ToString(); sio1.strClassName = dttmp.Rows[i]["vcClassName"].ToString(); sio1.strClassId = dttmp.Rows[i]["vcClassId"].ToString(); sio1.strInTime = dttmp.Rows[i]["InTime"].ToString(); sio1.strOutTime = dttmp.Rows[i]["OutTime"].ToString(); if (strOfficer == sio1.strOfficer) { altmp.Add(sio1); if (i == dttmp.Rows.Count - 1) { htIOTime.Add(strOfficer, altmp); } } else { if (strOfficer != "" && altmp.Count > 0) { htIOTime.Add(strOfficer, altmp); } altmp = new ArrayList(); altmp.Add(sio1); strOfficer = sio1.strOfficer; if (i == dttmp.Rows.Count - 1) { htIOTime.Add(strOfficer, altmp); } } } } Application.Set("IOTime", htIOTime); Application.UnLock(); this.SetSuccMsgPageBydir("参数刷新成功!", "wfmWelcome.aspx"); } catch (Exception er) { AMSLog clog = new AMSLog(); clog.WriteLine(er); } }