Exemplo n.º 1
0
        private void btnAddChangeBillAttachment_Click(object sender, EventArgs e)
        {
            if (txtFilePath.Text.Trim() == "")
            {
                this.ShowAlertMessage("请选择文件!");
                return;
            }
            byte[] byteFile = FileToBinary(txtFilePath.Text.Trim());

            ChangeBillDataAttachment ChangeBillDataAttachment = new ChangeBillDataAttachment();

            ChangeBillDataAttachment.ChangeBillDataAttachmentGuID = Guid.NewGuid().ToString();
            ChangeBillDataAttachment.ChangeBillGuID = txtGuid.Text;
            ChangeBillDataAttachment.FileContent    = byteFile;
            ChangeBillDataAttachment.FileSourceName = txtFilePath.Tag.ToString();

            lst.Add(ChangeBillDataAttachment);

            //文件增加到chklist中
            ListItem item = new ListItem();

            item.Text  = ChangeBillDataAttachment.FileSourceName;
            item.Value = ChangeBillDataAttachment.ChangeBillDataAttachmentGuID;
            chklstFile.Items.Add(item);



            txtFilePath.Text = "";
            //填充数据
            //gridView1.AddNewRow();
            //gridView1.SetFocusedRowCellValue(gridChangeBillDataAttachmentGuid , Guid.NewGuid().ToString());
            //gridView1.SetFocusedRowCellValue(gridChangeBillGuID,  txtGuid.TextD);
            //gridView1.SetFocusedRowCellValue(ChangeBillContent,byteChangeBill);
            //gridView1.SetFocusedRowCellValue(gridUnit, base.GetBasicDataNameByID(material.Unit));
            //gridView1.SetFocusedRowCellValue(gridSpec, base.GetBasicDataNameByID(material.Spec));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="MaterialGuid"></param>
        private void FillData(string ChangeBillGuID)
        {
            ChangeBillManage ChangeBillManage = new ChangeBillManage();

            DataTable dtl = ChangeBillManage.GetChangeBillByChangeBillGuID(ChangeBillGuID);

            if (dtl.Rows.Count > 0)
            {
                txtGuid.Text         = dtl.Rows[0]["ChangeBillGuID"].ToString();
                txtChangeBillID.Text = dtl.Rows[0]["ChangeBillID"].ToString();

                if (dtl.Rows[0]["ChangeBillDate"].ToString() != "")
                {
                    dtpChangeBillDate.Text = DateTime.Parse(dtl.Rows[0]["ChangeBillDate"].ToString()).ToString("yyyy-MM-dd");
                }
                txtChangePerson.Text = dtl.Rows[0]["ChangePersonName"].ToString();
                txtChangePerson.Tag  = dtl.Rows[0]["ChangePerson"].ToString();

                txtFileID.Text = dtl.Rows[0]["FileID"].ToString();
                txtFileID.Tag  = dtl.Rows[0]["FileGuID"].ToString();

                txtFileName.Text = dtl.Rows[0]["FileName"].ToString();

                txtOldVersionID.Text = dtl.Rows[0]["OldVersionID"].ToString();

                txtNewVersionID.Text = dtl.Rows[0]["NewVersionID"].ToString();
                txtRemark.Text       = dtl.Rows[0]["Remark"].ToString();

                txtCreateGuid.Tag  = dtl.Rows[0]["CreateGuid"].ToString();
                txtCreateGuid.Text = dtl.Rows[0]["CreateName"].ToString();
                if (dtl.Rows[0]["CreateDate"].ToString().Contains("1900-01-01") == false)
                {
                    txtCreateDate.Text = dtl.Rows[0]["CreateDate"].ToString();
                }
                else
                {
                    txtCreateDate.Text = "";
                }


                txtCheckGuid.Tag  = dtl.Rows[0]["CheckGuid"].ToString();
                txtCheckGuid.Text = dtl.Rows[0]["CheckName"].ToString();



                if (dtl.Rows[0]["CheckDate"].ToString().Contains("1900-01-01") == false)
                {
                    txtCheckDate.Text = dtl.Rows[0]["CheckDate"].ToString();
                }
                else
                {
                    txtCheckDate.Text = "";
                }



                //是否一级审核
                if (txtCheckGuid.Text.Trim() != "")
                {
                    tsbSave.Enabled = false;

                    tsbCheck.Enabled   = false;
                    tsbUnCheck.Enabled = true;
                }
                else
                {
                    tsbSave.Enabled = true;

                    tsbCheck.Enabled   = true;
                    tsbUnCheck.Enabled = false;
                }
            }



            //加载明细数据

            DataTable dtlDetail = ChangeBillManage.GetChangeBillDataAttachment(ChangeBillGuID);

            for (int i = 0; i < dtlDetail.Rows.Count; i++)
            {
                byte[] byteFile = (byte[])dtlDetail.Rows[i]["FileContent"];

                ChangeBillDataAttachment ChangeBillDataAttachment = new ChangeBillDataAttachment();
                ChangeBillDataAttachment.ChangeBillDataAttachmentGuID = dtlDetail.Rows[i]["ChangeBillDataAttachmentGuID"].ToString();
                ChangeBillDataAttachment.ChangeBillGuID = dtlDetail.Rows[i]["ChangeBillGuID"].ToString();
                ChangeBillDataAttachment.FileContent    = byteFile;
                ChangeBillDataAttachment.FileSourceName = dtlDetail.Rows[i]["FileSourceName"].ToString();

                lst.Add(ChangeBillDataAttachment);

                //文件增加到chklist中
                ListItem item = new ListItem();
                item.Text  = ChangeBillDataAttachment.FileSourceName;
                item.Value = ChangeBillDataAttachment.ChangeBillDataAttachmentGuID;
                chklstFile.Items.Add(item);
            }
        }