/// <summary> /// 增加一个供应商 /// </summary> /// <param name="p_strAgentName"></param> /// <param name="p_strIp"></param> /// <param name="p_strDNS"></param> /// <param name="p_strUserCount"></param> /// <returns></returns> public bool newAgent(string p_strAgentName, string p_strIp, string p_strDNS, string p_strUserCount) { Conn cn = null; bool bRet = false; try { cn = new Conn(); Top3 tp = new Top3(cn); tp.AddRow("vcAgentName", "c", p_strAgentName); tp.AddRow("vcWebIp", "c", p_strIp); tp.AddRow("vcDNS", "c", p_strDNS); tp.AddRow("numUserCount", "i", p_strUserCount); tp.AddRow("dtRegDate", "dt", System.DateTime.Now.ToLongTimeString()); if (tp.AddNewRec("eg_agent")) { bRet = true; } } catch (Exception ex) { gs.util.func.Write("newAgent is err" + ex.Message); } finally { cn.close(); } return(bRet); }
/// <summary> /// 修改门市的资料 /// </summary> /// <param name="p_strSalId"></param> /// <param name="p_strSalName"></param> /// <returns></returns> public bool updateSal(string p_strSalId, string p_strSalName) { Conn cn = null; bool bRet = false; try { cn = new Conn(); Top3 tp = new Top3(cn); tp.AddRow("vcSalsName", "c", p_strSalName); if (tp.Update("eg_sals", "numSalsId", p_strSalId)) { bRet = true; } } catch (Exception ex) { gs.util.func.Write("updateSal is err" + ex.Message); throw ex; } finally { cn.close(); } return(bRet); }
public bool newSal(string p_strAgentId, string p_strSalName) { Conn cn = null; bool bRet = false; try { cn = new Conn(); Top3 tp = new Top3(cn); tp.AddRow("numAgentId", "i", p_strAgentId); tp.AddRow("vcSalsName", "c", p_strSalName); if (tp.AddNewRec("eg_sals")) { bRet = true; } } catch (Exception ex) { gs.util.func.Write("newSal is err" + ex.Message); } finally { cn.close(); } return(bRet); }
/// <summary> /// 记录用户登入时间,用于后面刷新用户自己的初始化数据,同时生成PASSPORT /// </summary> /// <param name="p_strLoginName"></param> /// <returns>PASSPORT</returns> public string RecUserLogin(string p_strLoginName) { Conn cn = null; string strRet = ""; try { cn = new Conn(); string strSql = ""; string strRetTmp = System.Guid.NewGuid().ToString(); strRetTmp = strRetTmp.Replace("-", "").ToUpper(); strSql = "Select * from eg_onlineUser where vcLoginName='" + p_strLoginName.Trim() + "'"; DataSet dsPort = cn.GetDataSet(strSql); if (dsPort.Tables[0].Rows.Count > 0) { strRetTmp = dsPort.Tables[0].Rows[0]["vcPassPort"].ToString(); } strSql = "delete from eg_onlineUser where vcLoginName='" + p_strLoginName.Trim() + "'"; cn.Update(strSql); Top3 tp = new Top3(cn); string strCurTime = System.DateTime.Now.ToString(); tp.AddRow("vcLoginName", "c", p_strLoginName.Trim()); tp.AddRow("dtLoginTime", "dt", strCurTime); tp.AddRow("vcPassPort", "c", strRetTmp); if (tp.AddNewRec("eg_onlineUser")) { strRet = strRetTmp; } } catch (Exception ex) { gs.util.func.Write("RecUserLogin is err" + ex.Message); } finally { cn.close(); } return(strRet); }
public bool SaveScrollString(string strUserID, string strContext, string strBegTime, string strEndTime, string strNoticeType) { Conn cn = null; bool bRet = false; try { cn = new Conn(); Top3 tp = new Top3(cn); tp.AddRow("UserID", "c", strUserID); tp.AddRow("Context", "c", strContext); if (strBegTime == "") { strBegTime = DateTime.Now.ToLongTimeString(); } tp.AddRow("BegTime", "dt", strBegTime); tp.AddRow("NoticeType", "c", strNoticeType); if (strEndTime == "") { cn.Update("update eg_announce set EndTime=getdate() where EndTime is null"); } else { tp.AddRow("EndTime", "dt", strEndTime); } if (tp.AddNewRec("eg_announce")) { bRet = true; } } catch (Exception ex) { gs.util.func.Write("SaveScrollString is err" + ex.Message); } finally { cn.close(); } return(bRet); }
/// <summary> /// 保存用户操作记录,可供管理员查询 /// </summary> /// <param name="p_strUserCode"></param> /// <param name="p_strCm"></param> /// <param name="strCmType"></param> /// <param name="p_strTime"></param> /// <returns></returns> public bool SaveLogs(string p_strUserCode, string p_strCm, string p_strCmType, string p_strTime) { Conn cn = null; bool bRet = false; try { cn = new Conn(); Top3 tp = new Top3(cn); //string strCurTime = System.DateTime.Now.ToString(); /*tp.AddRow("vcLoginName","c",p_strUserCode.Trim()); * tp.AddRow("vcOperStr","c",p_strCm); * tp.AddRow("vcType","c",p_strCmType); * tp.AddRow("dtTime","dt",p_strTime); * * if(tp.AddNewRec("eg_userLogs")) * { * bRet = true; * }*/ //string strIns = "insert into eg_userLogs(vcLoginName,vcOperStr,vcType,dtTime) values('" + p_strUserCode.Trim() + "','" + p_strCm + "','" + p_strCmType + "','" + p_strTime + "')"; //cn.Update(strIns); bRet = true; } catch (Exception ex) { gs.util.func.Write("SaveLogs is err" + ex.Message); } finally { cn.close(); } return(bRet); }
/// <summary> /// 生成一个新的C客户 /// </summary> /// <param name="p_strXml"></param> /// <returns></returns> public string NewCUser(string p_strXml) { string strRet = ""; NewPara npGet = new NewPara(p_strXml.Trim()); string strMerchId = npGet.FindTextByPath("//eg/MerchId").Trim(); string strUserCode = npGet.FindTextByPath("//eg/User").Trim(); string strUserTitle = npGet.FindTextByPath("//eg/UserTitle").Trim(); string strUserPassWord = npGet.FindTextByPath("//eg/UserPassWord").Trim(); string strSex = npGet.FindTextByPath("//eg/Sex").Trim(); string strBirthday = npGet.FindTextByPath("//eg/Birthday").Trim(); string strCrosAdr = npGet.FindTextByPath("//eg/CrosAdr").Trim(); string strPostCode = npGet.FindTextByPath("//eg/PostCode").Trim(); string strEmail = npGet.FindTextByPath("//eg/Email").Trim(); string strTel = npGet.FindTextByPath("//eg/Tel").Trim(); string strUserType = npGet.FindTextByPath("//eg/vcUserType").Trim(); //NewPara npRet = new NewPara(); //XmlDocument doc = npRet.getRoot(); //npRet.AddPara("Flag","OverUserLimted"); Conn cn = null; try { cn = new Conn(); cn.beginTrans(); //得到C客户设置信息 DataSet dsMerch = cn.GetDataSet("select * from eg_AgentCUser where numAgentId='" + strMerchId + "'"); string strCurAgentId = ""; string strUserClass = ""; string strNewUserId = ""; if (dsMerch.Tables[0].Rows.Count > 0) { strCurAgentId = dsMerch.Tables[0].Rows[0]["numCurAgentId"].ToString().Trim(); strUserClass = dsMerch.Tables[0].Rows[0]["vcUserClass"].ToString().Trim(); } //计算用户名是否合法 JoinAgent ag = new JoinAgent(); bool bCanAdd = ag.getAgentOverUsercountLimt(cn, strCurAgentId); //检测是否超过最大用户数量 bool bExistLoginName = isExistUser(cn, strUserCode); if (bExistLoginName) { //如果用户名存在 strRet = "ReUserName"; } else { if (bCanAdd) { gs.util.DES des = new gs.util.DES(); string strPwd = des.EncryptString(strUserPassWord, gs.util.StringTool.getPubKey(), gs.util.StringTool.getMixKey()); strNewUserId = logic.mytool.util.getId(cn, "eg_user"); Top3 tp = new Top3(cn); tp.AddRow("numUserId", "i", strNewUserId); tp.AddRow("vcLoginName", "c", strUserCode); tp.AddRow("vcPass", "c", strPwd); tp.AddRow("vcUserTitle", "c", strUserTitle); if (strSex != "") { tp.AddRow("vcSex", "c", "男"); } else { tp.AddRow("vcSex", "c", strSex); } tp.AddRow("numRoleId", "i", "0"); tp.AddRow("numAgentId", "c", strCurAgentId); tp.AddRow("vcTel", "c", strTel); if (strBirthday != "") { tp.AddRow("vcBirthday", "c", strBirthday); } else { tp.AddRow("vcBirthday", "c", "2000-1-1"); } tp.AddRow("vcCrosAdr", "c", strCrosAdr); tp.AddRow("vcPostCode", "c", strPostCode); tp.AddRow("vcEmail", "c", strEmail); tp.AddRow("dtRegTime", "dt", System.DateTime.Now.ToLongTimeString()); tp.AddRow("dtLastAcsTime", "dt", System.DateTime.Now.ToLongTimeString()); tp.AddRow("numUserStat", "i", "0"); if (strUserType != "") { tp.AddRow("vcUserType", "c", strUserType); } else { tp.AddRow("vcUserType", "c", "c"); } tp.AddRow("numVal", "d", "0"); tp.AddRow("numStat", "i", "0"); if (tp.AddNewRec("eg_user")) { string strClassSql = "insert into eg_userCm(numUserId,numCmId) values(" + strNewUserId + ",'" + strUserClass + "')"; cn.Update(strClassSql); string strRightSql = "insert into eg_userModu(numUserId,numModuId) select " + strNewUserId + ",numModuId from eg_AgentCUserModus where numAgentId='" + strMerchId + "'"; cn.Update(strRightSql); strRet = "AddSucc"; } else { strRet = "AddFail"; } } else { strRet = "OverUserLimted"; } } cn.commit(); } catch (Exception ex) { gs.util.func.Write("NewCUser is err" + ex.Message); cn.rollback(); } finally { cn.close(); } return(strRet); }