Example #1
0
        private void list_template_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            if (e.ColumnIndex == -1)
            {
                return;
            }
            ztinfo zt      = (ztinfo)cmbZTList.SelectedItem;
            string type    = zt.DbType;
            string id      = this.dgwtemplate.Rows[e.RowIndex].Cells["Id"].Value.ToString();
            string tmpname = this.dgwtemplate.Rows[e.RowIndex].Cells["name"].Value.ToString();

            if (Path.GetExtension(this.txtFileName.Text.Trim()).IndexOf(".xls") >= 0)
            {
                ExcelProView ex = new ExcelProView(this.txtFileName.Text, tmpname, type, id);
                if (ex.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    this.tmplate             = ex.tmp;
                    this.txtTemplate.Text    = tmplate.Name;
                    this.panTemplate.Visible = false;
                }
            }
            else
            {
                this.txtTemplate.Text    = tmpname;
                this.panTemplate.Visible = false;
            }
        }
Example #2
0
        private void list_template_CellClick(object sender, DataGridViewCellEventArgs e)
        {

            if (e.RowIndex == -1) return;
            if (e.ColumnIndex == -1) return;
            ztinfo zt = (ztinfo)cmbZTList.SelectedItem;
            string type = zt.DbType;
            string id = this.dgwtemplate.Rows[e.RowIndex].Cells["Id"].Value.ToString();
            string tmpname = this.dgwtemplate.Rows[e.RowIndex].Cells["name"].Value.ToString();

            if (Path.GetExtension(this.txtFileName.Text.Trim()).IndexOf(".xls") >= 0)
            {
                ExcelProView ex = new ExcelProView(this.txtFileName.Text, tmpname, type, id);
                if (ex.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    this.tmplate = ex.tmp;
                    this.txtTemplate.Text = tmplate.Name;
                    this.panTemplate.Visible = false;
                }
            }
            else
            {
                this.txtTemplate.Text = tmpname;
                this.panTemplate.Visible = false;
            }
        }