Ejemplo n.º 1
0
        /// <summary>
        /// 改变操作状态
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool ChangeState(OfficeDocItem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update OA_OfficeDocItem set ");
            strSql.Append("Opinion=@Opinion,");
            strSql.Append("state=@state,");
            strSql.Append("OperateTime=@OperateTime");
            strSql.Append(" where OfficeDocItemID=@OfficeDocItemID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Opinion",         SqlDbType.NVarChar,  500),
                new SqlParameter("@state",           SqlDbType.Char,        1),
                new SqlParameter("@OperateTime",     SqlDbType.DateTime),
                new SqlParameter("@OfficeDocItemID", SqlDbType.VarChar, 36)
            };
            parameters[0].Value = model.Opinion;
            parameters[1].Value = model.state;
            parameters[2].Value = model.OperateTime;
            parameters[3].Value = model.OfficeDocItemID;

            int rows = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增公文
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddOfficeDoc(OfficeDoc model, IList <OfficeDocItem> list)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OA_OfficeDoc(");
            strSql.Append("OfficeDocID,Title,Contents,WriterID,WriteTime)");
            strSql.Append(" values (");
            strSql.Append("@OfficeDocID,@Title,@Contents,@WriterID,@WriteTime)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OfficeDocID", SqlDbType.VarChar,   36),
                new SqlParameter("@Title",       SqlDbType.NVarChar, 100),
                new SqlParameter("@Contents",    SqlDbType.Text),
                new SqlParameter("@WriterID",    SqlDbType.VarChar,   36),
                new SqlParameter("@WriteTime",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.OfficeDocID;
            parameters[1].Value = model.Title;
            parameters[2].Value = model.Contents;
            parameters[3].Value = model.WriterID;
            parameters[4].Value = model.WriteTime;

            IDbTransaction transaction = DBAccess.BeginDbTransaction(DB.Type, DB.ConnectionString);

            try
            {
                DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

                OfficeDocItemDAL itemBll = new OfficeDocItemDAL();

                for (int i = 0; i < list.Count; i++)
                {
                    OfficeDocItem item = list[i] as OfficeDocItem;
                    itemBll.AddOfficeDocItem(item);
                }
                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            return(1);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 新增公文行
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddOfficeDocItem(OfficeDocItem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OA_OfficeDocItem(");
            strSql.Append("OfficeDocItemID,OfficeDocID,ReceiverID,OperateType,state)");
            strSql.Append(" values (");
            strSql.Append("@OfficeDocItemID,@OfficeDocID,@ReceiverID,@OperateType,@state)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OfficeDocItemID", SqlDbType.VarChar, 36),
                new SqlParameter("@OfficeDocID",     SqlDbType.VarChar, 36),
                new SqlParameter("@ReceiverID",      SqlDbType.VarChar, 36),
                new SqlParameter("@OperateType",     SqlDbType.Char,     1),
                new SqlParameter("@state",           SqlDbType.Char, 1)
            };
            parameters[0].Value = model.OfficeDocItemID;
            parameters[1].Value = model.OfficeDocID;
            parameters[2].Value = model.ReceiverID;
            parameters[3].Value = model.OperateType;
            parameters[4].Value = model.state;

            return(DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取办理公文模型
        /// </summary>
        /// <param name="OfficeDocItemID"></param>
        /// <returns></returns>
        public OfficeDocItem GetModel(string OfficeDocItemID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.AppendFormat("select top 1 B.*,A.Title,A.Contents,A.WriterID,A.WriteTime,U.UserName from OA_OfficeDoc A ");
            strSql.AppendFormat(" inner join OA_OfficeDocItem B on A.OfficeDocID=B.OfficeDocID ");
            strSql.AppendFormat(" left join OA_User U on U.UserID=A.WriterID where OfficeDocItemID = '{0}' ", OfficeDocItemID);
            SqlParameter[] parameters =
            {
                new SqlParameter("@OfficeDocItemID", SqlDbType.VarChar, 36)
            };
            parameters[0].Value = OfficeDocItemID;

            OfficeDocItem model = new OfficeDocItem();
            DataSet       ds    = DBAccess.ExecuteDataset(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["OfficeDocItemID"] != null && ds.Tables[0].Rows[0]["OfficeDocItemID"].ToString() != "")
                {
                    model.OfficeDocItemID = ds.Tables[0].Rows[0]["OfficeDocItemID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OfficeDocID"] != null && ds.Tables[0].Rows[0]["OfficeDocID"].ToString() != "")
                {
                    model.OfficeDocID = ds.Tables[0].Rows[0]["OfficeDocID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ReceiverID"] != null && ds.Tables[0].Rows[0]["ReceiverID"].ToString() != "")
                {
                    model.ReceiverID = ds.Tables[0].Rows[0]["ReceiverID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Opinion"] != null && ds.Tables[0].Rows[0]["Opinion"].ToString() != "")
                {
                    model.Opinion = ds.Tables[0].Rows[0]["Opinion"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OperateType"] != null && ds.Tables[0].Rows[0]["OperateType"].ToString() != "")
                {
                    model.OperateType = ds.Tables[0].Rows[0]["OperateType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["state"] != null && ds.Tables[0].Rows[0]["state"].ToString() != "")
                {
                    model.state = ds.Tables[0].Rows[0]["state"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OperateTime"] != null && ds.Tables[0].Rows[0]["OperateTime"].ToString() != "")
                {
                    model.OperateTime = DateTime.Parse(ds.Tables[0].Rows[0]["OperateTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Title"] != null && ds.Tables[0].Rows[0]["Title"].ToString() != "")
                {
                    model.Title = ds.Tables[0].Rows[0]["Title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Contents"] != null && ds.Tables[0].Rows[0]["Contents"].ToString() != "")
                {
                    model.Contents = ds.Tables[0].Rows[0]["Contents"].ToString();
                }
                if (ds.Tables[0].Rows[0]["WriterID"] != null && ds.Tables[0].Rows[0]["WriterID"].ToString() != "")
                {
                    model.WriterID = ds.Tables[0].Rows[0]["WriterID"].ToString();
                }
                if (ds.Tables[0].Rows[0]["WriteTime"] != null && ds.Tables[0].Rows[0]["WriteTime"].ToString() != "")
                {
                    model.WriteTime = DateTime.Parse(ds.Tables[0].Rows[0]["WriteTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UserName"] != null && ds.Tables[0].Rows[0]["UserName"].ToString() != "")
                {
                    model.UserName = ds.Tables[0].Rows[0]["UserName"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 改变操作状态
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool ChangeState(OfficeDocItem model)
 {
     return(iOfficeDocItemDAL.ChangeState(model));
 }