Exemplo n.º 1
0
        [WebMethod]//得到代理商信息
        public string getAgentInfo(string p_strAgentId)
        {
            string strAgentId = p_strAgentId.Trim();

            logic.JoinAgent eu     = new logic.JoinAgent();
            string          strRet = eu.getAgentSrvInfo(strAgentId);

            return(strRet);
        }
Exemplo n.º 2
0
        /// <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);
        }