예제 #1
0
    public ArrayList getClicks(string url, string layout)
    {
        using (SqlConnection dbCon = new SqlConnection("Data Source=desktop-pc\\sqlexpress;Initial Catalog=click manager;Persist Security Info=True;User ID=click_manager;Password=password"))
        {
            //open connection
            dbCon.Open();

            //create reade query
            SqlCommand readCommand = new SqlCommand("SELECT x, y FROM clicks WHERE url = @url and layout = @layout", dbCon);
            readCommand.Parameters.AddWithValue("@url", url);
            readCommand.Parameters.AddWithValue("@layout", layout);

            //create list of results
            ArrayList clicks = new ArrayList();
            SqlDataReader reader = readCommand.ExecuteReader();

            while (reader.Read())
            {
                response resp = new response();
                resp.x = reader["x"].ToString();
                resp.y = reader["y"].ToString();

                clicks.Add(resp);
            }

            //close connection
            dbCon.Close();

            //return results
            return clicks;
        }
    }
예제 #2
0
파일: Plati.cs 프로젝트: andpsy/socisaV2
        public response Delete()
        {
            response  toReturn    = new response(false, "", null, null, new List <Error>());;
            ArrayList _parameters = new ArrayList();

            _parameters.Add(new MySqlParameter("_ID", this.ID));
            DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "PLATIsp_soft_delete", _parameters.ToArray());

            toReturn = da.ExecuteDeleteQuery();
            if (toReturn.Status)
            {
                try
                {
                    Dosar d = new Dosar(authenticatedUserId, connectionString, Convert.ToInt32(this.ID_DOSAR));
                    d.UpdateCounterPlati(-1);
                }
                catch (Exception exp) { LogWriter.Log(exp); }

                try
                {
                    Dosar d = new Dosar(this.authenticatedUserId, this.connectionString, Convert.ToInt32(this.ID_DOSAR));
                    d.REZERVA_DAUNA += this.SUMA;
                    d.GetNewStatus(false);
                    response r = d.Update();
                    if (!r.Status)
                    {
                        toReturn = r;
                    }
                }
                catch (Exception exp)
                {
                    toReturn = new response(false, exp.ToString(), null, null, new List <Error>()
                    {
                        new Error(exp)
                    });
                    LogWriter.Log(exp);
                }
            }
            return(toReturn);
        }
예제 #3
0
파일: Mesaje.cs 프로젝트: andpsy/socisaV2
        public response Insert()
        {
            response toReturn = Validare();

            if (!toReturn.Status)
            {
                return(toReturn);
            }
            PropertyInfo[] props       = this.GetType().GetProperties();
            ArrayList      _parameters = new ArrayList();

            var col = CommonFunctions.table_columns(authenticatedUserId, connectionString, "mesaje");

            foreach (PropertyInfo prop in props)
            {
                if (col != null && col.ToUpper().IndexOf(prop.Name.ToUpper()) > -1) // ca sa includem in Array-ul de parametri doar coloanele tabelei, nu si campurile externe si/sau alte proprietati
                {
                    string propName  = prop.Name;
                    string propType  = prop.PropertyType.ToString();
                    object propValue = prop.GetValue(this, null);
                    propValue = propValue == null ? DBNull.Value : propValue;
                    if (propType != null)
                    {
                        if (propName.ToUpper() != "ID") // il vom folosi doar la Edit!
                        {
                            _parameters.Add(new MySqlParameter(String.Format("_{0}", propName.ToUpper()), propValue));
                        }
                    }
                }
            }
            DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "MESAJEsp_insert", _parameters.ToArray());

            toReturn = da.ExecuteInsertQuery();
            if (toReturn.Status)
            {
                this.ID = toReturn.InsertedId;
            }

            return(toReturn);
        }
예제 #4
0
        public virtual response ValidareColoane(string fieldValueCollection)
        {
            response toReturn = new response(true, null, null, null, new List <Error>());

            try
            {
                Dictionary <string, string> changes = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(fieldValueCollection, CommonFunctions.JsonDeserializerSettings);
                foreach (string fieldName in changes.Keys)
                {
                    bool           gasit = false;
                    PropertyInfo[] props = this.GetType().GetProperties();
                    foreach (PropertyInfo prop in props)
                    {
                        if (fieldName.ToUpper() == prop.Name.ToUpper())
                        {
                            gasit = true;
                            break;
                        }
                    }
                    if (!gasit)
                    {
                        Error err = ErrorParser.ErrorMessage("campInexistentInTabela");
                        return(new response(false, err.ERROR_MESSAGE, null, null, new List <Error>()
                        {
                            err
                        }));
                    }
                }
            }
            catch
            {
                Error err = ErrorParser.ErrorMessage("cannotConvertStringToTableColumns");
                return(new response(false, err.ERROR_MESSAGE, null, null, new List <Error>()
                {
                    err
                }));
            }
            return(toReturn);
        }
예제 #5
0
파일: Plati.cs 프로젝트: andpsy/socisaV2
        public response InsertWithErrors()
        {
            response toReturn = new response(true, "", null, null, new List <Error>());

            PropertyInfo[] props       = this.GetType().GetProperties();
            ArrayList      _parameters = new ArrayList();
            var            col         = CommonFunctions.table_columns(authenticatedUserId, connectionString, "plati");

            foreach (PropertyInfo prop in props)
            {
                if (col != null && col.ToUpper().IndexOf(prop.Name.ToUpper()) > -1) // ca sa includem in Array-ul de parametri doar coloanele tabelei, nu si campurile externe si/sau alte proprietati
                {
                    string propName  = prop.Name;
                    string propType  = prop.PropertyType.ToString();
                    object propValue = prop.GetValue(this, null);
                    propValue = propValue ?? DBNull.Value;
                    if (propType != null)
                    {
                        if (propName.ToUpper() != "ID") // il vom folosi doar la Edit!
                        {
                            _parameters.Add(new MySqlParameter(String.Format("_{0}", propName.ToUpper()), propValue));
                        }
                    }
                }
            }
            DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "PENDING_IMPORT_ERRORS_PLATIsp_insert", _parameters.ToArray());

            toReturn = da.ExecuteInsertQuery();
            if (toReturn.Status)
            {
                this.ID          = toReturn.InsertedId;
                toReturn.Message = JsonConvert.SerializeObject(this, Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                {
                    DateTimeFormat = CommonFunctions.DATE_FORMAT
                });
                toReturn.Result = this; // pt. ID-uri externe generate !!!
            }
            return(toReturn);
        }
예제 #6
0
        public response Delete()
        {
            response  toReturn    = new response(false, "", null, null, new List <Error>());;
            ArrayList _parameters = new ArrayList();

            _parameters.Add(new MySqlParameter("_ID", this.ID));
            DataAccess da = new DataAccess();

            if (this.ID != null)
            {
                _parameters.Add(new MySqlParameter("_ID", this.ID));
                da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "UTILIZATORI_ACTIONSsp_soft_delete", _parameters.ToArray());
            }
            else
            {
                _parameters.Add(new MySqlParameter("_ID_UTILIZATOR", this.ID_UTILIZATOR));
                _parameters.Add(new MySqlParameter("_ID_ACTION", this.ID_ACTION));
                da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "UTILIZATORI_ACTIONSsp_soft_deleteByFields", _parameters.ToArray());
            }
            toReturn = da.ExecuteDeleteQuery();
            return(toReturn);
        }
예제 #7
0
파일: Mesaje.cs 프로젝트: andpsy/socisaV2
        public response GetMessageReadDate(int idUtilizator)
        {
            response toReturn = new response(true, null, null, null, null);

            try
            {
                DataAccess  da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "MESAJE_UTILIZATORIsp_GetByIdMesajIdUtilizator", new object[] { new MySqlParameter("_ID_MESAJ", this.ID), new MySqlParameter("_ID_UTILIZATOR", idUtilizator) });
                IDataReader r  = da.ExecuteSelectQuery();
                while (r.Read())
                {
                    MesajUtilizator mesajUtilizator = new MesajUtilizator(authenticatedUserId, connectionString, (IDataRecord)r);
                    toReturn = new response(true, mesajUtilizator.DATA_CITIRE.ToString(), mesajUtilizator.DATA_CITIRE, null, null);
                    break;
                }
                r.Close(); r.Dispose(); da.CloseConnection();
                return(toReturn);
            }
            catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.ToString(), null, null, new List <Error>()
                {
                    new Error(exp)
                })); }
        }
예제 #8
0
        /// <summary>
        /// Metoda pentru validarea societatii de asigurare curente
        /// </summary>
        /// <param name="_validareSimpla">Pt. validari din import</param>
        /// <returns>SOCISA.response = new object(bool = status, string = error message, int = id-ul cheie returnat)</returns>
        public response Validare(bool _validareSimpla)
        {
            bool     succes;
            response toReturn = Validator.Validate(authenticatedUserId, connectionString, this, _TABLE_NAME, out succes);

            if (!succes) // daca nu s-au putut citi validarile din fisier, sau nu sunt definite in fisier, mergem pe varianta hardcodata
            {
                toReturn = new response(true, "", null, null, new List <Error>());;
                Error err = new Error();
                if (this.DENUMIRE_SCURTA == null || this.DENUMIRE_SCURTA.Trim() == "")
                {
                    toReturn.Status     = false;
                    err                 = ErrorParser.ErrorMessage("emptyDenumireScurtaSocietate");
                    toReturn.Message    = string.Format("{0}{1};", toReturn.Message == null ? "" : toReturn.Message, err.ERROR_MESSAGE);
                    toReturn.InsertedId = null;
                    toReturn.Error.Add(err);
                }
                if (!_validareSimpla)
                {
                    if (this.DENUMIRE == null || this.DENUMIRE.Trim() == "")
                    {
                        toReturn.Status     = false;
                        err                 = ErrorParser.ErrorMessage("emptyDenumireSocietate");
                        toReturn.Message    = string.Format("{0}{1};", toReturn.Message == null ? "" : toReturn.Message, err.ERROR_MESSAGE);
                        toReturn.InsertedId = null;
                        toReturn.Error.Add(err);
                    }
                    if (this.CUI == null || this.CUI.Trim() == "")
                    {
                        toReturn.Status     = false;
                        err                 = ErrorParser.ErrorMessage("emptyCuiSocietate");
                        toReturn.Message    = string.Format("{0}{1};", toReturn.Message == null ? "" : toReturn.Message, err.ERROR_MESSAGE);
                        toReturn.InsertedId = null;
                        toReturn.Error.Add(err);
                    }
                }
            }
            return(toReturn);
        }
예제 #9
0
        public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log)
        {
            response response = new response(0, "Error");
            try {
                // parse query parameter
                int user_id = Convert.ToInt32(utilitles.getURLVar(req, "user_id"));
                string login_hash = utilitles.getURLVar(req, "login_hash");
                int vehicle_id = Convert.ToInt32(utilitles.getURLVar(req, "vehicle_id"));
                string new_status = utilitles.getURLVar(req, "status"); // 'ACTIVATED', 'DEACTIVATED', 'IN-USE'

                // Validates user identity.
                utilitles.validateUser( user_id , login_hash );
                update_vehicle_status(vehicle_id, new_status);
                response.status = 1;
                response.description = "status changed to " + new_status;

            } catch (CarSharingException ex) {
                response = new response(ex.status_code, "Error: " + ex.info);
            }

            return req.CreateResponse(HttpStatusCode.OK, response, JsonMediaTypeFormatter.DefaultMediaType);
        }
예제 #10
0
        //[AuthorizeUser(ActionName = "Dosare", Recursive = false)]
        public JsonResult ImportSedintaPortal(int IdSedintaPortal, ProcesStadiu ProcesStadiu, Sentinta Sentinta)
        {
            response r      = new response();
            string   conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int      uid    = Convert.ToInt32(Session["CURENT_USER_ID"]);

            if (Sentinta.NR_SENTINTA != null && Sentinta.DATA_SENTINTA != null)
            {
                Sentinta       s    = new Sentinta(uid, conStr);
                PropertyInfo[] pis1 = Sentinta.GetType().GetProperties();
                foreach (PropertyInfo pi in pis1)
                {
                    pi.SetValue(s, pi.GetValue(Sentinta));
                }
                r = s.Insert();
                if (r.Status)
                {
                    ProcesStadiu.ID_SENTINTA = r.InsertedId;
                }
            }
            ProcesStadiu ps = new ProcesStadiu(uid, conStr);

            PropertyInfo[] pis = ProcesStadiu.GetType().GetProperties();
            foreach (PropertyInfo pi in pis)
            {
                pi.SetValue(ps, pi.GetValue(ProcesStadiu));
            }
            r = ps.Insert();
            if (r.Status)
            {
                try
                {
                    SedintaPortal sp = new SedintaPortal(uid, conStr, IdSedintaPortal);
                    sp.Delete();
                }
                catch (Exception exp) { LogWriter.Log(exp); }
            }
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
예제 #11
0
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log)
        {
            response   response = new response(0, "Error");
            List <Car> Cars     = new List <Car>();

            try {
                // parse query parameter
                int    user_id    = Convert.ToInt32(utilitles.getURLVar(req, "user_id"));
                string login_hash = utilitles.getURLVar(req, "login_hash");

                // Validates user identity.
                utilitles.validateUser(user_id, login_hash);

                response.status = 1;
                Cars            = getCarsList(user_id);
            } catch (CarSharingException ex) {
                response = new response(ex.status_code, "Error: " + ex.info);
            }

            return(response.status == 1 ? req.CreateResponse(HttpStatusCode.OK, Cars, JsonMediaTypeFormatter.DefaultMediaType)
            : req.CreateResponse(HttpStatusCode.OK, response, JsonMediaTypeFormatter.DefaultMediaType));
        }
예제 #12
0
        public response GetPlatiFromLog(DateTime?data)
        {
            try
            {
                List <object[]> toReturnList = new List <object[]>();
                DataAccess      da           = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "IMPORT_LOG_PLATIsp_GetPlati", new object[] { new MySqlParameter("_DATA_IMPORT", data) });
                IDataReader     dr           = da.ExecuteSelectQuery();
                while (dr.Read())
                {
                    try
                    {
                        response r = new response();
                        r.Status     = Convert.ToBoolean(dr["STATUS"]);
                        r.Message    = dr["MESSAGE"].ToString();
                        r.InsertedId = Convert.ToInt32(dr["INSERTED_ID"]);
                        r.Error      = JsonConvert.DeserializeObject <List <Error> >(dr["ERRORS"].ToString(), CommonFunctions.JsonDeserializerSettings);

                        Plata         plata = r.Status ? new Plata(authenticatedUserId, connectionString, Convert.ToInt32(r.InsertedId)) : new Plata(authenticatedUserId, connectionString, Convert.ToInt32(r.InsertedId), true);
                        PlataExtended pe    = new PlataExtended(plata);

                        toReturnList.Add(new object[] { r, pe });
                    }
                    catch (Exception exp)
                    {
                        LogWriter.Log(exp);
                    }
                }
                dr.Close(); dr.Dispose();
                return(new response(true, JsonConvert.SerializeObject(toReturnList.ToArray(), CommonFunctions.JsonSerializerSettings), toReturnList.ToArray(), null, null));
            }
            catch (Exception exp)
            {
                LogWriter.Log(exp);
                return(new response(false, exp.Message, null, null, new List <Error>()
                {
                    new Error(exp)
                }));
            }
        }
예제 #13
0
        /// <summary>
        /// A simple function that takes a string and does a ToUpper
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public async Task <response> FunctionHandler(APIGatewayCustomAuthorizerRequest request, ILambdaContext context)
        {
            try
            {
                Get    get_til   = new Get("reddit_til", context);
                string child_str = JsonConvert.SerializeObject(await get_til.Child(), Formatting.Indented);

                //Response
                var response = new response()
                {
                    statusCode = "200",
                    headers    = new Dictionary <string, string>()
                    {
                        { "Access-Control-Allow-Origin", "*" }
                    },
                    body = child_str
                };

                //Return
                return(response);
            }
            catch (Exception e)
            {
                //Response
                var response = new response()
                {
                    statusCode = "400",
                    headers    = new Dictionary <string, string>()
                    {
                        { "Access-Control-Allow-Origin", "*" }
                    },
                    body = e.Message
                };

                //Return
                return(response);
            }
        }
예제 #14
0
 public response ImportAll(response responsesPlati, DateTime _date, int _import_type)
 {
     try
     {
         List <object[]> toReturnList = new List <object[]>();
         foreach (object[] responsePlata in (object[])responsesPlati.Result)
         {
             PlataExtended plataExtended = (PlataExtended)responsePlata[1];
             response      response      = (response)responsePlata[0];
             response      r             = new response();
             if (response.Status)
             {
                 r = plataExtended.Plata.Insert();
                 if (!r.Status)
                 {
                     response.Status = false;
                 }
             }
             else
             {
                 r = plataExtended.Plata.InsertWithErrors();
                 response.Status = false;
             }
             response.InsertedId = r.InsertedId;
             plataExtended.Plata.Log(response, _date, _import_type);
             toReturnList.Add(new object[] { response, plataExtended });
         }
         return(new response(true, JsonConvert.SerializeObject(toReturnList.ToArray(), CommonFunctions.JsonSerializerSettings), toReturnList.ToArray(), null, null));
     }
     catch (Exception exp)
     {
         LogWriter.Log(exp);
         return(new response(false, exp.Message, null, null, new List <Error>()
         {
             new Error(exp)
         }));
     }
 }
예제 #15
0
        /// <summary>
        /// Metoda pentru modificarea relatiei Dosar-stadiu curenta
        /// </summary>
        /// <returns>SOCISA.response = new object(bool = status, string = error message, int = id-ul cheie returnat)</returns>
        public response Update()
        {
            response toReturn = Validare();

            if (!toReturn.Status)
            {
                return(toReturn);
            }
            PropertyInfo[] props       = this.GetType().GetProperties();
            ArrayList      _parameters = new ArrayList();
            var            col         = CommonFunctions.table_columns(authenticatedUserId, connectionString, "dosare_stadii");

            foreach (PropertyInfo prop in props)
            {
                if (col != null && col.ToUpper().IndexOf(prop.Name.ToUpper()) > -1) // ca sa includem in Array-ul de parametri doar coloanele tabelei, nu si campurile externe si/sau alte proprietati
                {
                    string propName  = prop.Name;
                    string propType  = prop.PropertyType.ToString();
                    object propValue = prop.GetValue(this, null);
                    propValue = propValue == null ? DBNull.Value : propValue;
                    if (propType != null)
                    {
                        _parameters.Add(new MySqlParameter(String.Format("_{0}", propName.ToUpper()), propValue));
                    }
                }
            }
            DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "DOSARE_STADIIsp_update", _parameters.ToArray());

            toReturn = da.ExecuteUpdateQuery();
            try
            {
                Dosar d = new Dosar(authenticatedUserId, connectionString, this.ID_DOSAR);
                d.SetDataUltimeiModificari(DateTime.Now);
            }
            catch { }

            return(toReturn);
        }
예제 #16
0
        /// <summary>
        /// Metoda pentru stergerea Documentului scanat curent
        /// </summary>
        /// <returns>SOCISA.response = new object(bool = status, string = error message, int = id-ul cheie returnat)</returns>
        public response Delete()
        {
            DocumentScanat tmp = new DocumentScanat(authenticatedUserId, connectionString, Convert.ToInt32(this.ID));

            response  toReturn    = new response(false, "", null, null, new List <Error>());;
            ArrayList _parameters = new ArrayList();

            _parameters.Add(new MySqlParameter("_ID", this.ID));
            DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "DOCUMENTE_SCANATE_PROCESEsp_soft_delete", _parameters.ToArray());

            toReturn = da.ExecuteDeleteQuery();

            /*
             * if (toReturn.Status && _deleteFile)
             *  FileManager.DeleteFile(this.CALE_FISIER, this.DENUMIRE_FISIER, this.EXTENSIE_FISIER);
             */
            if (toReturn.Status)
            {
                try
                {
                    ThumbNails.DeleteThumbNail(tmp);
                    tmp = null;
                }
                catch { }
            }
            if (toReturn.Status)
            {
                /*
                 * try
                 * {
                 *  if (System.Web.HttpContext.Current.Request.Params["SEND_MESSAGE"] != null && Convert.ToBoolean(System.Web.HttpContext.Current.Request.Params["SEND_MESSAGE"]))
                 *      Mesaje.GenerateAndSendMessage(this.ID, DateTime.Now, "Document sters", Convert.ToInt32(System.Web.HttpContext.Current.Session["AUTHENTICATED_ID"]), (int)Mesaje.Importanta.Low);
                 * }
                 * catch { }
                 */
            }
            return(toReturn);
        }
예제 #17
0
        public response GetFiltered(JToken jProces, JToken jprocesJson)
        {
            string            conStr          = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int               _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]);
            ProceseRepository pr = new ProceseRepository(_CURENT_USER_ID, conStr);

            string limit = null;

            if (jprocesJson != null)
            {
                if (jprocesJson["LimitStart"] != null && !String.IsNullOrEmpty(jprocesJson["LimitStart"].ToString()) && jprocesJson["LimitEnd"] != null && !String.IsNullOrEmpty(jprocesJson["LimitEnd"].ToString()))
                {
                    limit = String.Format(" LIMIT {0},{1} ", jprocesJson["LimitStart"].ToString(), jprocesJson["LimitEnd"].ToString());
                }
            }
            //response r = dr.GetFiltered(null, null, String.Format("{'jProces':{0},'jprocesJson':{1}}", JsonConvert.SerializeObject(jProces), JsonConvert.SerializeObject(jprocesJson)), null);
            string jsonParam = CreateFilterString(jProces, jprocesJson);
            //response r = pr.GetFilteredExtended(null, null, jsonParam, limit);
            response r = pr.GetFiltered(null, null, jsonParam, limit);

            r.InsertedId = Convert.ToInt32(pr.CountFiltered(null, null, jsonParam, null).Result); // folosim campul InsertedId pt. counter
            return(r);
        }
예제 #18
0
        public JsonResult PostFile(int id_tip_document, int id_dosar)
        {
            HttpPostedFileBase f         = Request.Files[0];
            string             initFName = f.FileName;
            string             extension = f.FileName.Substring(f.FileName.LastIndexOf('.'));
            string             newFName  = Guid.NewGuid() + extension;

            Request.Files[0].SaveAs(System.IO.Path.Combine(CommonFunctions.GetScansFolder(), newFName));
            //string toReturn = "{\"DENUMIRE_FISIER\":\"" + initFName + "\",\"EXTENSIE_FISIER\":\"" + extension + "\",\"CALE_FISIER\":\"" + newFName + "\"}";
            string         conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            DocumentScanat ds     = new DocumentScanat(Convert.ToInt32(Session["CURENT_USER_ID"]), conStr);

            ds.ID_DOSAR        = id_dosar;
            ds.ID_TIP_DOCUMENT = id_tip_document;
            ds.CALE_FISIER     = newFName;
            ds.DENUMIRE_FISIER = initFName;
            ds.EXTENSIE_FISIER = extension;
            response   r      = ds.Insert();
            JsonResult result = Json(r, JsonRequestBehavior.AllowGet);

            result.MaxJsonLength = Int32.MaxValue;
            return(result);
        }
예제 #19
0
        public response Validare()
        {
            response toReturn = new response(true, "", null, null, new List <Error>());;
            Error    err      = new Error();

            if (this.NUME == null || this.NUME.Trim() == "")
            {
                toReturn.Status     = false;
                err                 = ErrorParser.ErrorMessage("emptyNumeSetare");
                toReturn.Message    = string.Format("{0}{1};", toReturn.Message == null ? "" : toReturn.Message, err.ERROR_MESSAGE);
                toReturn.InsertedId = null;
                toReturn.Error.Add(err);
            }
            if (this.VALOARE == null || this.VALOARE.Trim() == "")
            {
                toReturn.Status     = false;
                err                 = ErrorParser.ErrorMessage("emptyValoareSetare");
                toReturn.Message    = string.Format("{0}{1};", toReturn.Message == null ? "" : toReturn.Message, err.ERROR_MESSAGE);
                toReturn.InsertedId = null;
                toReturn.Error.Add(err);
            }
            return(toReturn);
        }
예제 #20
0
        /// <summary>
        /// Validated given number as per business rules
        /// </summary>
        /// <param name="Number">Input valid number</param>
        /// <returns>boolean</returns>
        public response <bool> ValidateInput(String Number)
        {
            response <bool> response = new response <bool>();
            Boolean         isvalid  = true;

            try
            {
                //validations
                // supports 12 chars
                // should be +ve number
                // should not contain decimals
                // can not have strings allowed numbers only.
                // bool beginsZero = false;//tests for 0XX

                if (string.IsNullOrEmpty(Number))
                {
                    isvalid = false;
                }
                if (Number.Contains("."))
                {
                    isvalid = false;
                }
                double number;
                isvalid = double.TryParse(Number, out number);
                if (isvalid && number < 0)
                {
                    isvalid = false;
                }
            }
            catch (Exception ex)
            {
                // log error and throw it
                _logger.LogError(ex, "");
            }
            response.result = isvalid;
            return(response);
        }
        public JsonResult Edit(SocietateAsigurare societate)
        {
            response r = new response();

            string conStr                   = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int    _CURENT_USER_ID          = Convert.ToInt32(Session["CURENT_USER_ID"]);
            SocietatiAsigurareRepository ur = new SocietatiAsigurareRepository(_CURENT_USER_ID, conStr);
            SocietateAsigurare           s  = new SocietateAsigurare(_CURENT_USER_ID, conStr);

            PropertyInfo[] pis = societate.GetType().GetProperties();
            foreach (PropertyInfo pi in pis)
            {
                pi.SetValue(s, pi.GetValue(societate));
            }
            if (societate.ID == null) // insert
            {
                r = s.Insert();
            }
            else // update
            {
                r = s.Update();
            }
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
예제 #22
0
        public string GetMZPatient([FromBody] request <GetMZPatient> getMZPatient)
        {
            if (getMZPatient == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }

            var pt_Info = ptInfoBLL.GetPtInfoByCardNo(getMZPatient.model.patName, getMZPatient.model.patCardType, getMZPatient.model.patCardNo);

            if (pt_Info == null || pt_Info.del == true)
            {
                return(RsXmlHelper.ResXml(1, "患者信息为空"));
            }

            response <Entity.SResponse.getMZPatient> getMZResponse = new response <Entity.SResponse.getMZPatient>()
            {
                model = new Entity.SResponse.getMZPatient()
                {
                    resultCode    = 0,
                    resultMessage = "",
                    patType       = 1,
                    patName       = pt_Info.pname,
                    patSex        = pt_Info.sex == "男" ? "M" : "F",
                    patBirth      = pt_Info.birth.ToString(),
                    patAddress    = pt_Info.addr1 + pt_Info.addr3,
                    patMobile     = pt_Info.tel,
                    patIdType     = CodeConvertUtils.GetIdNoType(pt_Info.idtype),
                    patIdNo       = pt_Info.idno,
                    patCardType   = getMZPatient.model.patCardType,
                    patCardNo     = getMZPatient.model.patCardNo,
                    hasMedicare   = !string.IsNullOrWhiteSpace(pt_Info.yno)
                }
            };

            return(XMLHelper.XmlSerialize(getMZResponse));
        }
예제 #23
0
        public static void GenerateRandomNodes(int _authenticatedUserId, string _connectionString)
        {
            SocietatiAsigurareRepository sar = new SocietatiAsigurareRepository(_authenticatedUserId, _connectionString);

            SocietateAsigurare[] sas = (SocietateAsigurare[])sar.GetAll().Result;
            Random r  = new Random(10);
            Random r2 = new Random();

            foreach (SocietateAsigurare sa1 in sas)
            {
                int NR_DOSARE = r2.Next(0, 9);
                foreach (SocietateAsigurare sa2 in sas)
                {
                    if (sa1.ID != sa2.ID)
                    {
                        for (int i = 0; i < NR_DOSARE; i++)
                        {
                            Dosar d = new Dosar(_authenticatedUserId, _connectionString);
                            d.NR_DOSAR_CASCO     = String.Format("AUTOGENERAT_{0}_{1}_{2}", sa1.ID, sa2.ID, i);
                            d.ID_ASIGURAT_CASCO  = 1;
                            d.ID_ASIGURAT_RCA    = 2;
                            d.ID_AUTO_CASCO      = 1;
                            d.ID_AUTO_RCA        = 2;
                            d.ID_SOCIETATE_CASCO = sa1.ID;
                            d.ID_SOCIETATE_RCA   = sa2.ID;
                            d.NR_POLITA_CASCO    = "TEST_POLITA_CASCO";
                            d.NR_POLITA_RCA      = "TEST_POLITA_RCA";
                            d.REZERVA_DAUNA      = d.SUMA_IBNR = d.VALOARE_DAUNA = d.VALOARE_REGRES = d.VMD = r.Next(10, 1000);
                            d.STATUS             = "AVIZAT";
                            d.DATA_EVENIMENT     = d.DATA_CREARE = d.DATA_ULTIMEI_MODIFICARI = DateTime.Now;
                            response rsp = d.Insert();
                        }
                    }
                }
            }
        }
예제 #24
0
        public JsonResult Filter(string _data)
        {
            try
            {
                string           conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
                int              uid    = Convert.ToInt32(Session["CURENT_USER_ID"]);
                FilterNotificari fn     = JsonConvert.DeserializeObject <FilterNotificari>(_data, CommonFunctions.JsonDeserializerSettings);

                //DateTime d = CommonFunctions.SwitchBackFormatedDate(_data) == null ? new DateTime() : CommonFunctions.SwitchBackFormatedDate(_data).Value.Date;
                NotificariEmailView nev = new NotificariEmailView(uid, conStr, fn);
                return(Json(JsonConvert.SerializeObject(nev, Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
                {
                    DateTimeFormat = CommonFunctions.DATE_FORMAT
                }), JsonRequestBehavior.AllowGet));
            }catch (Exception exp)
            {
                LogWriter.Log(exp);
                response r = new response(false, exp.Message, null, null, new List <Error>()
                {
                    new Error(exp)
                });
                return(Json(r, JsonRequestBehavior.AllowGet));
            }
        }
예제 #25
0
 private response CheckStatusCode(response response)
 {
     if (response == null)
     {
         throw new ServiceException("", ServiceExceptionType.Error);
     }
     if (response.status == null)
     {
         throw new ServiceException("", ServiceExceptionType.Error);
     }
     if (response.status.statuscode == statusStatuscode.ok)
     {
         return(response);
     }
     if (response.status.statuscode == statusStatuscode.error)
     {
         throw new ServiceException(response.status.debuginfo, ServiceExceptionType.Error);
     }
     if (response.status.statuscode == statusStatuscode.fsk)
     {
         throw new ServiceException(response.status.debuginfo, ServiceExceptionType.FSK);
     }
     if (response.status.statuscode == statusStatuscode.geolocation)
     {
         throw new ServiceException(response.status.debuginfo, ServiceExceptionType.GeoLocation);
     }
     if (response.status.statuscode == statusStatuscode.mailNotSent)
     {
         throw new ServiceException(response.status.debuginfo, ServiceExceptionType.MainNotSent);
     }
     if (response.status.statuscode == statusStatuscode.notFound)
     {
         throw new ServiceException(response.status.debuginfo, ServiceExceptionType.NotFound);
     }
     throw new ServiceException(response.status.debuginfo, ServiceExceptionType.Error);
 }
예제 #26
0
파일: z0Vk.cs 프로젝트: patel22p/dorumon
    public void GetFriends(bool async)
    {
        newThread(async, delegate()
        {
            string sendfunc = SendFunction(int.Parse(mid), ap_id, sid, secret,
                                           new string[][]
            {
                new string[] { "method", "friends.get" },
                new string[] { "fields", "nickname,first_name,last_name,photo,online,uid" }
            });

            string res = Write(sendfunc);
            res        = Regex.Match(res, "<response list=\"true\">(.*)</response>", RegexOptions.Singleline).Groups[1].Value.Trim();
            res        = "<response><users>" + res + "</users></response>";

            response r = (response)respxml.Deserialize(new StringReader(res));
            print("get friends " + r.users.Count);
            friends.Clear();
            friends.Add(localuser.uid, localuser);


            foreach (user user in r.users)
            {
                if (user.online == true)
                {
                    LoadAvatar(user);
                }
                friends.Add(user.uid, user);
                if (appusers.Contains(user.uid))
                {
                    user.installed = true;
                }
                user.st.text = user.online ? lc.onlin.ToString() : lc.offline.ToString();
            }
        });
    }
예제 #27
0
파일: Program.cs 프로젝트: andpsy/socisaV2
        public static void RestoreOrphanDocuments()
        {
            string   LOG_FILE = "c:\\Uploads\\Log.txt";
            response r        = new response();
            string   conStr   = CommonFunctions.StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["MySqlConnectionString"].ToString(), CommonFunctions.StringCipher.RetrieveKey());
            int      id       = 1;
            DocumenteScanateRepository dsr = new DocumenteScanateRepository(id, conStr);

            DocumentScanat[] docs = (DocumentScanat[])dsr.GetOrphanDocuments().Result;
            //FileManager.RestoreFilesFromDb(docs);
            StreamWriter sw = File.AppendText(LOG_FILE);

            sw.Write(String.Format("{0} documente orfane\r\n*****************************************************\r\n\r\n", docs.Length));
            sw.Flush(); sw.Dispose();
            foreach (DocumentScanat ds in docs)
            {
                r = FileManager.RestoreFileFromDb(ds);
                string message = String.Format("{0} ({1}) - {2}\r\n", ds.CALE_FISIER, ds.ID_DOSAR, r.Status ? "Recuperat" : r.Message);
                Console.Write(message);
                sw = File.AppendText(LOG_FILE);
                sw.Write(message);
                sw.Flush(); sw.Dispose();
            }
        }
        public response validateoperations(validatOTP req, IConfiguration _config)
        {
            response _response = response.GetInstance();

            try
            {
                otpDetailsDataBaseSettings _otpDetailsDataBaseSettings = new otpDetailsDataBaseSettings();
                _otpDetailsDataBaseSettings = _otpDetailsDataBaseSettings.setprops(_config);
                otpService _otpService = new otpService(_otpDetailsDataBaseSettings);
                otpDetails _otpDetails = _otpService.Get(req.mobileNumber);
                if (_otpDetails.otp == req.OTP && _otpDetails.mobileNumber == req.mobileNumber)
                {
                    _response.apiStatuscode = 200;
                    _response.error         = "";
                    _response.success       = true;
                    _response.data          = "Valid OTP";
                    _response.request       = req;
                    _response.appErrorcode  = 0;
                }
                else
                {
                    _response.apiStatuscode = 404;
                    _response.error         = "Inavlid OTP";
                    _response.success       = true;
                    _response.data          = "";
                    _response.request       = req;
                    _response.appErrorcode  = 0;
                }
            }
            catch (Exception ex)
            {
                _response.error = ex.Message;
            }

            return(_response);
        }
예제 #29
0
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log)
        {
            string name = req.GetQueryNameValuePairs()
                          .FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0)
                          .Value;
            response res = new response(0, "No such user in database.");

            if (name == null)
            {
                res.setData(-1, "No user sent!");
            }
            else
            {
                dbConnect db   = new dbConnect();
                int       rows = db.query_scalar("SELECT  COUNT(*) FROM Users WHERE FirstName = '" + name + "'");
                if (rows > 0)
                {
                    res.setData(1, "FOUND!");
                }
            }
            return(name == null
                ? req.CreateResponse(HttpStatusCode.BadRequest, res, JsonMediaTypeFormatter.DefaultMediaType)
                : req.CreateResponse(HttpStatusCode.OK, res, JsonMediaTypeFormatter.DefaultMediaType));
        }
예제 #30
0
        /// <summary>
        /// This factory method automatically resolves concreate class and expossed as interface
        /// </summary>
        /// <param name="Number">Input valid number</param>
        /// <returns>string</returns>
        public response <string> Translate(string Number)
        {
            response <string> response           = new response <string>();
            response <bool>   validationresponse = ValidateInput(Number);

            try
            {
                if (validationresponse.result)
                {
                    response.result = TranslateNumber(Number);
                }
                else
                {
                    response.errors = validationresponse.errors;
                }
            }
            catch (Exception ex)
            {
                // log error and throw it
                _logger.LogError(ex, "");
            }

            return(response);
        }
예제 #31
0
파일: z0Vk.cs 프로젝트: patel22p/dorumon
    public void GetMessages()
    {
        newThread(delegate()
        {
            string sendfunc = SendFunction(int.Parse(mid), ap_id, sid, secret,
                                           new string[][]
            {
                new string[] { "method", "messages.get" },
                new string[] { "filters", "1" },
            });

            string res = Write(sendfunc);

            res        = Regex.Match(res, "<count>.*?</count>(.*)</response>", RegexOptions.Singleline).Groups[1].Value;
            res        = "<response><personal>" + res + "</personal></response>";
            response r = (response)respxml.Deserialize(new StringReader(res));

            Add(r);
            if (r.personal.Count > 0)
            {
                string mids = "";
                foreach (message m in r.personal)
                {
                    mids += m.mid + ",";
                }
                sendfunc = SendFunction(int.Parse(mid), ap_id, sid, secret,
                                        new string[][]
                {
                    new string[] { "method", "messages.markAsRead" },
                    new string[] { "mids", mids.TrimEnd(',') },
                });

                print(Write(sendfunc));
            }
        });
    }
        private response BankcardCaptureResponse(XmlDocument _response, TransactionType _transactionType)
        {
            try
            {
                response r = new response(_transactionType, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
                                          "", "", "", "", "", "", "", "", "", "", "", "", "");

                //First Check to see if this was a transaction
                XmlNodeList nodes = _response.GetElementsByTagName("Status");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.Status = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("StatusCode");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.StatusCode = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("StatusMessage");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.StatusMessage = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("TransactionId");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.TransactionId = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("OriginatorTransactionId");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.OriginatorTransactionId = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("ServiceTransactionId");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.ServiceTransactionId = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("CaptureState");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.CaptureState = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("TransactionState");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.TransactionState = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("BatchId");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.BatchId = nodes[0].InnerText;

                return r;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occurred when displaying results for " + ex.Message);
                return null;
            }
        }
 // Removed. In the source code, the body of the double-using blog contained a call to
 // emit diagnostic information in DEBUG builds. This doesn't translate well to the
 // PowerShell codebase, where we currently build and ship our DEBUG bits.
 DebugPrintAnalyticsOutput(response.Content.ReadAsStringAsync(), hitData);
예제 #34
0
    public void GetNews()
    {

        newThread(delegate()
        {
            string sendfunc = SendFunction(int.Parse(mid), ap_id, sid, secret,
                        new string[][]
                    { 
                        new string[]{"timestamp",LastStatusTime.ToString()},                                                
                        new string[]{"method","activity.getNews"},                                                
                    });

            string res = Write(sendfunc);
            print("status");
            response resp = new response();
            foreach (Match m in Regex.Matches(res, "<uid>(.*?)</uid>.*?<timestamp>(.*?)</timestamp>.*?<text>(.*?)</text>", RegexOptions.Singleline))
            {
                status st = new status();
                st.uid = int.Parse(m.Groups[1].Value);
                st.timestamp = int.Parse(m.Groups[2].Value);
                st.text = m.Groups[3].Value;
                resp.statuses.Add(st);
                print("set status" + st.text);
            }
            Add(resp);
        });
        LastStatusTime = unixtime;
    }
예제 #35
0
    void Add(response resp)
    {

        lock ("vk")
            responses.Add(resp);
    }
예제 #36
0
 /// <summary>
 /// 复制HTTP响应
 /// </summary>
 /// <param name="response">HTTP响应</param>
 /// <returns>HTTP响应</returns>
 internal static response Copy(response response)
 {
     response value = Get(true);
     if (response != null)
     {
         value.CacheControl = response.CacheControl;
         value.ContentEncoding = response.ContentEncoding;
         value.ContentType = response.ContentType;
         value.ETag = response.ETag;
         value.LastModified = response.LastModified;
         value.ContentDisposition = response.ContentDisposition;
         int count = response.Cookies.Count;
         if (count != 0) value.Cookies.Add(response.Cookies.array, 0, count);
     }
     return value;
 }
        private string CreateRequest_Json(string _url, string _method, string _body, string _UserName, string _UserPassword,
                             TransactionType _transactionType)
        {
            //http://msdn.microsoft.com/en-us/library/bb969540(office.12).aspx
            //http://www.daniweb.com/forums/thread241233.html
            //http://stackoverflow.com/questions/897782/how-to-add-custom-http-header-for-c-web-service-client-consuming-axis-1-4-web-se

            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_url);
                request.Method = _method; //Valid values are "GET", "POST", "PUT" and "DELETE"
                request.UserAgent =
                    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50215)";
                request.ContentType = "application/json";
                request.Timeout = 1000 * 60;
                //Authorization is made up of UserName and Password in the format [UserName]:[Password]. In this case the identity token is the only value set and is the [UserName]
                String _Authorization = "Basic " +
                                        Convert.ToBase64String(Encoding.ASCII.GetBytes(_UserName + ":" + _UserPassword));
                request.Headers.Add(HttpRequestHeader.Authorization, _Authorization);

                //Capture the basical header information. Using a proxy sniffer would be prefered however this helps to capture most information.
                string ContentLength = "";
                if (request.ContentLength > 0)
                    ContentLength = "\r\nContent-Length: " + request.ContentLength;
                string _HeaderInformation = _method + " " + request.Address.AbsolutePath + request.Address.Query +
                                            "\r\n" + request.Headers.ToString().Trim() + "\r\nHost: " +
                                            request.Address.Host + ContentLength + "\r\n\r\n";

                if (_body.Length > 0)
                {
                    StreamWriter writer = new StreamWriter(request.GetRequestStream());
                    writer.Write(_body);
                    writer.Close();
                }
                txtRequest.Text = _HeaderInformation + _body;
                RTxtSummary.SelectionColor = Color.Blue;
                RTxtSummary.AppendText("REQUEST : \r\n");
                RTxtSummary.SelectionColor = Color.Black;
                RTxtSummary.AppendText(_HeaderInformation + _body + "\r\n");
                HttpWebResponse response = null;

                try
                {
                    response = (HttpWebResponse)request.GetResponse();
                }
                catch (Exception e)
                {
                    if (_method != "DELETE")
                        throw (e);
                }
                using (Stream data = response.GetResponseStream())
                {
                    try
                    {
                        string text = new StreamReader(data).ReadToEnd();

                        //Log out request and response as well as process last response for follow-on messages.
                        //Diaplay in modal the request information? 
                        if (ChkShowRequestModal.Checked)
                        {
                            ModalInformation mI = new ModalInformation();
                            mI.CallingForm("**** REQUEST****\r\n" + _HeaderInformation + _body +
                                           "\r\n\r\n**** RESPONSE ****\r\n" + text);
                            //mI.CallingForm(_method + " " + request.Address.AbsolutePath + "\r\n" + request.Headers + "Host: " + request.Address.Host + "\r\n" + request.ContentLength + request.Expect + _body);
                            mI.ShowDialog(this);
                        }
                        else
                        {
                            //Confirm processing of last transaction
                            if (!_blnResponseMessage && TransactionType.NotSet != _transactionType)
                            {
                                MessageBox.Show("Successfully processed " + _transactionType +
                                                " transaction. For more information about request and response check the show modal checkbox");
                                _blnResponseMessage = true;
                            }
                        }
                        txtResponse.Text = text;

                        RTxtSummary.SelectionColor = Color.Blue;
                        RTxtSummary.AppendText("\r\nRESPONSE : \r\n");
                        RTxtSummary.SelectionColor = Color.Black;
                        RTxtSummary.AppendText(text + "\r\n");

                        if (_transactionType != TransactionType.NotSet)
                            _LastResponse = ProcessResponse_Json(text, _transactionType);

                        return text;
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                    finally
                    {
                        data.Close();
                    }
                }
            }
            catch (System.Net.WebException ex2)
            {
                //Lets get the webException returned in the response
                using (Stream data2 = ex2.Response.GetResponseStream())
                {
                    try
                    {
                        string text = new StreamReader(data2).ReadToEnd();
                        txtResponse.Text = text;
                        RTxtSummary.SelectionColor = Color.Blue;
                        RTxtSummary.AppendText("\r\nRESPONSE : \r\n");
                        RTxtSummary.SelectionColor = Color.Black;
                        RTxtSummary.AppendText(text + "\r\n");

                        return text;
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                    finally
                    {
                        data2.Close();
                    }
                }
            }
            catch (Exception e)
            {
                return e.Message;
            }

        }
        private void Adjust()
        {
            if (_LastResponse != null && _LastResponse.TransactionType == TransactionType.AuthorizeAndCapture)
            {
                if (ChkUseJsonInstead.Checked)
                {
                    string strAuthorizeAndCaptureId =
                        "{\"$type\":\"Adjust,http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest\","
                            + "\"ApplicationProfileId\":\"" + _ApplicationProfileId + "\","
                            + "\"DifferenceData\":"
                            + "{"
                                + "\"TransactionId\":\"" + _LastResponse.TransactionId + "\","
                                + "\"TipAmount\":\"2.00\","
                                + "\"Amount\":\"2.00\","
                                + "\"Addendum\":null"
                            + "}"
                        + "}";

                    CreateRequest_Json(_txn + @"/" + _WorkflowId + @"/" + _LastResponse.TransactionId, "PUT", strAuthorizeAndCaptureId, _SessionToken, "",
                                  TransactionType.Adjust);
                }
                else
                {
                    string strAuthorizeAndCaptureId = "<SubmitTransaction xmlns:i='http://www.w3.org/2001/XMLSchema-instance' i:type='Adjust' xmlns='http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest'>"
                            + "<ApplicationProfileId>" + _ApplicationProfileId + "</ApplicationProfileId>"
                              + "<DifferenceData xmlns:d2p1='http://schemas.ipcommerce.com/CWS/v2.0/Transactions'>"
                                + "<d2p1:Amount>2.00</d2p1:Amount>"
                                + "<d2p1:TransactionId>" + _LastResponse.TransactionId + "</d2p1:TransactionId>"
                                + "<d2p1:TipAmount>2.00</d2p1:TipAmount>"
                            + "</DifferenceData>"
                            + "</SubmitTransaction>"
                            ;
                    CreateRequest(_txn + @"/" + _WorkflowId + @"/" + _LastResponse.TransactionId, "PUT", strAuthorizeAndCaptureId, _SessionToken, "",
                                  TransactionType.Adjust);
                }
                _LastResponse = null; //clear out the last transaction as no more operations to process

            }
            else
            {
                MessageBox.Show("In order to process an Adjust a AuthorizeAndCapture needs to be processed first");
            }
        }
        private response ProcessBankcardTransactionResponsePro(XmlDocument _response, TransactionType _transactionType)
        {
            try
            {
                response r = new response(_transactionType, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
                                          "", "", "", "", "", "", "", "", "", "", "", "", "");

                //First Check to see if this was a transaction
                XmlNodeList nodes = _response.GetElementsByTagName("Status");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.Status = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("StatusCode");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.StatusCode = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("StatusMessage");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.StatusMessage = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("TransactionId");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.TransactionId = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("OriginatorTransactionId");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.OriginatorTransactionId = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("ServiceTransactionId");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.ServiceTransactionId = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("CaptureState");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.CaptureState = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("TransactionState");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.TransactionState = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("Amount");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.Amount = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("CardType");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.CardType = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("FeeAmount");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.FeeAmount = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("ApprovalCode");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.ApprovalCode = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("AVSResult");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                {
                    foreach (XmlNode n in nodes[0])
                    {
                        if (n.InnerXml.Length > 0 && n.InnerText != "NotSet")
                            r.AVSResult = r.AVSResult + "\r\n" + n.Name + " : " + n.InnerText;
                        ;
                    }
                }

                nodes = _response.GetElementsByTagName("BatchId");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.BatchId = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("CVResult");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.CVResult = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("CardLevel");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.CardLevel = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("DowngradeCode");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.DowngradeCode = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("MaskedPAN");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.MaskedPAN = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("PaymentAccountDataToken");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.PaymentAccountDataToken = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("RetrievalReferenceNumber");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.RetrievalReferenceNumber = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("Resubmit");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.Resubmit = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("SettlementDate");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.SettlementDate = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("FinalBalance");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.FinalBalance = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("OrderId");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.OrderId = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("CashBackAmount");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.CashBackAmount = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("AdviceResponse");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.AdviceResponse = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("CommercialCardResponse");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.CommercialCardResponse = nodes[0].InnerText;

                nodes = _response.GetElementsByTagName("ReturnedACI");
                if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                    r.ReturnedACI = nodes[0].InnerText;

                return r;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occurred when displaying results for " + ex.Message);
                return null;
            }
        }
        private void CmdGenerateTCSamples_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            if (CboIndustryType.Text.Length < 1)
            {
                MessageBox.Show("Please select an industry type");
                CboIndustryType.Focus();
                Cursor = Cursors.Default;
                return;
            }
            if (TxtSvcId.Text.Length < 1)
            {
                MessageBox.Show("Please enter a valid ServiceId");
                TxtSvcId.Focus();
                Cursor = Cursors.Default;
                return;
            }
            else
            {
                _WorkflowId = TxtSvcId.Text;
            }

            RTxtSummary.Clear();

            RTxtSummary.SelectionColor = Color.Blue;
            RTxtSummary.AppendText("**************************************************************\r\n");
            RTxtSummary.SelectionColor = Color.Blue;
            RTxtSummary.AppendText("***** Sample REST transactions for Terminal Capture Services *****\r\n");
            RTxtSummary.SelectionColor = Color.Blue;
            RTxtSummary.AppendText("**************************************************************\r\n\r\n");

            //First generate the ServiceInformation Samples
            BuildServiceInfoSamples();

            //Now process some transactions
            Font currentFont = this.RTxtSummary.SelectionFont;
            FontStyle newFontStyle;
            newFontStyle = FontStyle.Bold;

            RTxtSummary.SelectionColor = Color.Blue;
            RTxtSummary.AppendText("\r\n\r\n****************************************************************\r\n");
            RTxtSummary.SelectionColor = Color.Blue;
            RTxtSummary.AppendText("***** Transaction Processing Samples ServiceId : " + _WorkflowId + "***************\r\n");
            RTxtSummary.SelectionColor = Color.Blue;
            RTxtSummary.AppendText("****************************************************************\r\n\r\n");

            //ONLY IF PINDEBIT IS IN SCOPE
            //RTxtSummary.SelectionColor = Color.DarkMagenta;
            //RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            //RTxtSummary.AppendText("\r\n***** AuthorizeAndCapture *****\r\n\r\n");
            //_WorkflowId = _ServiceId;
            //AuthorizeAndCapture();

            RTxtSummary.SelectionColor = Color.DarkMagenta;
            RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            RTxtSummary.AppendText("\r\n***** Authorize (for ReturnById) *****\r\n\r\n");
            _WorkflowId = TxtSvcId.Text;
            Authorize();
            response saveResponse = new response(TransactionType.Authorize, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
            saveResponse = _LastResponse;

            RTxtSummary.SelectionColor = Color.DarkMagenta;
            RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            RTxtSummary.AppendText("\r\n***** Authorize (for Undo) *****\r\n\r\n");
            _WorkflowId = TxtSvcId.Text;
            Authorize();

            RTxtSummary.SelectionColor = Color.DarkMagenta;
            RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            RTxtSummary.AppendText("\r\n***** Undo *****\r\n\r\n");
            _WorkflowId = TxtSvcId.Text;
            Undo();

            RTxtSummary.SelectionColor = Color.DarkMagenta;
            RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            RTxtSummary.AppendText("\r\n***** ReturnUnlinked *****\r\n\r\n");
            _WorkflowId = TxtSvcId.Text;
            ReturnUnlinked();

            RTxtSummary.SelectionColor = Color.DarkMagenta;
            RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            RTxtSummary.AppendText("\r\n***** CaptureAll *****\r\n\r\n");
            _WorkflowId = TxtSvcId.Text;
            CaptureAll();

            RTxtSummary.SelectionColor = Color.DarkMagenta;
            RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            RTxtSummary.AppendText("\r\n***** ReturnById *****\r\n\r\n");
            _LastResponse = saveResponse;//Set the Authorize response Above 
            _WorkflowId = TxtSvcId.Text;
            ReturnById();

            RTxtSummary.SelectionColor = Color.DarkMagenta;
            RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            RTxtSummary.AppendText("\r\n***** Authorize (for CaptureSelective) *****\r\n\r\n");
            _WorkflowId = TxtSvcId.Text;
            Authorize();

            RTxtSummary.SelectionColor = Color.DarkMagenta;
            RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            RTxtSummary.AppendText("\r\n***** CaptureSelective *****\r\n\r\n");
            _WorkflowId = TxtSvcId.Text;
            CaptureSelective();

            if (ChkProcessAsMagensa.Checked)
            {
                RTxtSummary.SelectionColor = Color.DarkMagenta;
                RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
                RTxtSummary.AppendText("\r\n***** Authorize (Magensa example) *****\r\n\r\n");
                _WorkflowId = TxtAltWorkFlowId.Text;
                Authorize();
            }

            #region Step3_CleanUpProcess
            //STEP 3:  Clean Up Process
            //Deletion of application and merchant IDs
            if (ChkSaveDeleteApplicationData.Checked)
            {
                RTxtSummary.SelectionColor = Color.DarkMagenta;
                RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
                RTxtSummary.AppendText("\r\n***** DeleteApplicationData *****\r\n\r\n");
                DeleteApplicationData();
            }

            RTxtSummary.SelectionColor = Color.DarkMagenta;
            RTxtSummary.SelectionFont = new Font(currentFont, newFontStyle);
            RTxtSummary.AppendText("\r\n***** DeleteMerchantProfileId *****\r\n\r\n");
            DeleteMerchantProfileId("IPC_Test_" + _WorkflowId, TxtSvcId.Text);
            #endregion

            Cursor = Cursors.Default;
        }
        private void Undo()
        {
            if (_LastResponse != null && _LastResponse.TransactionType == TransactionType.Authorize)
            {
                if (ChkUseJsonInstead.Checked)
                {
                    string strUndoRequest =
                        "{\"$type\":\"Undo,http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest\","
                            + "\"ApplicationProfileId\":\"" + _ApplicationProfileId + "\","
                            + "\"DifferenceData\":"
                            + "{\"$type\":\"BankcardUndo,http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Bankcard\","
                                + "\"TransactionId\":\"" + _LastResponse.TransactionId + "\","
                                + "\"Addendum\":null"
                            + "}"
                        + "}";

                    CreateRequest_Json(_txn + @"/" + _WorkflowId + @"/" + _LastResponse.TransactionId, "PUT", strUndoRequest,
                                   _SessionToken, "", TransactionType.Undo);
                }
                else
                {
                    string strUndoRequest = @"<SubmitTransaction xmlns:i='http://www.w3.org/2001/XMLSchema-instance' i:type='Undo' xmlns='http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest'>"
                        + "<ApplicationProfileId>" + _ApplicationProfileId + "</ApplicationProfileId>"
                        + "<DifferenceData xmlns:d2p1='http://schemas.ipcommerce.com/CWS/v2.0/Transactions' xmlns:d2p2='http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Bankcard' i:type='d2p2:BankcardUndo'>"
                            + "<d2p1:TransactionId>" + _LastResponse.TransactionId + "</d2p1:TransactionId>"
                        //+ "<d2p2:PINDebitReason>NotSet</d2p2:PINDebitReason>"
                        + "</DifferenceData>"
                        + "</SubmitTransaction>"
                        ;

                    CreateRequest(_txn + @"/" + _WorkflowId + @"/" + _LastResponse.TransactionId, "PUT", strUndoRequest,
                                  _SessionToken, "", TransactionType.Undo);
                }

                _LastResponse = null; //Clear out last transactiontype as no follow-on transactions are related to Undo
            }
            else
            {
                MessageBox.Show("In order to process an Undo a Authorize needs to be processed first");
            }
        }
        private void ReturnById()
        {
            if (_LastResponse != null &&
                (_LastResponse.TransactionType == TransactionType.AuthorizeAndCapture |
                 _LastResponse.TransactionType == TransactionType.Capture |
                 _LastResponse.TransactionType == TransactionType.Authorize))
            {
                if (ChkUseJsonInstead.Checked)
                {
                    string strReturnById =
                        "{\"$type\":\"ReturnById,http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest\","
                            + "\"ApplicationProfileId\":\"" + _ApplicationProfileId + "\","
                            + "\"MerchantProfileId\":\"" + _MerchantProfileId + "\","
                            + "\"DifferenceData\":"
                            + "{\"$type\":\"BankcardReturn,http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Bankcard\","
                                + "\"TransactionId\":\"" + _LastResponse.TransactionId + "\","
                                + "\"Amount\":\"" + TxtAmount.Text + "\","
                                + "\"Addendum\":null"
                            + "}"
                        + "}";

                    CreateRequest_Json(_txn + @"/" + _WorkflowId, "POST", strReturnById, _SessionToken, "",
                                  TransactionType.ReturnById);
                }
                else
                {
                    string strReturnById = "<SubmitTransaction xmlns:i='http://www.w3.org/2001/XMLSchema-instance' i:type='ReturnById' xmlns='http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest'>"
                            + "<ApplicationProfileId>" + _ApplicationProfileId + "</ApplicationProfileId>"
                            + "<MerchantProfileId>" + _MerchantProfileId + "</MerchantProfileId>"
                            + "<DifferenceData xmlns:d2p1='http://schemas.ipcommerce.com/CWS/v2.0/Transactions' xmlns:d2p2='http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Bankcard' i:type='d2p2:BankcardReturn'>"
                                + "<d2p1:TransactionId>" + _LastResponse.TransactionId + "</d2p1:TransactionId>"
                                + "<d2p1:TransactionDateTime>" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz") + "</d2p1:TransactionDateTime>"
                                + "<d2p2:Amount>" + TxtAmount.Text + "</d2p2:Amount>"
                            + "</DifferenceData>"
                            + "</SubmitTransaction>"
                            ;
                    CreateRequest(_txn + @"/" + _WorkflowId, "POST", strReturnById, _SessionToken, "",
                                  TransactionType.ReturnById);
                }
                _LastResponse = null; //clear out the last transaction as no more operations to process

            }
            else
            {
                MessageBox.Show("In order to process a ReturnById a AuthorizeAndCapture or Capture needs to be processed first");
            }
        }
예제 #43
0
 /// <summary>
 /// 添加到HTTP响应池
 /// </summary>
 /// <param name="response">HTTP响应</param>
 internal static void Push(ref response response)
 {
     response value = Interlocked.Exchange(ref response, null);
     if (value != null && value.isPool)
     {
         value.Clear();
         typePool<response>.Push(value);
     }
 }
        private response ProcessBankcardTransactionResponsePro_Json(string _response, TransactionType _transactionType)
        {
            try
            {
                response r = new response(_transactionType, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
                                          "", "", "", "", "", "", "", "", "", "", "", "", "");

                //TODO : Figure out how to easily parse the JSON
                //First Check to see if this was a transaction
                //XmlNodeList nodes = _response.GetElementsByTagName("Status");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.Status = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("StatusCode");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.StatusCode = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("StatusMessage");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.StatusMessage = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("TransactionId");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")

                //ToDo : Need a better approach to parse a Json Response
                r.TransactionId = _response.Substring(_response.IndexOf("\"TransactionId\":\"") + 17, 32);
                r.TransactionType = _transactionType;

                //nodes = _response.GetElementsByTagName("OriginatorTransactionId");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.OriginatorTransactionId = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("ServiceTransactionId");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.ServiceTransactionId = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("CaptureState");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.CaptureState = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("TransactionState");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.TransactionState = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("Amount");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //ToDo : Need a better approach to parse a Json Response
                r.Amount = _response.Substring(_response.IndexOf("\"Amount\":") + 9, 5);

                //nodes = _response.GetElementsByTagName("CardType");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.CardType = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("FeeAmount");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.FeeAmount = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("ApprovalCode");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.ApprovalCode = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("AVSResult");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //{
                //    foreach (XmlNode n in nodes[0])
                //    {
                //        if (n.InnerXml.Length > 0 && n.InnerText != "NotSet")
                //            r.AVSResult = r.AVSResult + "\r\n" + n.Name + " : " + n.InnerText;
                //        ;
                //    }
                //}

                //nodes = _response.GetElementsByTagName("BatchId");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.BatchId = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("CVResult");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.CVResult = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("CardLevel");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.CardLevel = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("DowngradeCode");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.DowngradeCode = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("MaskedPAN");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.MaskedPAN = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("PaymentAccountDataToken");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.PaymentAccountDataToken = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("RetrievalReferenceNumber");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.RetrievalReferenceNumber = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("Resubmit");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.Resubmit = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("SettlementDate");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.SettlementDate = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("FinalBalance");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.FinalBalance = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("OrderId");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.OrderId = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("CashBackAmount");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.CashBackAmount = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("AdviceResponse");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.AdviceResponse = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("CommercialCardResponse");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.CommercialCardResponse = nodes[0].InnerText;

                //nodes = _response.GetElementsByTagName("ReturnedACI");
                //if (nodes != null && nodes.Count > 0 && nodes[0].InnerText != "NotSet")
                //    r.ReturnedACI = nodes[0].InnerText;

                return r;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occurred when displaying results for " + ex.Message);
                return null;
            }
        }