Пример #1
0
        /// <summary>
        /// Impostazione del colore del carattere per la prima colonna della griglia:
        /// rosso se doc protocollato, altrimenti grigio
        /// </summary>
        /// <param name="item"></param>
        private void SetForeColorColumnDescrDocumento(DataGridItem item, int index)
        {
            Label lbl = item.Cells[8].Controls[1] as Label;

            if (lbl != null)
            {
                item.Cells[0].Font.Bold = true;

                if (lbl.Text.Equals(""))
                {
                    if (item.ItemIndex != index)
                    {
                        ((Label)item.Cells[0].Controls[1]).ForeColor = Color.Black;
                    }
                    else
                    {
                        ((Label)item.Cells[0].Controls[1]).ForeColor = Color.White;
                    }
                }
                else
                {
                    //string idAmm = UserManager.getInfoUtente().idAmministrazione;
                    string idAmm = string.Empty;
                    if ((string)Session["AMMDATASET"] != null)
                    {
                        idAmm = AmmUtils.UtilsXml.GetAmmDataSession((string)Session["AMMDATASET"], "3");
                    }
                    else
                    if (UserManager.getInfoUtente() != null && !string.IsNullOrEmpty(UserManager.getInfoUtente().idAmministrazione))
                    {
                        idAmm = UserManager.getInfoUtente().idAmministrazione;
                    }

                    DocsPaWR.DocsPaWebService ws = new DocsPAWA.DocsPaWR.DocsPaWebService();
                    string segnAmm = "0";
                    if (!string.IsNullOrEmpty(idAmm))
                    {
                        segnAmm = ws.getSegnAmm(idAmm);
                    }
                    switch (segnAmm)
                    {
                    case "0":
                        ((Label)item.Cells[0].Controls[1]).ForeColor = Color.Black;
                        break;

                    case "1":
                        ((Label)item.Cells[0].Controls[1]).ForeColor = Color.Blue;
                        break;

                    case "2":
                    default:
                        ((Label)item.Cells[0].Controls[1]).ForeColor = Color.Red;
                        break;
                    }
                }
                lbl = null;
            }
        }