Beispiel #1
0
        /// <summary>
        /// 添加一条日志记录对象
        /// </summary>
        /// <param name="templog">系统日志类对象</param>
        /// <returns>通过布尔值提示是否完成.</returns>
        public bool addLog(Model.SysLog templog)
        {
            string sqltext           = "insert syslog(logId,userId,ipAddress,actionTime,[column],actionType) values(@logId,@userId,@ipAddress,@actionTime,@column,@actionType)";
            List <SqlParameter> para = new List <SqlParameter>();
            string maxid             = DBTools.searchID("syslog", "logid");
            int    id = maxid != null?int.Parse(maxid) : 0;

            SqlParameter sqlpara1 = new SqlParameter("@logId", (id + 1).ToString());
            SqlParameter sqlpara2 = new SqlParameter("@userId", templog.UserId);
            SqlParameter sqlpara3 = new SqlParameter("@ipAddress", templog.IpAddress);
            SqlParameter sqlpara4 = new SqlParameter("@actionTime", templog.ActionTime.ToString());
            SqlParameter sqlpara5 = new SqlParameter("@column", templog.Column);
            SqlParameter sqlpara6 = new SqlParameter("@actionType", templog.ActionType);

            para.Add(sqlpara1);
            para.Add(sqlpara2);
            para.Add(sqlpara3);
            para.Add(sqlpara4);
            para.Add(sqlpara5);
            para.Add(sqlpara6);

            int i = DBTools.exenonquerySQL(sqltext, para);

            if (i == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 添加一条公告。
        /// </summary>
        public bool addNotice(Model.Notice notice)
        {
            string sqltext = "insert notice(noticeId,subject,title,body,userId,createTime,publishTime) values(@noticeId,@subject,@title,@body,@userId,@createTime,@publishTime)";
            string maxid   = DBTools.searchID("notice", "noticeId");
            int    id      = maxid != null?int.Parse(maxid) : 0;

            List <SqlParameter> para     = new List <SqlParameter>();
            SqlParameter        sqlpara1 = new SqlParameter("@noticeId", (id + 1).ToString());
            SqlParameter        sqlpara2 = new SqlParameter("@subject", notice.Subject);
            SqlParameter        sqlpara3 = new SqlParameter("@title", notice.Title);
            SqlParameter        sqlpara4 = new SqlParameter("@body", notice.Body);
            SqlParameter        sqlpara5 = new SqlParameter("@userId", notice.SysUser.UserId);
            SqlParameter        sqlpara6 = new SqlParameter("@createTime", notice.CreateTime.ToString());
            SqlParameter        sqlpara7 = new SqlParameter("@publishTime", notice.UpdateTime.ToString());

            para.Add(sqlpara1);
            para.Add(sqlpara2);
            para.Add(sqlpara3);
            para.Add(sqlpara4);
            para.Add(sqlpara5);
            para.Add(sqlpara6);
            para.Add(sqlpara7);

            int i = DBTools.exenonquerySQL(sqltext, para);

            if (i == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 添加一个系统用户。
        /// </summary>
        /// <param name="su">系统用户类对象</param>
        /// <returns>布尔值提示添加是否成功</returns>
        public bool addUser(Model.SysUser su)
        {
            string sqltext = "insert sysuser(userId,staffNum,password,job) values(@userId,@staffNum,@password,@job)";
            string maxid   = DBTools.searchID("sysuser", "userId");
            int    id      = maxid != null?int.Parse(maxid) : 0;

            List <SqlParameter> para     = new List <SqlParameter>();
            SqlParameter        sqlpara1 = new SqlParameter("@userId", (id + 1).ToString());
            SqlParameter        sqlpara2 = new SqlParameter("@staffNum", su.StaffNum);
            SqlParameter        sqlpara3 = new SqlParameter("@password", su.Password);
            SqlParameter        sqlpara4 = new SqlParameter("@job", su.Job);

            para.Add(sqlpara1);
            para.Add(sqlpara2);
            para.Add(sqlpara3);
            para.Add(sqlpara4);
            int i = DBTools.exenonquerySQL(sqltext, para);

            if (i == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 添加多个库位类型.
        /// </summary>
        /// <param name="posisty">库位类型对象泛型集合.</param>
        /// <returns>通过布尔类型判断操作是否成功.</returns>
        public bool addPositionsType(List <Model.PositionType> posisty)
        {
            for (int j = 0; j < posisty.Count; j++)
            {
                string sqltext           = "insert positiontype(positionTypeId,positionTypeName,length,width,height,remark) values(@positionTypeId,@positionTypeName,@length,@width,@height,@remark)";
                List <SqlParameter> para = new List <SqlParameter>();
                string maxid             = DBTools.searchID("position", "positionTypeId");
                int    id = maxid != null?int.Parse(maxid) : 0;

                SqlParameter sqlpara1 = new SqlParameter("@positionTypeId", (id + 1).ToString());
                SqlParameter sqlpara2 = new SqlParameter("@positionTypeName", posisty[j].PositionTypeName);
                SqlParameter sqlpara3 = new SqlParameter("@length", posisty[j].Length);
                SqlParameter sqlpara4 = new SqlParameter("@width", posisty[j].Width);
                SqlParameter sqlpara5 = new SqlParameter("@height", posisty[j].Height);
                SqlParameter sqlpara6 = new SqlParameter("@remark", posisty[j].Remark);
                para.Add(sqlpara1);
                para.Add(sqlpara2);
                para.Add(sqlpara3);
                para.Add(sqlpara4);
                para.Add(sqlpara5);
                para.Add(sqlpara6);
                int i = DBTools.exenonquerySQL(sqltext, para);
                if (i == 1)
                {
                    continue;
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #5
0
        /// <summary>
        /// 增加一个数据备份。
        /// </summary>
        /// <param name="ccopy">数据备份对象</param>
        /// <returns>通过布尔值判断操作是否成功。</returns>
        public bool addCopy(Model.DataCopy ccopy)
        {
            string sqltext           = "insert datacopy(copyId,dataName,copyTime,copyType,copySize,userId,copyLocation,copyState) values(@copyId,@dataName,@copyTime,@copyType,@copySize,@userId,@copyLocation,@copyState)";
            List <SqlParameter> para = new List <SqlParameter>();
            string maxid             = DBTools.searchID("datacopy", "copyId");
            int    id = maxid != null?int.Parse(maxid) : 0;

            SqlParameter sqlpara1 = new SqlParameter("@copyId", (id + 1).ToString());
            SqlParameter sqlpara2 = new SqlParameter("@dataName", ccopy.DataName);
            SqlParameter sqlpara3 = new SqlParameter("@copyTime", ccopy.CopyTime);
            SqlParameter sqlpara4 = new SqlParameter("@copyType", ccopy.CopyType);
            SqlParameter sqlpara5 = new SqlParameter("@copySize", ccopy.CopySize);
            SqlParameter sqlpara6 = new SqlParameter("@userId", ccopy.SysUser.UserId);
            SqlParameter sqlpara7 = new SqlParameter("@copyLocation", ccopy.CopyLocation);
            SqlParameter sqlpara8 = new SqlParameter("@copyState", ccopy.CopyState);

            para.Add(sqlpara1);
            para.Add(sqlpara2);
            para.Add(sqlpara3);
            para.Add(sqlpara4);
            para.Add(sqlpara5);
            para.Add(sqlpara6);
            para.Add(sqlpara7);
            para.Add(sqlpara8);
            int i = DBTools.exenonquerySQL(sqltext, para);

            if (i == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 添加多个部门。
        /// </summary>
        /// <param name="departs">部门对象泛型集合。</param>
        /// <returns>通过布尔值判断操作是否成功。</returns>
        public bool addDeparts(List <Model.Department> departs)
        {
            for (int j = 0; j < departs.Count; j++)
            {
                string sqltext           = "insert department(departId,departName,staffNum,parentdepartName) values(@departId,@departName,@staffNum,@parentdepartName)";
                List <SqlParameter> para = new List <SqlParameter>();
                string maxid             = DBTools.searchID("department", "departId");
                int    id = maxid != null?int.Parse(maxid) : 0;

                SqlParameter sqlpara1 = new SqlParameter("@departId", (id + 1).ToString());
                SqlParameter sqlpara2 = new SqlParameter("@departName", departs[j].DepartName);
                SqlParameter sqlpara3 = new SqlParameter("@staffNum", departs[j].SysUser.StaffNum);
                SqlParameter sqlpara4 = new SqlParameter("@parentdepartName", departs[j].ParentdepartName);
                para.Add(sqlpara1);
                para.Add(sqlpara2);
                para.Add(sqlpara3);
                para.Add(sqlpara4);
                int i = DBTools.exenonquerySQL(sqltext, para);
                if (i == 1)
                {
                    continue;
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }