예제 #1
0
        private void dgvItemsList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            try
            {
                if (e.Value != null)
                {
                    // Weight column
                    if (e.ColumnIndex == 1)
                    {
                        e.Value             = string.Format("{0:N3} kg", e.Value.ToString());
                        e.FormattingApplied = true;
                    }

                    // Value column or Total totalCost column
                    if (e.ColumnIndex == 4 || e.ColumnIndex == 5)
                    {
                        e.Value             = CurrencyUtil.ToStringWithCurrencySign((decimal)e.Value);
                        e.FormattingApplied = true;
                    }
                }
            }
            catch (Exception ex)
            {
                AppLogger.logError(this.ToString(), ex);
            }
        }
 private void dgvOrdersList_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     int count = 0;
     decimal totalPayment = 0;
     try
     {
         if (e.ColumnIndex == 0 && e.RowIndex != -1)
         {
             _checkedRows.Clear();
             // Loops through every row and calculates the sum of checked rows
             foreach (DataGridViewRow row in dgvOrdersList.Rows)
             {
                 if (row.Cells[0].Value != null && (bool)row.Cells[0].Value == true)
                 {
                     count++;
                     decimal cost;
                     if (decimal.TryParse(row.Cells["TotalCostColumn"].Value.ToString(), out cost))
                     {
                         _checkedRows.Add(row);
                         totalPayment += cost;
                     }
                 }
             }
             //_chkOrdersListHeaderSelectAll.Checked = _orders.Count.Equals(count);
         }
     }
     catch (Exception ex)
     {
         AppLogger.logError(this.ToString(), ex);
     }
     tbOrdersCount.Text = count.ToString();
     tbTotalPayment.Text = CurrencyUtil.ToStringWithCurrencySign(totalPayment);
 }
        private void dgvListDetails_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value != null)
            {
                // Weight column
                if (e.ColumnIndex == 2 || e.ColumnIndex == 3)
                {
                    if (double.Parse(e.Value.ToString()).Equals(Constants.MAX_WEIGHT_VALUE))
                    {
                        e.Value = "MAX";
                    }
                    else
                    {
                        e.Value = string.Format("{0:N3} kg", e.Value.ToString());
                    }
                    e.FormattingApplied = true;
                }

                // Value column or Total totalCost column
                if (e.ColumnIndex == 4)
                {
                    e.Value             = CurrencyUtil.ToStringWithCurrencySign((decimal)e.Value);
                    e.FormattingApplied = true;
                }
            }
        }
예제 #4
0
 private void dgvClosedOrders_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (e.Value != null)
     {
         // Value column or Total totalCost column
         if (e.ColumnIndex == 2)
         {
             e.Value             = CurrencyUtil.ToStringWithCurrencySign((decimal)e.Value);
             e.FormattingApplied = true;
         }
     }
 }
예제 #5
0
        private void dgvItemsList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value != null)
            {
                // Weight column
                if (e.ColumnIndex == 1)
                {
                    e.Value             = string.Format("{0:N3} kg", e.Value.ToString());
                    e.FormattingApplied = true;
                }

                // Value column or Total cost column
                if (e.ColumnIndex == 4 || e.ColumnIndex == 5)
                {
                    e.Value             = CurrencyUtil.ToStringWithCurrencySign((decimal)e.Value);
                    e.FormattingApplied = true;
                }
            }
        }
예제 #6
0
        private void dgvOpenOrders_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value != null)
            {
                // TotalCostColumn
                if (e.ColumnIndex == 2)
                {
                    e.Value             = CurrencyUtil.ToStringWithCurrencySign((decimal)e.Value);
                    e.FormattingApplied = true;
                }

                // DeliveryStatusColumn
                if (e.ColumnIndex == 4)
                {
                    e.Value             = EnumHelper.Parse <Constants.DeliveryStatus>(e.Value.ToString()).GetDescription();
                    e.FormattingApplied = true;
                }
            }
        }
 private void dgvItemsList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (e.Value != null)
     {
         // Value column or Total totalCost column
         if (e.ColumnIndex == 1 || e.ColumnIndex == 2 || e.ColumnIndex == 3)
         {
             if (decimal.Parse(e.Value.ToString()).Equals(Constants.MAX_MONEY_VALUE))
             {
                 e.Value             = "MAX";
                 e.FormattingApplied = true;
             }
             else
             {
                 e.Value             = CurrencyUtil.ToStringWithCurrencySign((decimal)e.Value);
                 e.FormattingApplied = true;
             }
         }
     }
 }
        private void dgvOrdersList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            // CreatedDateColumn
            if (e.ColumnIndex == 2)
            {
                e.Value = ((DateTime)e.Value).ToString("dd/MM/yyyy hh:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
            }

            // DeliveryStatusColumn
            if (e.ColumnIndex == 4)
            {
                e.Value = EnumHelper.GetDescription((Constants.DeliveryStatus)(System.Enum.Parse(typeof(Constants.DeliveryStatus), e.Value.ToString())));
            }

            // TotalCostColumn
            if (e.ColumnIndex == 5)
            {
                e.Value = CurrencyUtil.ToStringWithCurrencySign((decimal)e.Value);
                e.FormattingApplied = true;
            }
        }
        public override string Update(GuaranteeFeeConfiguration configuration)
        {
            string result = string.Empty;

            //AppLogger.logInfo(this.ToString(), string.Format("Begin updating guarantee fee configuration [{0}].", configuration.id));
            try
            {
                var duplicatedConfiguration = Repository.EntitiesSet.FirstOrDefault(config => !configuration.id.Equals(config.id) &&
                                                                                    ((config.value_from <= configuration.value_from && configuration.value_from < config.value_to) ||
                                                                                     (configuration.value_from <= config.value_from && config.value_from < configuration.value_to)));
                if (duplicatedConfiguration == null)
                {
                    base.Update(configuration);
                    //AppLogger.logInfo(this.ToString(), "Updated guarantee fee configuration successfully.");
                }
                else
                {
                    string valueTo = configuration.value_to == Constants.MAX_MONEY_VALUE ? "MAX" : CurrencyUtil.ToStringWithCurrencySign(configuration.value_to);
                    result = string.Format("Phạm vi giá trị từ '{0}' đến '{1}' không hợp lệ. Có thể đã bị trùng với thiết lập khác. Vui lòng thử lại.", CurrencyUtil.ToStringWithCurrencySign(configuration.value_from), valueTo);
                    AppLogger.logInfo(this.ToString(), "Invalid value range. Possibly conflicted with another configuration(s).");
                }
            }
            catch (Exception ex)
            {
                AppLogger.logError(this.ToString(), ex);
                result = Constants.Messages.ERROR_OPERATION_NOT_PERFORMED;
            }
            //AppLogger.logInfo(this.ToString(), "Finish updating guarantee fee configuration.");
            return(result);
        }