Exemplo n.º 1
0
        private void btnCK_Click(object sender, EventArgs e)
        {
            #region
            if (showModel == ShowModel.List)
            {
                if (UIPublicClass.PublicClass.OpenYj == YjOpenModel.ImageType)
                {
                    this.Visible       = false;
                    panelDgv.Visible   = false;
                    panelPhoto.Visible = true;
                    showModel          = ShowModel.Photo;
                    getPhotoList(DocID);

                    if (dgvYj.CurrentCell != null)
                    {
                        if (dgvYj.Rows.Count == 1)
                        {
                            ShowPhotoIndex(-1);
                        }
                        else
                        {
                            ShowPhotoIndex(dgvYj.CurrentCell.RowIndex);
                        }
                    }
                    else
                    {
                        ShowPhotoIndex(-1);
                    }
                    this.Visible = true;
                }
                else
                {
                    if (dgvYj.CurrentCell != null)
                    {
                        object path     = dgvYj.Rows[dgvYj.CurrentCell.RowIndex].Cells["Ftp目录"].Value;
                        object fileName = dgvYj.Rows[dgvYj.CurrentCell.RowIndex].Cells["Ftp保存名称"].Value;

                        if (!Object.Equals(path, string.Empty) && !Object.Equals(path, null) && !Object.Equals(path, DBNull.Value))
                        {
                            if (!Object.Equals(fileName, string.Empty) && !Object.Equals(fileName, null) && !Object.Equals(fileName, DBNull.Value))
                            {
                                UpLoadDownLoad.OpenFile(path.ToString(), fileName.ToString());
                            }
                        }
                    }
                }
            }
            #endregion
        }
Exemplo n.º 2
0
        //查看原件
        private void btnCheckYj_Click(object sender, EventArgs e)
        {
            if (dgvYj.CurrentCell != null)
            {
                object path     = dgvYj.Rows[dgvYj.CurrentCell.RowIndex].Cells["路径"].Value;
                object fileName = dgvYj.Rows[dgvYj.CurrentCell.RowIndex].Cells["保存名称"].Value;

                if (!Object.Equals(path, string.Empty) && !Object.Equals(path, null) && !Object.Equals(path, DBNull.Value))
                {
                    if (!Object.Equals(fileName, string.Empty) && !Object.Equals(fileName, null) && !Object.Equals(fileName, DBNull.Value))
                    {
                        UpLoadDownLoad.OpenFile(path.ToString(), fileName.ToString());
                    }
                }
            }
        }
Exemplo n.º 3
0
        //查看详细信息
        private void dgvYj_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            #region 查看和下载原件
            if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
            {
                object YjID     = dgvYj.Rows[e.RowIndex].Cells["原件ID"].Value;
                object desc     = dgvYj.Rows[e.RowIndex].Cells["描述"].Value;
                object ext      = dgvYj.Rows[e.RowIndex].Cells["扩展名"].Value;
                object path     = dgvYj.Rows[e.RowIndex].Cells["Ftp目录"].Value;
                object fileName = dgvYj.Rows[e.RowIndex].Cells["Ftp保存名称"].Value;

                if (dgvYj.Columns[e.ColumnIndex].Name == "载入")
                {
                    //新增行,直接调用添加原件
                    if (e.RowIndex == (dgvYj.Rows.Count - 1))
                    {
                        InputYJ(false, 0);
                    }
                    else//修改原件
                    {
                        if (!Object.Equals(YjID, "") && !Object.Equals(YjID, null) && !Object.Equals(YjID, DBNull.Value))
                        {
                            //如存在原件文件,先删除原有文件,再载入新的文件
                            if (!Object.Equals(path, string.Empty) && !Object.Equals(path, null) && !Object.Equals(path, DBNull.Value))
                            {
                                DialogResult result = MessageBox.Show("已经存在原件文件,是否要替换原有文件?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                                if (result == DialogResult.OK)
                                {
                                    UpLoadDownLoad.DeleteFile(path.ToString(), fileName.ToString());
                                }
                                else
                                {
                                    return;
                                }
                            }

                            //单个原件加载
                            InputYJ(false, Convert.ToInt32(YjID));
                        }
                    }

                    if (dgvYj.Rows.Count > 1)
                    {
                        dgvYj.CurrentCell = dgvYj.Rows[e.RowIndex].Cells[dgvYj.FirstDisplayedCell.ColumnIndex];
                    }
                }

                if (dgvYj.Columns[e.ColumnIndex].Name == "查看" &&
                    e.RowIndex != (dgvYj.Rows.Count - 1))
                {
                    if (!Object.Equals(path, string.Empty) && !Object.Equals(path, null) && !Object.Equals(path, DBNull.Value))
                    {
                        if (!Object.Equals(fileName, string.Empty) && !Object.Equals(fileName, null) && !Object.Equals(fileName, DBNull.Value))
                        {
                            UpLoadDownLoad.OpenFile(path.ToString(), fileName.ToString());
                        }
                    }
                }

                if (dgvYj.Columns[e.ColumnIndex].Name == "下载" &&
                    e.RowIndex != (dgvYj.Rows.Count - 1))
                {
                    if (!Object.Equals(path, string.Empty) && !Object.Equals(path, null) && !Object.Equals(path, DBNull.Value))
                    {
                        if (!Object.Equals(fileName, string.Empty) && !Object.Equals(fileName, null) && !Object.Equals(fileName, DBNull.Value))
                        {
                            UIPublicClass.PublicClass.DownLoadFile(Convert.ToString(path), Convert.ToString(fileName), Convert.ToString(desc), Convert.ToString(ext));
                        }
                    }
                }

                if (dgvYj.Columns[e.ColumnIndex].Name == "删除" &&
                    e.RowIndex != (dgvYj.Rows.Count - 1))
                {
                    DialogResult result = MessageBox.Show("确实要删除原件吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    if (result == DialogResult.OK)
                    {
                        if (!Object.Equals(YjID, "") && !Object.Equals(YjID, null) && !Object.Equals(YjID, DBNull.Value))
                        {
                            if (!Object.Equals(path, string.Empty) && !Object.Equals(path, null) && !Object.Equals(path, DBNull.Value))
                            {
                                if (!Object.Equals(fileName, string.Empty) && !Object.Equals(fileName, null) && !Object.Equals(fileName, DBNull.Value))
                                {
                                    UpLoadDownLoad.DeleteFile(path.ToString(), fileName.ToString());
                                }
                            }
                            gd_yj.DeleteYj(Convert.ToInt32(YjID));
                        }

                        MessageBox.Show("删除成功!");
                        ds = gd_yj.getData(DocID);
                        dgvYj.DataSource = ds.Tables[0];
                        table            = ds.Tables[0];
                        lblCount.Text    = Convert.ToString(dgvYj.Rows.Count - 1);
                        if (dgvYj.Rows.Count == 1)
                        {
                            txt行号.Text = "1";
                        }
                        else
                        {
                            txt行号.Text = Convert.ToString(dgvYj.CurrentCell.RowIndex + 1);
                        }
                    }
                }
            }
            #endregion
        }