예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="listWork"></param>
        /// <returns></returns>
        //public JsonResult SaveTrouble(Routine entity, List<RoutineWork> listWork)
        //{
        //    JsonResult jsonreslut = new JsonResult();
        //    try
        //    {
        //        如果是新增
        //        if (string.IsNullOrEmpty(entity.ID))
        //            dao.AddRoutine(entity, listWork);
        //        编辑
        //        else
        //        {
        //            dao.UpdateRoutine(entity, listWork);
        //        }
        //        jsonreslut.result = true;
        //        jsonreslut.msg = "保存成功!";
        //    }
        //    catch (Exception ex)
        //    {
        //        LogHelper.WriteException(ex, LogType.BussinessDLL);
        //        jsonreslut.result = false;
        //        jsonreslut.msg = ex.Message;
        //    }
        //    return jsonreslut;
        //}

        /// <summary>
        /// 项目问题文件保存
        ///  Created:2017.04.06(Xuxb)
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public JsonResult SaveTroubleFile(TroubleFiles entity)
        {
            JsonResult jsonreslut = new JsonResult();

            try
            {
                string _id;
                if (string.IsNullOrEmpty(entity.ID))
                {
                    new Repository <TroubleFiles>().Insert(entity, true, out _id);
                }
                else
                {
                    new Repository <TroubleFiles>().Update(entity, true, out _id);
                }
                jsonreslut.data   = _id;
                jsonreslut.result = true;
                jsonreslut.msg    = "保存成功!";
            }
            catch (Exception ex)
            {
                LogHelper.WriteException(ex, LogType.BussinessDLL);
                jsonreslut.result = false;
                jsonreslut.msg    = ex.Message;
            }
            return(jsonreslut);
        }
예제 #2
0
        /// <summary>
        /// 原因、分析、解决方案的加载
        /// Created:20170609(ChengMengjia)
        /// </summary>
        private void LoadSpecFiles(string troubleID)
        {
            List <TroubleFiles> list = troubleBLL.GetTroubleFiles(TroubleId, null);
            //原因
            TroubleFiles entity  = list.Where(t => t.Type == 1).FirstOrDefault();
            bool         IsExist = entity != null;

            if (IsExist)
            {
                lbl1.Text  = entity.Name;
                lbl1.Tag   = entity.Path;
                btnUp1.Tag = entity.ID;
            }
            else
            {
                btnUp1.Tag = null;
            }
            lbl1.Visible     = IsExist;
            btnDown1.Visible = IsExist;

            //分析
            entity  = null;
            entity  = list.Where(t => t.Type == 2).FirstOrDefault();
            IsExist = entity != null;
            if (IsExist)
            {
                lbl2.Text  = entity.Name;
                lbl2.Tag   = entity.Path;
                btnUp2.Tag = entity.ID;
            }
            else
            {
                btnUp2.Tag = null;
            }
            lbl2.Visible     = IsExist;
            btnDown2.Visible = IsExist;

            //解决方案
            entity  = null;
            entity  = list.Where(t => t.Type == 3).FirstOrDefault();
            IsExist = entity != null;
            if (IsExist)
            {
                lbl3.Text  = entity.Name;
                lbl3.Tag   = entity.Path;
                btnUp3.Tag = entity.ID;
            }
            else
            {
                btnUp3.Tag = null;
            }
            lbl3.Visible     = IsExist;
            btnDown3.Visible = IsExist;
        }
예제 #3
0
        /// <summary>
        /// 项目问题文件保存按钮按下时
        /// Created:2017.04.06(Xuxb)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFileSave_Click(object sender, EventArgs e)
        {
            //保存前检查
            if (!FileCheck())
            {
                return;
            }

            TroubleFiles file = new TroubleFiles();

            //文件ID
            file.ID = _fileId;
            //项目问题ID
            file.TroubleID = TroubleId.Substring(0, 36);
            //文件路径
            file.Name = txtFileName.Text;
            //文件描述
            file.Desc = txtFileDesc.Text;
            //文件类型
            file.Type = 0;
            //上传文件名
            if (_fileSelectFlg)
            {
                file.Path = FileHelper.UploadFile(txtFilePath.Text, UploadType.Trouble, ProjectId, _nodeID);
            }
            else
            {
                file.Path = _filePath;
            }

            //如果返回文件名为空,不保存数据库
            if (string.IsNullOrEmpty(file.Path))
            {
                return;
            }

            //保存
            JsonResult result = troubleBLL.SaveTroubleFile(file);

            _fileId = result.result ? (string)result.data : _fileId;
            if (result.result)
            {
                //附件列表加载
                LoadFileList(TroubleId);
            }
            MessageHelper.ShowRstMsg(result.result);
        }