Ejemplo n.º 1
0
        public string GetVisibleText(string parm)
        {
            parm = parm.Replace("*", "");

            DataTable dt     = ChecklistTemplateItems.GetCheckListItem(decimal.Parse(parm), 1, 1);
            string    retval = "";

            if (dt.Rows.Count > 0)
            {
                retval = dt.Rows[0]["VisibleText"].ToString();
            }
            return(retval);
        }
Ejemplo n.º 2
0
        public ChecklistItem GetChecklistItem(string ItemCKey, int Mode, decimal DraftVersion)
        {
            try
            {
                ChecklistItem item = new ChecklistItem();


                item.CKey                      = "";
                item.ItemType                  = 0;
                item.VisibleText               = "";
                item.AnswerUnit                = 0;
                item.MustAnswer                = 0;
                item.MustImplement             = 0;
                item.SelectionDisablesChildren = 0;
                item.SelectionDisablesSiblings = 0;
                item.Notes                     = "";
                item.NotesHyperlinked          = "";
                item.NoteCKeys                 = "";
                item.ReportOption              = 2;
                item.Comments                  = "";
                item.Condition                 = "";

                if (ItemCKey == "null" || ItemCKey == "*" || ItemCKey == "" || ItemCKey == null)
                {
                    return(item);
                }

                ItemCKey = ItemCKey.Replace("*", "");
                DataTable dt = ChecklistTemplateItems.GetCheckListItem(decimal.Parse(ItemCKey), Mode, DraftVersion);
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];

                    item.CKey = dr["ChecklistTemplateItemCkey"].ToString();


                    //comboboxnote (26) to note (12) as users don't want to distinguish between the two
                    if (int.Parse(dr["ItemTypeKey"].ToString()) != 26)
                    {
                        item.ItemType = int.Parse(dr["ItemTypeKey"].ToString());
                    }
                    else
                    {
                        item.ItemType = 12;
                    }



                    item.VisibleText               = dr["VisibleText"].ToString();
                    item.AnswerUnit                = int.Parse(dr["AnswerUnits_Id"].ToString());
                    item.MustAnswer                = int.Parse(dr["MustAnswer"].ToString());
                    item.MustImplement             = int.Parse(dr["MustImplement"].ToString());
                    item.SelectionDisablesChildren = int.Parse(dr["SelectionDisablesChildren"].ToString());
                    item.SelectionDisablesSiblings = int.Parse(dr["SelectionDisablesSiblings"].ToString());
                    item.Notes            = dr["NotesAlt"].ToString();
                    item.NotesHyperlinked = dr["Notes"].ToString();
                    item.NoteCKeys        = dr["NoteCKeys"].ToString();
                    item.RequiredStatus   = dr["Authorityrequired"] == System.DBNull.Value ? 1 : int.Parse(dr["Authorityrequired"].ToString());
                    item.ReportOption     = dr["showInReport_Id"] == System.DBNull.Value ? 2 : int.Parse(dr["showInReport_Id"].ToString());
                    item.Comments         = dr["comments"] == System.DBNull.Value ? "" : dr["comments"].ToString();
                    item.Condition        = dr["condition"].ToString();
                }

                return(item);
            }
            catch (Exception ex)
            {
                var resp = new HttpResponseMessage(HttpStatusCode.ExpectationFailed)

                {
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(resp);
            }
        }