Exemple #1
0
        private void LoadDropDownList()
        {
            PODocumentUploadDL ddlDL = new PODocumentUploadDL();

            ddlListContact.Items.Clear();
            ddlListContact.DataSource     = new ContactDL().GetContactList(Convert.ToInt32(hfCompanyID.Value)).Tables[0];
            ddlListContact.DataTextField  = "FName";
            ddlListContact.DataValueField = "ContactID";
            ddlListContact.DataBind();
            ddlListContact.Items.Insert(0, "-- Select One --");
            ddlListContact.Items[0].Value = "";


            ddlCustomer.Items.Clear();
            ddlCustomer.DataSource     = new ContactDL().GetContactList(Convert.ToInt32(hfCompanyID.Value)).Tables[0];
            ddlCustomer.DataTextField  = "FName";
            ddlCustomer.DataValueField = "ContactID";
            ddlCustomer.DataBind();
            ddlCustomer.Items.Insert(0, "-- Select One --");
            ddlCustomer.Items[0].Value = "";

            ddlPONO.Items.Clear();
            ddlPONO.DataSource     = new PurchaseWorkOrderDL().GetPurchaseWorkOrderList().Tables[0];
            ddlPONO.DataTextField  = "WorkOrder";
            ddlPONO.DataValueField = "WorkOrder";
            ddlPONO.DataBind();
            ddlPONO.Items.Insert(0, "-- Select One --");
            ddlPONO.Items[0].Value = "";


            //ddlCustomer.ClearSelection();
        }
Exemple #2
0
        private void DownloadDocumentFile()
        {
            PODocumentUploadDL _fileStatus = new PODocumentUploadDL();

            _fileStatus.GetWorkOrderDocumentByWorkOrderDocumentID(Convert.ToInt32(hfFileID.Value.ToString()));

            string path = MapPath(_fileStatus.FilePathandFileName);

            byte[] bts = System.IO.File.ReadAllBytes(path);

            Response.Clear();
            Response.ClearHeaders();

            Response.AddHeader("Content-Type", "Application/octet-stream");
            Response.AddHeader("Content-Length", bts.Length.ToString());
            Response.AddHeader("Content-Disposition", "attachment; filename=" + _fileStatus.FileName);
            Response.BinaryWrite(bts);
            Response.Flush();
            Response.End();



            //WebClient client = new WebClient();
            //client.Credentials = CredentialCache.DefaultCredentials;
            //client.DownloadFileAsync(new Uri(url), @"c:\temp\image35.png");
            ////object documentFile = _fileStatus.DocumentFile;
            ////byte[] bytFile = (byte[])documentFile;

            ////Response.ContentType = "application/vnd.ms-word";
            ////Response.AppendHeader("Content-Disposition", "inline;filename=" + _clientFileStatus.DocumentFileName);
            ////Response.BinaryWrite(bytFile);
            ////Response.End();
        }
Exemple #3
0
        protected void gvWorkOrderDocument_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    e.Row.Cells[1].Visible = false;
                    e.Row.Cells[3].Visible = false;

                    // Set the Serial Number
                    Label lblSerial = (Label)e.Row.FindControl("lblSerial");
                    lblSerial.Text =
                        ((gvWorkOrderDocument.PageIndex * gvWorkOrderDocument.PageSize) + e.Row.RowIndex + 1).ToString();



                    PODocumentUploadDL _fileStatus = new PODocumentUploadDL();

                    _fileStatus.GetWorkOrderDocumentByWorkOrderDocumentID(Convert.ToInt32(e.Row.Cells[1].Text));

                    string path = MapPath(_fileStatus.FilePathandFileName);
                    //byte[] bts = System.IO.File.ReadAllBytes(path);

                    //Response.Clear();
                    //Response.ClearHeaders();

                    //Response.AddHeader("Content-Type", "Application/octet-stream");
                    //Response.AddHeader("Content-Length", bts.Length.ToString());
                    //Response.AddHeader("Content-Disposition", "attachment; filename=" + _fileStatus.FileName);
                    //Response.BinaryWrite(bts);
                    //Response.Flush();
                    //Response.End();



                    HyperLink hlDocumentDownload = (HyperLink)e.Row.FindControl("hlDocumentDownload");
                    hlDocumentDownload.NavigateUrl = "~\\" + _fileStatus.FilePathandFileName;
                }
                else if (e.Row.RowType == DataControlRowType.Header)
                {
                    // Hide Column Headers
                    e.Row.Cells[1].Visible = false;
                    e.Row.Cells[3].Visible = false;
                }
                else if (e.Row.RowType == DataControlRowType.Footer)
                {
                    e.Row.Cells[1].Visible = false;
                    e.Row.Cells[3].Visible = false;
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrorMessageToDB("DocumentUpload.aspx", "", "gvWorkOrderDocument_RowDataBound", ex.Message.ToString(), new ACEConnection());
                throw;
            }
        }
Exemple #4
0
 protected void ddlCustomer_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlCustomer.SelectedValue != "")
     {
         PODocumentUploadDL filesDL = new PODocumentUploadDL();
         DataView           dView   = filesDL.GetWorkOrderDocumentListByContactID(Convert.ToInt32(ddlCustomer.SelectedValue)).Tables[0].DefaultView;
         gvWorkOrderDocument.DataSource = dView;
         gvWorkOrderDocument.DataBind();
     }
     else
     {
         gvWorkOrderDocument.DataSource = null;
         gvWorkOrderDocument.DataBind();
     }
 }
Exemple #5
0
        protected void PI_lbtnSave_Click(object sender, EventArgs e)
        {
            if (fileUpload.HasFile)
            {
                if (fileUpload.FileName.ToString() != "")
                {
                    PODocumentUploadDL fileDL = new PODocumentUploadDL();
                    fileDL.WorkOrderDocumentId = 0;
                    fileDL.WorkOrderId         = 1;
                    fileDL.ContactId           = Convert.ToInt32(ddlListContact.SelectedValue);
                    fileDL.PONo            = Convert.ToString(ddlPONO.SelectedValue).ToString();
                    fileDL.FileName        = fileUpload.FileName;
                    fileDL.FileExtension   = getFileExtension(fileUpload.FileName);
                    fileDL.FileDescription = txtFileDescription.Text;

                    StreamReader sr       = new StreamReader(fileUpload.PostedFile.InputStream);
                    string       filePath = fileUpload.PostedFile.FileName;

                    byte[] fileUploadFile;
                    fileUploadFile = GetByteData();
                    string serverMapPath = Server.MapPath("~");

                    string fileContinuePath = "";
                    fileContinuePath = @"PODocuments\" + Convert.ToInt32(ddlListContact.SelectedValue).ToString() + "\\" + Convert.ToString(ddlPONO.SelectedValue).ToString() + "\\" + "" + DateTime.Now.ToString("MMddyyyy") + DateTime.Now.Date.Second.ToString() + "" + DateTime.Now.Date.Hour.ToString() + "" + fileUpload.FileName.ToString();

                    SaveFile(fileUploadFile, serverMapPath + "" + fileContinuePath);
                    fileDL.FilePathandFileName = fileContinuePath;

                    fileDL.ScreenMode = ScreenMode.Add;

                    TransactionResult transactionResult = fileDL.Commit();

                    bool bl = transactionResult.Status != TransactionStatus.Success;
                    if (!bl)
                    {
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.Append(string.Concat("<script>alert(\'", transactionResult.Message.ToString(), ".\');"));
                        stringBuilder.Append("</script>");
                        ScriptManager.RegisterStartupScript(base.Page, typeof(string), "MyScript", stringBuilder.ToString(), false);
                    }
                    else
                    {
                        //txtAvailablecount.Text = "0";
                        //lblEnquiryReviewChecklistID.Text = "0";
                    }
                }
            }
        }