Пример #1
0
        public BaseResult UpdateInstance_Structure(T_INSTANCE_DOCUMENT info)
        {
            BaseResult br = new BaseResult()
            {
                Succeeded = true, Errors = new List <string>()
            };

            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = BaseDB.EntityToDictionary(info);
                    if (info.INSTANCE_DOCUMENT_ID > 0)
                    {
                        dbHelper.ExecuteNonQueryProc("pkg_redas_instance_document.sp_instance_modifyStructure", dic);
                        br.ResultId = info.INSTANCE_DOCUMENT_ID;
                    }
                }
                catch (Exception ex)
                {
                    br.Succeeded = false;
                    br.Errors.Add("修改不成功");
                    throw;
                }
                return(br);
            }
        }
Пример #2
0
 /// <summary>
 /// 保存标签信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public BaseResult SaveLabel(DataLabelModel model)
 {
     BaseResult result = new BaseResult() { Succeeded = true };
     using (BaseDB dbHelper = new OmpdDBHelper())
     {
         try
         {
             Dictionary<string, object> dic = BaseDB.EntityToDictionary(model);
             if (model.DATA_LABEL_ID == 0)
             {
                 model.CREATED_TIME = DateTime.Now;
                 dbHelper.ExecuteNonQueryProc("PKG_UCS_DATA_LABEL.sp_data_label_add", dic);
             }
             else
             {
                 model.MODIFIED_TIME = DateTime.Now;
                 dbHelper.ExecuteNonQueryProc("PKG_UCS_DATA_LABEL.sp_data_label_modify", dic);
             }
         }
         catch (Exception ex)
         {
             result.Succeeded = false;
             result.Errors.Add(ex.Message);
             throw;
         }
     }
     return result;
 }
Пример #3
0
        /// <summary>
        /// 往实例文档表中添加数据
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        //public BaseResult AddInstance_Document(T_INSTANCE_DOCUMENT info, enum_DocumentType t)
        //{
        //    BaseResult br = new BaseResult() { Succeeded = true, Errors = new List<string>() };
        //    using (BaseDB dbHelper = new OmpdDBHelper())
        //    {
        //        try
        //        {
        //            Dictionary<string, object> dic = BaseDB.EntityToDictionary(info);
        //            if (info.INSTANCE_DOCUMENT_ID > 0)
        //            {
        //                dbHelper.ExecuteNonQueryProc("pkg_redas_instance_document.sp_instance_document_modify", dic);
        //                br.ResultId = info.INSTANCE_DOCUMENT_ID;
        //            }
        //            else
        //            {

        //                dbHelper.ExecuteNonQueryProc("pkg_redas_instance_document.sp_instance_document_add", dic);
        //                decimal id = Convert.ToDecimal(dic["O_INSTANCE_DOCUMENT_ID"]);
        //                br.ResultId = id;
        //                //更改项目的实例ID
        //                if (info.Project_ID > 0)
        //                {
        //                    UpdateProjectInstanceDocumentID(info.Project_ID, id, t);
        //                }
        //                if (info.Object_ID > 0)
        //                {
        //                    UpdateObjectInstanceDocumentID(info.Object_ID, id, t);
        //                }
        //            }
        //        }
        //        catch (Exception ex)
        //        {
        //            br.Succeeded = false;
        //            br.Errors.Add("添加不成功");
        //            throw;
        //        }
        //        return br;
        //    }
        //}
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <param name="t">1:预估函 2:报告</param>
        /// <param name="isSingleObject">是否是单标的物</param>
        /// <param name="isDownLoadSort">是否是多标的物下载操作</param>
        /// <returns></returns>
        public BaseResult AddInstance_Document(T_INSTANCE_DOCUMENT info, EntrustItem t, bool isSingleObject, bool isDownLoadSort)
        {
            BaseResult br = new BaseResult()
            {
                Succeeded = true, Errors = new List <string>()
            };

            using (BaseDB dbHelper = new OmpdDBHelper())
            {
                try
                {
                    Dictionary <string, object> dic = BaseDB.EntityToDictionary(info);
                    if (info.INSTANCE_DOCUMENT_ID > 0)
                    {
                        dbHelper.ExecuteNonQueryProc("pkg_redas_instance_document.sp_instance_document_modify", dic);
                        br.ResultId = info.INSTANCE_DOCUMENT_ID;
                    }
                    else
                    {
                        dbHelper.ExecuteNonQueryProc("pkg_redas_instance_document.sp_instance_document_add", dic);
                        decimal id = Convert.ToDecimal(dic["O_INSTANCE_DOCUMENT_ID"]);
                        br.ResultId = id;
                        //更改项目的实例ID 多标的物的实例保存  只要更新object表InstanceID,多标的物的下载保存  需要更新projectID
                        if (!isSingleObject)
                        {                            //UpdateProjectInstanceDocumentID(info.Project_ID, id, t);
                            if (isDownLoadSort)
                            {
                                UpdateInstanceDocumentID(0, info.Project_ID, id, t);
                            }
                            else
                            {
                                UpdateInstanceDocumentID(info.Object_ID, 0, id, t);
                            }
                        }
                        else  //单标的物的预估函即要更新object表InstanceID 也要更新project表的InstanceID
                        {
                            //更改object表
                            UpdateInstanceDocumentID(info.Object_ID, 0, id, t);
                            //更改project表
                            UpdateInstanceDocumentID(0, info.Project_ID, id, t);
                        }
                    }
                }
                catch (Exception ex)
                {
                    br.Succeeded = false;
                    br.Errors.Add("添加不成功");
                    throw;
                }
                return(br);
            }
        }