Exemple #1
0
        /// <summary>
        /// 对象编辑
        /// </summary>
        /// <param name="tOaPartCollar_UpdateSet">UpdateSet用户对象</param>
        /// <param name="tOaPartCollar_UpdateWhere">UpdateWhere用户对象</param>
        /// <returns>是否成功</returns>
        public bool Edit(TOaPartCollarVo tOaPartCollar_UpdateSet, TOaPartCollarVo tOaPartCollar_UpdateWhere)
        {
            string strSQL = SqlHelper.BuildUpdateExpress(tOaPartCollar_UpdateSet, TOaPartCollarVo.T_OA_PART_COLLAR_TABLE);

            strSQL += this.BuildWhereStatement(tOaPartCollar_UpdateWhere);
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false);
        }
Exemple #2
0
        /// <summary>
        /// 获取领用物料明细
        /// </summary>
        /// <param name="tOaPartCollar"></param>
        /// <param name="tOaPartInfor"></param>
        /// <param name="iIndex"></param>
        /// <param name="iCount"></param>
        /// <returns></returns>
        public DataTable SelectUnionPartByTable(TOaPartCollarVo tOaPartCollar, TOaPartInfoVo tOaPartInfor, int iIndex, int iCount)
        {
            string strSQL = @" SELECT A.ID,A.PART_ID,A.USED_QUANTITY,A.USER_ID,A.LASTIN_DATE,A.REMARK1,A.REASON,B.PART_NAME,B.PART_CODE,B.UNIT,B.MODELS,C.REAL_NAME,C.USER_NAME
                                           FROM T_OA_PART_COLLAR A 
                                           JOIN T_OA_PART_INFO B ON B.ID=A.PART_ID and B.IS_DEL='0' 
                                           LEFT JOIN T_SYS_USER C ON C.ID=A.USER_ID WHERE 1=1";

            if (!String.IsNullOrEmpty(tOaPartCollar.ID))
            {
                strSQL += String.Format(" AND A.ID IN ('{0}')", tOaPartCollar.ID);
            }
            if (!String.IsNullOrEmpty(tOaPartInfor.ID))
            {
                strSQL += String.Format(" AND B.ID = '{0}'", tOaPartInfor.ID);
            }
            if (!String.IsNullOrEmpty(tOaPartInfor.PART_CODE))
            {
                strSQL += String.Format(" AND B.PART_CODE LIKE '%{0}%'", tOaPartInfor.PART_CODE);
            }
            if (!String.IsNullOrEmpty(tOaPartInfor.PART_NAME))
            {
                strSQL += String.Format(" AND B.PART_NAME LIKE '%{0}%'", tOaPartInfor.PART_NAME);
            }

            if (!String.IsNullOrEmpty(tOaPartCollar.REMARK4) && !String.IsNullOrEmpty(tOaPartCollar.REMARK5))
            {
                strSQL += " AND CONVERT(DATETIME, CONVERT(VARCHAR(100), A.LASTIN_DATE,23),111)  ";
                strSQL += String.Format("  BETWEEN  CONVERT(DATETIME, CONVERT(varchar(100), '{0}',23),111) AND CONVERT(DATETIME, CONVERT(varchar(100), '{1}',23),111)", tOaPartCollar.REMARK4, tOaPartCollar.REMARK5);
            }
            if (!String.IsNullOrEmpty(tOaPartCollar.USER_ID))
            {
                strSQL += String.Format(" AND C.REAL_NAME LIKE '%{0}%'", tOaPartCollar.USER_ID);
            }
            return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount)));
        }
Exemple #3
0
        /// <summary>
        /// 获取对象DataTable
        /// </summary>
        /// <param name="tOaPartCollar">对象</param>
        /// <param name="iIndex">起始页码</param>
        /// <param name="iCount">每页数目</param>
        /// <returns>返回结果</returns>
        public DataTable SelectByTable(TOaPartCollarVo tOaPartCollar, int iIndex, int iCount)
        {
            string strSQL = " select * from T_OA_PART_COLLAR {0} ";

            strSQL = String.Format(strSQL, BuildWhereStatement(tOaPartCollar));
            return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount)));
        }
Exemple #4
0
        /// <summary>
        /// 对象编辑
        /// </summary>
        /// <param name="tOaPartCollar">用户对象</param>
        /// <returns>是否成功</returns>
        public bool Edit(TOaPartCollarVo tOaPartCollar)
        {
            string strSQL = SqlHelper.BuildUpdateExpress(tOaPartCollar, TOaPartCollarVo.T_OA_PART_COLLAR_TABLE);

            strSQL += string.Format(" where ID='{0}' ", tOaPartCollar.ID);
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false);
        }
Exemple #5
0
    public void PartCollarInfor()
    {
        DataTable       dt           = new DataTable();
        TOaPartCollarVo objItems     = new TOaPartCollarVo();
        TOaPartInfoVo   objItemParts = new TOaPartInfoVo();

        if (!String.IsNullOrEmpty(strPartCollarId))
        {
            objItems.ID = strPartCollarId;
        }
        objItems.USER_ID = strReal_Name;
        if (!String.IsNullOrEmpty(strBeginDate) || !String.IsNullOrEmpty(strEndDate))
        {
            objItems.REMARK4 = strBeginDate;
            objItems.REMARK5 = strEndDate;
        }

        if (!String.IsNullOrEmpty(strPartCode) || !String.IsNullOrEmpty(strPartName) || !String.IsNullOrEmpty(strPartId))
        {
            objItemParts.ID        = strPartId;
            objItemParts.PART_NAME = strPartName;
            objItemParts.PART_CODE = strPartCode;
        }

        dt = new TOaPartCollarLogic().SelectUnionPartByTable(objItems, objItemParts, 0, 0);

        ReportDataSource rds = new ReportDataSource("DataSet1", dt);

        this.reportViewer1.LocalReport.DataSources.Clear();
        this.reportViewer1.LocalReport.DataSources.Add(rds);
        this.reportViewer1.LocalReport.Refresh();
    }
Exemple #6
0
        /// <summary>
        /// 对象删除
        /// </summary>
        /// <param name="Id">ID</param>
        /// <returns>是否成功</returns>
        public bool Delete(TOaPartCollarVo tOaPartCollar)
        {
            string strSQL = "delete from T_OA_PART_COLLAR ";

            strSQL += this.BuildWhereStatement(tOaPartCollar);

            return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false);
        }
    protected void btnExport_Click(object sender, EventArgs e)
    {
        string strPartCollarId = "";

        strPartCollarId = this.hidExportDate.Value.ToString();
        DataTable       dt           = new DataTable();
        TOaPartCollarVo objItems     = new TOaPartCollarVo();
        TOaPartInfoVo   objItemParts = new TOaPartInfoVo();

        objItems.ID = strPartCollarId.Replace(",", "','");
        if (!String.IsNullOrEmpty(strPartId))
        {
            objItemParts.ID = strPartId;
        }
        dt = new TOaPartCollarLogic().SelectUnionPartByTable(objItems, objItemParts, 0, 0);
        FileStream   file         = new FileStream(HttpContext.Current.Server.MapPath("template/PartUsedHistorySheet.xls"), FileMode.Open, FileAccess.Read);
        HSSFWorkbook hssfworkbook = new HSSFWorkbook(file);
        ISheet       sheet        = hssfworkbook.GetSheet("Sheet1");

        sheet.GetRow(2).GetCell(0).SetCellValue("生成日期:" + DateTime.Now.ToString("yyyy-MM-dd"));
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            sheet.GetRow(i + 4).GetCell(0).SetCellValue(dt.Rows[i]["PART_NAME"].ToString());
            sheet.GetRow(i + 4).GetCell(1).SetCellValue(dt.Rows[i]["PART_CODE"].ToString());
            sheet.GetRow(i + 4).GetCell(2).SetCellValue(dt.Rows[i]["USED_QUANTITY"].ToString());
            sheet.GetRow(i + 4).GetCell(3).SetCellValue(dt.Rows[i]["LASTIN_DATE"].ToString());
            sheet.GetRow(i + 4).GetCell(4).SetCellValue(dt.Rows[i]["REAL_NAME"].ToString());
            sheet.GetRow(i + 4).GetCell(5).SetCellValue(dt.Rows[i]["REASON"].ToString());
        }
        using (MemoryStream stream = new MemoryStream())
        {
            hssfworkbook.Write(stream);
            HttpContext curContext = HttpContext.Current;
            // 设置编码和附件格式
            curContext.Response.ContentType     = "application/vnd.ms-excel";
            curContext.Response.ContentEncoding = Encoding.UTF8;
            curContext.Response.Charset         = "";
            curContext.Response.AppendHeader("Content-Disposition",
                                             "attachment;filename=" + HttpUtility.UrlEncode("物料领用历史明细表-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls", Encoding.UTF8));
            curContext.Response.BinaryWrite(stream.GetBuffer());
            curContext.Response.End();
        }
    }
Exemple #8
0
        /// <summary>
        /// 根据对象构造条件语句
        /// </summary>
        /// <param name="tOaPartCollar"></param>
        /// <returns></returns>
        public string BuildWhereStatement(TOaPartCollarVo tOaPartCollar)
        {
            StringBuilder strWhereStatement = new StringBuilder(" Where 1=1 ");

            if (null != tOaPartCollar)
            {
                //编号
                if (!String.IsNullOrEmpty(tOaPartCollar.ID.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND ID = '{0}'", tOaPartCollar.ID.ToString()));
                }
                //物料ID
                if (!String.IsNullOrEmpty(tOaPartCollar.PART_ID.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND PART_ID = '{0}'", tOaPartCollar.PART_ID.ToString()));
                }
                //领用数量
                if (!String.IsNullOrEmpty(tOaPartCollar.USED_QUANTITY.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND USED_QUANTITY = '{0}'", tOaPartCollar.USED_QUANTITY.ToString()));
                }
                //领用人ID
                if (!String.IsNullOrEmpty(tOaPartCollar.USER_ID.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND USER_ID = '{0}'", tOaPartCollar.USER_ID.ToString()));
                }
                //领用日期
                if (!String.IsNullOrEmpty(tOaPartCollar.LASTIN_DATE.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND LASTIN_DATE = '{0}'", tOaPartCollar.LASTIN_DATE.ToString()));
                }
                //领用理由
                if (!String.IsNullOrEmpty(tOaPartCollar.REASON.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REASON = '{0}'", tOaPartCollar.REASON.ToString()));
                }
                //备注1
                if (!String.IsNullOrEmpty(tOaPartCollar.REMARK1.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK1 = '{0}'", tOaPartCollar.REMARK1.ToString()));
                }
                //备注2
                if (!String.IsNullOrEmpty(tOaPartCollar.REMARK2.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK2 = '{0}'", tOaPartCollar.REMARK2.ToString()));
                }
                //备注3
                if (!String.IsNullOrEmpty(tOaPartCollar.REMARK3.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK3 = '{0}'", tOaPartCollar.REMARK3.ToString()));
                }
                //备注4
                if (!String.IsNullOrEmpty(tOaPartCollar.REMARK4.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK4 = '{0}'", tOaPartCollar.REMARK4.ToString()));
                }
                //备注5
                if (!String.IsNullOrEmpty(tOaPartCollar.REMARK5.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK5 = '{0}'", tOaPartCollar.REMARK5.ToString()));
                }
            }
            return(strWhereStatement.ToString());
        }
Exemple #9
0
        /// <summary>
        /// 对象明细
        /// </summary>
        /// <param name="tOaPartCollar">对象条件</param>
        /// <returns>对象</returns>
        public TOaPartCollarVo Details(TOaPartCollarVo tOaPartCollar)
        {
            string strSQL = String.Format("select * from  T_OA_PART_COLLAR " + this.BuildWhereStatement(tOaPartCollar));

            return(SqlHelper.ExecuteObject(new TOaPartCollarVo(), strSQL));
        }
 /// <summary>
 /// 对象编辑
 /// </summary>
 /// <param name="tOaPartCollar_UpdateSet">UpdateSet用户对象</param>
 /// <param name="tOaPartCollar_UpdateWhere">UpdateWhere用户对象</param>
 /// <returns>是否成功</returns>
 public bool Edit(TOaPartCollarVo tOaPartCollar_UpdateSet, TOaPartCollarVo tOaPartCollar_UpdateWhere)
 {
     return(access.Edit(tOaPartCollar_UpdateSet, tOaPartCollar_UpdateWhere));
 }
Exemple #11
0
        /// <summary>
        /// 获得查询结果总行数,用于分页
        /// </summary>
        /// <param name="tOaPartCollar">对象</param>
        /// <returns>返回行数</returns>
        public int GetSelectResultCount(TOaPartCollarVo tOaPartCollar)
        {
            string strSQL = "select Count(*) from T_OA_PART_COLLAR " + this.BuildWhereStatement(tOaPartCollar);

            return(Convert.ToInt32(SqlHelper.ExecuteScalar(strSQL)));
        }
 /// <summary>
 /// 获得查询结果总行数,用于分页
 /// </summary>
 /// <param name="tOaPartCollar">对象</param>
 /// <returns>返回行数</returns>
 public int GetSelectResultCount(TOaPartCollarVo tOaPartCollar)
 {
     return(access.GetSelectResultCount(tOaPartCollar));
 }
 /// <summary>
 /// 对象删除
 /// </summary>
 /// <param name="Id">ID</param>
 /// <returns>是否成功</returns>
 public bool Delete(TOaPartCollarVo tOaPartCollar)
 {
     return(access.Delete(tOaPartCollar));
 }
Exemple #14
0
        /// <summary>
        /// 对象添加
        /// </summary>
        /// <param name="tOaPartCollar">对象</param>
        /// <returns>是否成功</returns>
        public bool Create(TOaPartCollarVo tOaPartCollar)
        {
            string strSQL = SqlHelper.BuildInsertExpress(tOaPartCollar, TOaPartCollarVo.T_OA_PART_COLLAR_TABLE);

            return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false);
        }
Exemple #15
0
        /// <summary>
        /// 根据对象获取全部数据,用Table承载
        ///  数据量较小时使用【不推荐】
        /// </summary>
        /// <param name="tOaPartCollar"></param>
        /// <returns></returns>
        public DataTable SelectByTable(TOaPartCollarVo tOaPartCollar)
        {
            string strSQL = "select * from T_OA_PART_COLLAR " + this.BuildWhereStatement(tOaPartCollar);

            return(SqlHelper.ExecuteDataTable(strSQL));
        }
 /// <summary>
 /// 根据对象获取全部数据,用Table承载
 ///  数据量较小时使用【不推荐】
 /// </summary>
 /// <param name="tOaPartCollar"></param>
 /// <returns></returns>
 public DataTable SelectByTable(TOaPartCollarVo tOaPartCollar)
 {
     return(access.SelectByTable(tOaPartCollar));
 }
 /// <summary>
 /// 对象添加
 /// </summary>
 /// <param name="sysRole">对象</param>
 /// <returns>是否成功</returns>
 public bool Create(TOaPartCollarVo tOaPartCollar)
 {
     return(access.Create(tOaPartCollar));
 }
 /// <summary>
 /// 获取对象DataTable
 /// </summary>
 /// <param name="tOaPartCollar">对象</param>
 /// <param name="iIndex">起始页码</param>
 /// <param name="iCount">每页数目</param>
 /// <returns>返回结果</returns>
 public DataTable SelectByTable(TOaPartCollarVo tOaPartCollar, int iIndex, int iCount)
 {
     return(access.SelectByTable(tOaPartCollar, iIndex, iCount));
 }
 /// <summary>
 /// 获取对象List
 /// </summary>
 /// <param name="tOaPartCollar">对象</param>
 /// <param name="iIndex">起始页码</param>
 /// <param name="iCount">每页数目</param>
 /// <returns>返回结果</returns>
 public List <TOaPartCollarVo> SelectByObject(TOaPartCollarVo tOaPartCollar, int iIndex, int iCount)
 {
     return(access.SelectByObject(tOaPartCollar, iIndex, iCount));
 }
 /// <summary>
 /// 对象明细
 /// </summary>
 /// <param name="tOaPartCollar">对象条件</param>
 /// <returns>对象</returns>
 public TOaPartCollarVo Details(TOaPartCollarVo tOaPartCollar)
 {
     return(access.Details(tOaPartCollar));
 }
Exemple #21
0
        /// <summary>
        /// 获取对象List
        /// </summary>
        /// <param name="tOaPartCollar">对象</param>
        /// <param name="iIndex">起始页码</param>
        /// <param name="iCount">每页数目</param>
        /// <returns>返回结果</returns>
        public List <TOaPartCollarVo> SelectByObject(TOaPartCollarVo tOaPartCollar, int iIndex, int iCount)
        {
            string strSQL = String.Format("select * from  T_OA_PART_COLLAR " + this.BuildWhereStatement(tOaPartCollar));

            return(SqlHelper.ExecuteObjectList(tOaPartCollar, BuildPagerExpress(strSQL, iIndex, iCount)));
        }
 public int GetUnionPartByTableCount(TOaPartCollarVo tOaPartCollar, TOaPartInfoVo tOaPartInfor)
 {
     return(access.GetUnionPartByTableCount(tOaPartCollar, tOaPartInfor));
 }
 /// <summary>
 /// 对象编辑
 /// </summary>
 /// <param name="tOaPartCollar">用户对象</param>
 /// <returns>是否成功</returns>
 public bool Edit(TOaPartCollarVo tOaPartCollar)
 {
     return(access.Edit(tOaPartCollar));
 }
 public DataTable SelectUnionPartByTable(TOaPartCollarVo tOaPartCollar, TOaPartInfoVo tOaPartInfor, int iIndex, int iCount)
 {
     return(access.SelectUnionPartByTable(tOaPartCollar, tOaPartInfor, iIndex, iCount));
 }
 /// <summary>
 /// 根据对象特征获取单一对象
 /// </summary>
 /// <param name="tOaPartCollar">对象</param>
 /// <returns></returns>
 public TOaPartCollarVo SelectByObject(TOaPartCollarVo tOaPartCollar)
 {
     return(access.SelectByObject(tOaPartCollar));
 }
 public TOaPartCollarLogic(TOaPartCollarVo _tOaPartCollar)
 {
     tOaPartCollar = _tOaPartCollar;
     access        = new TOaPartCollarAccess();
 }