예제 #1
0
 protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         Model.Customer customer = (Model.Customer)e.Row.DataItem;
         if (customer != null)
         {
             if (customer.Address != null)
             {
                 Label lbAddress = (Label)e.Row.FindControl("lblAddress");
                 if (lbAddress != null)
                 {
                     string strAddress = new AddressRepo().GetToString(customer.Address);
                     lbAddress.Text = new AddressRepo().ShortString(strAddress);
                     lbAddress.ToolTip = strAddress;
                 }
             }
         }
     }
 }
예제 #2
0
 protected void gvUsers_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     Model.User user = (Model.User)e.Row.DataItem;
     if (user != null)
     {
         if (user.Address != null)
         {
             Label lbAddress = (Label)e.Row.FindControl("lblAddress");
             if (lbAddress != null)
             {
                 string strAddress = new AddressRepo().GetToString(user.Address);
                 lbAddress.Text = new AddressRepo().ShortString(strAddress);
                 lbAddress.ToolTip = strAddress;
             }
         }
     }
 }
예제 #3
0
 protected void gvOrders_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     Order order = (Order)e.Row.DataItem;
     if (order != null)
     {
         OrderStatu orderStatus = new OrderStatusRepo().GetById(ToSQL.SQLToInt(order.OrderStatus_ID));
         if (orderStatus != null)
         {
             e.Row.Cells[2].Text = orderStatus.Name;//order stat
         }
         Customer customer = new CustomerRepo().GetById(ToSQL.SQLToInt(order.Customer_ID));
         if (customer != null)
         {
             e.Row.Cells[3].Text = customer.FirstName;//customer nam
         }
         Model.Payment payment = new PaymentRepo().GetById(ToSQL.SQLToInt(order.Payment_ID));
         if (payment != null)
         {
             e.Row.Cells[4].Text = payment.Name;//payment method
         }
         ShippingAddress shippingAddress = new ShippingAddressRepo().GetById(ToSQL.SQLToInt(order.ShippingAddress_ID));
         if (shippingAddress != null)
         {
             e.Row.Cells[5].Text = shippingAddress.Name;//Recipient's Name
             e.Row.Cells[6].Text = shippingAddress.Phone;
             string strAddress = new AddressRepo().GetToString(shippingAddress.Address);
             e.Row.Cells[7].Text = new AddressRepo().ShortString(strAddress);
             e.Row.Cells[7].ToolTip = strAddress;
         }
     }
 }