Example #1
0
        //上传收货凭证
        private void btn_up2_Click(object sender, EventArgs e)
        {
            string filePath = "";

            FID = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString();

            //创建文件弹出选择窗口(包括文件名)对象
            OpenFileDialog ofd = new OpenFileDialog();

            //判断选择的路径
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                progressBar1.Visible = true;
                //this.txtSoundPath.Text = ofd.FileName.ToString();
                filePath = ofd.FileName.ToString();
                try
                {
                    //上传后文件保存的名称
                    string saveName = FID + "_SHPZ" + ".jpg";
                    int    count    = UpFile.UpSound_Request(filePath, saveName, this.progressBar1);
                    if (count > 0)
                    {
                        MessageBox.Show("上传文件成功!");
                        progressBar1.Visible = false;

                        DataSet ds     = null;
                        int     result = -1;
                        try
                        {
                            DateTime currentTime = DateTime.Now;
                            string   time        = currentTime.ToString("yyyy-MM-dd HH:mm:ss");
                            string   strSql      = string.Format("exec UP_TLogistics_ADD '{0}','{1}','{2}','{3}','{4}','{5}'",
                                                                 FID, 2, dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[7].Value.ToString(), saveName, dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[8].Value.ToString(), time);
                            ds = DbFunc.GetTableNoName(strSql);
                            if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                            {
                                DataTable dt = ds.Tables[0];
                                result = (int)dt.Rows[0]["Result"];
                            }
                        }
                        catch
                        {
                        }

                        query();
                    }
                    else
                    {
                        MessageBox.Show("上传文件失败!");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("" + ex.GetBaseException());
                }
            }
        }
Example #2
0
        private void btn_up_Click(object sender, EventArgs e)
        {
            //创建文件弹出选择窗口(包括文件名)对象
            OpenFileDialog ofd = new OpenFileDialog();

            //判断选择的路径
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                progressBar1.Visible = true;
                //this.txtSoundPath.Text = ofd.FileName.ToString();
                filePath = ofd.FileName.ToString();
                try
                {
                    //上传后文件保存的名称
                    string saveName = FID + ".doc";
                    int    count    = UpFile.UpSound_Request(filePath, saveName, this.progressBar1);
                    if (count > 0)
                    {
                        MessageBox.Show("上传文件成功!");
                        progressBar1.Visible = false;

                        DataSet ds     = null;
                        int     result = -1;
                        try
                        {
                            string strSql = string.Format("exec UP_TForm_ADD '{0}','{1}','{2}','{3}','{4}'",
                                                          FID, CID, lab_num.Text, lab_price.Text, 1);
                            ds = DbFunc.GetTableNoName(strSql);
                            if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                            {
                                DataTable dt = ds.Tables[0];
                                result = (int)dt.Rows[0]["Result"];
                            }
                        }
                        catch
                        {
                        }

                        query();
                    }
                    else
                    {
                        MessageBox.Show("上传文件失败!");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("" + ex.GetBaseException());
                }
            }
        }
Example #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.RowCount == 0)
            {
                MessageBox.Show("没有选中任何产品,请选中后重试!", "提示");
            }
            else
            {
                string filePath = "";

                //创建文件弹出选择窗口(包括文件名)对象
                OpenFileDialog ofd = new OpenFileDialog();
                //判断选择的路径
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    progressBar1.Visible = true;
                    //this.txtSoundPath.Text = ofd.FileName.ToString();
                    filePath = ofd.FileName.ToString();
                    try
                    {
                        //上传后文件保存的名称
                        int    a        = dataGridView1.CurrentRow.Index;
                        int    id       = (int)dataGridView1.Rows[a].Cells[0].Value;
                        string name     = dataGridView1.Rows[a].Cells[1].Value.ToString();
                        string saveName = name + ".doc";
                        int    count    = UpFile.UpSound_Request(filePath, saveName, this.progressBar1);
                        if (count > 0)
                        {
                            MessageBox.Show("上传文件成功!");
                            progressBar1.Visible = false;

                            DataSet ds     = null;
                            int     result = -1;
                            try
                            {
                                DateTime currentTime = DateTime.Now;
                                string   time        = currentTime.ToString("yyyy-MM-dd HH:mm:ss");
                                string   strSql      = string.Format("exec UP_TStaff_Resume '{0}','{1}'", id, saveName);
                                ds = DbFunc.GetTableNoName(strSql);
                                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                                {
                                    DataTable dt = ds.Tables[0];
                                    result = (int)dt.Rows[0]["Result"];
                                }
                            }
                            catch
                            {
                            }

                            query();
                        }
                        else
                        {
                            MessageBox.Show("上传文件失败!");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("" + ex.GetBaseException());
                    }
                }
            }
        }