/// <summary>
        /// 添加一条Information
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public bool Add(Information info)
        {
            try
            {
                return(_informationDAL.Insert(info));
            }
            catch (Exception ex)
            {
                LogHelper.Log.Write(ex.Message);
                LogHelper.Log.Write(ex.StackTrace);

                return(false);
            }
        }
Esempio n. 2
0
        public OperatorState AddInformation(Information information, string user, string companycode)
        {
            if (information == null)
            {
                return(OperatorState.empty);
            }

            try
            {
                // 构造datacode
                information.DataCode = new StringBuilder().
                                       Append("DC").Append(companycode).
                                       Append(TimeManager.GetTimeSpan()).
                                       Append(RandomManager.GenerateRandom(5)).ToString();
                information.InsertTime = DateTime.Now;
                information.UpdateTime = DateTime.Now;
                information.IsDeleted  = false;
                information.State      = (int)InformatinState.UnAssigned;  // 初始时为  未分配 状态

                information.UsageMember = information.InsertMember = user; // 初始化可使用用户  和 插入用户
                information.CompanyCode = companycode;                     // 次条数据的公司代码

                if (_informationDAL.Insert(information))
                {
                    return(OperatorState.success);
                }
                else
                {
                    return(OperatorState.error);
                }
            }
            catch (Exception ex)
            {
                LogHelper.writeLog_error(ex.Message);
                LogHelper.writeLog_error(ex.StackTrace);

                throw;
            }
        }