Exemplo n.º 1
0
        //根据fieldID查找表单中formLabelID
        private List <SELECTMODEL> GetFormLabelList(string fieldID)
        {
            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("i_field_id", fieldID);
                    var lst = dbHelper.ExecuteListProc <SELECTMODEL>("pkg_redas_build_doc.sp_form_label_get", dic);

                    return(lst);
                }
                catch
                {
                    return(new List <SELECTMODEL>());
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取所有数据源
        /// </summary>
        /// <returns></returns>
        public IList<DataSourceDTO> GetAllDataSource()
        {
            IList<DataSourceDTO> result = null;
            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic.Add("i_Type", -1);
                    result = dbHelper.ExecuteListProc<DataSourceDTO>("PKG_UCS_DataSource.sp_Data_Source_get", dic);                 
                }
                catch (Exception ex)
                {

                }
            }
            return result;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据文档实例ID获得实例信息
        /// </summary>
        /// <param name="objectId"></param>
        /// <param name="templateType"></param>
        /// <returns></returns>
        public T_INSTANCE_DOCUMENT GetInstanceDocumentGetById(decimal instanceDocumentID)
        {
            T_INSTANCE_DOCUMENT result = null;

            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("I_INSTANCE_DOCUMENT_ID", instanceDocumentID);
                    List <T_INSTANCE_DOCUMENT> lst = dbHelper.ExecuteListProc <T_INSTANCE_DOCUMENT>("pkg_redas_build_doc.sp_instance_document_get", dic);
                    result = lst[0];
                }
                catch
                {
                }
            }
            return(result);
        }
Exemplo n.º 4
0
 public IList<DataSourceDTO> GetDataSource(int templateTypeId)
 {
     IList<DataSourceDTO> result = new List<DataSourceDTO>();
     using (BaseDB dbHelper = new OmpdDBHelper())
     {
         try
         {
             Dictionary<string, object> dic = new Dictionary<string, object>();
             dic.Add("i_template_type", templateTypeId);
             result = dbHelper.ExecuteListProc<DataSourceDTO>("pkg_redas_build_doc.sp_data_source_get", dic);
             
         }
         catch (Exception ex)
         {
             result = null;
         }
     }
     return result;
 }
Exemplo n.º 5
0
        /// <summary>
        /// 获得数据处理的数据源
        /// </summary>
        /// <returns></returns>
        public IList<LabelDealWithModel> GetLabelDealSource()
        {
            List<LabelDealWithModel> list = null;
            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    list = dbHelper.ExecuteListProc<LabelDealWithModel>("PKG_UCS_DataSource.sp_label_deal_with_get", dic);  
                    

                }
                catch (Exception ex)
                {
                    throw;
                }
            }
            return list;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 根据估价对象ID获得实例信息
        /// </summary>
        /// <param name="objectId"></param>
        /// <param name="templateType"></param>
        /// <returns></returns>
        public T_INSTANCE_DOCUMENT GetInstanceDocumentGetByObject(decimal objectId, EntrustItem businessType)
        {
            T_INSTANCE_DOCUMENT result = null;

            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("i_OBJECT_ID", objectId);
                    dic.Add("i_businessType", (int)businessType);
                    List <T_INSTANCE_DOCUMENT> lst = dbHelper.ExecuteListProc <T_INSTANCE_DOCUMENT>("pkg_redas_instance_document.sp_instanceDocumentGetByObject", dic);
                    result = lst[0];
                }
                catch
                {
                }
            }
            return(result);
        }
Exemplo n.º 7
0
        public IList<MotherSetDTO> GetMotherSetByCustomer(int customerId, int type)
        {
            IList<MotherSetDTO> result = null;
            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic.Add("i_customer_ID", customerId);
                    dic.Add("i_document_type", type);
                    result = dbHelper.ExecuteListProc<MotherSetDTO>("pkg_redas_mother_set.sp_mother_set_getByCustomer", dic);

                }
                catch
                {
                    result = null;
                }
            }
            return result;
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获得数据源
        /// </summary>
        /// <param name="type">-1获得所有的数据源  1:获得除数据转换之外的数据源  </param>
        /// <returns></returns>
        public IList<DataSourceDTO> GetDataSourceByType(int type)
        {
            IList<DataSourceDTO> result = null;
            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic.Add("i_Type", type);
                    result = dbHelper.ExecuteListProc<DataSourceDTO>("PKG_UCS_DataSource.sp_Data_Source_get", dic);
                    //提取sql中参数
                    ExtractSqlParms(result);
                }
                catch (Exception ex)
                {

                }
            }
            return result;
        }
Exemplo n.º 9
0
 public MotherSetDTO GetMotherSet(int motherId)
 {
     MotherSetDTO result = null;
     using (BaseDB dbHelper = new OmpdDBHelper())
     {
         try
         {
             Dictionary<string, object> dic = new Dictionary<string, object>();
             dic.Add("i_MOTHER_SET_ID", motherId);
             List<MotherSetDTO> list = null;
             list = dbHelper.ExecuteListProc<MotherSetDTO>("pkg_redas_mother_set.sp_mother_set_get", dic);
             if (list.Count > 0)
                 result = list[0];
         }
         catch (Exception ex)
         {
             throw;
         }
     }
     return result;
 }
Exemplo n.º 10
0
 public TemplateTypeDTO GetTemplateType(int templateTypeId)
 {
     TemplateTypeDTO result = null;
     using (BaseDB dbHelper = new OmpdDBHelper())
     {
         try
         {
             Dictionary<string, object> dicParms = new Dictionary<string, object>();
             dicParms.Add("i_template_type", templateTypeId);
             var templateTypeList = dbHelper.ExecuteListProc<TemplateTypeDTO>("pkg_redas_build_doc.sp_template_type_get", dicParms);
             if (templateTypeList.Count > 0)
             {
                 result = templateTypeList[0];
             }
         }
         catch { 
         
         }
         return result;
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// 获得文档实例信息
        /// </summary>
        /// <param name="instanceId"></param>
        /// <returns></returns>
        public T_INSTANCE_DOCUMENT GetInstanceInfo(int instanceId)
        {
            T_INSTANCE_DOCUMENT info = new T_INSTANCE_DOCUMENT();;

            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("i_INSTANCE_DOCUMENT_ID", instanceId);
                    IList <T_INSTANCE_DOCUMENT> infos = dbHelper.ExecuteListProc <T_INSTANCE_DOCUMENT>("pkg_instance_document.sp_instance_document_get", dic);
                    if (infos.Count > 0)
                    {
                        info = infos[0];
                    }
                }
                catch
                {
                }
            }
            return(info);
        }
Exemplo n.º 12
0
 /// <summary>
 /// 根据文档实例ID获得实例信息
 /// </summary>
 /// <param name="objectId"></param>
 /// <param name="templateType"></param>
 /// <returns></returns>
 public InstanceDocumentDTO GetInstanceDocument(decimal instanceDocumentID)
 {
     InstanceDocumentDTO result = null;
     using (BaseDB dbHelper = new OmpdDBHelper())
     {
         try
         {
             Dictionary<string, object> dic = new Dictionary<string, object>();
             dic.Add("I_INSTANCE_DOCUMENT_ID", instanceDocumentID);
             List<InstanceDocumentDTO> lst = dbHelper.ExecuteListProc<InstanceDocumentDTO>("pkg_redas_build_doc.sp_instance_document_get", dic);
             if (lst.Count() > 0)
             {
                 result = lst[0];
             }
         }
         catch
         {
             result = null;
         }
     }
     return result;
 }
Exemplo n.º 13
0
        /// <summary>
        /// 根据客户ID获得该公司下的所有构件
        /// </summary>
        /// <param name="customerId"></param>
        /// <param name="template_Type"></param>
        /// <returns></returns>
        public IList<DocumentStructureDTO> GetStructuresByCustomer(decimal customerId, decimal stype, decimal dtype)
        {
            IList<DocumentStructureDTO> result = null;
            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic.Add("i_customerId", customerId);                  
                    dic.Add("i_Structure_Type", stype);
                    dic.Add("i_Document_Type", dtype);
                    result = dbHelper.ExecuteListProc<DocumentStructureDTO>("PKG_USC_DocumentStructure.sp_structure_getByCustomer", dic);

                }
                catch
                {
                    result = new List<DocumentStructureDTO>();
                    throw;
                }
            }
            return result;
        }
Exemplo n.º 14
0
        public DataLabelModel GetLabel(int customerId, string dataLabelName)
        {
            DataLabelModel result = null;
            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                List<DataLabelModel> list = null;
                try
                {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic.Add("i_LABEL_NAME", dataLabelName);
                    dic.Add("i_CUSTOMER_ID", customerId);
                    list = dbHelper.ExecuteListProc<DataLabelModel>("PKG_UCS_DATA_LABEL.sp_data_label_getInfoByName", dic);
                }
                catch
                {

                }
                if (list.Count > 0)
                    result = list[0];
            }
            return result;
        }
Exemplo n.º 15
0
        public DocumentStructureDTO GetStructure(int structureId)
        {
            DocumentStructureDTO result = null;
            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary<string, object> dicParms = new Dictionary<string, object>();
                    dicParms.Add("i_structure_id", structureId);
                    var list = dbHelper.ExecuteListProc<DocumentStructureDTO>("pkg_redas_build_doc.sp_doc_structure_get", dicParms);
                    if (list.Count() > 0)
                    {
                        result = list[0];
                    }
                }
                catch
                {
                    result = null;
                }

            }
            return result;
        }
Exemplo n.º 16
0
        /// <summary>
        /// 根据估价对象ID获得实例信息
        /// </summary>
        /// <param name="objectId"></param>
        /// <param name="templateType"></param>
        /// <returns></returns>
        public List <_ChangeSortModel> GetObjectInstanceByProjectId(decimal projectId, EntrustItem businessType, decimal customerId)
        {
            List <_ChangeSortModel> result = new List <_ChangeSortModel>();

            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("i_project_id", projectId);
                    dic.Add("i_businessType", (int)businessType);
                    List <_ObjectInstance> lst = dbHelper.ExecuteListProc <_ObjectInstance>("pkg_redas_instance_document.sp_ObjectInstance_Get", dic);
                    string prjStructure        = dic["O_PRJ_STRUCTURE"].ToString();

                    //获得构件的排序
                    IList <Document_structureModel> lstStructure        = new Document_structureLogic().GetByCustomer(customerId, 0, 0);
                    Dictionary <decimal, decimal>   dicStructureAndSort = new Dictionary <decimal, decimal>(); //优先考虑项目是否已经保存排序,为保存则读取构件中的排序
                    List <_ProjectStructrue>        lstPrjStructure     = new List <_ProjectStructrue>();

                    //估价对象是否更换模板
                    bool isChangeMotherSet = false;
                    if (!string.IsNullOrEmpty(prjStructure))
                    {
                        lstPrjStructure = JsonTools.JsonToObject <List <_ProjectStructrue> >(prjStructure);
                        //如果与数据库的模板不匹配  表示已更换模板,所以排序显示的是构件表中的排序 (多标的物)
                        foreach (var info in lst)
                        {
                            //info.MOTHER_SET_ID
                            if (lstPrjStructure.Where(p => p.MotherSetId == info.MOTHER_SET_ID).Count() <= 0)
                            {
                                isChangeMotherSet = true;
                                break;
                            }
                        }
                    }
                    if (isChangeMotherSet || prjStructure == "")
                    {
                        foreach (var info in lstStructure)
                        {
                            dicStructureAndSort.Add(info.STRUCTURE_ID, info.SORT_NO);
                        }
                    }
                    var sort = 0;
                    foreach (var info in lst)
                    {
                        sort++;
                        //实例中的所有构件
                        Dictionary <BlockType, List <_DocStructrue> > structureCofig = GetStructureDictionary(info.DOCUMENT_STRUCTURE);
                        foreach (var dicConfig in structureCofig)
                        {
                            foreach (var structure in dicConfig.Value)
                            {
                                _ChangeSortModel model = new _ChangeSortModel();
                                model.Object_Name   = info.OBJECT_NAME;
                                model.StructureName = structure.Name;
                                model.StructureType = ((int)dicConfig.Key).ToString();
                                model.SturctureId   = structure.Key;
                                model.Type          = structure.Type;
                                model.Sort          = 0;
                                //单标的物就按数据库中的顺序来
                                if (lst.Count == 1)
                                {
                                    model.Sort = sort;
                                }
                                else
                                {
                                    //并没有更改模板 且 数据库中已保存排序
                                    if (!isChangeMotherSet && lstPrjStructure.Count > 0)
                                    {
                                        for (var i = 0; i < lstPrjStructure.Count(); i++)
                                        {
                                            if (lstPrjStructure[i].Key == structure.Key && lstPrjStructure[i].InstanceId == info.INSTANCE_DOCUMENT_ID)
                                            {
                                                model.Sort = i;
                                                break;
                                            }
                                        }
                                    }
                                    else if (model.Type == "Config") //只有用户上传的构件才有排序
                                    {
                                        model.Sort = dicStructureAndSort[model.SturctureId];
                                    }
                                }
                                model.Instance_document_id = info.INSTANCE_DOCUMENT_ID;
                                model.MotherSetId          = info.MOTHER_SET_ID;
                                result.Add(model);
                            }
                        }
                    }

                    result = result.OrderBy(p => p.StructureType).ThenBy(p => p.Type).ThenBy(p => p.Sort).ToList();
                }
                catch
                {
                }
            }
            return(result);
        }