Ejemplo n.º 1
0
        public HandshakeStartResponse HandshakeStart(HandshakeStartRequest handshakeStartRequest)
        {
            if (handshakeStartRequest.acp_email.Equals(Settings.Default.IPConvergeAdminEmail) == false ||
                handshakeStartRequest.acp_md5_password.Equals(Settings.Default.IPConvergeAdminPasswordMD5) == false)
            {
                throw new XmlRpcFaultException(500, "ipConverge.handshakeStart: Invalid credentials");
            }

            using (var db = new CSSDataContext())
            {
                db.IPConverges.DeleteAllOnSubmit(db.IPConverges);

                db.IPConverges.InsertOnSubmit(new IPConverge()
                {
                    Active       = false,
                    Added        = ConvertFromUnixTimestamp(handshakeStartRequest.reg_date),
                    ApiCode      = handshakeStartRequest.reg_code,
                    HttpPassword = handshakeStartRequest.http_pass,
                    HttpUser     = handshakeStartRequest.http_user,
                    IpAddress    = HttpContext.Current.Request.UserHostAddress,
                    ProductId    = handshakeStartRequest.reg_product_id,
                    Url          = handshakeStartRequest.converge_url
                });

                db.SubmitChanges();
            }

            return(new HandshakeStartResponse()
            {
                acp_email = handshakeStartRequest.acp_email,
                acp_md5_password = handshakeStartRequest.acp_md5_password,
                converge_url = handshakeStartRequest.converge_url,
                http_pass = handshakeStartRequest.http_pass,
                http_user = handshakeStartRequest.http_user,
                master_response = 1,
                reg_code = handshakeStartRequest.reg_code,
                reg_date = handshakeStartRequest.reg_date.ToString(),
                reg_id = handshakeStartRequest.reg_id,
                reg_product_id = handshakeStartRequest.reg_product_id
            });
        }
        public HandshakeStartResponse HandshakeStart(HandshakeStartRequest handshakeStartRequest)
        {
            if (handshakeStartRequest.acp_email.Equals(Settings.Default.IPConvergeAdminEmail) == false
                || handshakeStartRequest.acp_md5_password.Equals(Settings.Default.IPConvergeAdminPasswordMD5) == false)
            {
                throw new XmlRpcFaultException(500, "ipConverge.handshakeStart: Invalid credentials");
            }

            using (var db = new CSSDataContext())
            {
                db.IPConverges.DeleteAllOnSubmit(db.IPConverges);

                db.IPConverges.InsertOnSubmit(new IPConverge()
                {
                    Active = false,
                    Added = ConvertFromUnixTimestamp(handshakeStartRequest.reg_date),
                    ApiCode = handshakeStartRequest.reg_code,
                    HttpPassword = handshakeStartRequest.http_pass,
                    HttpUser = handshakeStartRequest.http_user,
                    IpAddress = HttpContext.Current.Request.UserHostAddress,
                    ProductId = handshakeStartRequest.reg_product_id,
                    Url = handshakeStartRequest.converge_url
                });

                db.SubmitChanges();
            }

            return new HandshakeStartResponse()
                {
                    acp_email = handshakeStartRequest.acp_email,
                    acp_md5_password = handshakeStartRequest.acp_md5_password,
                    converge_url = handshakeStartRequest.converge_url,
                    http_pass = handshakeStartRequest.http_pass,
                    http_user = handshakeStartRequest.http_user,
                    master_response = 1,
                    reg_code = handshakeStartRequest.reg_code,
                    reg_date = handshakeStartRequest.reg_date.ToString(),
                    reg_id = handshakeStartRequest.reg_id,
                    reg_product_id = handshakeStartRequest.reg_product_id
                };
        }