Ejemplo n.º 1
0
        public tbl_SMSReportShort ParseBakcell(tbl_SMSDetail detailItem, Int64 userID)
        {
            tbl_SMSReportShort smsRepotShort = null;

            try
            {
                string[] arrayList = detailItem.Message.Split(' ');
                if (arrayList.Length > 3)
                {
                    if (arrayList[1] == "balansa")
                    {
                        smsRepotShort             = new tbl_SMSReportShort();
                        smsRepotShort.UserID      = userID;
                        smsRepotShort.SMSModelID  = detailItem.SMSModelID;
                        smsRepotShort.SMSDetailID = detailItem.ID;
                        smsRepotShort.Month       = detailItem.RecievedDate.HasValue == true ? detailItem.RecievedDate.Value.Month : 0;
                        smsRepotShort.Year        = detailItem.RecievedDate.HasValue == true ? detailItem.RecievedDate.Value.Year : 0;
                        smsRepotShort.SenderName  = detailItem.SenderName;

                        string numberOnly = Regex.Replace(arrayList[0], "[^0-9.]", "");
                        smsRepotShort.IsExpense = 1;

                        smsRepotShort.Amount = decimal.Parse(numberOnly);

                        smsRepotShort.MerchantName = detailItem.SenderName;
                        smsRepotShort.Currency     = "AZN";
                        return(smsRepotShort);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
Ejemplo n.º 2
0
        public tbl_SMSReportShort ParseAzeriCard(tbl_SMSDetail detailItem, Int64 userID)
        {
            tbl_SMSReportShort smsRepotShort = null;

            try
            {
                string[] arrayList = detailItem.Message.Split('\n');
                if (arrayList[0].Substring(0, 7) == "Mebleg:")
                {
                    smsRepotShort             = new tbl_SMSReportShort();
                    smsRepotShort.UserID      = userID;
                    smsRepotShort.SMSModelID  = detailItem.SMSModelID;
                    smsRepotShort.SMSDetailID = detailItem.ID;
                    smsRepotShort.Month       = detailItem.RecievedDate.HasValue == true ? detailItem.RecievedDate.Value.Month : 0;
                    smsRepotShort.Year        = detailItem.RecievedDate.HasValue == true ? detailItem.RecievedDate.Value.Year : 0;
                    smsRepotShort.SenderName  = detailItem.SenderName;
                    string[] amountList = arrayList[0].Trim().Split(' ');
                    if (amountList[0].Substring(7, 1) == "-")
                    {
                        smsRepotShort.IsExpense = 1;
                    }
                    else
                    {
                        smsRepotShort.IsExpense = 0;
                    }
                    string amount = string.Empty;
                    if (amountList.Length > 2)
                    {
                        amount = amountList[0] + amountList[1];
                        smsRepotShort.Currency = amountList[2];
                    }
                    else
                    {
                        amount = amountList[0];
                        smsRepotShort.Currency = amountList[1];
                    }

                    string newamount = amount.Substring(8);
                    smsRepotShort.Amount = decimal.Parse(newamount);

                    try
                    {
                        if (arrayList[1].Contains("Kart"))
                        {
                            smsRepotShort.CardNumber = arrayList[1].Substring(5);
                        }
                        else
                        {
                            smsRepotShort.CardNumber = arrayList[1];
                        }

                        if (arrayList[2].Contains("Tarix"))
                        {
                            smsRepotShort.OperationDate = DateTime.Parse(arrayList[2].Substring(6));
                        }
                        else
                        {
                            smsRepotShort.OperationDate = DateTime.Parse(arrayList[2]);
                        }
                        if (arrayList[3].Contains("Emeliyyat"))
                        {
                            smsRepotShort.MerchantName = arrayList[3].Substring(9);
                        }
                        else
                        {
                            smsRepotShort.MerchantName = arrayList[3];
                        }

                        string[] balance = arrayList[4].Split(' ');
                        smsRepotShort.Balance         = decimal.Parse(balance[0].Substring(7));
                        smsRepotShort.BalanceCurrency = balance[1];
                    }
                    catch (Exception ex)
                    {
                    }



                    return(smsRepotShort);
                }
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
Ejemplo n.º 3
0
        public void AddSMSReportDetail(Int64 userID, string phoneNumer, tbl_SMSDetail detailItem, tbl_SMSSenderInfo smsSenderInfo)
        {
            CRUDOperation cRUDOperation = new CRUDOperation();
            int           _outMsjCountSame = 0, _outMsjCountOther = 0, _outMsjForeignCount = 0, _outMsjRoamingCount = 0;
            int           _inMsjCount = 0, _inMsjForeignCount = 0;

            tbl_OperatorInformation _OperatorInformation = new tbl_OperatorInformation();
            decimal pointValue = 0;
            decimal priceValue = 0;
            int     month = detailItem.RecievedDate.HasValue == true ? detailItem.RecievedDate.Value.Month : 0;
            int     year  = detailItem.RecievedDate.HasValue == true ? detailItem.RecievedDate.Value.Year : 0;

            try
            {
                if (detailItem.IsShortMessage == 0)
                {
                    if (detailItem.InOutType == 1)
                    {
                        if (detailItem.IsForeign == 0 || detailItem.IsForeign == null)
                        {
                            bool IsSame = NumberHelper.ControlSameOrOther(phoneNumer, detailItem.PhonePrefix);
                            if (IsSame)
                            {
                                _outMsjCountSame     = 1;
                                _OperatorInformation = cRUDOperation.GetOperatorInformationByPrefixAndType(NumberHelper.GetNumberPrefix(phoneNumer), (int)SMSOperatorInformation.OutSameCount, (int)OperatorChanelType.Message);
                                if (_OperatorInformation != null)
                                {
                                    pointValue = 1 * _OperatorInformation.Point == null ? 0 : (decimal)_OperatorInformation.Point;
                                    priceValue = 1 * _OperatorInformation.Price == null ? 0 : (decimal)_OperatorInformation.Price;
                                    AddUserPointAndPrice(userID, month, year, pointValue, priceValue, (int)ChanelType.SMS);
                                }
                            }
                            else
                            {
                                _outMsjCountOther    = 1;
                                _OperatorInformation = cRUDOperation.GetOperatorInformationByPrefixAndType(NumberHelper.GetNumberPrefix(phoneNumer), (int)SMSOperatorInformation.OutOtherCount, (int)OperatorChanelType.Message);
                                if (_OperatorInformation != null)
                                {
                                    pointValue = 1 * _OperatorInformation.Point == null ? 0 : (decimal)_OperatorInformation.Point;
                                    priceValue = 1 * _OperatorInformation.Price == null ? 0 : (decimal)_OperatorInformation.Price;
                                    AddUserPointAndPrice(userID, month, year, pointValue, priceValue, (int)ChanelType.SMS);
                                }
                            }
                        }
                        else if (detailItem.IsForeign == 1)
                        {
                            _outMsjForeignCount  = 1;
                            _OperatorInformation = cRUDOperation.GetOperatorInformationByPrefixAndType(NumberHelper.GetNumberPrefix(phoneNumer), (int)SMSOperatorInformation.OutSameCount, (int)OperatorChanelType.Message);
                            if (_OperatorInformation != null)
                            {
                                pointValue = 1 * _OperatorInformation.Point == null ? 0 : (decimal)_OperatorInformation.Point;
                                priceValue = 1 * _OperatorInformation.Price == null ? 0 : (decimal)_OperatorInformation.Price;
                                AddUserPointAndPrice(userID, month, year, pointValue, priceValue, (int)ChanelType.SMS);
                            }
                        }
                    }
                    else
                    {
                        if (detailItem.IsForeign == 0 || detailItem.IsForeign == null)
                        {
                            _inMsjCount          = 1;
                            _OperatorInformation = cRUDOperation.GetOperatorInformationByPrefixAndType(NumberHelper.GetNumberPrefix(phoneNumer), (int)SMSOperatorInformation.INCount, (int)OperatorChanelType.Message);
                            if (_OperatorInformation != null)
                            {
                                pointValue = 1 * _OperatorInformation.Point == null ? 0 : (decimal)_OperatorInformation.Point;
                                priceValue = 1 * _OperatorInformation.Price == null ? 0 : (decimal)_OperatorInformation.Price;
                                AddUserPointAndPrice(userID, month, year, pointValue, priceValue, (int)ChanelType.SMS);
                            }
                        }
                        else if (detailItem.IsForeign == 1)
                        {
                            _inMsjForeignCount   = 1;
                            _OperatorInformation = cRUDOperation.GetOperatorInformationByPrefixAndType(NumberHelper.GetNumberPrefix(phoneNumer), (int)SMSOperatorInformation.INCount, (int)OperatorChanelType.Message);
                            if (_OperatorInformation != null)
                            {
                                pointValue = 1 * _OperatorInformation.Point == null ? 0 : (decimal)_OperatorInformation.Point;
                                priceValue = 1 * _OperatorInformation.Price == null ? 0 : (decimal)_OperatorInformation.Price;
                                AddUserPointAndPrice(userID, month, year, pointValue, priceValue, (int)ChanelType.SMS);
                            }
                        }
                    }

                    tbl_SMSReport smsReport = new tbl_SMSReport()
                    {
                        SMSModelID         = detailItem.SMSModelID,
                        SMSDetailID        = detailItem.ID,
                        UserID             = userID,
                        Month              = detailItem.RecievedDate.HasValue == true ? detailItem.RecievedDate.Value.Month : 0,
                        Year               = detailItem.RecievedDate.HasValue == true ? detailItem.RecievedDate.Value.Year : 0,
                        OutMsjCountSame    = _outMsjCountSame,
                        OutMsjCountOther   = _outMsjCountOther,
                        OutMsjForeignCount = _outMsjForeignCount,
                        InMsjCount         = _inMsjCount,
                        InMsjForeignCount  = _inMsjForeignCount,
                    };

                    cRUDOperation.AddSMSReport(smsReport);
                }
                else if (detailItem.IsShortMessage == 1)
                {
                    if (smsSenderInfo != null)
                    {
                        pointValue = 1 * (smsSenderInfo.Point == null ? 0 : (decimal)smsSenderInfo.Point);
                        priceValue = 1 * (smsSenderInfo.Price == null ? 0 : (decimal)smsSenderInfo.Price);
                        AddUserPointAndPrice(userID, month, year, pointValue, priceValue, (int)ChanelType.SMS);
                    }

                    if (detailItem.IsParse == 1)
                    {
                        if (detailItem.SenderName == "Azericard")
                        {
                            tbl_SMSReportShort smsRepotShort = ParseAzeriCard(detailItem, userID);
                            //Mebleg:-30.00 AZN
                            if (smsRepotShort != null)
                            {
                                cRUDOperation.AddSMSReportShort(smsRepotShort);
                                decimal priceAzeriCardValue = 0;
                                priceAzeriCardValue = smsRepotShort.Amount;
                                if (smsRepotShort.IsExpense == 1)
                                {
                                    if (smsRepotShort.Currency == "AZN")
                                    {
                                        AddUserPointAndPrice(userID, month, year, 0, priceAzeriCardValue, (int)ChanelType.AzeriCard);
                                        AddUserExpenseAbility(userID, "Azericard", "Xərc", month, year, priceAzeriCardValue, (int)ChanelType.AzeriCard);
                                    }
                                }
                                else
                                {
                                    AddUserIncomeAbility(userID, true, "Azericard", "Gəlir", month, year, priceAzeriCardValue, (int)ChanelType.AzeriCard);
                                }
                            }
                        }
                        if (detailItem.SenderName.ToLower() == "bakcell")
                        {
                            tbl_SMSReportShort smsRepotShort = ParseBakcell(detailItem, userID);
                            //Mebleg:-30.00 AZN
                            if (smsRepotShort != null)
                            {
                                cRUDOperation.AddSMSReportShort(smsRepotShort);
                                if (smsRepotShort.IsExpense == 1)
                                {
                                    AddUserPointAndPrice(userID, month, year, 0, smsRepotShort.Amount, (int)ChanelType.Bakcell);
                                    AddUserExpenseAbility(userID, "Bakcell", "Kontur", month, year, smsRepotShort.Amount, (int)ChanelType.Bakcell);
                                    AddUserIncomeAbility(userID, false, "Bakcell", "Kontur", month, year, smsRepotShort.Amount, (int)ChanelType.Bakcell);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }