public static List <Template> GetTemplates(int ClientID, string Connection)
        {
            DataTable dt = new DataTable();

            DataAccess.ImportTemplate itemp = new DataAccess.ImportTemplate(Connection);
            dt = itemp.GetImport(ClientID);
            string          att = "";
            List <Template> Ts  = new List <Template>();

            foreach (DataRow dr in dt.Rows)
            {
                att = "";
                Template t = new Template(Connection, ClientID);
                t.TemplateID     = dr[TalentozTemplate.TemplateID.Name] == null ? "" : dr[TalentozTemplate.TemplateID.Name].ToString();
                t.Name           = dr[TalentozTemplate.Name.Name] == null ? "" : dr[TalentozTemplate.Name.Name].ToString();
                t.Category       = dr[TalentozTemplate.Category.Name] == null ? "" : dr[TalentozTemplate.Category.Name].ToString();
                t.Code           = dr[TalentozTemplate.TemplateCode.Name] == null ? "" : dr[TalentozTemplate.TemplateCode.Name].ToString();
                t.Type           = dr[TalentozTemplate.TemplateType.Name] == null ? TemplateType.DIRECT : (TemplateType)Convert.ToInt32(dr[TalentozTemplate.TemplateType.Name]);
                t.ViewID         = dr[TalentozTemplate.ViewID.Name] == null ? "" : dr[TalentozTemplate.ViewID.Name].ToString();
                att              = dr[TalentozTemplate.ViewFields.Name] == null ? "" : dr[TalentozTemplate.Name.Name].ToString();
                att              = dr[TalentozTemplate.ViewFields.Name] == null ? "" : dr[TalentozTemplate.ViewFields.Name].ToString();
                t.TemplateFields = Newtonsoft.Json.JsonConvert.DeserializeObject <List <TemplateField> >(att);
                Ts.Add(t);
            }
            return(Ts);
        }
        private void Load()
        {
            DataTable dt = new DataTable();

            DataAccess.ImportTemplate itemp = new DataAccess.ImportTemplate(Connection);
            dt = itemp.GetImport(this.TemplateID, ClientID);
            string att = "";

            foreach (DataRow dr in dt.Rows)
            {
                Name           = dr[TalentozTemplate.Name.Name] == null ? "" : dr[TalentozTemplate.Name.Name].ToString();
                Category       = dr[TalentozTemplate.Category.Name] == null ? "" : dr[TalentozTemplate.Category.Name].ToString();
                Code           = dr[TalentozTemplate.TemplateCode.Name] == null ? "" : dr[TalentozTemplate.TemplateCode.Name].ToString();
                Type           = dr[TalentozTemplate.TemplateType.Name] == null ?  TemplateType.DIRECT : (TemplateType)Convert.ToInt32(dr[TalentozTemplate.TemplateType.Name]);
                ViewID         = dr[TalentozTemplate.ViewID.Name] == null ? "" : dr[TalentozTemplate.ViewID.Name].ToString();
                att            = dr[TalentozTemplate.ViewFields.Name] == null ? "" : dr[TalentozTemplate.ViewFields.Name].ToString();
                TemplateFields = Newtonsoft.Json.JsonConvert.DeserializeObject <List <TemplateField> >(att);
            }
        }