示例#1
0
文件: bo_cmds.cs 项目: nelsonjma/ntec
    public string CloneUser(string userId, string newUserName, string ctrl)
    {
        string crlHash = Generic.GetHash(Generic.GetWebConfigValue("WebServiceKey"));

        if (ctrl != crlHash) return string.Empty;

        db_config_users dcu = null;

        try
        {
            // first validation to garanty that user is graiter then zero
            int auxUserId = Convert.ToInt32(userId);
            if (auxUserId < 0) return "User ID is less then zero";

            dcu = new db_config_users(auxUserId);
            dcu.Open();

            if (dcu.AllUsers.Count == 0) return "User not available";

            dcu.Clone(newUserName);

            return "User Cloned";
        }
        catch (Exception ex)
        {
            return ex.Message;
        }
        finally
        {
            if (dcu != null) dcu.Close();
        }
    }