Exemple #1
0
 public FormData GetWithoutGridFormData(IConnectionHandler connectionHandler, FormStructure formStructure, string refId, string objname, string culture)
 {
     if (!string.IsNullOrEmpty(refId))
     {
         var controls  = formStructure.Controls.Where(x => x.GetType().Name != typeof(ControlFactory.Controls.Grid).Name && string.IsNullOrEmpty(((Control)x).GridId)).ToList();
         var formDatas = new FormDataBO().Where(connectionHandler, x => x.RefId.ToLower() == refId.ToLower() && x.ObjectName.ToLower() == objname.ToLower() && x.StructureId == formStructure.Id);
         if (formDatas == null || !formDatas.Any())
         {
             return(null);
         }
         new FormDataBO().GetLanuageContent(connectionHandler, culture, formDatas);
         FormData setformData = null;
         foreach (var formData in formDatas)
         {
             var list = Extentions.GetControlData(formData.Data);
             foreach (var control in controls)
             {
                 if (!list.ContainsKey(((Control)control).Id))
                 {
                     continue;
                 }
                 if (!formData.GetFormControl.ContainsKey(((Control)control).Id))
                 {
                     formData.GetFormControl.Add(((Control)control).Id, list[((Control)control).Id]);
                 }
                 setformData = formData;
             }
             if (setformData != null)
             {
                 return(setformData);
             }
         }
     }
     return(null);
 }
Exemple #2
0
        public List <FormData> GetGridDataSource(IConnectionHandler connectionHandler, FormStructure formStructure, string objactname, string refId, string gridId, string culture)
        {
            var datas = new List <FormData>();

            if (!string.IsNullOrEmpty(refId))
            {
                var controls  = formStructure.Controls.Where(x => x.GetType().Name != typeof(Grid).Name && ((Control)x).GridId == gridId).ToList();
                var formDatas = new FormDataBO().Where(connectionHandler,
                                                       x =>
                                                       x.RefId.ToLower() == refId.ToLower() && x.ObjectName.ToLower() == objactname.ToLower() &&
                                                       x.StructureId == formStructure.Id);
                if (formDatas == null || !formDatas.Any())
                {
                    return(null);
                }
                new FormDataBO().GetLanuageContent(connectionHandler, culture, formDatas);
                foreach (var formData in formDatas)
                {
                    var  list = Extentions.GetControlData(formData.Data);
                    bool add  = false;
                    foreach (var control in controls)
                    {
                        if (!list.ContainsKey(((Control)control).Id))
                        {
                            continue;
                        }
                        add = true;
                        if (!formData.GetFormControl.ContainsKey(((Control)control).Id))
                        {
                            formData.GetFormControl.Add(((Control)control).Id, list[((Control)control).Id]);
                        }
                    }
                    if (add)
                    {
                        datas.Add(formData);
                    }
                }
            }
            return(datas);
        }