コード例 #1
0
        private bool tryPost(ref Model.Piecerestore model, out string errMsg)
        {
            errMsg = "";
            bool re = false;

            model.Creater     = this.auth.UserId;
            model.CreatedDate = DateTime.Now;
            if (PieceManager.RestorePiece(ref model, out errMsg))
            {
                re = true;
            }
            return(re);
        }
コード例 #2
0
        private bool tryValidate(Model.Piecerestore model, out string errMsg)
        {
            errMsg = "";
            bool re = true;

            if (model.Piece == 0 ||
                model.Creater == 0)
            {
                errMsg = "输入数据不合法";
                re     = false;
            }
            if (re && model.Creater != auth.UserId)
            {
                errMsg = "登录信息异常,请刷新浏览器以重启应用(APP请退出应用后重新打开)";
                re     = false;
            }
            return(re);
        }
コード例 #3
0
ファイル: PieceManager.cs プロジェクト: lianghuiyin/htps
 /// <summary>
 /// 试件还原
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static bool RestorePiece(ref Model.Piecerestore model, out string errMsg)
 {
     return(PieceService.RestorePiece(ref model, out errMsg));
 }
コード例 #4
0
        /// <summary>
        /// 试件还原
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool RestorePiece(ref Model.Piecerestore model, out string errMsg)
        {
            errMsg = "";
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@Piece", model.Piece),
                    new SqlParameter("@Creater", model.Creater),
                    new SqlParameter("@CreatedDate", model.CreatedDate),
                    new SqlParameter("@OutState", SqlDbType.Int),
                    new SqlParameter("@return", SqlDbType.Int)
                };
                para[3].Direction = ParameterDirection.Output;
                para[4].Direction = ParameterDirection.ReturnValue;
                DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_PieceRestore", para);
                int outState    = int.Parse(para[3].Value.ToString());
                int returnValue = int.Parse(para[4].Value.ToString());
                if (returnValue > 0)
                {
                    EventLog e = new EventLog();
                    e.TargetIds = returnValue.ToString();
                    e.CodeTag   = "RestorePiece";
                    e.LogName   = "试件还原";
                    EventLogService.AddEventLog <Model.Piecerestore>(e, model);
                    return(true);
                }
                else
                {
                    switch (outState)
                    {
                    case -100:
                        errMsg = "该试件下有申请单没有归档,不能归档该试件";
                        break;

                    case -1:
                        errMsg = "归档试件失败";
                        break;

                    default:
                        errMsg = "异常错误";
                        break;
                    }
                    ErrorLog e = new ErrorLog();
                    e.TargetIds = model.Piece.ToString();
                    e.CodeTag   = "RestorePiece";
                    e.LogName   = "试件还原";
                    e.ErrorMsg  = errMsg;
                    ErrorLogService.AddErrorLog <Model.Piecerestore>(e, model);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLog e = new ErrorLog();
                e.TargetIds = "0";
                e.CodeTag   = "RestorePiece";
                e.LogName   = "试件还原";
                e.ErrorMsg  = ex.Message.ToString();
                ErrorLogService.AddErrorLog <Model.Piecerestore>(e, model);
                return(false);
            }
        }