Ejemplo n.º 1
0
        /// <summary>
        /// 文件下载事件
        /// 2017/04/12(zhuguanjun)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void File_DownLoad(object sender, EventArgs e)
        {
            #region 检查
            if (string.IsNullOrEmpty(ID))
            {
                MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "分包合同");
                return;
            }
            #endregion
            ButtonX            button = (ButtonX)sender;
            int                Type   = int.Parse(button.Name.Substring(4, 1));
            DomainDLL.Supplier entity = bll.GetSupplier(ID);
            if (entity == null)
            {
                MessageHelper.ShowMsg(MessageID.W000000005, MessageType.Alert);
                return;
            }

            //取得上传文件类型
            string fileName = string.Empty;
            switch (Type)
            {
            case 1: fileName = entity.PathYYZZ;
                break;

            case 2: fileName = entity.PathZGZ;
                break;

            case 3: fileName = entity.PathDMZ;
                break;
            }

            FileHelper.DownLoadFile(UploadType.Supplier, ProjectId, null, fileName);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Save_Click(object sender, EventArgs e)
        {
            #region 检查
            if (string.IsNullOrEmpty(ProjectId))
            {
                MessageHelper.ShowMsg(MessageID.W000000002, MessageType.Alert, "项目");
                return;
            }
            if (string.IsNullOrEmpty(txtName.Text.ToString()))
            {
                MessageHelper.ShowMsg(MessageID.W000000001, MessageType.Alert, "供应商名称");
                return;
            }
            #endregion

            string             id;
            DomainDLL.Supplier entity = new DomainDLL.Supplier();
            entity.Addr     = txtAddr.Text.ToString();
            entity.LegalMan = txtLegalMan.Text.ToString();
            entity.Manager  = txtManager.Text.ToString();
            entity.Name     = txtName.Text.ToString();
            entity.Tel      = txtTel.Text.ToString();
            entity.CREATED  = CREATED;
            entity.ID       = ID;
            entity.PID      = ProjectId;
            entity.PathDMZ  = DMZ;
            entity.PathYYZZ = YYZZ;
            entity.PathZGZ  = ZGZ;
            ////上传组织机构代码证
            //if (!string.IsNullOrEmpty(DMZtext))
            //    entity.PathDMZ = FileHelper.UploadFile(DMZtext, UploadType.Supplier, ProjectId, null);
            ////上传营业执照
            //if (!string.IsNullOrEmpty(YYZZtext))
            //    entity.PathYYZZ = FileHelper.UploadFile(YYZZtext, UploadType.Supplier, ProjectId, null);
            ////上传纳税人资格证
            //if (!string.IsNullOrEmpty(ZGZtext))
            //    entity.PathZGZ = FileHelper.UploadFile(ZGZtext, UploadType.Supplier, ProjectId, null);
            ////代码证上传失败
            //if (string.IsNullOrEmpty(entity.PathDMZ) && !string.IsNullOrEmpty(DMZtext))
            //    return;
            ////营业执照上传失败
            //else if (string.IsNullOrEmpty(entity.PathYYZZ) && !string.IsNullOrEmpty(YYZZtext))
            //    return;
            ////资格证上传失败
            //else if (string.IsNullOrEmpty(entity.PathZGZ) && !string.IsNullOrEmpty(ZGZtext))
            //    return;
            //else
            {
                JsonResult json = bll.SaveSupplier(entity, out id);
                MessageHelper.ShowRstMsg(json.result);
                if (json.result)
                {
                    Clear_Click(null, null);
                }
                DataBind();
            }
        }
Ejemplo n.º 3
0
        private void File_Upload(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ID))
            {
                MessageBox.Show("请选择供应商");
                return;
            }
            ButtonX button = (ButtonX)sender;
            int     Type   = int.Parse(button.Name.Substring(3, 1));

            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                dialog.Multiselect = false;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    DomainDLL.Supplier entity = new DomainDLL.Supplier();
                    entity = bll.GetSupplier(ID);
                    switch (Type)
                    {
                    case 1:
                        entity.PathYYZZ = FileHelper.UploadFile(dialog.FileName, UploadType.Supplier, ProjectId, null);
                        _fileYYZZName   = entity.PathYYZZ;
                        break;

                    case 2:
                        entity.PathZGZ = FileHelper.UploadFile(dialog.FileName, UploadType.Supplier, ProjectId, null);
                        _fileZGZName   = entity.PathZGZ;
                        break;

                    case 3:
                        entity.PathDMZ = FileHelper.UploadFile(dialog.FileName, UploadType.Supplier, ProjectId, null);
                        _fileDMZName   = entity.PathDMZ;
                        break;
                    }
                    if (string.IsNullOrEmpty(entity.PathYYZZ) && string.IsNullOrEmpty(entity.PathDMZ) && string.IsNullOrEmpty(entity.PathZGZ))
                    {
                        MessageHelper.ShowRstMsg(false);
                    }
                    else
                    {
                        JsonResult json = bll.SaveSupplier(entity, out ID);
                        MessageHelper.ShowRstMsg(json.result);
                        LoadFile();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void LoadFile()
        {
            DomainDLL.Supplier entity = new DomainDLL.Supplier();

            //营业执照
            entity = bll.GetSupplier(ID);
            if (entity != null && !string.IsNullOrEmpty(entity.PathYYZZ))
            {
                _fileYYZZName = entity.PathYYZZ;
                lblFile1.Show();
                btnD1.Show();
            }
            else
            {
                lblFile1.Hide();
                btnD1.Hide();
            }

            //资格证
            if (entity != null && !string.IsNullOrEmpty(entity.PathZGZ))
            {
                _fileZGZName = entity.PathZGZ;
                lblFile2.Show();
                btnD2.Show();
            }
            else
            {
                lblFile2.Hide();
                btnD2.Hide();
            }

            //代码证
            if (entity != null && !string.IsNullOrEmpty(entity.PathDMZ))
            {
                _fileDMZName = entity.PathDMZ;
                lblFile3.Show();
                btnD3.Show();
            }
            else
            {
                lblFile3.Hide();
                btnD3.Hide();
            }
        }