Example #1
0
        //获得object对象
        public ObjectDTO GetObjectById(decimal objectId)
        {
            ObjectDTO result = null;

            using (BaseDB dbHelper = new RedasDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("i_object_id", objectId);
                    List <ObjectDTO> list = null;
                    list = dbHelper.ExecuteListProc <ObjectDTO>("PKG_OBJECT.sp_object_get", dic);

                    if (list.Count > 0)
                    {
                        result = list[0];
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
            return(result);
        }
Example #2
0
        //获得表单数据
        public FormStoreDTO GetFormStore(decimal?store_id)
        {
            FormStoreDTO result = null;

            using (BaseDB dbHelper = new RedasDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("i_STORE_ID", store_id);
                    List <FormStoreDTO> list = null;
                    list = dbHelper.ExecuteListProc <FormStoreDTO>("pkg_form_store.sp_form_store_get", dic);

                    if (list.Count > 0)
                    {
                        result = list[0];
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
            return(result);
        }
Example #3
0
        /// <summary>
        /// 根据项目ID获得估价对象集合
        /// </summary>
        /// <param name="customerId"></param>
        /// <returns></returns>
        public IList <ObjectAndHouseModel> GetObjectByProjectId(int projectId)
        {
            IList <ObjectAndHouseModel> result = null;

            using (BaseDB dbHelper = new RedasDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("i_project_id", projectId);
                    result = dbHelper.ExecuteListProc <ObjectAndHouseModel>("PKG_OBJECT.sp_objectByProjectId_get", dic);
                }
                catch
                {
                    result = new List <ObjectAndHouseModel>();
                }
            }
            return(result);
        }
Example #4
0
        public FormViewModel GetFormDataByObjectId(int ObjectId, int FormType)
        {
            FormViewModel formInstance        = new FormViewModel();
            FormLabelDTO  label               = new FormLabelDTO();
            Dictionary <string, object> dsDic = new Dictionary <string, object>();

            dsDic.Add("i_object_id", ObjectId);
            dsDic.Add("i_form_type", FormType);
            using (BaseDB db = new RedasDBHelper())
            {
                IList <FormViewModel> InstanceList = db.ExecuteListProc <FormViewModel>("pkg_forminstance.sp_get_formDataByObj", dsDic);
                if (InstanceList != null && InstanceList.Count > 0)
                {
                    formInstance = InstanceList[0];
                    //formInstance.LABLELIST = JsonTools.JsonToObject2<List<FormLabelDTO>>(formInstance.CONTENTS).OrderBy(l => l.SORT).ToList();
                    formInstance.LABLELIST = JsonTools.JsonToObject2 <DFormViewModel>(formInstance.CONTENTS).FormLabels
                                             .Where(l => l.IsSelected == true)
                                             .OrderBy(l => l.SORT).ToList();
                    List <LabelDataDTO> lstData = new List <LabelDataDTO>();
                    if (!string.IsNullOrEmpty(formInstance.FORMDATA))
                    {
                        lstData = JsonTools.JsonToObject2 <List <LabelDataDTO> >(formInstance.FORMDATA);
                    }

                    foreach (LabelDataDTO c in lstData)
                    {
                        decimal id = 0;
                        decimal.TryParse(c.NAME, out id);
                        if (id > 0)
                        {
                            label = formInstance.LABLELIST.SingleOrDefault(l => l.FORM_LABEL_ID == Convert.ToDecimal(c.NAME));
                            if (label == null)
                            {
                                continue;
                            }
                            label.CONTENT = c.VALUE;
                            //label.CONTENT =label.FIELD_TYPE == "DATE"?Convert.ToDateTime(c.VALUE): c.VALUE;
                        }
                    }
                }
            }
            return(formInstance);
        }