Example #1
0
        /// <summary>
        ///     Removes the item.
        /// </summary>
        /// <returns><c>true</c>, if item was removed, <c>false</c> otherwise.</returns>
        /// <param name="genreName">Genre name.</param>
        public static bool RemoveItem(string genreName)
        {
            var bolRetVal = false;

            try
            {
                var declaringType = MethodBase.GetCurrentMethod().DeclaringType;
                if (declaringType != null)
                {
                    MyMessages.NameOfClass = declaringType.Name;
                }

                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                GenreList.Remove(genreName);
                return(bolRetVal = true);
            }
            catch (ArgumentException ex)
            {
                MyMessages.ErrorMessage = "Encountered error while removing this item.";
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, Environment.NewLine);
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, genreName);
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(bolRetVal);
            }
            catch (NullReferenceException ex)
            {
                MyMessages.ErrorMessage = "Encountered error while removing this item.";
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, Environment.NewLine);
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, genreName);
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(bolRetVal);
            }
        }
Example #2
0
        /// <summary>
        ///     Removes the item at index.
        /// </summary>
        /// <returns>The <see cref="System.Boolean" />.</returns>
        /// <param name="index">Index of item to remove.</param>
        public static bool RemoveItemAt(int index)
        {
            var bolRetVal = false;

            try
            {
                var declaringType = MethodBase.GetCurrentMethod().DeclaringType;
                if (declaringType != null)
                {
                    MyMessages.NameOfClass = declaringType.Name;
                }

                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                GenreList.RemoveAt(index);
                return(bolRetVal = true);
            }
            catch (IndexOutOfRangeException ex)
            {
                MyMessages.ErrorMessage = "Encountered error removing item at Index: ";
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, Environment.NewLine);
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, index.ToString());
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(bolRetVal);
            }
            catch (NullReferenceException ex)
            {
                MyMessages.ErrorMessage = "Encountered error removing item at Index: ";
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, Environment.NewLine);
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, index.ToString());
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(bolRetVal);
            }
        }
Example #3
0
        public DataTable InsertMessagesToUser([FromBody] MyMessages json)
        {
            DataTable dt = null;

            try
            {
                if (!string.IsNullOrWhiteSpace(json.userids))
                {
                    EPData    ep    = new EPData();
                    ValidInfo valid = ep.InsertMessagesToUserByCP(json);
                    dt = GetTable(valid.valid.ToString(), valid.errmsg);
                }
                else
                {
                    dt = GetTable("false", "参数错误");
                }
            }
            catch (Exception ex)
            {
                dt = GetTable("false", ex.Message);
                Log.WriteError(ex, "我的消息(SendMessagesToUser)");
            }
            return(dt);
        }
Example #4
0
        /// <summary>
        ///     Inserts the item at position and item.
        /// </summary>
        /// <returns>The <see cref="System.Boolean" />.</returns>
        /// <param name="pos">Position.</param>
        /// <param name="item">Item to be inserted.</param>
        public static bool InsertItemAt(int pos, string item)
        {
            var bolRetVal = false;

            try
            {
                var declaringType = MethodBase.GetCurrentMethod().DeclaringType;
                if (declaringType != null)
                {
                    MyMessages.NameOfClass = declaringType.Name;
                }

                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                GenreList.Insert(pos, item);
                return(bolRetVal = true);
            }
            catch (ArgumentNullException ex)
            {
                MyMessages.ErrorMessage = "Encountered error while adding new genre directory to this collection.";
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, Environment.NewLine);
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, item);
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(bolRetVal);
            }
            catch (NullReferenceException ex)
            {
                MyMessages.ErrorMessage = "Encountered error while adding new genre directory to this collection.";
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, Environment.NewLine);
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, item);
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(bolRetVal);
            }
        }
Example #5
0
        /// <summary>
        ///     Contains the item.
        /// </summary>
        /// <returns><c>true</c>, if item was contained, <c>false</c> otherwise.</returns>
        /// <param name="genreName">Genre name.</param>
        private static bool ContainsItem(string genreName)
        {
            try
            {
                var declaringType = MethodBase.GetCurrentMethod().DeclaringType;
                if (declaringType != null)
                {
                    MyMessages.NameOfClass = declaringType.Name;
                }

                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                return(GenreList.Contains(genreName));
            }
            catch (ArgumentException ex)
            {
                MyMessages.ErrorMessage = "Genre Directory Name is invalid and will not be added to the list.";
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, Environment.NewLine);
                MyMessages.ErrorMessage = string.Concat(MyMessages.ErrorMessage, genreName);
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(false);
            }
        }
        /// <summary>
        ///     Deletes the directory.
        /// </summary>
        /// <param name="dirPath">Dir path.</param>
        /// <exception cref="DirectoryNotFoundException">
        ///     Unable to locate this directory.
        /// </exception>
        public static bool DeleteDirectory(string dirPath)
        {
            try
            {
                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                if (!Directory.Exists(dirPath))
                {
                    throw new DirectoryNotFoundException();
                }

                const bool deleteFilesRecursively = true;
                Directory.Delete(dirPath, deleteFilesRecursively);

                // All OK
                return(true);
            }
            catch (UnauthorizedAccessException ex)
            {
                MyMessages.ErrorMessage = "You do not have the necessary permission level  for this operation.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (ArgumentNullException ex)
            {
                MyMessages.ErrorMessage = "The directory path is missing.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (ArgumentException ex)
            {
                MyMessages.ErrorMessage = "The directory path is invalid.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (PathTooLongException ex)
            {
                MyMessages.ErrorMessage = "The directory path is to long.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (DirectoryNotFoundException ex)
            {
                MyMessages.ErrorMessage = "Found no directory at this path: " + dirPath;
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (IOException ex)
            {
                MyMessages.ErrorMessage = "Encountered error while deleting the directory. Aborting operation.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (NotSupportedException ex)
            {
                MyMessages.ErrorMessage = "This delete directory encountered an error. Operation aborted.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyConstants mc = new MyConstants();

            try
            {
                var dataSche = (Dictionary <string, object>)Session["changingschedule"];

                string token        = "";
                int    numberQuotes = 0;

                token        = Request["token"].ToString();
                numberQuotes = int.Parse(Request["numcuotes"].ToString());

                string codeCurrency = Request["typeCurrency"].ToString();

                var newUserName = User.Identity.Name.Split('¬')[1];

                var idMemberDetails = 0;


                BrTypeChange brTypeChange = new BrTypeChange();
                var          arrayTypes   = brTypeChange.GetTypesChange().Split('|');

                var tcBuy  = decimal.Parse(arrayTypes[1]);
                var tcSale = decimal.Parse(arrayTypes[0]);

                if (Session["quotePay"] == null || Session["numCuota"] == null)
                {
                    //MessageError.Text = "Ocurrio un error.";
                    return;
                }
                var totalPay = decimal.Parse(Session["quotePay"].ToString());

                var description = Session["numCuota"].ToString();

                var methods2 = "CULQI";

                var recibe = string.Empty;


                if (Session["StatusCalendar"] == null || Session["CurrencyCode"] == null)
                {
                    //MessageError.Text = "Ocurrio un error.";
                    return;
                }

                idMemberDetails = int.Parse(Session["StatusCalendar"].ToString());

                //monto| fecha de expiration |codecurrency | description| typechange
                BrMembershipPayDetail brMembership = new BrMembershipPayDetail();
                var response = brMembership.GetQuote(idMemberDetails, User.Identity.Name.Split('¬')[1]).Split('|');

                if (decimal.Parse(response[0]) == 0)
                {
                    //MessageError.Text = "Ocurrio un error.";
                    return;
                }
                var amountCro = decimal.Parse(response[0]);

                var codeCurrencyCro = response[2];
                var tcCrono         = decimal.Parse(response[4]);

                var idInfo = idMemberDetails.ToString();
                //dos es que wallet es una parte del pago de una cuota
                var typeInfo         = "2";
                var walleOperationId = "2";


                bool IsPay = brMembership.IsPayQuote(idMemberDetails.ToString());

                if (!IsPay)
                {
                    //MessageWarning.Text = "Tu Cuota ya esta Pagada.Verifica tu cronograma de pagos.";
                    return;
                }

                BrWallet    brWallet   = new BrWallet();
                MyMessages  myMessages = new MyMessages();
                MyFunctions mf         = new MyFunctions();

                var amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1]));



                BrPerson brPerson   = new BrPerson();
                var      dataPerson = brPerson.GetByUserName(newUserName).Split('|');
                PayCulqi payCulqi   = new PayCulqi();


                decimal surcharge         = (1 + mc.Surcharge);
                var     amountRestan      = 0m;
                var     amountPayCulqires = 0d;

                var tcSend = 0m;

                if (codeCurrencyCro == "USD")
                {
                    if (codeCurrency == "PEN")
                    {
                        tcSend            = tcSale;
                        amountRestan      = ((amountCro - amountWallet) * tcSale) * surcharge;
                        amountPayCulqires = double.Parse(amountRestan.ToString());
                    }
                    if (codeCurrency == "USD")
                    {
                        tcSend            = tcBuy;
                        amountRestan      = (amountCro - amountWallet) * surcharge;
                        amountPayCulqires = double.Parse(amountRestan.ToString());
                    }
                }

                if (codeCurrencyCro == "PEN")
                {
                    if (codeCurrency == "USD")
                    {
                        tcSend            = tcCrono;
                        amountRestan      = ((amountCro * tcCrono) - amountWallet) * surcharge;
                        amountPayCulqires = double.Parse(amountRestan.ToString());
                    }
                    if (codeCurrency == "PEN")
                    {
                        tcSend            = tcBuy;
                        amountRestan      = (amountCro - (amountWallet * tcBuy)) * surcharge;
                        amountPayCulqires = double.Parse(amountRestan.ToString());
                    }
                }

                string[] culqiAnwser = payCulqi.newPayment(newUserName, dataPerson[1], amountPayCulqires, token, numberQuotes, codeCurrency).Split('¬');
                if (culqiAnwser[0] == "false")
                {
                    Response.Write("false¬" + culqiAnwser[1]);
                    return;
                }



                var namePeson = User.Identity.Name.Split('¬')[0];

                var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');

                string tranferId    = "";
                string numReceipt   = "0";
                string datecomplete = dateCurrent[2] + " de " + mf.GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                string nAffiliate   = "";

                string hour = DateTime.Now.ToString("HH:mm:ss");

                namePeson = myMessages.ToCapitalize(namePeson);
                var moneyStatus = 1;

                string imgTicketWalle = "";

                var action       = dataSche["Action"];
                var valueQuote   = Convert.ToDouble(dataSche["ValueQuote"]);
                var numQuote     = Convert.ToDouble(dataSche["NumQuote"]);
                var idMembership = Convert.ToInt32(dataSche["IdMembership"]);

                var lastpaydate = Convert.ToDateTime(dataSche["PayDate"]);

                var smallDate = DateTime.Now - lastpaydate;

                var numberDays = smallDate.Days;


                int numQuotes = int.Parse(numQuote.ToString());

                BrMembershipPayDetail payDetail = new BrMembershipPayDetail();
                bool responseb = payDetail.PutQuotesChangingSchedule(idMembership, numQuotes, recibe, 2);

                if (numberDays > 0)
                {
                    BrDaysFree brDaysFree = new BrDaysFree();
                    var        dataanw    = brDaysFree.Put(User.Identity.Name.Split('¬')[1], numberDays, idMembership);
                }


                if (amountWallet > 0)
                {
                    imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWallet.ToString() + $" USD  Atravez de Wallet.", "", $" {description}", "WL");


                    //amount | @idInfo | @typeInfo | @walletOperationId | @currencyCode | @typeChange | idmembershipDetail | imgTicket
                    string data   = $"{(amountWallet * tcSend).ToString()}|{idInfo}|{typeInfo}|{walleOperationId}|PEN|{tcSend}|{idMemberDetails.ToString()}|{imgTicketWalle}";
                    bool   answer = brWallet.Put(data, User.Identity.Name.Split('¬')[1], moneyStatus);

                    //Extorno

                    if (!answer)
                    {
                        //MessageError.Text = "Ocurrio un error.";
                        return;
                    }
                }
                //MessageSucces.Text = "Su Pago de Realizo Con Exito.";

                /*=============================================================================================================================*/

                var amountOthers = amountCro;
                //esta en estado pendienete
                var statusPay = 1;


                //marcar como pagado en la tabla membershipdetails

                //TODO: Agregar los detalles del pago
                BrUser brUser      = new BrUser();
                var    recibeCulqi = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountRestan.ToString("0.00") + $" {codeCurrency}  Atravez de Culqi.", "", $" {description}", "CQ");

                //recibe
                bool habiliAccount = brUser.BiPayQuote(idMemberDetails, imgTicketWalle + '~' + recibeCulqi, amountWallet, amountRestan, "WALLET", methods2, statusPay, tcBuy);


                var urlRedirect = "EndPaymendMbs";


                Response.Write($"true¬{urlRedirect}.aspx");
            }
            catch (Exception ex)
            {
                Email email = new Email();
                email.SendEmail(mc.ErrorEmail, "error-inresorts", ex.StackTrace + '¬' + DateTime.Now.ToLongDateString(), false);
                Response.Write("false¬ocurrio un error");
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string TypeMembership = "";

            #region Declaracion de variables
            string           quotesPendiente = "";
            string           codeCurrencyPay = "";
            string           namePeson = "";
            string[]         dataLogin = null;
            int              typeRegister = 0, numberQuotes = 0, formPay = 0, idMemberDetails = 0;
            string           dataKit = null, dataKitMember = null, dataMemberSinKit;
            string           token = null, userCurrent = null, newUserName = null, emailNewUser = null;
            double           amountPay        = 0;
            bool             isRegister       = false;
            BrUser           brUser           = null;
            BrTypeMembership brTypeMembership = null;
            Email            oEmail           = null;
            BrPayments       brPayments       = null;
            BrConsuption     brConsuption;

            #endregion

            #region Entradas de valores

            var _var = (string)Session["typeRegister"];
            if (!string.IsNullOrEmpty(_var))
            {
                typeRegister = int.Parse(Session["typeRegister"].ToString());
            }
            formPay          = int.Parse("1");
            token            = Request["token"].ToString();
            numberQuotes     = int.Parse(Request["numcuotes"].ToString());
            brUser           = new BrUser();
            brTypeMembership = new BrTypeMembership();
            dataLogin        = HttpContext.Current.User.Identity.Name.Split('¬');
            oEmail           = new Email();
            brPayments       = new BrPayments();
            brConsuption     = new BrConsuption();
            #endregion

            #region Procesos

            userCurrent = dataLogin[0];
            if (dataLogin.Length > 1)
            {
                userCurrent = dataLogin[1];
            }

            #endregion

            #region Registrar Usuario Y Generar Cuenta

            if (formPay == 1)
            {
                if (!string.IsNullOrEmpty((string)Session["SwitchAmort"]))
                {
                    var values      = (string)Session["dataAmort"];
                    var arrayValues = values.Split('|');
                    if (!string.IsNullOrEmpty(values))
                    {
                        brPayments = new BrPayments();
                        PayCulqi   payCulqi   = new PayCulqi();
                        MyMessages myMessages = new MyMessages();
                        // (int TypePay, string IdMembershipDetail, int nQuotes, decimal NewAmort, int Rate)
                        //Get the Email
                        string photo     = "culqi.jpeg";
                        string emailUser = brPayments.PayQuoteMembership(arrayValues[0], "10", photo);

                        bool     ans          = brPayments.Amortization(1, arrayValues[0], Int32.Parse(arrayValues[1]), decimal.Parse(arrayValues[2]), Int32.Parse(arrayValues[3]), photo);
                        string   currencyCode = "PEN";
                        string[] culqiAnwser  = payCulqi.newPayment(emailUser, emailUser, double.Parse(arrayValues[2]), token, numberQuotes, currencyCode).Split('¬');

                        if (culqiAnwser[0] == "true")
                        {
                            bool awnserEmail = oEmail.SubmitEmail(emailUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago());
                            Response.Write("true¬" + culqiAnwser[1]);
                            Session.Remove("SwitchAmort");
                            return;
                        }
                        Response.Redirect("Payments.aspx");
                        return;
                    }
                }
                else if (Session["StatusCalendar"] == null)
                {
                    string dataBdd = Session["datos"].ToString();
                    TypeMembership = (dataBdd.Split('$')[3]).Split('|')[7];
                    // string data2 = (string)Session["civilStatus"];
                    string   data2 = (string)Session["civilState"];
                    string[] oIdMembreship_amount = brUser.RegisterUser(dataBdd, data2).Split('¬');

                    if (oIdMembreship_amount.Length < 2)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                        return;
                    }

                    string[] parameterPerson  = dataBdd.Split('$');
                    string[] arraydata        = parameterPerson[0].Split('|');
                    string[] arrayTypeaccount = parameterPerson[2].Split('|');
                    string[] arrayaccount     = parameterPerson[3].Split('|');

                    string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + userCurrent + '|' + oIdMembreship_amount[0];
                    //'999999999999|1|sa|1'
                    newUserName = brUser.GenerateAccount(parameterAccount);



                    if (string.IsNullOrEmpty(newUserName))
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                        return;
                    }
                }
                else
                {
                    var    calendar       = (string)Session["StatusCalendar"];
                    var    data           = (string)Session["StatusCalendar"];
                    string numCuota       = Session["numCuota"].ToString();
                    var    listParameters = data.Split('|');
                    var    data2          = listParameters[0];
                    string quotePay       = (string)Session["quotePay"];
                    string userName       = User.Identity.Name.Split('¬')[1];
                    TypeMembership = User.Identity.Name.Split('¬')[7];
                    string   emailUser    = brUser.GetPersonalInformation(userName).Split('|')[5];
                    PayCulqi payCulqi     = new PayCulqi();
                    string   currencyCode = "PEN";
                    if (Session["CurrencyCode"] != null)
                    {
                        currencyCode = Session["CurrencyCode"].ToString();
                    }
                    string[] culqiAnwser = payCulqi.newPayment(userCurrent, emailUser, Double.Parse(quotePay), token, numberQuotes, currencyCode).Split('¬');

                    bool awnserEmail = oEmail.SubmitEmail(emailUser, "[RIBERA DEL RIO - PAGO]", "Ud. Ha efectuado su pago en Ribera del Rio con Exito.");
                    if (culqiAnwser[0] == "true")
                    {
                        //enviar recibo
                        var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

                        string tranferId  = culqiAnwser[2];
                        string numReceipt = "0";
                        string date       = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                        string nAffiliate = "";

                        string hour    = DateTime.Now.ToString("HH:mm:ss");
                        string detalle = Double.Parse(quotePay).ToString();

                        namePeson = User.Identity.Name.Split('¬')[0].ToUpper();

                        //cvbc
                        string nameTicket = GetRecibo(tranferId, userName, numReceipt, date,
                                                      nAffiliate, TypeMembership, namePeson, hour, detalle,
                                                      quotesPendiente, " " + numCuota);

                        string EmailUserA = brPayments.PayQuoteMembership(data2, "1", nameTicket);
                        Response.Write("true¬" + culqiAnwser[1]);
                    }
                    else
                    {
                        Response.Write("false¬" + culqiAnwser[1]);
                    }
                    return;
                }
            }
            #endregion

            #region Solo elegio el kit

            if (typeRegister == 1 && formPay == 1)
            {
                string arrayKit = Session["arrayKit"].ToString() + "¬" + newUserName;
                //'2018-10-19¬31¬31¬31¬userName'
                //  isRegister = brUser.PutRegisterkIT(arrayKit);
                string data2 = Session["financedAmount"].ToString();
                if (data2 == "0")
                {
                    data2 = Session["Amount"].ToString();
                }

                string codeCurrency = Session["TypeCurrency"].ToString();

                Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data2, 1, codeCurrency);

                if (ansNmembershi != 0)
                {
                    isRegister = brUser.PutRegisterkIT(arrayKit, ansNmembershi);
                }
                else
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    return;
                }
                //monto a pagar
                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    return;
                }
                idMemberDetails             = int.Parse(username_idmen_amount_email[1]);
                amountPay                   = double.Parse(username_idmen_amount_email[2]);
                emailNewUser                = username_idmen_amount_email[3];
                username_idmen_amount_email = null;
            }
            #endregion

            #region Elegio kit mas membresia

            if (typeRegister == 2 && formPay == 1)
            {
                dataKitMember = Session["cronograma"].ToString();

                string[] datos = Session["datos"].ToString().Split('$');

                if (Session["datos"] == null)
                {
                    Response.Write("false¬Ha Ocurrido Un Error, no hay datos.");
                    return;
                }
                string[] arraycontacto = datos[3].Split('|');
                string[] arrayperson   = datos[0].Split('|');

                amountPay = double.Parse(Session["FirtsPay"].ToString());


                if (idMemberDetails <= 0 || amountPay <= 0)
                {
                    Response.Write("false¬Ha Ocurrido Un Error id idMemberDetails vacio,amountPay vacio");
                    return;
                }

                string dni = arrayperson[5];

                newUserName     = arrayperson[0].Substring(0, 1).ToUpper() + arrayperson[1].Substring(0, 1).ToUpper() + dni;
                emailNewUser    = arraycontacto[0].Trim();
                codeCurrencyPay = Session["TypeCurrency"].ToString();


                PayCulqi   payCulqi   = new PayCulqi();
                MyMessages myMessages = new MyMessages();
                //string currencyCode = "PEN";
                string[] culqiAnwser = payCulqi.newPayment(newUserName, emailNewUser, amountPay, token, numberQuotes, codeCurrencyPay).Split('¬');
                if (culqiAnwser[0] == "false")
                {
                    Response.Write("false¬" + culqiAnwser[1]);
                    return;
                }



                /*=====================================================================================================================================================================*/

                //correo = arraycontacto[0];
                namePeson = arrayperson[0] + " " + arrayperson[1];


                string date = dataKitMember.Split('$')[1];

                string[] array1     = Session["cronogramaYa"].ToString().Split('^');
                string[] datosMem   = array1[0].Split('|');
                string[] array2     = array1[1].Split('~');
                string[] cuotas     = array2[0].Split('¬');
                string   cronoActiv = "";
                quotesPendiente = (cuotas.Length - 2).ToString();
                for (int i = 0; i < cuotas.Length - 1; i++)
                {
                    var fila = cuotas[i].Split('|');
                    if (fila[0].Substring(0, 7) != "Inicial")
                    {
                        cronoActiv += DateTime.Parse(fila[1]).ToString("yyyy-MM-dd");
                        //amountFinanciade = double.Parse(fila[2].Replace("S/.", ""));
                        break;
                    }
                    else
                    {
                        cronoActiv += DateTime.Parse(fila[1]).ToString("yyyy-MM-dd") + "¬";
                    }
                }

                string respData = brPayments.PersonGetData(newUserName);
                respData = respData + '^' + dataKitMember;
                // isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName);
                string data2        = Session["financedAmount"].ToString();
                string codeCurrency = Session["TypeCurrency"].ToString();

                Int32  ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data2, 1, codeCurrency);
                string exchange      = Session["carrito"].ToString().Split('|')[4];
                isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, exchange, 1);

                //validamos si tiene consumo


                if (!isRegister)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                    return;
                }

                BrActivation brActivation = new BrActivation();
                bool         registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);

                //obtengo el monto a pagar

                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    return;
                }
                idMemberDetails             = int.Parse(username_idmen_amount_email[1]);
                amountPay                   = double.Parse(username_idmen_amount_email[2]);
                emailNewUser                = username_idmen_amount_email[3];
                codeCurrencyPay             = username_idmen_amount_email[4];
                date                        = null;
                username_idmen_amount_email = null;
                dataKitMember               = null;
                respData                    = null;


                /*=============================================================================================================================*/

                var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

                string tranferId    = culqiAnwser[2] == null ? "" : culqiAnwser[2];
                string numReceipt   = "0";
                string datecomplete = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                string nAffiliate   = "";

                string hour    = DateTime.Now.ToString("HH:mm:ss");
                string detalle = amountPay.ToString();


                //cvbc
                string nameTicket = GetRecibo(tranferId, newUserName, numReceipt, datecomplete, nAffiliate, TypeMembership, namePeson, hour, detalle, quotesPendiente, " Inicial 1");


                //marcar como pagado en la tabla membershipdetails
                bool habiliAccount = brUser.enableAcount(idMemberDetails, nameTicket);

                int nAfiliate = int.Parse(brUser.GetNafiliate(idMemberDetails));

                Cronograma2(nAfiliate, codeCurrencyPay);

                // enviar el email de confirmacion con la data y lo redirecciona al post register
                if (!habiliAccount)
                {
                    Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.Sin embargo su Pago fue Exitoso");
                    return;
                }


                string ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/");
                //enviar email con los documentos
                if (typeRegister == 2 && formPay == 1)
                {
                    bool awnserEmailDoc = oEmail.SubmitEmail(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.DocumentosRegister(newUserName), true, ruta, newUserName);
                }
                else
                {
                    bool awnserEmailDoc = oEmail.SubmitEmailKit(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.DocumentosRegister(newUserName), true, ruta);
                }


                bool awnserEmail = oEmail.SubmitEmail(emailNewUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago());

                //ejecutamos el core para los puntos de equipo
                // BrCore_Automation brCore_Automation = new BrCore_Automation();
                //bool isCoreRegister = brCore_Automation.ExecuteCore();

                Response.Write("true¬" + culqiAnwser[1]);
                return;
            }
            #endregion
        }
Example #9
0
        private void OpenFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            string filePath = openFileDialog1.FileName;
            string extension = Path.GetExtension(filePath);
            string header = "YES";
            string conStr, sheetName;

            conStr = string.Empty;
            switch (extension)
            {
            case ".xls":     //Excel 97-03
                conStr = string.Format(Excel03ConString, filePath, header);
                break;

            case ".xlsx":     //Excel 07
                conStr = string.Format(Excel07ConString, filePath, header);
                break;
            }

            //Get the name of the First Sheet.

            using (OleDbConnection con = new OleDbConnection(conStr))
            {
                using (OleDbCommand cmd = new OleDbCommand())
                {
                    cmd.Connection = con;
                    try
                    {
                        con.Open();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        MyMessages m = new MyMessages("Невірний формат", "Упевніться, що ексель має розширення xlsx і має структуру як на фото нижче", 2);
                        m.ShowDialog();

                        bool okButtonClicked = m.OKButtonClicked;
                        return;
                    }
                    DataTable dtExcelSchema = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
                    //sheetName = "data";
                    sheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString();
                    //sheetName1 = dtExcelSchema.Rows[2]["TABLE_NAME"].ToString();
                    con.Close();
                }
            }

            dataGridView1.Visible = true;
            btnPrint.Visible      = true;
            button1.Visible       = true;
            button2.Visible       = true;
            btnSelect.Visible     = false;

            using (OleDbConnection con = new OleDbConnection(conStr))
            {
                using (OleDbCommand cmd = new OleDbCommand())
                {
                    using (OleDbDataAdapter oda = new OleDbDataAdapter())
                    {
                        try
                        {
                            WaitForm wf = new WaitForm();
                            wf.Show();
                            DataTable dt = new DataTable();
                            cmd.CommandText = "SELECT * From [" + sheetName + "]";
                            cmd.Connection  = con;
                            con.Open();
                            oda.SelectCommand = cmd;
                            oda.Fill(dt);
                            con.Close();

                            Saloon Q3    = new SaloonQ3("Audi Q3");
                            Saloon G11   = new SaloonG11("G11");
                            Saloon G3    = new SaloonG3("G3");
                            Saloon BR223 = new SaloonBR223("BR223");
                            Saloon Skoda = new SaloonSK38("SK38");

                            int i           = 0;
                            int percentcoef = dt.Rows.Count / 100;
                            foreach (DataRow row in dt.Rows)
                            {
                                i++;
                                if (row[6].ToString().Contains("Audi") && row[6].ToString().Contains("Q3"))
                                {
                                    Q3.ParseExcel(row);
                                }
                                else if (row[6].ToString().ToUpper().Contains("G1"))
                                {
                                    G11.ParseExcel(row);
                                }
                                else if (row[6].ToString().ToUpper().Contains("G3Y") || row[6].ToString().ToUpper().Contains("F90"))
                                {
                                    G3.ParseExcel(row);
                                }
                                else if (row[6].ToString().ToUpper().Contains("BR223"))
                                {
                                    BR223.ParseExcel(row);
                                }
                                else if (row[6].ToString().ToUpper().Contains("SK38"))
                                {
                                    Skoda.ParseExcel(row);
                                }

                                if (wf.ProgressBarValue == (int)(i / percentcoef))
                                {
                                    continue;
                                }
                                else
                                {
                                    wf.ProgressBarValue++;
                                    Console.WriteLine(wf.ProgressBarValue.ToString());
                                }
                            }

                            Saloon BMWhiga = new SaloonBMWhiga(G11, "BMWhiga");
                            Saloon BMWvoga = new SaloonBMWvoga(G11, G3, "BMWvoga");

                            foreach (DataRow row in dt.Rows)
                            {
                                if (row[6].ToString().ToUpper().Contains("G1") || row[6].ToString().ToUpper().Contains("G3Y") || row[6].ToString().ToUpper().Contains("F90"))
                                {
                                    if (row[6].ToString().ToUpper().Contains("RC") || row[6].ToString().ToUpper().Contains("RB"))
                                    {
                                        BMWhiga.ParseExcel(row);
                                    }
                                    else if (row[6].ToString().ToUpper().Contains("FC") || row[6].ToString().ToUpper().Contains("FB"))
                                    {
                                        BMWvoga.ParseExcel(row);
                                    }
                                }
                            }

                            DataTable result = new DataTable();
                            result.Clear();
                            result.Columns.Add("Проект");
                            result.Columns.Add("Кількість чохлів").DataType = typeof(string);
                            result.Columns.Add("Загальний час").DataType    = typeof(string);
                            result.Columns.Add("Час на одну штуку");
                            result.Columns.Add("Час на салон");
                            result.Columns.Add("Кількість салонів").DataType                = typeof(int);
                            result.Columns.Add("Середній час на одну штуку").DataType       = typeof(double);
                            result.Columns.Add("Коефіцієнт/кількість компонентів").DataType = typeof(double);
                            result.Columns.Add("Кількість компонент помножено на середній на одну штуку").DataType = typeof(double);
                            result.Columns.Add("Prod. sets planned").DataType    = typeof(double);
                            result.Columns.Add("Кількість бригад").DataType      = typeof(int);
                            result.Columns.Add("Кількість днів").DataType        = typeof(int);
                            result.Columns.Add("Кількість бригад soll").DataType = typeof(int);
                            result.Columns.Add("Кількість бригад ist").DataType  = typeof(int);
                            result.Columns.Add("Коефіцієнт").DataType            = typeof(double);
                            result.Columns.Add("Дні").DataType = typeof(double);


                            Q3.Coef = 9.0;
                            Cars.Add(Q3);

                            G11.Coef = 8;
                            G3.Coef  = 4.0;
                            Cars.Add(G11);
                            Cars.Add(G3);

                            BMWvoga.Coef = 4.0;
                            BMWhiga.Coef = 4.0;


                            Cars.Add(BMWvoga);
                            Cars.Add(BMWhiga);

                            BR223.Coef = 8.0;
                            Cars.Add(BR223);

                            Skoda.Coef = 3.0;
                            Cars.Add(Skoda);

                            LinesDayCount LD = new LinesDayCount(ref Cars);
                            LD.ShowDialog();

                            int    SaloonSum     = 0;
                            int    LinesSum      = 0;
                            int    PlanLinesSum  = 0;
                            double MiddleSetplan = 0;


                            foreach (Saloon car in Cars)
                            {
                                DataRow row1 = result.NewRow();
                                car.CreateRow(ref row1);
                                result.Rows.Add(row1);
                            }

                            foreach (DataRow a in result.Rows)
                            {
                                SaloonSum     += Convert.ToInt32(a[5].ToString());
                                LinesSum      += Convert.ToInt32(a[13].ToString());
                                PlanLinesSum  += Convert.ToInt32(a[10].ToString());
                                MiddleSetplan += Convert.ToDouble(a[9].ToString()) * Convert.ToDouble(a[13].ToString());
                            }
                            DataRow row2 = result.NewRow();
                            row2[0]  = "Підсумок";
                            row2[9]  = Math.Round(MiddleSetplan / LinesSum, 3);
                            row2[5]  = SaloonSum;
                            row2[13] = LinesSum;
                            row2[10] = PlanLinesSum;
                            result.Rows.Add(row2);
                            dataGridView1.DataSource = result;
                            Cursor = Cursors.Arrow;
                        }

                        catch (Exception ex)
                        {
                            MessageBox.Show("Exception Occured while releasing object " + ex.ToString());
                        }
                    }
                }
            }
        }
Example #10
0
        protected void SendEmail_Click(object sender, EventArgs e)
        {
            bool   anwser = false;
            string nombre = "", dni = "", username = "", correo = "";

            //Session["datos"] = "Aaaaa|Aaaa|birthDay|M|DocumentType|88884444$NombreC|ApellidoC|1|313231c$bankName|nombreBankAccount|TypeAccount|nroAccount|nroTaxer|SocialReason|fiscalAdress|[email protected]|nroCell|nroCell2|country|State|City|Adress";
            //Session["carrito"] = "6000.00|descripcionDB|60|9750.00|3.25|10|TOP";
            //Session["cronograma"] = "6000|222";

            username = txtUserName.Text;

            if (string.IsNullOrEmpty(username))
            {
                return;
            }

            BrUser     brUser = new BrUser();
            MyMessages mm     = new MyMessages();

            var arrayperson = brUser.GetPersonalInformation(username).Split('|');

            if (arrayperson.Length < 5)
            {
                return;
            }
            correo   = arrayperson[5];
            nombre   = arrayperson[1] + " " + arrayperson[2];
            dni      = arrayperson[13];
            username = arrayperson[1].Substring(0, 1).ToUpper() + arrayperson[2].Substring(0, 1).ToUpper() + dni;
            string gender = arrayperson[4];
            string name   = arrayperson[1];

            BrAccount brAccount = new BrAccount();

            string codeMemb = brAccount.GetLastCodeMembership(username).Trim();

            if (string.IsNullOrEmpty(codeMemb))
            {
                MessageError.Text = "no tiene membresia.";
                return;
            }

            if (rbDoc.Checked)
            {
                BrTypeMembership brTypeMembership = new BrTypeMembership();
                var correlativo = int.Parse(brTypeMembership.GetTotalMemberships(username));
                correlativo--;
                if (correlativo < 0)
                {
                    correlativo = 0;
                }
                username = $"{username}{correlativo}";
                var ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/");
                if (codeMemb == "KIT")
                {
                    anwser = this.SendEmailKit(name, gender, username, ruta, correo);
                }
                if (codeMemb == "EXP" || codeMemb == "LHT" || codeMemb == "STD" ||
                    codeMemb == "PLUS" || codeMemb == "TOP" || codeMemb == "VIT")
                {
                    anwser = this.SendEmailClub(name, gender, username, ruta, correo);
                }
                if (codeMemb == "EVOL" || codeMemb == "MVC")
                {
                    anwser = this.SendEmailVacational(name, gender, username, ruta, correo);
                }
                if (codeMemb == "SBY")
                {
                    anwser = this.SendEmailFounder(name, gender, username, ruta, correo);
                }
            }

            if (rbRece.Checked)
            {
                MyConstants mc          = new MyConstants();
                var         bankAccount = mc.BankAccount;
                var         repsonse_   = brAccount.GetFirtsPayCurrency(username).Split('|');

                var infoAfiliate = brAccount.GetSponsorInfo(username).Split('|');

                var nameAfiliate   = infoAfiliate[0];
                var correoAfiliate = infoAfiliate[1];

                var    firtsPay     = repsonse_[0];
                var    currencyCode = repsonse_[1];
                string fullname     = arrayperson[1].Trim().ToLower() + " " + arrayperson[2].Trim().ToLower();
                fullname = ToCapitalize(fullname);
                string[] sepName    = arrayperson[1].Split(' ');
                var      fName      = ToCapitalize(sepName[0]);
                var      bienvenido = "Bienvenido";
                if (arrayperson[4] == "F")
                {
                    bienvenido = "Bienvenida";
                }

                var cuerpo = "<html><head><title></title></head><body style='color:black'>";
                cuerpo += "<div style='width: 100%'>";
                cuerpo += "<div style='display:flex;'>";
                cuerpo += "<div style='width:50%;'>";
                cuerpo += " <img src='http://www.inresorts.club/Views/img/novologo.png' align='left' style='width: 98px;'>";
                cuerpo += "</div>";
                cuerpo += "<div style='width:50%;'>";
                cuerpo += "<img src='http://cieneguillariberadelrio.com/riberadelrio/img/image006.png' align='right' style='width: 120px;padding-top: 7px;'>";
                cuerpo += "</div>";
                cuerpo += "</div>";
                cuerpo += "<img style='width: 100%' src='http://www.inresorts.club/Views/img/fondo.png'>";
                cuerpo += "<h1 style='margin-top: 2px ;text-align: center;font-weight: bold;font-style: italic;'>" + bienvenido + " " + fName + "</h1>";
                cuerpo += "<h2 style='text-align: center;'>Muy pronto formarás parte de la familia inResorts. Estamos a la espera de que nos brindes tu comprobante de pago</h2>";
                cuerpo += "<center><p style='margin-left: 10%;margin-right: 10%;'>Cuando lo tengas listo, solo tienes que subirlo a nuestra pagina y enseguida lo estaremos validando</p></center> ";
                cuerpo += "";
                cuerpo += "<center><div style='width: 100%'>";
                cuerpo += "<p style='margin-left: 10%;margin-right: 10%; '> Click en el boton para validar el pago.</p>";
                cuerpo += "<a style='text-decoration: none;' href='https://inresorts.club/Views/Login.aspx?usuario=" + dni + "&fullname=" + fullname + "'>";
                cuerpo += "<center><div style='background: #0d80ea;border-radius:10px;width: 158px;height: 30px;font-size: 16px;color: white;font-weight: bold;padding: 4px;padding-top: 10px;cursor: pointer;text-align: center;margin: 23px;'>Validar pago<div></center>";
                cuerpo += "</a></div></center>";

                cuerpo += "<center><div style='width: 100%'>";
                cuerpo += "<p style='margin-left: 10%;margin-right: 10%; '></p>";
                cuerpo += "<center>Recuerde que el pago lo puede realizar mediante deposito en nuestra cuenta corriente atravez de Agente BCP, Agencia BCP O transferencia bancaria desde Banca por Internet.</center>";
                cuerpo += "</div></center>";


                cuerpo += "<center><div style='width: 100%'>";
                cuerpo += "<p style='margin-left: 10%;margin-right: 10%; '>Cuenta Bancaria </p>";
                cuerpo += $"<center>BCP: N° {bankAccount} - Valle Encantado S.A.C</center>";
                cuerpo += "</div></center>";

                cuerpo += "<center><div style='width: 50%;display: flex;border-radius: 10px;margin: 11px;'>";
                cuerpo += "<p style='margin-left: 10%;margin-right: 10%;'>Monto a depositar</p>";

                cuerpo += "<center style=' margin: 12px;'> " + firtsPay + " (" + currencyCode + ")</center>";
                cuerpo += "</div></center>";

                //cuerpo += "<center><img src='http://www.inresorts.club/Views/img/recibo.png' align='left' style='width: 100%'></center></div>";
                cuerpo += "<div style='margin-left: 9%;'>";
                cuerpo += "<p style='margin:5px'>Patrocinador: " + nameAfiliate + "</p>";
                cuerpo += "<p style='margin:5px'>Saludos Cordiales</p><p  style='margin:5px'>Equipo inResorts</p></div>";
                cuerpo += "<div style='margin: 5%; width: 70%;background-image: url('https://lh3.googleusercontent.com/NSDQDl8ytJrWSwMe0b3b9DlxubIal-RBEPIWI1a-15f9ynEGQ9eYjTnm-PVqst26f4KJThmjOEPK4lcVoaUw=w1016-h917-rw');'></ div > ";
                cuerpo += "<img style='width: 100%' src='https://preview.ibb.co/ixY7iL/fondo222.png'>";
                cuerpo += "</div>";

                cuerpo += "</body>";
                cuerpo += "</html>";

                Email email = new Email();
                anwser = email.SubmitEmail(correo, "[Ribera del Rio - Inresorts, Registro en Proceso] ", cuerpo);

                string correoOamr = "*****@*****.**";

                email.SubmitEmail(correoOamr, "[Ribera del Rio - Inresorts, Registro en Proceso] ", cuerpo);

                if (correoAfiliate != "")
                {
                    email.SubmitEmail(correoAfiliate, "[Ribera del Rio - Inresorts, Registro en Proceso] ", cuerpo);
                }
            }

            if (rbQuote.Checked)
            {
                //SendEmailAmountRestante(username, "PEN", "", "", "", "", "");
            }

            MessageError.Text  = string.Empty;
            MessageSucces.Text = string.Empty;
            if (!anwser)
            {
                MessageError.Text = "ocurred error.";
                return;
            }
            MessageSucces.Text = "correo enviado.";
        }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string token        = string.Empty;
                string currencyCode = string.Empty;
                int    numberQuotes = 0;

                token        = Request["tokenid"];
                numberQuotes = int.Parse(Request["ddlQuote"]);
                currencyCode = Request["ddlcurrencyCode"];

                if (currencyCode != "USD" && currencyCode != "PEN")
                {
                    Response.Write("false¬ocurrio un error.");
                    return;
                }

                string[] dataLogin   = HttpContext.Current.User.Identity.Name.Split('¬');
                string   userCurrent = dataLogin[0];

                if (dataLogin.Length > 1)
                {
                    userCurrent = dataLogin[1];
                }

                BrUser brUser = new BrUser();

                var arraycar   = Session["carrito"].ToString().Split('|');
                var tipocambio = double.Parse(arraycar[4]);

                string dataBdd        = Session["datos"].ToString();
                var    TypeMembership = (dataBdd.Split('$')[3]).Split('|')[7];
                // string data2 = (string)Session["civilStatus"];
                string   data2 = (string)Session["civilState"];
                string[] oIdMembreship_amount = brUser.RegisterUser(dataBdd, data2).Split('¬');

                if (oIdMembreship_amount.Length < 2)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                    return;
                }

                string[] parameterPerson  = dataBdd.Split('$');
                string[] arraydata        = parameterPerson[0].Split('|');
                string[] arrayTypeaccount = parameterPerson[2].Split('|');
                string[] arrayaccount     = parameterPerson[3].Split('|');

                string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + userCurrent + '|' + oIdMembreship_amount[0];
                //'999999999999|1|sa|1'
                var newUserName = brUser.GenerateAccount(parameterAccount);

                if (string.IsNullOrEmpty(newUserName))
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                    return;
                }

                var dataKitMember = Session["cronograma"].ToString();

                string[] datos = Session["datos"].ToString().Split('$');

                if (Session["datos"] == null)
                {
                    Response.Write("false¬Ha Ocurrido Un Error, no hay datos.");
                    return;
                }
                string[] arraycontacto = datos[3].Split('|');
                string[] arrayperson   = datos[0].Split('|');

                var amountPay = double.Parse(Session["FirtsPay"].ToString());


                if (amountPay <= 0)
                {
                    Response.Write("false¬Ha Ocurrido Un Error id idMemberDetails vacio,amountPay vacio");
                    return;
                }

                //amount pay es un valor en soles
                if (currencyCode == "USD")
                {
                    amountPay = amountPay / tipocambio;
                }

                string dni = arrayperson[5];

                newUserName = arrayperson[0].Substring(0, 1).ToUpper() + arrayperson[1].Substring(0, 1).ToUpper() + dni;
                var emailNewUser = arraycontacto[0].Trim();


                PayCulqi   payCulqi   = new PayCulqi();
                MyMessages myMessages = new MyMessages();
                //string currencyCode = "PEN";
                string[] culqiAnwser = payCulqi.newPayment(newUserName, emailNewUser, amountPay, token, numberQuotes, currencyCode).Split('¬');
                if (culqiAnwser[0] == "false")
                {
                    Response.Write("false¬" + culqiAnwser[1]);
                    return;
                }

                /*=====================================================================================================================================================================*/

                //correo = arraycontacto[0];
                var namePeson = arrayperson[0] + " " + arrayperson[1];


                string date = dataKitMember.Split('$')[1];

                string[] array1          = Session["cronogramaYa"].ToString().Split('^');
                string[] datosMem        = array1[0].Split('|');
                string[] array2          = array1[1].Split('~');
                string[] cuotas          = array2[0].Split('¬');
                string   cronoActiv      = "";
                var      quotesPendiente = (cuotas.Length - 2).ToString();
                for (int i = 0; i < cuotas.Length - 1; i++)
                {
                    var fila = cuotas[i].Split('|');
                    if (fila[0].Substring(0, 7) != "Inicial")
                    {
                        cronoActiv += DateTime.Parse(fila[1]).ToString("yyyy-MM-dd");
                        //amountFinanciade = double.Parse(fila[2].Replace("S/.", ""));
                        break;
                    }
                    else
                    {
                        cronoActiv += DateTime.Parse(fila[1]).ToString("yyyy-MM-dd") + "¬";
                    }
                }

                BrPayments brPayments = new BrPayments();

                string respData = brPayments.PersonGetData(newUserName);
                respData = respData + '^' + dataKitMember;
                // isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName);
                string financedAmount = Session["financedAmount"].ToString();
                string codeCurrency   = Session["TypeCurrency"].ToString();

                Int32  ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, financedAmount, 1, codeCurrency);
                string exchange      = Session["carrito"].ToString().Split('|')[4];
                var    isRegister    = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, exchange, 1);

                //validamos si tiene consumo


                if (!isRegister)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                    return;
                }

                BrActivation brActivation = new BrActivation();
                bool         registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);

                //obtengo el monto a pagar

                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    return;
                }
                var idMemberDetails = int.Parse(username_idmen_amount_email[1]);
                amountPay    = double.Parse(username_idmen_amount_email[2]);
                emailNewUser = username_idmen_amount_email[3];

                date = null;
                username_idmen_amount_email = null;
                dataKitMember = null;
                respData      = null;


                /*=============================================================================================================================*/

                var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

                string tranferId    = culqiAnwser[2] == null ? "" : culqiAnwser[2];
                string numReceipt   = "0";
                string datecomplete = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                string nAffiliate   = "";

                string hour    = DateTime.Now.ToString("HH:mm:ss");
                string detalle = amountPay.ToString();


                //cvbc
                string nameTicket = GetRecibo(tranferId, newUserName, numReceipt, datecomplete, nAffiliate, TypeMembership, namePeson, hour, detalle, quotesPendiente, " Inicial 1");


                //marcar como pagado en la tabla membershipdetails
                bool habiliAccount = brUser.enableAcount(idMemberDetails, nameTicket);

                int nAfiliate = int.Parse(brUser.GetNafiliate(idMemberDetails));

                Cronograma2(nAfiliate, currencyCode);

                // enviar el email de confirmacion con la data y lo redirecciona al post register
                if (!habiliAccount)
                {
                    Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.Sin embargo su Pago fue Exitoso");
                    return;
                }


                string ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/");
                //enviar email con los documentos
                //bool awnserEmailDoc = oEmail.SubmitEmailKit(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.DocumentosRegister(newUserName), true, ruta);

                Email oemail         = new Email();
                bool  awnserEmailDoc = oemail.SubmitEmail(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.DocumentosRegister(newUserName), true, ruta, newUserName);
                bool  awnserEmail    = oemail.SubmitEmail(emailNewUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago());

                //ejecutamos el core para los puntos de equipo
                // BrCore_Automation brCore_Automation = new BrCore_Automation();
                //bool isCoreRegister = brCore_Automation.ExecuteCore();

                Response.Write("true¬" + culqiAnwser[1]);
            }
            catch (Exception ex)
            {
                Response.Write("false¬ocurrio un error¬" + ex.Message);
            }
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyConstants mc = new MyConstants();

            try
            {
                string token        = "";
                int    numberQuotes = 0;

                token        = Request["token"].ToString();
                numberQuotes = int.Parse(Request["numcuotes"].ToString());

                //pagar con wallet
                BrWallet brWallet      = new BrWallet();
                var      amountWalletc = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1]));

                var amountTotal = 0m;

                if (Session["MontoWallet"] != null)
                {
                    amountTotal = decimal.Parse(Session["MontoWallet"].ToString());
                }


                var amountRestan = amountTotal - amountWalletc;

                //if (amountWalletc < quota)
                //{
                //    MessageError.Text = "No tiene el monto suficiente para realizar Pago.";
                //    return;
                //}

                var methods2 = "CULQI";

                var recibe = string.Empty;



                BrPayments brPayments    = new BrPayments();
                BrUser     brUser        = new BrUser();
                string     dataKitMember = Session["cronograma"].ToString();


                string date = dataKitMember.Split('$')[1];

                var cart = Session["carrito"].ToString();

                var arrayCart = cart.Split('|');
                var codeMemb  = arrayCart[6];

                string[] datos   = Session["datos"].ToString().Split('$');
                var      dataBdd = Session["datos"].ToString();



                if (Session["datos"] == null)
                {
                    Response.Write("false¬Ha Ocurrido Un Error, no hay datos.");
                    return;
                }
                string[] arraycontacto = datos[3].Split('|');
                string[] arrayperson   = datos[0].Split('|');


                string dni = arrayperson[5];

                var newUserName     = User.Identity.Name.Split('¬')[1];
                var emailNewUser    = arraycontacto[0].Trim();
                var codeCurrencyPay = Session["TypeCurrency"].ToString();



                string[] array1          = Session["cronogramaYa"].ToString().Split('^');
                string[] datosMem        = array1[0].Split('|');
                string[] array2          = array1[1].Split('~');
                string[] cuotas          = array2[0].Split('¬');
                string   cronoActiv      = "";
                var      quotesPendiente = (cuotas.Length - 2).ToString();
                for (int i = 0; i < cuotas.Length - 1; i++)
                {
                    var fila = cuotas[i].Split('|');
                    if (fila[0].Substring(0, 7) != "Inicial")
                    {
                        cronoActiv += DateTime.Parse(fila[1]).ToString("yyyy-MM-dd");
                        //amountFinanciade = double.Parse(fila[2].Replace("S/.", ""));
                        break;
                    }
                    else
                    {
                        cronoActiv += DateTime.Parse(fila[1]).ToString("yyyy-MM-dd") + "¬";
                    }
                }

                var respDataper = brPayments.PersonGetData(newUserName);

                string respData = string.Empty;
                respData = respData + '^' + dataKitMember;

                // isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName);
                //string data2 = Session["financedAmount"].ToString();

                string data2 = "0";
                //string codeCurrency = Session["TypeCurrency"].ToString();



                var currencyCode = Session[""].ToString();

                PayCulqi payCulqi = new PayCulqi();

                string[] culqiAnwser = payCulqi.newPayment(newUserName, emailNewUser, double.Parse(amountRestan.ToString()), token, numberQuotes, codeCurrencyPay).Split('¬');
                if (culqiAnwser[0] == "false")
                {
                    Response.Write("false¬" + culqiAnwser[1]);
                    return;
                }


                Int32 ansNmembershi = brUser.RegisterNmembership(codeMemb + '|' + newUserName, data2, 1, codeCurrencyPay);

                BrTypeMembership brTypeMemb = new BrTypeMembership();
                string           typeChange = arrayCart[4];

                //var isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, typeChange, 1);
                bool isRegister = false;
                if (Session["codeUpgrate"] != null)
                {
                    //si es upgrate

                    isRegister = brPayments.GetCalculatePaymentScheduleUpgrate(respData, newUserName, ansNmembershi, typeChange, 1);
                    if (!isRegister)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                        return;
                    }

                    if (Session["dateup"] != null)
                    {
                        string dateup = Session["dateup"].ToString();
                        bool   an     = brPayments.PutDateUpgrate(ansNmembershi, dateup);
                    }

                    //registramos si upgrate para
                }
                else
                {
                    //si no es upgrate

                    isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, typeChange, 1);
                    if (!isRegister)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                        return;
                    }
                    //cronograma de activacion
                    BrActivation brActivation = new BrActivation();
                    bool         registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);
                }

                if (Session["codeUpgrate"] != null)
                {
                    //el id de account n membership del upgrate ¬ y el nuevo
                    int  codeUpgrate = int.Parse(Session["codeUpgrate"].ToString());
                    bool upgrate     = brTypeMemb.CancelMembershipUpgrate(codeUpgrate, ansNmembershi);
                    if (!upgrate)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                        return;
                    }
                    BrActivation brActivation  = new BrActivation();
                    string       fechaAnterior = Session["fechaanterior"].ToString();
                    bool         registerActi  = brActivation.PutCronogramaUpgrade(fechaAnterior, newUserName, ansNmembershi, codeUpgrate);
                }
                //validamos si tiene consumo


                if (!isRegister)
                {
                    // "Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario";
                    return;
                }

                //BrActivation brActivation = new BrActivation();
                //bool registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);

                //obtengo el monto a pagar

                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    // "false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar";
                    return;
                }
                var idMemberDetails = int.Parse(username_idmen_amount_email[1]);
                var amountPay       = double.Parse(username_idmen_amount_email[2]);
                emailNewUser                = username_idmen_amount_email[3];
                codeCurrencyPay             = username_idmen_amount_email[4];
                date                        = null;
                username_idmen_amount_email = null;
                dataKitMember               = null;
                respData                    = null;


                var namePeson = arrayperson[0].Trim() + " " + arrayperson[1].Trim();

                var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

                string tranferId    = "";
                string numReceipt   = "0";
                string datecomplete = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                string nAffiliate   = "";

                string     hour       = DateTime.Now.ToString("HH:mm:ss");
                string     detalle    = amountRestan.ToString();
                MyMessages myMessages = new MyMessages();
                namePeson = myMessages.ToCapitalize(namePeson);
                //cvbc
                var imgTicket = GetRecibo(tranferId, newUserName, numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, detalle, quotesPendiente, " Inicial 1");


                /*=============================================================================================================================*/

                //var currencyCode = Session["CurrencyCode"].ToString();
                BrMembershipPayDetail brMembership = new BrMembershipPayDetail();
                var response = brMembership.GetQuote(idMemberDetails, User.Identity.Name.Split('¬')[1]).Split('|');

                if (decimal.Parse(response[0]) == 0)
                {
                    // "Ocurrio un error.";
                    return;
                }
                var amount = decimal.Parse(response[0]).ToString();


                if (codeCurrencyPay == "USD")
                {
                    amount = (decimal.Parse(amount) * decimal.Parse(typeChange)).ToString();
                }


                var idInfo = idMemberDetails.ToString();
                //dos es que wallet es una parte del pago de una cuota
                var typeInfo         = "2";
                var walleOperationId = "2";


                bool IsPay = brMembership.IsPayQuote(idMemberDetails.ToString());

                if (!IsPay)
                {
                    // "Tu Cuota ya esta Pagada.Verifica tu cronograma de pagos.";
                    return;
                }


                var amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1]));

                //if (amountWallet < decimal.Parse(amount))
                //{
                //    MessageError.Text = "No tiene el monto suficiente para realizar Pago.";
                //    return;
                //}

                imgTicket += recibe;

                var moneyStatus = 0;

                if (amountWallet > 0)
                {
                    var imgTicketWalle = GetRecibo(idMemberDetails.ToString(), newUserName, numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, amountWalletc.ToString(), quotesPendiente, " Inicial 1");
                    imgTicket += $"~{imgTicketWalle}";
                    //amount | @idInfo | @typeInfo | @walletOperationId | @currencyCode | @typeChange | idmembershipDetail | imgTicket
                    string data   = $"{amountWalletc}|{idInfo}|{typeInfo}|{walleOperationId}|PEN|{typeChange}|{idMemberDetails.ToString()}|{imgTicket}";
                    bool   answer = brWallet.Put(data, User.Identity.Name.Split('¬')[1], moneyStatus);

                    //Extorno

                    if (!answer)
                    {
                        // = "Ocurrio un error.";
                        return;
                    }
                }
                //MessageSucces.Text = "Su Pago de Realizo Con Exito.";

                /*=============================================================================================================================*/

                var amountOthers = amount;
                //esta en estado pendienete
                var statusPay = 1;

                //marcar como pagado en la tabla membershipdetails

                //TODO: Agregar los detalles del pago


                bool habiliAccount = brUser.BiPayQuote(idMemberDetails, imgTicket, amountWalletc, amountRestan, "WALLET", methods2, statusPay, decimal.Parse(typeChange));

                int nAfiliate = int.Parse(brUser.GetNafiliate(idMemberDetails));

                BrTypeMembership brTypeMembership = new BrTypeMembership();
                var correlativo = int.Parse(brTypeMembership.GetTotalMemberships(User.Identity.Name.Split('¬')[1]));

                correlativo--;

                if (correlativo < 0)
                {
                    correlativo = 0;
                }

                Cronograma2(nAfiliate, codeCurrencyPay, correlativo.ToString());

                // enviar el email de confirmacion con la data y lo redirecciona al post register
                if (!habiliAccount)
                {
                    Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.Sin embargo su Pago fue Exitoso");
                    return;
                }


                var urlRedirect = "EndPaymendMbs";

                if (codeMemb == "EXP" || codeMemb == "LHT" || codeMemb == "STD" ||
                    codeMemb == "PLUS" || codeMemb == "TOP" || codeMemb == "VIT")
                {
                    urlRedirect = "EndPaymendMbs";
                }
                if (codeMemb == "EVOL" || codeMemb == "MVC")
                {
                    urlRedirect = "EndPaymendMbs";
                }
                if (codeMemb == "SBY")
                {
                    urlRedirect = "EndPaymentSby";
                }


                Response.Write($"true¬{urlRedirect}.aspx");
            }
            catch (Exception ex)
            {
                Email email = new Email();
                email.SendEmail(mc.ErrorEmail, "error-inresorts", ex.StackTrace + '¬' + DateTime.Now.ToLongDateString(), false);
                Response.Write("false¬ocurrio un error");
            }
        }
Example #13
0
    /// <summary>
    /// Use the app account settings from developer.att.com for the following values.
    /// Make sure MIM,IMMN is enabled for the app key/secret
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Enter the value from the 'App Key' field obtained at developer.att.com in your
        // app account.
        string clientId = "";

        // Enter the value from the 'App Secret' field obtained at developer.att.com
        // in your app account.
        string secretKey = "";

        // Set the fully-qualified domain name to: https://api.att.com
        string fqdn = "https://api.att.com";

        // Set the redirect URI for returning after consent flow.
        string authorizeRedirectUri = "";

        //Set the scope to MIM,IMMN
        string scope = "MIM,IMMN";

        //Create the service for requesting an OAuth access token.
        var oauth = new OAuth(fqdn, clientId, secretKey, authorizeRedirectUri, scope);

        // If there's no access token yet go through the concent flow.
        if (Request["code"] == null)
        {
            // Authenticate the user. Note: This requires a Web browser.
            // Obtain the url string that is used for consent flow.
            if (!oauth.GetAuthCode())
            {
                //Get any error codes returned by the API Gateway.
                 string authCodeError = oauth.getAuthCodeError;
            }
        }
        else
        {
            // Get code in the query parameters after doing consent flow
            oauth.authCode = Request["code"].ToString();

            // Get the OAuth access token using the OAuth authentication code.
            if (oauth.GetAccessToken(OAuth.AccessTokenType.AuthorizationCode))
            {
                // Get access token
                OAuthToken at = new OAuthToken();
                var accessToken = at.getAccessToken(oauth.accessTokenJson);

                // Create the service for making the method request.
                var mymessages = new MyMessages(fqdn, accessToken);

                // Create an instance for JavaScriptSerializer.
                var serializer = new JavaScriptSerializer();

                //*************************************************************************
                // Operation: Create Message Index
                // The Create Message Index method allows the developer to create an index
                // cache for the user's AT&T Message inbox with prior consent.

                try
                {
                    // Make an Make a method call to the In-App Messaging API.
                    // Method takes no param
                    mymessages.createMessageIndex();
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Get Message List
                // Get meta-data for one or more messages from the customer's AT&T Message inbox.

                string limit = "<Enter limit>"; // e.g 500
                string offset = "<Enter pffset>"; // e.g. 50

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes no param
                    MessageObj.MessageList responseData = mymessages.getMessageList(limit, offset);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Get Message
                // Get one specific message from a user's AT&T Message inbox.

                var getMsg_messageId = "<Enter Message Id>";

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes:
                    // param 1: string message id
                    MessageObj.Message responseData = mymessages.getMessage(getMsg_messageId);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Get Message Content
                // Get media associated with a user message.

                string getMsgCtntMessageId = "<Enter Message Id>";
                string getMsgCtntPartId = "<Enter Part Id>"; // e.g. 0

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes:
                    // param 1: string message id
                    // param 2: string part id
                    string responseData = mymessages.getMessageContent(getMsgCtntMessageId, getMsgCtntPartId);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Get Message Index Info
                // Get the state, status, and message count of the index cache.

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes no param
                    string responseData = mymessages.getMessageIndexInfo();
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Delete Message
                // The Delete Message method gives the developer the ability to delete one
                // specific message from a user's AT&T Message inbox with prior consent.

                var delMsg_messageId = "<Enter Message Id>";

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes:
                    // param 1: string message id
                    mymessages.deleteMessage(delMsg_messageId);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Delete Messages
                // The Delete Message method gives the developer the ability to delete one
                // or more specific messages.

                var delMsg_messageId1 = "<Enter Message ID>";
                var delMsg_messageId2 = "<Enter Message ID>";
                var delMsg_messageId3 = "<Enter Message ID>";
                var queryString = "messageIds=" + delMsg_messageId1 + "%2" + delMsg_messageId2 + "%2" + delMsg_messageId3;

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes:
                    // param 1: string query string
                    mymessages.deleteMessage(queryString);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Get Message Delta
                // provides the capability to check for updates by passing in a client state.

                string state = "1403732028949";

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes no param
                    string responseData = mymessages.getMessageDelta(state);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Get Message Notification Connection Details
                // Retrieves details about the credentials, endpoint, and resource information
                // to required to set up a notification connection.

                string queues = "MMS";//MMS or TEXT

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes param 1: queues
                    string responseData = mymessages.getMessageNotificationConnectionDetails(queues);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Send Message
                // The Send Message method sends messages on behalf of an AT&T Wireless user.

                //Convert Message request object to JSON
                string smAddress = "<Enter address>";//e.g. tel:2060000000
                string smText = "<Enter messgae>"; // message content

                var addressesList = new List<string>();
                addressesList.Add(smAddress);

                var sendMsgObj = new MessageRequestObj.RootObject()
                {
                    messageRequest = new MessageRequestObj.MessageRequest()
                    {
                        addresses = addressesList,
                        text = smText
                    }
                };

                var sendMsgJson = serializer.Serialize(sendMsgObj);

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes:
                    // param 1: string json
                    mymessages.SendMessage(sendMsgJson);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Update Message
                // Update some flags related to one of the messages in a user's AT&T Message inbox.

                var isUnread = true;

                //Convert Message object to JSON
                var updateMsgObj = new MessageObj.RootObject()
                {
                    message = new MessageObj.Message()
                    {
                        isUnread = isUnread
                    }
                };
                var updateMsgJson = serializer.Serialize(updateMsgObj);

                string umMessageId = "<Enter Message Id>";

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes:
                    // param 1: string json
                    // param 2: string message id
                    mymessages.updateMessage(updateMsgJson, umMessageId);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }

                //*************************************************************************
                // Operation: Update Messages
                // Update some flags related to one of the messages in a user's AT&T Message inbox.

                //Convert Message object to JSON
                bool umIsUnread = true;
                var umMessages = new List<MessageObj.Message>();

                umMessages.Add(new MessageObj.Message()
                {
                    messageId = "<Enter Message Id>",
                    isUnread = umIsUnread
                });

                var updateMsgsObj = new MessageObj.RootObject();
                updateMsgsObj.messages = umMessages;

                var updateMsgsJson = serializer.Serialize(updateMsgsObj);

                try
                {
                    // Make a method call to the In-App Messaging API.
                    // Method takes:
                    // param 1: string json
                    mymessages.updateMessages(updateMsgsJson);
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }
            }
        }
    }
        private async Task RunAsync(CancellationToken cancellationToken)
        {
            try
            {
                CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=[name];AccountKey=[key]");
                CloudQueueClient    queueClient    = storageAccount.CreateCloudQueueClient();
                CloudQueue          queue          = queueClient.GetQueueReference("myqueue");
                CloudTableClient    tableClient    = storageAccount.CreateCloudTableClient();
                CloudTable          table          = tableClient.GetTableReference("mytable");

                // Create the queue if it doesn't already exist
                queue.CreateIfNotExists();

                // Create the table if it doesn't exist.
                table.CreateIfNotExists();

                // TODO: Replace the following with your own logic.
                while (!cancellationToken.IsCancellationRequested)
                {
                    // Get the next message
                    CloudQueueMessage retrievedMessage = queue.GetMessage();

                    if (retrievedMessage != null)
                    {
                        var messages = new StringBuilder("Worker received: " + retrievedMessage.AsString);
                        messages.AppendLine();

                        // read the latest messages from the table
                        TableOperation retrieveOperation = TableOperation.Retrieve <MyMessages>("Partition0", "Row0");

                        // Execute the retrieve operation.
                        TableResult retrievedResult = table.Execute(retrieveOperation);

                        MyMessages myMessages = retrievedResult.Result == null
                                              ? new MyMessages {
                            PartitionKey = "Partition0", RowKey = "Row0", LastUpdated = DateTime.Now
                        }
                                              : (MyMessages)retrievedResult.Result;


                        messages.AppendLine(myMessages.Messages);

                        var filename = RoleEnvironment.IsEmulated
                                     ? @"c:\windows\system32\cmd.exe"
                                     : @"d:\windows\system32\cmd.exe";

                        var processStartInfo = new ProcessStartInfo()
                        {
                            Arguments = "/c echo \"test message from a process on the worker vm\"",
                            FileName  = filename,
                            RedirectStandardOutput = true,
                            UseShellExecute        = false
                        };

                        var process = Process.Start(processStartInfo);

                        using (var streamReader = new StreamReader(process.StandardOutput.BaseStream))
                        {
                            messages.AppendLine(streamReader.ReadToEnd() + " at " + DateTime.Now.ToString() + " on " + RoleEnvironment.CurrentRoleInstance);
                        }

                        // replace the messages
                        myMessages.Messages    = messages.ToString();
                        myMessages.LastUpdated = DateTime.Now;

                        // Create the Replace TableOperation.
                        TableOperation replaceOperation = TableOperation.InsertOrReplace(myMessages);

                        // Execute the operation.
                        var result = table.Execute(replaceOperation);

                        //Process the message in less than 30 seconds, and then delete the message
                        queue.DeleteMessage(retrievedMessage);


                        Trace.TraceInformation("Updated myMessage");
                    }

                    Trace.TraceInformation("Working");
                    await Task.Delay(1000);
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("Worker failed with " + ex.Message);
            }
        }
        /// <summary>
        ///     Moves the file.
        /// </summary>
        /// <returns><c>true</c>, if file was moved, <c>false</c> otherwise.</returns>
        /// <param name="sourceFile">Source file.</param>
        /// <param name="destFile">Destination file.</param>
        /// <exception cref="FileNotFoundException">
        ///     Unable to locate this source file or destination file.
        /// </exception>
        /// <exception cref="ArgumentException"></exception>
        /// <exception cref="ArgumentNullException">
        ///     Either the source file path or the destination file path is null.
        /// </exception>
        public static bool MoveFile(string sourceFile, string destFile)
        {
            try
            {
                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                if (string.IsNullOrEmpty(sourceFile))
                {
                    throw new ArgumentNullException();
                }

                if (!File.Exists(sourceFile))
                {
                    throw new FileNotFoundException();
                }

                if (string.IsNullOrEmpty(destFile) ||
                    File.Exists(destFile))
                {
                    throw new ArgumentException();
                }

                if (File.Exists(destFile))
                {
                    MyMessages.QuestionMessage = "A file with this name already exists: "
                                                 + " Are you sure you wish to overwrite it. " + destFile;

                    var result = MyMessages.ShowQuestionMessageBox();

                    if (result != DialogResult.Yes)
                    {
                        return(false);
                    }
                }

                File.Move(sourceFile, destFile);

                return(true);
            }
            catch (UnauthorizedAccessException ex)
            {
                MyMessages.ErrorMessage = "You do not have the necessary permission level  for this operation.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (ArgumentNullException ex)
            {
                MyMessages.ErrorMessage = "The source file path or destination file path is missing.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (ArgumentException ex)
            {
                MyMessages.ErrorMessage = "The source file path or destination file path is not valid.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (PathTooLongException ex)
            {
                MyMessages.ErrorMessage = "Either the file source or destination file path is to long.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (FileNotFoundException ex)
            {
                MyMessages.ErrorMessage = "The source file path or destination file path is not valid.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (IOException ex)
            {
                MyMessages.ErrorMessage = "The file path is not correctly formed. Aborting. operation.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (NotSupportedException ex)
            {
                MyMessages.ErrorMessage = "This file move encountered an error. Operation aborted.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
        }
        /// <summary>
        ///     Moves the directory.
        /// </summary>
        /// <returns><c>true</c>, if directory was moved, <c>false</c> otherwise.</returns>
        /// <param name="sourceDir">Source directory to move.</param>
        /// <param name="destDir">Destination directory.</param>
        /// <exception cref="ArgumentNullException">The file path is null.</exception>
        /// <exception cref="DirectoryNotFoundException">
        ///     The file path is invalid.
        /// </exception>
        /// <exception cref="IOException">
        ///     Source or destination directory path null.
        /// </exception>
        public static bool MoveDirectory(string sourceDir, string destDir)
        {
            try
            {
                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                if (string.IsNullOrEmpty(sourceDir))
                {
                    throw new ArgumentNullException();
                }

                if (!Directory.Exists(sourceDir))
                {
                    throw new DirectoryNotFoundException();
                }
                if (string.IsNullOrEmpty(destDir))
                {
                    throw new ArgumentNullException();
                }

                if (Directory.Exists(destDir))
                {
                    MyMessages.QuestionMessage = "A destination directory with this name all ready exists: " + destDir
                                                 + " Do you wish to delete it?";

                    var result = MyMessages.ShowQuestionMessageBox();

                    if (result == DialogResult.Yes)
                    {
                        if (!DeleteDirectory(destDir))
                        {
                            throw new IOException();
                        }
                    }
                }

                Directory.Move(sourceDir, destDir);

                return(!Directory.Exists(destDir));
            }
            catch (UnauthorizedAccessException ex)
            {
                MyMessages.ErrorMessage = "You do not have the necessary permission level  for this operation.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (ArgumentNullException ex)
            {
                MyMessages.ErrorMessage = "The source directory path or destination directory path is missing.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);

                return(false);
            }
            catch (ArgumentException ex)
            {
                MyMessages.ErrorMessage = "The source directory path or destination directory path is invalid.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (PathTooLongException ex)
            {
                MyMessages.ErrorMessage = "The source directory path or destination directory path is to long.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (DirectoryNotFoundException ex)
            {
                MyMessages.ErrorMessage = "Found no directory at this path: " + sourceDir;
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (IOException ex)
            {
                MyMessages.ErrorMessage = "Encountered error while deleting the directory. Aborting operation.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (NotSupportedException ex)
            {
                MyMessages.ErrorMessage = "Encountered an error. Operation aborted.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
        }
        /// <summary>
        ///     Deletes the file.
        /// </summary>
        /// <returns><c>true</c>, if file was deleted, <c>false</c> otherwise.</returns>
        /// <param name="filePath">File path.</param>
        /// <exception cref="ArgumentNullException">
        ///     The directory path is null.
        /// </exception>
        public static bool DeleteFile(string filePath)
        {
            try
            {
                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                if (string.IsNullOrEmpty(filePath))
                {
                    throw new ArgumentNullException();
                }

                if (File.Exists(filePath))
                {
                    MyMessages.QuestionMessage = "A file with this name already exists: "
                                                 + " Are you sure you wish to delete it. " + filePath;

                    var result = MyMessages.ShowQuestionMessageBox();

                    if (result != DialogResult.Yes)
                    {
                        return(false);
                    }
                }

                if (File.Exists(filePath))
                {
                    MyMessages.QuestionMessage = "A file with this name already exists: "
                                                 + " Are you sure you wish to delete it. " + filePath;

                    var result = MyMessages.ShowQuestionMessageBox();

                    if (result != DialogResult.Yes)
                    {
                        return(false);
                    }
                }

                File.Delete(filePath);

                // All OK
                MyMessages.InformationMessage = "This file has been deleted successfully";
                MyMessages.ShowInformationMessageBox();

                // All OK
                return(true);
            }
            catch (UnauthorizedAccessException ex)
            {
                MyMessages.ErrorMessage = "You do not have the necessary permission level  for this operation.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (ArgumentNullException ex)
            {
                MyMessages.ErrorMessage = "Either the file source or the destination file path is null.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (ArgumentException ex)
            {
                MyMessages.ErrorMessage = "Either the file source or the destination file path is invalid.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (PathTooLongException ex)
            {
                MyMessages.ErrorMessage = "Either the file source or destination file path is to long.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (FileNotFoundException ex)
            {
                MyMessages.ErrorMessage = "The source file was not found at this path. " + filePath;
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (IOException ex)
            {
                MyMessages.ErrorMessage = "Encountered error while copying source file to destination.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (NotSupportedException ex)
            {
                MyMessages.ErrorMessage = "This file copy encountered an error. Operation aborted.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
        }
Example #18
0
        protected void PayByWallet_Click(object sender, EventArgs e)
        {
            decimal amount = 0, typeChangeVentaCurrent = 0, typechangecompraCurrent = 0;
            string  numcuota = string.Empty;
            string  idInfo = string.Empty, typeInfo = string.Empty, walleOperationId = string.Empty;
            string  currencyCode       = string.Empty;
            string  imgTicket          = string.Empty;
            decimal amountWallet       = 0;
            string  idMembershipDetail = string.Empty;

            decimal typechangesend = 0;


            currencyCode = ddlcurrencyCode.SelectedValue.Trim();

            if (currencyCode != "USD" && currencyCode != "PEN")
            {
                MessageError.Text = "ocurrio un error.";
                return;
            }



            if (Session["StatusCalendar"] == null || Session["CurrencyCode"] == null)
            {
                MessageError.Text = "Ocurrio un error.";
                return;
            }
            idMembershipDetail = int.Parse(Session["StatusCalendar"].ToString()).ToString();
            imgTicket          = $"{idMembershipDetail}{DateTime.Now.ToString("yyyyMMdd")}";

            //

            BrTypeChange tc = new BrTypeChange();

            var arraytypechan = tc.GetTypesChange().Split('|');

            typeChangeVentaCurrent  = decimal.Parse(arraytypechan[0]);
            typechangecompraCurrent = decimal.Parse(arraytypechan[1]);



            BrMembershipPayDetail brMembership = new BrMembershipPayDetail();
            var response = brMembership.GetQuote(int.Parse(idMembershipDetail), User.Identity.Name.Split('¬')[1]).Split('|');

            if (decimal.Parse(response[0]) == 0)
            {
                MessageError.Text = "Ocurrio un error.";
                return;
            }
            //el monto llega deacuerdo al currency code del cronograma
            amount = decimal.Parse(response[0]);
            var currencyCodeCro = response[2];
            var typechangeCro   = decimal.Parse(response[4]);

            idInfo           = "1";
            typeInfo         = "1";
            walleOperationId = "2";


            MessageError.Text   = string.Empty;
            MessageWarning.Text = string.Empty;
            MessageSucces.Text  = string.Empty;

            bool IsPay = brMembership.IsPayQuote(idMembershipDetail);

            if (!IsPay)
            {
                MessageWarning.Text = "Tu Cuota ya esta Pagada.Verifica tu cronograma de pagos.";
                return;
            }

            BrWallet    brWallet   = new BrWallet();
            MyMessages  myMessages = new MyMessages();
            MyFunctions mf         = new MyFunctions();


            var namePeson = mf.ToCapitalize(User.Identity.Name.Split('¬')[0].ToLower());

            var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

            string tranferId    = "";
            string numReceipt   = "0";
            string datecomplete = dateCurrent[2] + " de " + mf.GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
            string nAffiliate   = "";

            string hour            = DateTime.Now.ToString("HH:mm:ss");
            string detalle         = amount.ToString() + $" {currencyCode}";
            string quotesPendiente = "";
            string codeMemb        = "";

            string descripcion = string.Empty;

            if (Session["numCuota"] != null)
            {
                descripcion = Session["numCuota"].ToString();
            }

            namePeson = myMessages.ToCapitalize(namePeson);
            //cvbc

            amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1]));
            //el monto de wallet viene en dolares.

            if (currencyCodeCro == "PEN")
            {
                if ((amountWallet * typechangeCro) < amount)
                {
                    MessageError.Text = "No tiene el monto suficiente para realizar Pago.";
                    return;
                }

                detalle = amount.ToString() + $" {currencyCode}";
                //tipo de moneda en soles
                imgTicket = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, detalle, quotesPendiente, $" {descripcion}");

                //en este caso el amount esta en soles y le aplicamos elm tipo de cambioo
                typechangesend = typechangeCro;
            }

            if (currencyCodeCro == "USD")
            {
                if (amountWallet < amount)
                {
                    MessageError.Text = "No tiene el monto suficiente para realizar Pago.";
                    return;
                }

                //tipo de moneda en dolares

                if (currencyCode == "USD")
                {
                    detalle   = amount.ToString() + $" {currencyCode}";
                    imgTicket = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, detalle, quotesPendiente, $" {descripcion}");
                }

                amount         = amount * typechangecompraCurrent;
                typechangesend = typechangecompraCurrent;

                if (currencyCode == "PEN")
                {
                    detalle   = amount.ToString() + $" {currencyCode}";
                    imgTicket = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, detalle, quotesPendiente, $" {descripcion}");
                }
            }


            //amount|@idInfo|@typeInfo|@walletOperationId|@currencyCode|@typeChange|idmembershipDetail|imgTicket
            string data   = $"{amount}|{idInfo}|{typeInfo}|{walleOperationId}|{currencyCode}|{typechangesend}|{idMembershipDetail}|{imgTicket}";
            bool   answer = brWallet.Put(data, User.Identity.Name.Split('¬')[1]);


            if (!answer)
            {
                MessageError.Text = "Ocurrio un error.";
                return;
            }

            MessageSucces.Text = "Su Pago de Realizo Con Exito.";

            var urlRedirect = "EndPaymentQuote";

            //Email oEmail = new Email();
            //bool awnserEmail = oEmail.submitEmail(emailNewUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago());
            //MessageSucces.Text += " - y se le envio un correo con su confirmacion. ";
            var dataSche = (Dictionary <string, object>)Session["changingschedule"];

            var action       = dataSche["Action"];
            var valueQuote   = Convert.ToDouble(dataSche["ValueQuote"]);
            var numQuote     = Convert.ToDouble(dataSche["NumQuote"]);
            var idMembership = Convert.ToInt32(dataSche["IdMembership"]);

            var lastpaydate = Convert.ToDateTime(dataSche["PayDate"]);

            var smallDate = DateTime.Now - lastpaydate;

            var numberDays = smallDate.Days;

            if (numberDays > 0)
            {
                BrDaysFree brDaysFree = new BrDaysFree();
                var        dataanw    = brDaysFree.Put(User.Identity.Name.Split('¬')[1], numberDays, idMembership);
            }


            Response.Redirect($"{urlRedirect}.aspx");
        }
Example #19
0
        protected void ProcesarPay_Click(object sender, EventArgs e)
        {
            var dataSche = (Dictionary <string, object>)Session["changingschedule"];


            var idMemberDetails   = 0;
            var typeChangeSend    = 0m;
            var typeChangecurrent = 0m;

            typeChangecurrent = decimal.Parse(User.Identity.Name.Split('¬')[4]);

            BrWallet brWallet     = new BrWallet();
            var      amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1]));

            if (!(amountWallet > 0))
            {
                MessageError.Text = "ocurrio un error";
                return;
            }

            string currencyCode = ddlcurrencyCode.SelectedValue;

            if (Session["quotePay"] == null || Session["numCuota"] == null)
            {
                MessageError.Text = "Ocurrio un error.";
                return;
            }
            var totalPay = decimal.Parse(Session["quotePay"].ToString());

            var description = Session["numCuota"].ToString();

            var methods2 = "AFTER";

            var recibe = string.Empty;

            if (NowReceipt.Checked)
            {
                if (!Recibo.HasFile)
                {
                    MessageError.Text = "No hay imagen.";
                    return;
                }

                string[] arraynombreArchivo2 = Recibo.FileName.Split('.');

                int indice = (arraynombreArchivo2.Length - 1);

                string extension = arraynombreArchivo2[indice];

                var nameFile = Guid.NewGuid().ToString();

                recibe = $"{nameFile}.{extension}";
                string filePath = "~/Resources/RecibosRegister/" + recibe;

                Recibo.SaveAs(Server.MapPath(filePath));

                methods2 = "NOW";
            }


            if (Session["StatusCalendar"] == null || Session["CurrencyCode"] == null)
            {
                MessageError.Text = "Ocurrio un error.";
                return;
            }

            idMemberDetails = int.Parse(Session["StatusCalendar"].ToString());

            BrMembershipPayDetail brMembership = new BrMembershipPayDetail();
            var response = brMembership.GetQuote(idMemberDetails, User.Identity.Name.Split('¬')[1]).Split('|');

            if (decimal.Parse(response[0]) == 0)
            {
                MessageError.Text = "Ocurrio un error.";
                return;
            }
            var amount          = decimal.Parse(response[0]);
            var currencycodecro = response[2];

            var typechangecro = decimal.Parse(response[4]);



            BrTypeChange tc = new BrTypeChange();
            MyMessages   mm = new MyMessages();
            MyFunctions  mf = new MyFunctions();

            var arraytypechan           = tc.GetTypesChange().Split('|');
            var typeChangeVentaCurrent  = decimal.Parse(arraytypechan[0]);
            var typechangecompraCurrent = decimal.Parse(arraytypechan[1]);

            decimal amountRestan      = 0;
            decimal amountWalletSoles = 0;


            var    idInfo         = idMemberDetails.ToString();
            var    imgTicketWalle = "";
            var    namePeson      = User.Identity.Name.Split('¬')[0];
            var    dateCurrent    = DateTime.Now.ToString("yyyy-MM-dd").Split('-');
            string tranferId      = "";
            string numReceipt     = "0";
            string datecomplete   = dateCurrent[2] + " de " + mf.GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
            string nAffiliate     = "";
            string hour           = DateTime.Now.ToString("HH:mm:ss");

            namePeson = mm.ToCapitalize(namePeson);
            var moneyStatus = 1;

            if (currencycodecro == "PEN")
            {
                if (currencyCode == "PEN")
                {
                    typeChangeSend    = typechangecompraCurrent;
                    amountWalletSoles = amountWallet * typechangecompraCurrent;

                    amountRestan = amount - amountWalletSoles;

                    imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWalletSoles.ToString("0.00") + " PEN Atravez del Wallet", "", $" {description}");

                    if (!NowReceipt.Checked)
                    {
                        SendEmailAmountRestante(amountRestan.ToString("0.00"), amountWalletSoles.ToString("0.00"), amount.ToString("0.00"), idInfo, description, currencyCode);
                    }
                }

                if (currencyCode == "USD")
                {
                    typeChangeSend = typechangecro;

                    amountRestan = (amount / typechangecro) - amountWallet;

                    imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWallet.ToString() + " USD Atravez del Wallet", "", $" {description}");

                    if (!NowReceipt.Checked)
                    {
                        SendEmailAmountRestante(amountRestan.ToString("0.00"), amountWallet.ToString("0.00"), (amount / typechangecro).ToString("0.00"), idInfo, description, currencyCode);
                    }
                }
            }

            if (currencycodecro == "USD")
            {
                if (currencyCode == "USD")
                {
                    amountRestan = amount - amountWallet;

                    imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWallet.ToString() + " USD Atravez del Wallet", "", $" {description}");

                    if (!NowReceipt.Checked)
                    {
                        SendEmailAmountRestante(amountRestan.ToString("0.00"), amountWallet.ToString("0.00"), amount.ToString("0.00"), idInfo, description, currencyCode);
                    }
                }

                amount         = amount * typechangecompraCurrent;
                typeChangeSend = typechangecompraCurrent;

                if (currencyCode == "PEN")
                {
                    amountWalletSoles = amountWallet * typechangecompraCurrent;
                    amountRestan      = amount - amountWalletSoles;

                    imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWalletSoles.ToString() + " PEN Atravez del Wallet", "", $" {description}");

                    if (!NowReceipt.Checked)
                    {
                        SendEmailAmountRestante(amountRestan.ToString("0.00"), amountWalletSoles.ToString("0.00"), amount.ToString("0.00"), idInfo, description, currencyCode);
                    }
                }
            }


            //dos es que wallet es una parte del pago de una cuota
            var typeInfo         = "2";
            var walleOperationId = "2";

            MessageError.Text   = string.Empty;
            MessageWarning.Text = string.Empty;
            MessageSucces.Text  = string.Empty;

            bool IsPay = brMembership.IsPayQuote(idMemberDetails.ToString());

            if (!IsPay)
            {
                MessageWarning.Text = "Tu Cuota ya esta Pagada.Verifica tu cronograma de pagos.";
                return;
            }


            var action       = dataSche["Action"];
            var valueQuote   = Convert.ToDouble(dataSche["ValueQuote"]);
            var numQuote     = Convert.ToDouble(dataSche["NumQuote"]);
            var idMembership = Convert.ToInt32(dataSche["IdMembership"]);

            var lastpaydate = Convert.ToDateTime(dataSche["PayDate"]);

            var smallDate = DateTime.Now - lastpaydate;

            var numberDays = smallDate.Days;


            int numQuotes = int.Parse(numQuote.ToString());

            BrMembershipPayDetail payDetail = new BrMembershipPayDetail();
            bool responseb = payDetail.PutQuotesChangingSchedule(idMembership, numQuotes, recibe, 2);

            if (numberDays > 0)
            {
                BrDaysFree brDaysFree = new BrDaysFree();
                var        dataanw    = brDaysFree.Put(User.Identity.Name.Split('¬')[1], numberDays, idMembership);
            }



            if (amountWallet > 0)
            {
                if (string.IsNullOrEmpty(recibe))
                {
                    recibe += $"{imgTicketWalle}";
                }
                else
                {
                    recibe += $"~{imgTicketWalle}";
                }
                //amount | @idInfo | @typeInfo | @walletOperationId | @currencyCode | @typeChange | idmembershipDetail | imgTicket
                string data   = $"{(amountWallet * typeChangeSend).ToString()}|{idInfo}|{typeInfo}|{walleOperationId}|PEN|{typeChangeSend}|{idMemberDetails.ToString()}|{recibe}";
                bool   answer = brWallet.Put(data, User.Identity.Name.Split('¬')[1], moneyStatus);

                //Extorno

                if (!answer)
                {
                    MessageError.Text = "Ocurrio un error.";
                    return;
                }
            }
            //MessageSucces.Text = "Su Pago de Realizo Con Exito.";

            /*=============================================================================================================================*/

            var amountOthers = amount;
            //esta en estado pendienete
            var statusPay = 4;

            if (methods2 == "NOW")
            {
                statusPay = 2;
            }

            //marcar como pagado en la tabla membershipdetails

            //TODO: Agregar los detalles del pago
            BrUser brUser = new BrUser();

            bool habiliAccount = brUser.BiPayQuote(idMemberDetails, recibe, amountWallet * typeChangeSend, amountRestan, "WALLET", methods2, statusPay, typeChangeSend);

            var amountTot = amountWallet + amountRestan;



            if (habiliAccount)
            {
                Response.Redirect("EndPaymentQuote.aspx");
            }
        }
Example #20
0
        private void RemoveDisciline()
        {
            string       discipline  = null;
            int          number      = -1;
            string       error       = null;
            int          id_discip   = -1;
            DialogResult affirmative = DialogResult.None;

            if (DelDiscipList.SelectedIndex == -1 && String.IsNullOrEmpty(DelDiscpTextBox.Text.Trim()))
            {
                MessageBox.Show("Спочатку оберіть дисципліну");
            }
            else
            {
                discipline = DelDiscipList.SelectedItem.ToString();
                number     = GetNumberOfDocuments(discipline);
                if (number <= 0)
                {
                    affirmative = MyMessages.QuestionMessage("Дисципліна " + discipline + " буде видалена з бази даних. " +
                                                             "Ви впевнені, що хочете продовжити?");
                }
                else
                {
                    affirmative = MyMessages.QuestionMessage("Дисципліна " + discipline + " буде видалена з бази даних. " +
                                                             "За цією дисципліною закріплено " + number + " навчальних матеріалів вони також будуть видалені(з бази даних)." +
                                                             "Ви впевнені, що хочете продовжити?");
                }
                if (affirmative == DialogResult.Yes)
                {
                    try
                    {
                        using (MySqlConnection con = DBUtils.GetDBConnection())
                        {
                            con.Open();
                            MySqlCommand cmd = new MySqlCommand("SelectDisciplineID", con)
                            {
                                CommandType = CommandType.StoredProcedure
                            };
                            cmd.Parameters.AddWithValue("_name", discipline);
                            using (MySqlDataReader r = cmd.ExecuteReader())
                            {
                                while (r.Read())
                                {
                                    id_discip = int.Parse(r["id"].ToString());
                                }
                            }
                            cmd = new MySqlCommand("DeleteDiscipline", con)
                            {
                                CommandType = CommandType.StoredProcedure
                            };
                            cmd.Parameters.AddWithValue("_id", id_discip);
                            int rows = cmd.ExecuteNonQuery();
                            if (rows >= 0)
                            {
                                MessageBox.Show("Навчальна дисципліна " + discipline + " була видалена з бази даних");
                                if (Directory.Exists(targetdirectory + discipline))
                                {
                                    Directory.Delete(targetdirectory + discipline, true);
                                }
                            }
                            else
                            {
                                using (MySqlDataReader r = cmd.ExecuteReader())
                                {
                                    while (r.Read())
                                    {
                                        error = r["@full_error"].ToString();
                                    }
                                }
                                MessageBox.Show(error);
                            }
                        }
                    }
                    catch (Exception e1)
                    {
                        MessageBox.Show(e1.Message);
                    }
                }
            }
            DelDisciplineListBoxFill(DelDiscpTextBox.Text.Trim());
        }
Example #21
0
        protected void btnEnviarImagen_Click(object sender, EventArgs e)
        {
            string numdoc = "";

            userName = "";
            numdoc   = txtNumeroDoc.Text.Trim();
            if (string.IsNullOrEmpty(numdoc))
            {
                lblErrorSi.Text  = "El Numero de Documento es Obligatorio.";
                lblErrorSi2.Text = "El Numero de Documento es Obligatorio.";
                txtNumeroDoc.Focus();
                return;
            }
            if (!file_upload.HasFile)
            {
                lblErrorSi.Text  = "No hay una Imagen Seleccionada.";
                lblErrorSi2.Text = "No hay una Imagen Seleccionada.";/*TRY MERGE WILL*/
                return;
            }
            Validation val   = new Validation();
            bool       isDoc = val.IsDocument(numdoc);

            if (!isDoc)
            {
                lblErrorSi.Text  = "El Dato Ingresado No es un Documento Valido.";
                lblErrorSi2.Text = "El Dato Ingresado No es un Documento Valido.";
                return;
            }

            BrInformacion brInformacion = new BrInformacion();

            string[] anwser = brInformacion.GetBYNunDoc(numdoc).Split('|');

            if (anwser.Length < 2)
            {
                lblErrorSi.Text  = "Aun no eres Socio.";
                lblErrorSi2.Text = "Aun no eres Socio.";
                return;
            }
            userName = anwser[0];
            string idMPayMdetail = anwser[1];

            if (!val.IsEntero(idMPayMdetail))
            {
                lblErrorSi.Text  = "Ocurrio un error de sistema.";
                lblErrorSi2.Text = "Ocurrio un error de sistema.";
                return;
            }
            if (!file_upload.HasFile)
            {
                lblErrorSi.Text  = "No hay una Imagen Seleccionada.";
                lblErrorSi2.Text = "No hay una Imagen Seleccionada.";
                return;
            }
            //si hay una archivo.

            string[] arraynombreArchivo2 = file_upload.FileName.Split('.');

            int indice = (arraynombreArchivo2.Length - 1);

            string extension = arraynombreArchivo2[indice];

            if (extension.ToLower() == "png" || extension.ToLower() == "jpg" || extension.ToLower() == "jpeg")
            {
                var idmem = LblIdMembership.Text.Trim();

                if (idmem != "")
                {
                    idMPayMdetail = idmem;
                }

                var    key           = DateTime.Now.ToString("yyyyMMddHHmmss");
                string nombreArchivo = $"login{key}__{idMPayMdetail}" + userName + "." + extension;

                if (val.IsEntero(idMPayMdetail))
                {
                    //var llave = Guid.NewGuid().ToString();

                    string ruta = "~/Resources/RecibosRegister/" + nombreArchivo;

                    //ComprimirImagen(file_upload.FileContent, ruta, "Jpeg", 40);
                    //GuardarImage(file_upload.FileContent, ruta, "compresionImagen.Jpeg", "jpg");

                    file_upload.SaveAs(Server.MapPath(ruta));
                }
                BrUser brUser       = new BrUser();
                bool   updateIdMent = false;


                if (idmem != "")
                {
                    if (val.IsEntero(idmem))
                    {
                        BrMembershipPayDetail brMembership = new BrMembershipPayDetail();
                        var response = brMembership.GetQuote(int.Parse(idmem), userName).Split('|');
                        var quote    = response[0];

                        //DateTime payDate = DateTime.Parse("2019-04-04 23:59:59");
                        //if (decimal.Parse(quote) == decimal.Parse("0"))
                        //{
                        //    lblErrorSi.Text = "Ocurrio un error.";
                        //    lblErrorSi2.Text = "Ocurrio un error.";
                        //    return;
                        //}
                        updateIdMent = brMembership.PutReceiptQuote(idmem, nombreArchivo);
                    }
                }
                else
                {
                    updateIdMent = brUser.PorVerificar(idMPayMdetail + "¬" + userName + "¬" + nombreArchivo);
                }

                if (!updateIdMent)
                {
                    lblErrorSi.Text  = "Usted ya no puede subir recibos.";
                    lblErrorSi2.Text = "Usted ya no puede subir recibos.";
                    return;
                }


                lblErrorSi.Text   = "El Recibo Fue Enviado Con exito, espere la confirmación que se le estará enviando a su correo, dentro de las proximas 24 horas";
                lblErrorSi2.Text  = "El Recibo Fue Enviado Con exito, espere la confirmación que se le estará enviando a su correo, dentro de las proximas 24 horas";
                txtNumeroDoc.Text = "";

                Email      oEmail    = new Email();
                MyMessages mm        = new MyMessages();
                var        emailUser = anwser[2].Trim();
                string     fname     = mm.ToCapitalize(anwser[3].Trim()).Trim();
                string     gender    = anwser[4].Trim();

                bool answer = oEmail.SendEmail(emailUser, "[Ribera del Rio - Inresorts, Registro en Proceso]", mm.MessageComprobandoImagen(fname, gender), true);
                answer = oEmail.SendEmail("*****@*****.**", "[Ribera del Rio - Inresorts, Registro en Proceso]", mm.MessageComprobandoImagen(fname, gender), true);

                string hex    = "#2981c5";
                Color  _color = ColorTranslator.FromHtml(hex);
                lblErrorSi2.ForeColor = _color;
                lblErrorSi.ForeColor  = _color;
                return;
            }
            lblErrorSi.Text  = "La Imagen No tiene el Formato Correcto.";
            lblErrorSi2.Text = "La Imagen No tiene el Formato Correcto.";
        }
Example #22
0
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            string       user        = null;
            int          userid      = -1;
            int          number      = -1;
            string       error       = null;
            DialogResult affirmative = DialogResult.None;

            Studyload.Discipline.Clear();
            if (DelUsersList.SelectedIndex == -1)
            {
                MessageBox.Show("Спочатку оберіть користувача");
            }
            else
            {
                user = DelUsersList.SelectedItem.ToString();
                using (MySqlConnection con = DBUtils.GetDBConnection())
                {
                    con.Open();
                    MySqlCommand cmd = new MySqlCommand("GetUserInfo", con)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    cmd.Parameters.AddWithValue("_name", user);
                    using (MySqlDataReader r = cmd.ExecuteReader())
                    {
                        while (r.Read())
                        {
                            userid = (int)r["user_id"];
                        }
                    }
                }
                number = GetNumberOfDisciplines(user);
                if (number <= 0)
                {
                    affirmative = MyMessages.QuestionMessage("Користувач " + user + " буде видалений з бази даних. " +
                                                             "Ви впевнені, що хочете продовжити?");
                }
                else
                {
                    affirmative = MyMessages.QuestionMessage("Викладач " + user + " буде видалений з бази даних. " +
                                                             "За цим викладачем закріплено " + number + " навчальних дисциплін." +
                                                             "Ви впевнені, що хочете продовжити?");
                }
                if (affirmative == DialogResult.Yes)
                {
                    if (id_role == 2 && number != 0)
                    {
                        affirmative = MyMessages.QuestionMessage("Бажаєте назначити дисципліни, які веде викладач " + user +
                                                                 " іншому користувачу?");
                        if (affirmative == DialogResult.No)
                        {
                            RemoveUser(user, id_role);
                        }
                        else
                        {
                            Studyload.Olduser = user;
                            foreach (string i in DelUserDisciplines.Items)
                            {
                                Studyload.Discipline.Add(i);
                            }
                            StudyloadRebuild form = new StudyloadRebuild()
                            {
                                Owner = this
                            };
                            form.ShowDialog();
                        }
                    }
                    else
                    {
                        RemoveUser(user, id_role);
                    }
                }
            }
            DeleteUserPageInitialSize();
        }
Example #23
0
        /// <summary>
        ///     If the user has made a back up file then they can restore it from here.
        /// </summary>
        public static void RestoreGenreDefaultListFromBackup()
        {
            try
            {
                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                var validate = false;

                GenreDefaultListCollection.ClearCollection();

                using (var ofd = new OpenFileDialog())
                {
                    ofd.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
                    ofd.FilterIndex      = 2;
                    ofd.RestoreDirectory = true;
                    ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

                    if (ofd.ShowDialog() == DialogResult.OK)
                    {
                        using (var sr = new StreamReader(ofd.FileName))
                        {
                            string genreName;
                            while ((genreName = sr.ReadLine()) != null)
                            {
                                if (!validate)
                                {
                                    validate = CheckForValidGenreName(genreName);
                                }
                                else
                                {
                                    if (!string.IsNullOrEmpty(genreName))
                                    {
                                        GenreDefaultListCollection.AddItem(genreName);
                                    }
                                }
                            }
                        }
                    }
                }

                if (GenreDefaultListCollection.ItemCount() <= 0)
                {
                    return;
                }

                MyMessages.QuestionMessage = "This will overwrite your current genre default list."
                                             + " Do you wish to continue.";
                var result = MyMessages.ShowQuestionMessage(MyMessages.QuestionMessage, MyMessages.NameOfClass);
                if (result == DialogResult.Yes)
                {
                    GenreFileReadWrite.WriteGenreTemplateList();
                }
            }
            catch (FileNotFoundException ex)
            {
                MyMessages.ErrorMessage = "Not a valid path. Exiting operation.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
            }
            catch (ArgumentNullException ex)
            {
                MyMessages.ErrorMessage = "Not a valid path. Exiting operation.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
            }
        }
Example #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var answer = "ocurrio un error";
            var action = Request["action"];

            if (action == "get")
            {
                BrWallet    brWallet  = new BrWallet();
                MyFunctions mf        = new MyFunctions();
                string      tableHtml = "";
                var         arrayData = brWallet.Get(User.Identity.Name.Split('¬')[1]);

                if (!string.IsNullOrEmpty(arrayData))
                {
                    string[] arrayRows = arrayData.Split('¬');
                    tableHtml  = "<table class='table table-hover'><thead>";
                    tableHtml += "<tr>";
                    tableHtml += "<th>#</th>";
                    tableHtml += "<th>Fecha</th>";
                    tableHtml += "<th>Operacion</th>";
                    tableHtml += "<th>Monto</th>";
                    tableHtml += "</tr></thead><tbody>";
                    for (int i = 0; i < arrayRows.Length; i++)
                    {
                        string[] row = arrayRows[i].Split('|');
                        if (row.Length > 2)
                        {
                            var classtr = "";
                            var restan  = "";
                            if (row[3] == "1")
                            {
                                classtr = "text-red";
                                restan  = "-";
                            }
                            tableHtml += $"<tr >";
                            tableHtml += $"<td>{(i + 1).ToString()}</td>";
                            tableHtml += $"<td>{mf.DateFormatClient(row[0])}</td>";
                            tableHtml += $"<td>{row[2]}</td>";
                            tableHtml += $"<td class='{classtr}'>{restan}{row[1]}</td>";
                            tableHtml += "</tr>";
                        }
                    }
                    tableHtml += "</tbody></table>";
                    answer     = tableHtml;
                }
                else
                {
                    answer = "No hay Datos";
                }
            }

            if (action == "getDoc")
            {
                BrWallet    brWallet = new BrWallet();
                MyFunctions mf       = new MyFunctions();
                var         data     = brWallet.GetDocsByUser(User.Identity.Name.Split('¬')[1]);

                answer = "no hay datos";

                if (!string.IsNullOrEmpty(data))
                {
                    var tableHtml = "<table class='table table-hover'>";
                    tableHtml += "<tr>";
                    tableHtml += $"<th>#</th>";
                    tableHtml += $"<th>Archivo</th>";
                    tableHtml += $"<th>Fecha</th>";
                    tableHtml += $"<th>Monto</th>";
                    tableHtml += $"<th>Estado</th>";
                    tableHtml += $"<th>Obs</th>";
                    tableHtml += $"<th>Voucher</th>";
                    tableHtml += "</tr>";
                    var arrayData = data.Split('¬');

                    for (int i = 0; i < arrayData.Length; i++)
                    {
                        var row = arrayData[i].Split('|');
                        tableHtml += "<tr>";
                        tableHtml += $"<td>{(i + 1).ToString()}</td>";
                        tableHtml += $"<td><a target='_blank' href='/Resources/wallet/{row[1]}' ><img src='../Resources/RecibosRegister/pdf.png' width='30px' /></a></td>";
                        tableHtml += $"<td>{mf.DateFormatClient(row[2])}</td>";
                        tableHtml += $"<td>{row[3]}</td>";
                        tableHtml += $"<td>{row[4]}</td>";
                        tableHtml += $"<td>{row[5]}</td>";

                        if (row[6] != "")
                        {
                            tableHtml += $"<td><a target='_blank' href='/Resources/Make/{row[6]}' ><img src='../Resources/RecibosRegister/pdf.png' width='30px' /></a></td>";
                        }
                        else
                        {
                            tableHtml += "<td></td>";
                        }
                        tableHtml += "</tr>";
                    }
                    tableHtml += "</table>";

                    answer = tableHtml;
                }
            }

            if (action == "infoper")
            {
                var usernameBen = Request["userNameBen"];
                var amountleter = Request["amount"];

                answer = "false";
                Validation val = new Validation();
                if (val.IsDecimal(amountleter))
                {
                    var amount = decimal.Parse(amountleter);

                    BrUser brUser        = new BrUser();
                    var    dataPersonBen = brUser.GetPersonalInformation(usernameBen).Split('|');
                    var    dataPerson    = brUser.GetPersonalInformation(User.Identity.Name.Split('¬')[1]).Split('|');

                    if (dataPersonBen.Length > 1)
                    {
                        BrWallet brWallet     = new BrWallet();
                        var      amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1]));
                        if (amountWallet >= amount)
                        {
                            var emailfull  = dataPerson[5].Split('@')[0];
                            var emailfront = emailfull.Substring(0, (emailfull.Length / 2) + 2);

                            MyMessages  mm    = new MyMessages();
                            MyFunctions mf    = new MyFunctions();
                            Email       email = new Email();

                            var numberOne   = (new Random().Next(89) + 10).ToString("00");
                            var numberTwo   = ((new Random().Next(32) + 1) * 3).ToString("00");
                            var numberThree = ((new Random().Next(18) + 1) * 5).ToString("00");


                            var token = $"{numberOne}{numberTwo}{numberThree}";

                            var body = mm.EmailClaveDigital(token, mf.ToCapitalize(dataPersonBen[1]));
                            //
                            if (email.SendEmail(dataPerson[5], "Clave Digital - Inresorts", body, true))
                            {
                                BrWalletToken brWalletToken = new BrWalletToken();

                                var dateEnd = DateTime.UtcNow.AddMinutes(5);

                                var isSuccess = brWalletToken.PutToken(User.Identity.Name.Split('¬')[1], token, dateEnd, DateTime.Now.ToString(), 1, amount, usernameBen);

                                if (isSuccess)
                                {
                                    answer = $"true|{dataPersonBen[1]} {dataPersonBen[2]}|{emailfront}|{amountleter}";
                                }
                            }
                        }
                    }
                }
            }


            if (action == "validtoken")
            {
                answer = "false";
                var token  = Request["clave"];
                var amount = decimal.Parse(Request["amount"]);

                BrWalletToken brWalletToken = new BrWalletToken();
                var           data          = brWalletToken.GetInfoToken(User.Identity.Name.Split('¬')[1], token, amount).Split('|');

                if (data.Length > 1)
                {
                    var dateend = DateTime.Parse(data[0]);
                    if (DateTime.UtcNow <= dateend)
                    {
                        BrWallet brWallet     = new BrWallet();
                        var      amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1]));
                        if (amountWallet >= amount)
                        {
                            var isSuccess = brWallet.PutTransferenciaBetwenWallet(data[1], User.Identity.Name.Split('¬')[1], amount);
                            if (isSuccess)
                            {
                                MyMessages  mm    = new MyMessages();
                                MyFunctions mf    = new MyFunctions();
                                Email       email = new Email();
                                var         name  = User.Identity.Name.Split('¬')[0].Split()[0];
                                var         body  = mm.EmailTranferSuccess(mf.ToCapitalize(name), mf.ToCapitalize(data[3]), amount.ToString());

                                //
                                var send = email.SendEmail(data[2], "Transferencia Exitosa - Inresorts", body, true);
                                answer = "true";
                            }
                        }
                    }
                }
            }

            if (action == "sendreport")
            {
                var subjet   = Request["subjet"].Trim().ToUpper();
                var messagge = Request["messagge"].Trim();

                Email       email = new Email();
                MyMessages  mm    = new MyMessages();
                MyConstants mc    = new MyConstants();
                var         body  = mm.ReportProblemWallet(User.Identity.Name.Split('¬')[1], subjet, messagge);

                var send = email.SendEmail(mc.EmailEmpresa, "Problemas del Wallet - Inresorts", body, true);
                answer = "false";
                if (send)
                {
                    answer = "true";
                }
            }

            Response.Write(answer);
        }
Example #25
0
        /// <summary>
        ///     Validates the destination file exists.
        /// </summary>
        /// <returns>
        ///     <c>true</c>, if destination file exists was validated, <c>false</c> otherwise.
        /// </returns>
        /// <param name="filePath">File path.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public static bool ValidateDestinationFileExists(string filePath)
        {
            var sb = new StringBuilder();

            try
            {
                var declaringType = MethodBase.GetCurrentMethod().DeclaringType;
                if (declaringType != null)
                {
                    MyMessages.NameOfClass = declaringType.Name;
                }

                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                if (string.IsNullOrEmpty(filePath))
                {
                    throw new ArgumentNullException();
                }

                if (File.Exists(filePath))
                {
                    sb.Append("A file with the destination name all ready exists.");
                    sb.Append(filePath);
                    sb.Append("Do you wish to delete this existing file.");
                    MyMessages.QuestionMessage = sb.ToString();
                    var rspAns = MyMessages.ShowQuestionMessageBox();

                    if (rspAns == DialogResult.No)
                    {
                        MyMessages.InformationMessage = "Canceling this operation. The file will not be saved.";
                        MyMessages.ShowInformationMessageBox();
                        return(false);
                    }

                    File.Delete(filePath);
                }

                return(true);
            }
            catch (ArgumentNullException ex)
            {
                MyMessages.ErrorMessage = "Source file path is null.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (ArgumentException ex)
            {
                MyMessages.ErrorMessage = "Source file path is not valid.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
            catch (FileNotFoundException ex)
            {
                MyMessages.ErrorMessage = "Unable to locate this file.";
                MyMessages.BuildErrorString(
                    MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage, ex.Message);
                return(false);
            }
        }
Example #26
0
        /// <summary>
        ///     Create Make Proper name from current directory name.
        /// </summary>
        /// <returns>
        ///     <c>true</c>, if make proper case name was directory, <c>false</c> otherwise.
        /// </returns>
        /// <param name="dirName">Directory path.</param>
        /// <exception cref="DirectoryNotFoundException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        public string DirectoryMakeProperCaseName(string dirName)
        {
            try
            {
                MyMessages.NameOfMethod = MethodBase.GetCurrentMethod().Name;

                dirName = dirName.Trim();

                if (string.IsNullOrEmpty(dirName))
                {
                    throw new ArgumentNullException();
                }

                string newDirPath;
                var    parentDirName = new DirectoryInfo(dirName).Parent.FullName;
                var    origDirName   = new DirectoryInfo(dirName).Name;
                var    newDirName    = string.Empty;

                var myTI = new CultureInfo("en-US", false).TextInfo;

                var newLowerCase = myTI.ToLower(origDirName);

                newDirName = myTI.ToTitleCase(newLowerCase);

                var comp = string.Compare(origDirName, newDirName, StringComparison.CurrentCultureIgnoreCase);
                if (comp == 0)
                {
                    OriginalDirectoryFilePathsCollection.AddItem(dirName);
                    OriginalDirectoryFileNamesCollection.AddItem(origDirName);

                    newDirPath = Path.Combine(parentDirName, newDirName);
                    SongRecordProperties.NewDirectoryPath = newDirPath;
                    NewDirectoryFilePathsCollection.AddItem(newDirPath);
                    NewDirectoryFileNameCollection.AddItem(newDirName);
                }
                else
                {
                    newDirPath = string.Empty;
                }

                return(newDirPath);
            }
            catch (ArgumentNullException ex)
            {
                MyMessages.ErrorMessage = "The directory path is not valid.";
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(string.Empty);
            }
            catch (ArgumentException ex)
            {
                MyMessages.ErrorMessage = "The directory path is not valid.";
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(string.Empty);
            }
            catch (DirectoryNotFoundException ex)
            {
                MyMessages.ErrorMessage = "The directory path is not valid.";
                MyMessages.BuildErrorString(MyMessages.NameOfClass, MyMessages.NameOfMethod, MyMessages.ErrorMessage,
                                            ex.Message);
                return(string.Empty);
            }
        }
Example #27
0
        /// <summary>
        ///     Splits the original song path by getting parent.
        /// </summary>
        /// <returns>
        ///     <c>true</c>, if original song path by getting parent was split,
        ///     <c>false</c> otherwise.
        /// </returns>
        /// <param name="songPath">Song path.</param>
        /// <exception cref="FileNotFoundException"></exception>
        public int SplitOriginalSongPathByGettingParent(string songPath)
        {
            var val = 0;

            SongRecordProperties.SongFilePath = string.Empty;

            if (string.IsNullOrEmpty(songPath) ||
                !File.Exists(songPath))
            {
                MyMessages.ErrorMessage = "The path string is null, empty or invalid file path.";
                MyMessages.ShowErrorMessage(MyMessages.ErrorMessage, MyMessages.NameOfMethod);
                return(-1);
            }

            SongRecordProperties.SongTitle     = Path.GetFileNameWithoutExtension(songPath);
            SongRecordProperties.SongFilePath  = songPath;
            SongRecordProperties.SongExtension = Path.GetExtension(songPath);

            var directoryInfo = new FileInfo(songPath).Directory;

            if (directoryInfo != null)
            {
                SongRecordProperties.AlbumDirectoryName = directoryInfo.Name;

                SongRecordProperties.AlbumDirectoryPath = directoryInfo.FullName;
            }

            SongRecordProperties.RootPathDrive = Path.GetPathRoot(songPath);

            var directoryPath = new FileInfo(songPath).DirectoryName;

            if (string.IsNullOrEmpty(directoryPath))
            {
                return(-1);
            }

            var dirInfo = new DirectoryInfo(SongRecordProperties.AlbumDirectoryPath);

            if (dirInfo.Parent == null)
            {
                return(val);
            }
            SongRecordProperties.ArtistDirectoryName = dirInfo.Parent.Name;

            SongRecordProperties.ArtistDirectoryPath = dirInfo.Parent.FullName;

            val = SongGetDirectoryFilePaths.CheckForAlbumDirectories(SongRecordProperties.ArtistDirectoryPath);

            if (val == 1)
            {
                SongRecordProperties.ArtistDirectoryName = string.Empty;
                SongRecordProperties.ArtistDirectoryPath = string.Empty;

                SongRecordProperties.GenreDirectoryName = dirInfo.Parent.Name;
                SongRecordProperties.GenreDirectoryPath = dirInfo.Parent.FullName;

                var parent = new DirectoryInfo(directoryPath).Parent;
                if (parent != null)
                {
                    directoryPath = parent.FullName;

                    dirInfo = new DirectoryInfo(directoryPath);
                    if (dirInfo.Parent != null)
                    {
                        SongRecordProperties.MusicDirectoryName = dirInfo.Parent.Name;
                    }
                }
            }
            else if (val == 2)
            {
                SongRecordProperties.ArtistDirectoryPath = dirInfo.Parent.FullName;

                var info = new DirectoryInfo(directoryPath).Parent;
                if (info != null)
                {
                    directoryPath = info.FullName;

                    dirInfo = new DirectoryInfo(directoryPath);

                    if (dirInfo.Parent != null)
                    {
                        SongRecordProperties.GenreDirectoryName = dirInfo.Parent.Name;
                        SongRecordProperties.GenreDirectoryPath = dirInfo.Parent.FullName;
                        directoryPath = info.FullName;

                        dirInfo = new DirectoryInfo(directoryPath);
                        if (dirInfo.Parent != null)
                        {
                            SongRecordProperties.MusicDirectoryName = dirInfo.Parent.Name;
                            SongRecordProperties.MusicDirectoryPath = dirInfo.Parent.FullName;
                        }
                    }
                }
            }

            return(val);
        }
Example #28
0
        private void ConfirmRebuildButton_Click(object sender, EventArgs e)
        {
            //Studyload.Discipline.Clear();
            string discipline = DisciplinesList.SelectedItem.ToString();
            //List<string> discipline = new List<string>()
            string user   = OldTeacherLabel.Text.Trim();
            int    userid = -1;
            string error  = null;

            Studyload.Studyloadid = -1;
            int Reb_s_l     = -1;
            int disciplines = -1;

            try
            {
                for (int i = 0; i < Studyload.Discipline.Count; i++)
                {
                    disciplines++;
                    using (MySqlConnection con = DBUtils.GetDBConnection())
                    {
                        con.Open();
                        Studyload.Studyloadid = GetStudyloadId(user, i, con);
                        MySqlCommand cmd = new MySqlCommand("GetUserId", con)
                        {
                            CommandType = CommandType.StoredProcedure
                        };
                        cmd.Parameters.AddWithValue("_username", Studyload.Newuser);
                        cmd.Parameters.AddWithValue("_role", 2);
                        using (MySqlDataReader r = cmd.ExecuteReader())
                        {
                            while (r.Read())
                            {
                                userid = int.Parse(r["ID"].ToString());
                            }
                        }
                        Reb_s_l = GetStudyloadId(Studyload.Newuser, i, con);
                        if (Reb_s_l == -1)
                        {
                            cmd = new MySqlCommand("RebuildStudyload", con)
                            {
                                CommandType = CommandType.StoredProcedure
                            };
                            cmd.Parameters.AddWithValue("_iduser", userid);
                            cmd.Parameters.AddWithValue("_Id_s_l", Studyload.Studyloadid);
                            int rows = cmd.ExecuteNonQuery();
                            if (rows >= 0)
                            {
                                if (Directory.Exists(targetdirectory + Studyload.Discipline[i] + user))
                                {
                                    Directory.Delete(targetdirectory + Studyload.Discipline[i] + user, true);
                                }
                                Studyload.Studyloadid = -1;
                            }
                            else
                            {
                                using (MySqlDataReader r = cmd.ExecuteReader())
                                {
                                    while (r.Read())
                                    {
                                        error = r["@full_error"].ToString();
                                    }
                                }
                                MyMessages.ErrorMessage(error);
                            }
                            Studyload.Studyloadid = GetStudyloadId(user, i, con);
                            if (Studyload.Studyloadid != -1)
                            {
                                MyMessages.WarningMessage("Ви перенаправили не всі дисципліни");
                            }
                        }
                    }
                }
                if (disciplines != -1)
                {
                    MessageBox.Show("Навчальні дисципліни було перенаправлено");
                }
                DataDeletion.RemoveUser(user, 2);
                Studyload.Discipline.Clear();
                //Close();
            }
            catch (Exception e1)
            {
                MyMessages.ErrorMessage(e1.Message);
            }
            Close();
        }
Example #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Declaracion de variables
            string[] dataLogin = null;
            string[] obj = HttpContext.Current.User.Identity.Name.Split('¬');
            int      typeRegister = 0, numberQuotes = 0, formPay = 0, idMemberDetails = 0;

            //string dataKit = null, dataKitMember = null, dataMemberSinKit;
            string token = null, userCurrent = null, newUserName = null, emailNewUser = null;
            int    amountPay = 0;
            //bool isRegister = false;
            BrUser brUser = null;
            //BrTypeMembership brTypeMembership = null;
            Email      oEmail     = null;
            BrPayments brPayments = null;
            //BrConsuption brConsuption;

            #endregion

            #region Entradas de valores

            //var _var = (string)Session["typeRegister"];
            //if (!string.IsNullOrEmpty(_var))
            //{
            //    typeRegister = int.Parse(Session["typeRegister"].ToString());
            //}
            formPay      = int.Parse("1");
            token        = Request["token"].ToString();
            numberQuotes = int.Parse(Request["numcuotes"].ToString());
            brUser       = new BrUser();
            //brTypeMembership = new BrTypeMembership();
            dataLogin  = HttpContext.Current.User.Identity.Name.Split('¬');
            oEmail     = new Email();
            brPayments = new BrPayments();
            //brConsuption = new BrConsuption();
            #endregion

            #region Realizar Pago Culqi

            if (formPay == 1)
            {
                amountPay = (int)Session["precio"];
                if (amountPay <= 0)
                {
                    Response.Write("false¬Ha Ocurrido Un Error id idMemberDetails vacio,amountPay vacio");
                    return;
                }
                PayCulqi   payCulqi   = new PayCulqi();
                MyMessages myMessages = new MyMessages();

                newUserName  = obj[3];
                emailNewUser = "******";

                string   currencyCode = "PEN";
                string[] culqiAnwser  = payCulqi.newPayment(newUserName, emailNewUser, amountPay, token, numberQuotes, currencyCode).Split('¬');
                if (culqiAnwser[0] == "false")
                {
                    Response.Write("false¬" + culqiAnwser[1]);
                    return;
                }
                //marcar como pagado en la tabla membershipdetails
                // bool habiliAccount = brUser.enableAcount(idMemberDetails);

                //int nAfiliate = int.Parse(brUser.GetNafiliate(idMemberDetails));

                //Cronograma2(nAfiliate);

                // enviar el email de confirmacion con la data y lo redirecciona al post register
                //if (!habiliAccount)
                //{
                //    Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.Sin embargo su Pago fue Exitoso");
                //    return;
                //}

                //string ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/");
                //enviar email con los documentos
                string nombreBenef = Session["servicio"].ToString().Split('|')[0];
                string vigencia    = Session["servicio"].ToString().Split('|')[1];
                string cantidad    = Session["servicio"].ToString().Split('|')[2];
                string fAdqui      = Session["servicio"].ToString().Split('|')[3];
                amountPay = int.Parse(Session["precio"].ToString());

                var  IdServicio     = Session["IdServicio"];
                bool awnserEmailDoc = oEmail.SubmitEmailNotFiles3(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.EmailPago(), true);
                var  reg            = nombreBenef + "|" + vigencia + "|" + CodigoReserva + "|" + cantidad + "|" + fAdqui + "|" + IdServicio + "|" + obj[3] + "|" + "2" + "|" + "culqui.png" + "|" + amountPay;
                bool qwe            = brUser.RegisterService(reg);

                //bool awnserEmail = oEmail.submitEmail(emailNewUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago());

                //ejecutamos el core para los puntos de equipo
                // BrCore_Automation brCore_Automation = new BrCore_Automation();
                //bool isCoreRegister = brCore_Automation.ExecuteCore();

                Response.Write("true¬" + culqiAnwser[1]);
                return;
            }

            #endregion
        }
Example #30
0
        /// <summary>
        /// Loads the grid.
        /// </summary>
        /// <param name="calledby">The called by.</param>
        public void LoadGrid(string calledby)
        {
            try
            {
                string[] data = _dataContext.Msgsummary;

                #region Called by Bottom

                if (calledby == "Bottom")
                {
                    int        index           = 0;
                    MyMessages selectedMessage = bottom.DGMyMessages.SelectedItem as MyMessages;
                    if (_dataContext.MyMessages.Count >= 0 && selectedMessage != null)
                    {
                        if (_dataContext.MyMessages.Any(p => p.Index == selectedMessage.Index && p.ISread == false))
                        {
                            index = _dataContext.MyMessages.IndexOf(_dataContext.MyMessages.Where(p => p.Index == selectedMessage.Index).FirstOrDefault());
                            _dataContext.MyMessages.RemoveAt(index);
                            _dataContext.MyMessages.Insert(index, new MyMessages(selectedMessage.Index, selectedMessage.MessageIconImageSource, selectedMessage.MessageType,
                                                                                 selectedMessage.MessageSender, selectedMessage.MessageSubject, selectedMessage.MessagePriority,
                                                                                 selectedMessage.MessageDate, selectedMessage.MessageAudience, selectedMessage.MessageBody, true));
                            _dataContext.UnreadMsgCount--;
                            _dataContext.UnreadMessageCount = (_dataContext.UnreadMsgCount) >= 9 ? "9" : (_dataContext.UnreadMsgCount).ToString();
                            _dataContext.MessageCountRange  = _dataContext.UnreadMsgCount <= 0 ? "-1" : (_dataContext.UnreadMsgCount <= 9 ? "0" : "1");
                        }
                    }
                    if (selectedMessage != null)
                    {
                        if (data.Length > 0)
                        {
                            if (data.Any(s => s.Contains("Subject")))
                            {
                                data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Subject")).FirstOrDefault()).i] = "Subject:$" + selectedMessage.MessageSubject.ToString();
                            }
                            if (data.Any(s => s.Contains("Sender")))
                            {
                                data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Sender")).FirstOrDefault()).i] = "Sender:$" + selectedMessage.MessageSender.ToString();
                            }
                            if (data.Any(s => s.Contains("Priority")))
                            {
                                data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Priority")).FirstOrDefault()).i] = "Priority:$" + selectedMessage.MessagePriority.ToString();
                            }
                            if (data.Any(s => s.Contains("Date")))
                            {
                                data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Date")).FirstOrDefault()).i] = "Date:$" + selectedMessage.MessageDate.ToString();
                            }
                            if (data.Any(s => s.Contains("Topic")))
                            {
                                data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Topic")).FirstOrDefault()).i] = "Audience:$" + selectedMessage.MessageAudience.ToString();
                            }
                        }
                        int item = 0;
                        foreach (string value in data)
                        {
                            string[] temp = value.Split('$');
                            if (temp.Count() == 2)
                            {
                                if (item == 0)
                                {
                                    _dataContext.Message11  = temp[0];
                                    _dataContext.Message111 = temp[1];
                                }
                                else if (item == 1)
                                {
                                    _dataContext.Message22  = temp[0];
                                    _dataContext.Message222 = temp[1];
                                }
                                else if (item == 2)
                                {
                                    _dataContext.Message33  = temp[0];
                                    _dataContext.Message333 = temp[1];
                                }
                                else if (item == 3)
                                {
                                    _dataContext.Message44  = temp[0];
                                    _dataContext.Message444 = temp[1];
                                }
                                else if (item == 4)
                                {
                                    _dataContext.Message55  = temp[0];
                                    _dataContext.Message555 = temp[1];
                                }
                            }
                            item++;
                        }
                        _dataContext.MessageBodyMsg = selectedMessage.MessageBody;
                        if (!string.IsNullOrEmpty(selectedMessage.MessageBody))
                        {
                            _dataContext.MsgRowHeight = GridLength.Auto;
                        }
                        else
                        {
                            _dataContext.MsgRowHeight = new GridLength(0);
                        }
                        _dataContext.MessageIconImageSource   = selectedMessage.MessageIconImageSource;
                        _dataContext.MessageType              = selectedMessage.MessageType;
                        _dataContext.BroadCastBackgroundBrush = (Brush)(new BrushConverter().ConvertFromString(_dataContext.BroadCastAttributes[selectedMessage.MessagePriority.ToString()]));
                        var color = (Color)ColorConverter.ConvertFromString(_dataContext.BroadCastAttributes[selectedMessage.MessagePriority.ToString()]);
                        //  var brush = new SolidColorBrush(color);
                        _dataContext.BroadCastForegroundBrush = color;
                        show();
                        if (_dataContext.OpenedMessage != index.ToString())
                        {
                            _dataContext.OpenedMessage = index.ToString();
                        }
                        else
                        {
                            this.Blink();
                        }
                    }
                }

                #endregion Called by Bottom

                #region Called by Notifier

                else if (calledby == "Notifier")
                {
                    if (data.Length > 0)
                    {
                        if (data.Any(s => s.Contains("Subject")))
                        {
                            data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Subject")).FirstOrDefault()).i] = "Subject:$" + _dataContext.MessageSubject.ToString();
                        }
                        if (data.Any(s => s.Contains("Sender")))
                        {
                            data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Sender")).FirstOrDefault()).i] = "Sender:$" + _dataContext.MessageSender.ToString();
                        }
                        if (data.Any(s => s.Contains("Priority")))
                        {
                            data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Priority")).FirstOrDefault()).i] = "Priority:$" + _dataContext.MessagePriority.ToString();
                        }
                        if (data.Any(s => s.Contains("Date")))
                        {
                            data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Date")).FirstOrDefault()).i] = "Date:$" + _dataContext.MessageDate.ToString();
                        }
                        if (data.Any(s => s.Contains("Topic")))
                        {
                            data[(data.Select((c, i) => new { c, i }).Where(x => x.c.StartsWith("Topic")).FirstOrDefault()).i] = "Audience:$" + _dataContext.MessageAudience.ToString();
                        }
                    }

                    int item1 = 0;
                    foreach (string value in data)
                    {
                        string[] temp = value.Split('$');
                        if (temp.Count() == 2)
                        {
                            if (item1 == 0)
                            {
                                _dataContext.Message11  = temp[0];
                                _dataContext.Message111 = temp[1];
                            }
                            else if (item1 == 1)
                            {
                                _dataContext.Message22  = temp[0];
                                _dataContext.Message222 = temp[1];
                            }
                            else if (item1 == 2)
                            {
                                _dataContext.Message33  = temp[0];
                                _dataContext.Message333 = temp[1];
                            }
                            else if (item1 == 3)
                            {
                                _dataContext.Message44  = temp[0];
                                _dataContext.Message444 = temp[1];
                            }
                            else if (item1 == 4)
                            {
                                _dataContext.Message55  = temp[0];
                                _dataContext.Message555 = temp[1];
                            }
                        }
                        item1++;
                    }
                    _dataContext.MessageBodyMsg = _dataContext.MessageBodyMsg;
                    if (!string.IsNullOrEmpty(_dataContext.MessageBodyMsg))
                    {
                        _dataContext.MsgRowHeight = GridLength.Auto;
                    }
                    else
                    {
                        _dataContext.MsgRowHeight = new GridLength(0);
                    }
                    _dataContext.MessageIconImageSource   = _dataContext.MessageIconImageSource;
                    _dataContext.MessageType              = _dataContext.MessageType;
                    _dataContext.BroadCastBackgroundBrush = (Brush)(new BrushConverter().ConvertFromString(_dataContext.BroadCastAttributes[_dataContext.MessagePriority.ToString()]));
                    var color = (Color)ColorConverter.ConvertFromString(_dataContext.BroadCastAttributes[_dataContext.MessagePriority.ToString()]);
                    // var brush = new SolidColorBrush(color);
                    _dataContext.BroadCastForegroundBrush = color;
                    //this.Title = _dataContext.MessageType + " - " + _dataContext.MessageSubject.ToString();
                    //this.Icon = _dataContext.MessageIconImageSource;
                    show();
                    if (_dataContext.OpenedMessage != _dataContext.OpenedNotifyMessage)
                    {
                        _dataContext.OpenedMessage = _dataContext.OpenedNotifyMessage;
                    }
                    else
                    {
                        this.Blink();
                    }
                }

                #endregion Called by Notifier
            }
            catch (Exception commonException)
            {
                _logger.Error("Error occurred while loading Grid : " + commonException.Message.ToString());
            }
        }