Exemplo n.º 1
0
        private void btnBidEvalReport_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.grdProject.CurrentRow != null)
                {
                    gpTenderProjectWebDO gptp = this.grdProject.CurrentRow.Tag as gpTenderProjectWebDO;

                    OpenFileDialog ofdl = new OpenFileDialog();
                    ofdl.Filter = "pdf(*.pdf)|*.pdf";

                    if (ofdl.ShowDialog() == DialogResult.OK)
                    {
                        gpSectionWebDO obj = new gpSectionWebDO();
                        obj.gtpId = gptp.gtpId;
                        obj.gsId  = gptp.gsId;
                        obj.evalReportUploadTime = DateTime.Now;
                        obj.evalReportFileName   = Path.GetFileName(ofdl.FileName);

                        using (Stream stream = ofdl.OpenFile())
                        {
                            byte[] bytes = new byte[stream.Length];
                            stream.Read(bytes, 0, bytes.Length);

                            bool result = bidEvaluationService.BidFileResave(obj, bytes);

                            if (result)
                            {
                                MetroMessageBox.Show(this, "上传成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MetroMessageBox.Show(this, "上传失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "请选择招标项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (System.Exception ex)
            {
                log.Error(ex);
                MetroMessageBox.Show(this, "上传失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// UpdateBidEvaluationSingState
        /// </summary>
        /// <param name="gpSectionWebDO">gpSectionWebDO</param>
        /// <param name="evalReportFile">evalReportFile</param>
        /// <returns>bool</returns>
        public bool UpdateBidEvaluationSingState(gpSectionWebDO gpSectionWebDO, byte[] evalReportFile)
        {
            resultDO result = this.wsAgent.updateBidEvaluationSingState(gpSectionWebDO, evalReportFile);

            return(result.success);
        }
        /// <summary>
        /// BidFileResave
        /// </summary>
        /// <param name="gpSectionWebDO">gpSectionWebDO</param>
        /// <param name="evalReportFile">evalReportFile</param>
        /// <returns>bool</returns>
        public bool BidFileResave(gpSectionWebDO gpSectionWebDO, byte[] evalReportFile)
        {
            resultDO result = this.wsAgent.bidFileResave(gpSectionWebDO, evalReportFile);

            return(result.success);
        }