Exemple #1
0
        protected void gvTariffs_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            var code = gvTariffs.Rows[e.RowIndex].Cells[1].Controls[1] as TextBox;
            var name = gvTariffs.Rows[e.RowIndex].Cells[2].Controls[1] as TextBox;
            var hasflagfall = gvTariffs.Rows[e.RowIndex].Cells[3].Controls[1] as CheckBox;
            var infreecall = gvTariffs.Rows[e.RowIndex].Cells[4].Controls[1] as CheckBox;

            // (Changed rag 15/02/2009) #001-10
            //Label networkid = gvTariffs.Rows[e.RowIndex].Cells[4].Controls[1] as Label;
            var networkTariffId = (int)gvTariffs.DataKeys[e.RowIndex].Value;

            var entity = new NetworkTariff(networkTariffId)
                                {
                                    Code = code.Text,
                                    Name = name.Text,
                                    IsCountedInFreeCall = infreecall.Checked,
                                    HasFlagfall = hasflagfall.Checked,
                                    NetworkId = NetworkId
                                };

            var request = new UpdateNetworkTariffRequest()
            {
                Tariff = entity,
                User = Users.Current
            };

            var response = NetworkService.UpdateNetworkTariff(request);
            if (response.IsSuccessful)
            {
                gvTariffs.EditIndex = -1;
                BindTariffs(NetworkId);
                UserMessage.SetSuccess("Tariff updated.");
            }
            else
            {
                UserMessage.SetFailure(response.Message);
            }
        }
Exemple #2
0
        private void InsertNetworkTariff(string code, string tariff, bool freeCall, bool hasFlagfall, int networkId)
        {
            var newTariff = new NetworkTariff
            {
                Code = code,
                Name = tariff,
                IsCountedInFreeCall = freeCall,
                HasFlagfall = hasFlagfall,
                NetworkId = networkId
            };

            var request = new InsertNetworkTariffRequest
            {
                Tariff = newTariff,
                User = Users.Current
            };

            var response = NetworkService.InsertNetworkTariff(request);
            if (!response.IsSuccessful)
            {
                UserMessage.SetFailure(response.Message);
            }
            else {
                UserMessage.SetSuccess("Tariff added.");
            }

            BindTariffs(networkId);
        }
        private AirtimeBilling.Core.Entities.NetworkTariff PopulateEntityFromNetworkTariff(NetworkTariff tariff)
        {
            AirtimeBilling.Core.Entities.NetworkTariff entity = null;
            if (tariff != null)
            {
                entity = new AirtimeBilling.Core.Entities.NetworkTariff(tariff.NetworkTariffId)
                {
                    Code = tariff.Code,
                    Name = tariff.Tariff,
                    IsCountedInFreeCall = tariff.IsCountedInFreeCall,
                    NetworkId = tariff.NetworkId,
                    HasFlagfall = tariff.HasFlagfall
                };
            }

            return entity;
        }