Beispiel #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="dataLabelName">数据标签名称</param>
        /// <param name="docMaster">文档主类</param>
        /// <param name="structureID">构件ID</param>
        /// <param name="customerID">客户ID</param>
        public DataLabel(string dataLabelName, DocMaster docMaster, decimal structureID, decimal customerID)
        {
            this.structureID = structureID;
            this.customerID  = customerID;

            // 没有缓存从数据库取出内容
            //string key = string.Format("{0}_{1}", dataSourctName, dataLabelName);
            //if (!CacheData.ContainsKey(key))
            //{

            DataLabelModel label = BuildWordInstance.GetLabel((int)customerID, dataLabelName);

            if (label != null)
            {
                JObject config = JObject.Parse(label.CONFIG_CONTENT);
                if (config["LabelType"].Value <string>() == "TextLabel")
                {
                    this.DataLabelName = config["LabelName"].Value <string>();
                    this.textLabel     = new TextLabel(this.DataLabelName, config, docMaster, this.structureID);

                    // 添加到缓存
                    // CacheData.Add(key, this);
                    this.DocControl = this.textLabel.DocControl;
                }
            }


            //}
        }
Beispiel #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;
 }
Beispiel #3
0
        public ActionResult Save(DataLabelModel model)
        {
            model.CREATED_BY    = 1236;
            model.MODIFIED_BY   = 1236;
            model.MODIFIED_TIME = DateTime.Now;
            model.CREATED_TIME  = DateTime.Now;
            model.CUSTOMER_ID   = 1;
            var result = BuildWordInstance.SaveLabel(model);

            return(Json(new { IsSuccess = true, Message = "添加成功" }, "Text/html", JsonRequestBehavior.AllowGet));
        }
Beispiel #4
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;
        }