コード例 #1
0
    /// <summary>
    /// Get the images for a cell
    /// </summary>
    /// <param name="cell">The given cell</param>
    private void SetItemImageValues(GridTableCell cell)
    {
        Image imgControl = cell.Controls[1] as Image;

        if (!String.IsNullOrEmpty(imgControl.DescriptionUrl))
        {
            //Get the cell value from the DescriptionUrl property
            bool cellValue = (imgControl.DescriptionUrl == "0") ? false : true;
            //Get the image path
            string imgUrl = "~/Images/";
            if (cellValue)
            {
                imgUrl += "PastilleGreen.gif";
            }
            else
            {
                imgUrl += "PastilleRed.gif";
            }

            if (imgControl == null)
            {
                return;
            }
            //Set the image
            imgControl.ImageUrl = imgUrl;
        }
    }
コード例 #2
0
    /// <summary>
    /// When edit button is clicked, the RadComboBoc of the selected row is intitalised.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        // Bind AutoComplete values for Manager Column
        if (e.Item is GridEditableItem)
        {
            GridDataItem  gdi = e.Item as GridDataItem;
            GridTableCell gdc = gdi["ManagerNameUnique"] as GridTableCell;

            RadComboBox ManagerCB = (RadComboBox)gdc.FindControl("ManagerRadComboBox");
            if (ManagerCB != null)
            {
                ManagerCB.DataSource = (from r in (Session["data"] as EmployeeDataContract).Employees
                                        select r.Name).ToList <string>();
                ManagerCB.DataBind();

                // Initialize the ComboBox with the already selected text.
                if (Session["ManagerInLabel"] != null)
                {
                    ManagerCB.SelectedIndex = (from i in ManagerCB.Items
                                               where i.Text == Session["ManagerInLabel"].ToString()
                                               select i.Index).First <int>();
                }
                Session["ManagerInLabel"] = null;
            }
        }
    }
コード例 #3
0
    private void SetItemRemoveLastUpload(GridTableCell cell, int year, int lastUploadedMonth, string lastUpoadedMonthS, int idImport)
    {
        if (lastUploadedMonth == 0)
        {
            return;
        }
        LinkButton linkControl = cell.Controls[1] as LinkButton;

        if (linkControl != null)
        {
            linkControl.Text            = string.Format("Remove last upload ({0} {1})", lastUpoadedMonthS, year);
            linkControl.CommandArgument = string.Format("{0},{1},{2}", lastUploadedMonth, year, idImport);
        }
    }
コード例 #4
0
    private void SetViewDetailColumn()
    {
        //Change the value in the EditColumn for all items
        foreach (GridEditableItem item in grdLogs.Items)
        {
            //Get the cell that contains the Editcolumn
            GridTableCell cell = item["EditColumn"] as GridTableCell;
            if (cell == null)
            {
                return;
            }
            //Clear the cell controls
            cell.Controls.Clear();

            //Get the import id from the IdImport column
            int    idImport   = int.Parse(item["IdImport"].Text);
            string validation = item["Validation"].Text;

            //Construct a new link
            LinkButton lnkDetail = new LinkButton();
            lnkDetail.Text = "See Detail";
            //Disable the link if the import was succesfull or the current user does not have the necessary rights
            CurrentUser currentUser = (CurrentUser)SessionManager.GetSessionValueRedirect((IndBasePage)this.Page, SessionStrings.CURRENT_USER);
            if ((validation.ToUpper() == "G") &&
                (currentUser.UserRole.Id != ApplicationConstants.ROLE_BUSINESS_ADMINISTATOR) &&
                (currentUser.UserRole.Id != ApplicationConstants.ROLE_TECHNICAL_ADMINISTATOR))
            {
                lnkDetail.Enabled            = false;
                item["DeleteColumn"].Enabled = false;
            }
            else
            {
                bool doReload = true;
                if (validation.ToUpper() == "R")
                {
                    doReload = false;
                }

                //Assingn link properties
                lnkDetail.OnClientClick = "ShowPopUpWithReload('" + ResolveUrl("~/Pages/AnnualBudget/AnnualDataLogsDetail.aspx?IdImport=" + idImport.ToString()) + "&Validation=" + validation + "',0,1024, '" + ResolveUrl("~/Pages/AnnualBudget/AnnualUpload.aspx") + "','" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "','" + doReload.ToString() + "','" + this.Page.Form.ClientID + "');return false;";
            }

            //Add the link object in the cell
            cell.Controls.Add(lnkDetail);
        }
    }
コード例 #5
0
    private void SetViewDetailColumn()
    {
        //Change the value in the EditColumn for all items
        foreach (GridEditableItem item in grdLogs.Items)
        {
            //Get the cell that contains the Editcolumn
            GridTableCell cell = item["EditColumn"] as GridTableCell;
            if (cell == null)
            {
                return;
            }
            //Clear the cell controls
            cell.Controls.Clear();

            //Get the import id from the IdImport column
            int    idImport   = int.Parse(item["IdImport"].Text);
            string validation = item["Validation"].Text;

            //Construct a new link
            LinkButton lnkDetail = new LinkButton();
            lnkDetail.Text = "See Detail";

            //Disable the link if the import was succesfull
            if (validation.ToUpper() == "G")
            {
                lnkDetail.Enabled            = false;
                item["DeleteColumn"].Enabled = false;
            }
            else
            {
                //if the error is yellow (missing data) - it will generate a reload of the parent page because
                //data might have been changed. Reload does not execute on red traffic light
                bool doReload = true;
                if (validation.ToUpper() == "R")
                {
                    doReload = false;
                }

                //Assingn link properties.
                lnkDetail.OnClientClick = "ShowPopUpWithReload('" + ResolveUrl("~/Pages/Upload/DataLogsDetail.aspx?IdImport=" + idImport.ToString()) + "&Validation=" + validation + "',0,1024, '" + ResolveUrl("~/Upload.aspx") + "','" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "','" + doReload.ToString() + "','" + this.Page.Form.ClientID + "');return false;";
            }

            //Add the link object in the cell
            cell.Controls.Add(lnkDetail);
        }
    }
コード例 #6
0
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem gdi = (GridDataItem)e.Item;
            try
            {
                if (gdi["ActionColumn"] != null)
                {
                    GridTableCell cell = (GridTableCell)gdi["ActionColumn"];
                    HyperLink     link = (HyperLink)cell.FindControl("Link2");

                    link.Attributes.Add("href", "PopUps/RadWindowContent2.aspx?" +
                                        "ename=" + gdi["enameUnique"].Text.Trim() + "&" +
                                        "job=" + gdi["Job"].Text.Trim() + "&" +
                                        "salary=" + gdi["SalaryUnique"].Text.Trim() + "&" +
                                        "manager=" + gdi["ManagerName"].Text.Trim());
                }
                if (gdi["empnoUnique"] != null)
                {
                    GridTableCell cell = (GridTableCell)gdi["empnoUnique"];
                    HyperLink     link = (HyperLink)cell.FindControl("Link");

                    link.Attributes.Add("href", "PopUps/RadWindowContent.aspx?" +
                                        "ename=" + gdi["enameUnique"].Text.Trim() + "&" +
                                        "job=" + gdi["Job"].Text.Trim() + "&" +
                                        "salary=" + gdi["SalaryUnique"].Text.Trim() + "&" +
                                        "manager=" + gdi["ManagerName"].Text.Trim());
                }
                else if (double.Parse(gdi["SalaryUnique"]
                                      .Text.Replace(",", "").ToString()) <= 25000)
                {
                    gdi["SalaryUnique"].BackColor = Color.Yellow;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    }
コード例 #7
0
        protected void grdMain_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem gr = (GridDataItem)e.Item;
                DataRowView  dr = (DataRowView)gr.DataItem;


                GridTableCell Linkcell = (GridTableCell)gr["Location_name"];
                Label         link     = (Label)Linkcell.FindControl("locationName");
                GridTableCell gpCell   = (GridTableCell)gr["checkInUser"];
                RadGrid       gpc      = (RadGrid)gpCell.FindControl("grdCurrCheckIn1");

                //GridTableCell gpInnerCell = (GridTableCell)gpc.Columns[0];
                //HyperLink Status = (HyperLink)gpInnerCell.FindControl("lblGuardCIStatus");
                //grdCurrCheckIn_ItemDataBound(object sender, GridItemEventArgs e)

                BindSchedule(gpc, dr, "GetCheckedInGuardsNew", false, true, false);
                //RadGrid gv = ((RadGrid)gr.Cells[1].FindControl("grdCurrCheckOuts"));
                GridTableCell gvCell = (GridTableCell)gr["checkOutUser"];
                RadGrid       gv     = (RadGrid)gpCell.FindControl("grdCurrCheckOuts1");

                BindSchedule(gv, dr, "GetCheckedOutGuardsNew", true, true, true);
                GridTableCell gpCellShift = (GridTableCell)gr["CurrentShift"];
                RadGrid       gpcShift    = (RadGrid)gpCellShift.FindControl("grdCurrentShift1");

                //string shiftCurrId=BindScheduleShift(gpcShift, dr, "CurrentShiftID", false, true, false);
                //BindScheduleShift1(gpcShift, dr, "CurrentShiftID", false, true, false);
                BindScheduleShift(gpcShift, dr, "CurrentShiftTest", false, true, false);
                //BindCurrShiftData(gpcShift,shiftCurrId,"CurrShiftData",false, true, false);

                GridTableCell gvCellShift = (GridTableCell)gr["NextShift"];
                RadGrid       gvShift     = (RadGrid)gvCellShift.FindControl("grdNextShift1");

                //string shiftNextId=BindScheduleShift(gvShift, dr, "NextShiftID", false, true, false);
                BindScheduleShift(gvShift, dr, "NextShift", false, true, false);
                //BindNextShiftData(gvShift,shiftNextId,"NextShiftData", false, true, false);
            }
        }
コード例 #8
0
    /// <summary>
    /// Get the images for a cell
    /// </summary>
    /// <param name="cell">The given cell</param>
    private void SetItemImageValues(GridTableCell cell, int currentMonth, ref int lastUploadedMonth, ref string lastUploadedMonthS)
    {
        Image imgControl = cell.Controls[1] as Image;

        if (!String.IsNullOrEmpty(imgControl.DescriptionUrl))
        {
            //Get the cell value from the DescriptionUrl property
            bool cellValue = (imgControl.DescriptionUrl == "0") ? false : true;
            //Get the image path
            string imgUrl = "~/Images/";
            if (cellValue)
            {
                imgUrl           += "PastilleGreen.gif";
                lastUploadedMonth = currentMonth;
                switch (lastUploadedMonth)
                {
                case 1:
                    lastUploadedMonthS = "Jan";
                    break;

                case 2:
                    lastUploadedMonthS = "Feb";
                    break;

                case 3:
                    lastUploadedMonthS = "Mar";
                    break;

                case 4:
                    lastUploadedMonthS = "Apr";
                    break;

                case 5:
                    lastUploadedMonthS = "May";
                    break;

                case 6:
                    lastUploadedMonthS = "Jun";
                    break;

                case 7:
                    lastUploadedMonthS = "Jul";
                    break;

                case 8:
                    lastUploadedMonthS = "Aug";
                    break;

                case 9:
                    lastUploadedMonthS = "Sep";
                    break;

                case 10:
                    lastUploadedMonthS = "Oct";
                    break;

                case 11:
                    lastUploadedMonthS = "Nov";
                    break;

                case 12:
                    lastUploadedMonthS = "Dec";
                    break;
                }
            }
            else
            {
                imgUrl += "PastilleRed.gif";
            }

            if (imgControl == null)
            {
                return;
            }
            //Set the image
            imgControl.ImageUrl = imgUrl;
        }
    }