Пример #1
0
        //binding a readonly field to the associated property of the datasource
        protected void lbl_DataBinding(object sender, EventArgs e)
        {
            Label lbl = (Label)sender;

            if (column.IsStatic)
            {
                lbl.Text = column.Text;
            }
            else
            {
                object oValue = dataSource.GetType().GetProperty(column.Text).GetValue(dataSource, null);
                if (NullFinder.IsNull(oValue, column.DataType) || (oValue == null))
                {
                    lbl.Text = string.Empty;
                }
                else
                {
                    if (column.IsLookup)
                    {
                        lbl.Text = lookup.GetLookup(column.Lookup)[oValue];
                    }
                    else
                    {
                        if ((column.Format != null) && (column.Format != string.Empty))
                        {
                            lbl.Text = string.Format("{0:" + column.Format + "}", oValue);
                        }
                        else
                        {
                            lbl.Text = oValue.ToString();
                        }
                    }
                }
            }
        }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         GINDataEditor.DataSource = GINInformation;
         GINInfo ginInfo = (GINInfo)GINDataEditor.DataSource;
         if (NullFinder.IsNull(ginInfo.DateApproved, "System.DateTime"))
         {
             ginInfo.DateApproved = DateTime.Now;
         }
         GINDataEditor.DataBind();
     }
 }
Пример #3
0
        protected void txtTm_DataBinding(object sender, EventArgs e)
        {
            object  oValue = dataSource.GetType().GetProperty(column.Text).GetValue(dataSource, null);
            TextBox txt    = (TextBox)sender;

            if (NullFinder.IsNull(oValue, column.DataType))
            {
                txt.Text = string.Empty;
            }
            else
            {
                txt.Text = ((DateTime)oValue).ToShortTimeString();
            }
        }
Пример #4
0
        protected void txtDt_DataBinding(object sender, EventArgs e)
        {
            object  oValue = dataSource.GetType().GetProperty(column.Text).GetValue(dataSource, null);
            TextBox txt    = (TextBox)sender;

            if (NullFinder.IsNull(oValue, column.DataType))
            {
                txt.Text = string.Empty;
            }
            else
            {
                txt.Text = string.Format("{0:MM-dd-yyyy}", (DateTime)oValue);
            }
        }
Пример #5
0
        //mapping the associated property of the datasource to its text in the dropdown list
        protected void ddl_DataBinding(object sender, EventArgs e)
        {
            object dataValue = dataSource.GetType().GetProperty(column.Text).GetValue(dataSource, null);

            if (!NullFinder.IsNull(dataValue, column.DataType))
            {
                try
                {
                    ((DropDownList)sender).SelectedValue = dataValue.ToString();
                }
                catch
                {
                }
            }
        }
Пример #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             GINDataEditor.DataSource = new LeavingTruck(GINTruckInformation);
             LeavingTruck lt = (LeavingTruck)GINDataEditor.DataSource;
             if (NullFinder.IsNull(lt.TruckCheckedOutOn, "System.DateTime"))
             {
                 lt.TruckCheckedOutOn = DateTime.Now;
             }
             GINDataEditor.DataBind();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
Пример #7
0
        //binding an editable field to the associated property of the datasource
        protected void txt_DataBinding(object sender, EventArgs e)
        {
            object  oValue = dataSource.GetType().GetProperty(column.Text).GetValue(dataSource, null);
            TextBox txt    = (TextBox)sender;

            if (NullFinder.IsNull(oValue, column.DataType) || (oValue == null))
            {
                txt.Text = string.Empty;
            }
            else
            {
                if ((column.Format != null) && (column.Format != string.Empty))
                {
                    txt.Text = string.Format("{0:" + column.Format + "}", oValue);
                }
                else
                {
                    txt.Text = oValue.ToString();
                }
            }
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ReturnedBagsGridViewer.DataSource =
                from returnedBags in GINTruckInformation.Weight.ReturnedBags
                select new ReturnedBagsWrapper(returnedBags, ginProcess.GINProcessInformation.CommodityGradeId, ginProcess.GINProcessInformation.ProductionYear);

            ReturnedBagsGridViewer.DataBind();

            AddedBagsGridViewer.DataSource =
                from addedBags in GINTruckInformation.Weight.AddedBags
                select new ReturnedBagsWrapper(addedBags, ginProcess.GINProcessInformation.CommodityGradeId, ginProcess.GINProcessInformation.ProductionYear);

            AddedBagsGridViewer.DataBind();

            var gridCommands = from command in ReturnedBagsGridViewer.Driver.Columns
                               where command.IsCommand
                               select command.AttachedRenderer;

            foreach (LinkGINColumnRenderer linkCommand in gridCommands)
            {
                linkCommand.Command += new CommandEventHandler(linkCommand_Command);
            }

            var addedGridCommands = from command in AddedBagsGridViewer.Driver.Columns
                                    where command.IsCommand
                                    select command.AttachedRenderer;

            foreach (LinkGINColumnRenderer linkCommand in addedGridCommands)
            {
                linkCommand.Command += new CommandEventHandler(linkCommand_Command);
            }

            if (!IsPostBack)
            {
                try
                {
                    GINDataEditor.DataSource = ginProcess.GetGINReport(GINTruckInformation.TruckId);
                    GINDataEditor.DataBind();
                    TruckWeightEditor.DataSource = GINTruckInformation.Weight;
                    TruckWeightEditor.DataBind();
                    GINIssuanceEditor.DataSource = GINTruckInformation.GIN;
                    GINInfo ginInfo = (GINInfo)GINIssuanceEditor.DataSource;
                    if (NullFinder.IsNull(ginInfo.DateIssued, "System.DateTime"))
                    {
                        ginInfo.DateIssued = DateTime.Now;
                    }
                    GINIssuanceEditor.DataBind();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            TruckWeightInfo newWeight   = (TruckWeightInfo)TruckWeightEditor.DataSource;
            decimal         truckWeight = GINTruckInformation.Weight.TruckWeight;
            decimal         grossWeight = GINTruckInformation.Weight.GrossWeight;

            GINTruckInformation.Weight.TruckWeight = newWeight.TruckWeight;
            GINTruckInformation.Weight.GrossWeight = newWeight.GrossWeight;
            lblNetWeight.Text = ginProcess.CalculateNetWeight(newWeight.TruckId).ToString();
            GINTruckInformation.Weight.TruckWeight = truckWeight;
            GINTruckInformation.Weight.GrossWeight = grossWeight;
        }