protected void grdAtchFile_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int iDocID = 0;
                for (int i = 0; i < grdAtchFile.Rows.Count; i++)
                {
                    if (grdAtchFile.SelectedIndex == i)
                    {
                        iDocID = Convert.ToInt32(grdAtchFile.DataKeys[i].Value.ToString());
                        SendRecDoc  objSendDoc = new SendRecDoc();
                        entDocument objEnt     = objSendDoc.downloadDocForAttachFile(iDocID);


                        if (objEnt != null)
                        {
                            Byte[] programFile = objEnt.FileData;


                            if (objEnt.FileName != null)
                            {
                                string contentType = objEnt.FileType;
                                //obtaing filename from the table
                                string fileName = objEnt.FileName;
                                //The ContentType property specifies the HTTP content type for the response.
                                //If no ContentType is specified, the default is text/HTML.
                                Response.ContentType = contentType;
                                //The AddHeader method adds a new HTML header and value to the response sent to the client
                                Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
                                //The Charset property appends the name of the character set (for example, ISO-8859-13) to the content-type header in the Response object
                                //Here Blank is attached
                                Response.Charset = "";
                                //Provides enumerated values that are used to set the Cache-Control HTTP header.
                                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                            }

                            //Provides enumerated values that are used to set the Cache-Control HTTP header.
                            Response.BinaryWrite(programFile);
                            //The End method causes the Web server to stop
                            //  processing the script and return the current result.
                            Response.End();
                        }
                        else
                        {
                            lblMessage.Text = "File DoesNot Exists";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
Esempio n. 2
0
        public entDocument downloadDocForAttachFile(int iDocID)
        {
            SqlDataAccess objConnection = new SqlDataAccess(clsConstant.DBCONSTRING);

            if (objConnection.Connection.State == ConnectionState.Closed)
            {
                objConnection.Connection.Open();
            }
            SqlParameter[] param  = new SqlParameter[] { new SqlParameter("@iDocID", iDocID), new SqlParameter("@action", 'd') };
            entDocument    objEnt = new entDocument();
            SqlDataReader  dr     = objConnection.ExecuteReaderQuery(clsConstant.SP_SELECT_DOC_FILE_ATTACH, CommandType.StoredProcedure, param);

            if (dr.Read())
            {
                objEnt.FileType = dr.GetValue(1).ToString();
                objEnt.FileData = (byte[])(dr.GetValue(3));
                objEnt.FileName = dr.GetValue(2).ToString();
            }
            dr.Close();
            return(objEnt);
        }
Esempio n. 3
0
        public entDocument getDocDetailsMDB(int iDocDetailsID)
        {
            if (objConnection.Connection.State == ConnectionState.Closed)
            {
                objConnection.Connection.Open();
            }
            entDocument objEntDoc = new entDocument();

            SqlParameter[] param = new SqlParameter[] { new SqlParameter("iDocDetailsID", iDocDetailsID) };

            SqlDataReader dr = objConnection.ExecuteReaderQuery("sp_selectdocDetailsMDB", CommandType.StoredProcedure, param);

            if (dr.Read())
            {
                objEntDoc.DocType        = dr.GetValue(0).ToString();
                objEntDoc.DocCat         = dr.GetValue(1).ToString();
                objEntDoc.LoanNo         = dr.GetValue(2).ToString();
                objEntDoc.TANo           = dr.GetValue(3).ToString();
                objEntDoc.DocID          = dr.GetValue(4).ToString();
                objEntDoc.FileTrackingID = dr.GetValue(5).ToString();
                objEntDoc.SenderName     = dr.GetValue(6).ToString();
                objEntDoc.DueDate        = Convert.ToDateTime(dr.GetValue(7).ToString()).ToString(clsConstant.DATE_FORMAT);
                objEntDoc.DocName        = dr.GetValue(9).ToString();

                // reply email of sender and whether that user notification is enabled or not
                objEntDoc.eMailID = dr.GetValue(10).ToString();
                objEntDoc.Project = dr.GetValue(11).ToString();

                objEntDoc.UserID  = dr.GetValue(12).ToString();
                objEntDoc.Message = dr.GetValue(13).ToString();

                /// For World Bank
                objEntDoc.Portfolio = dr.GetValue(14).ToString();
                objEntDoc.Pipeline  = dr.GetValue(15).ToString();
                objEntDoc.AAA       = dr.GetValue(16).ToString();
            }
            dr.Close();
            return(objEntDoc);
        }
Esempio n. 4
0
        public bool isDocClose(string DocDetailsID, string UserID)
        {
            bool returnval = false;

            if (objConnection.Connection.State == ConnectionState.Closed)
            {
                objConnection.Connection.Open();
            }
            entDocument objEntDoc = new entDocument();

            SqlParameter[] param = new SqlParameter[] { new SqlParameter("@iDocSendDetailsID", DocDetailsID), new SqlParameter("@iUserID", UserID) };

            SqlDataReader dr = objConnection.ExecuteReaderQuery(clsConstant.SP_GET_DOCS_STATUS, CommandType.StoredProcedure, param);

            if (dr.Read())
            {
                if (dr.GetValue(0) == "C")
                {
                    returnval = true;
                }
            }
            return(returnval);
        }
Esempio n. 5
0
        public entDocument  setEntValues(int iDocID, int iUserId, int itype, int iDocDetailsID)
        {
            if (objConnection.Connection.State == ConnectionState.Closed)
            {
                objConnection.Connection.Open();
            }
            entDocument objEntDoc = new entDocument();

            SqlParameter[] param = new SqlParameter[] { new SqlParameter("@iDocID", iDocID), new SqlParameter("@iUserID", iUserId), new SqlParameter("iType", itype) };

            SqlDataReader dr = objConnection.ExecuteReaderQuery(clsConstant.SP_SELECT_DOCS_SEND, CommandType.StoredProcedure, param);


            if (dr.Read())
            {
                objEntDoc.DocType          = dr.GetValue(0).ToString();
                objEntDoc.DocCat           = dr.GetValue(1).ToString();
                objEntDoc.LoanNo           = dr.GetValue(2).ToString();
                objEntDoc.TANo             = dr.GetValue(3).ToString();
                objEntDoc.DocID            = dr.GetValue(4).ToString();
                objEntDoc.FileTrackingID   = dr.GetValue(5).ToString();
                objEntDoc.SenderName       = dr.GetValue(6).ToString();
                objEntDoc.DueDate          = Convert.ToDateTime(dr.GetValue(7).ToString()).ToString(clsConstant.DATE_FORMAT);
                objEntDoc.FileName         = dr.GetValue(8).ToString();
                objEntDoc.Message          = dr.GetValue(9).ToString();
                objEntDoc.DocSendDetailsID = dr.GetValue(10).ToString();
                objEntDoc.UserID           = dr.GetValue(11).ToString();
                objEntDoc.DocSendStatus    = dr.GetValue(12).ToString();
                objEntDoc.DocName          = dr.GetValue(13).ToString();
                objEntDoc.dtCreateDate     = dr.GetValue(14).ToString();
                objEntDoc.ParentID         = dr.GetValue(15).ToString();
                objEntDoc.AgencyCode       = dr.GetValue(16).ToString();
                objEntDoc.Designation      = dr.GetValue(17).ToString();
                objEntDoc.Project          = dr.GetValue(18).ToString();

                // World Bank . on 09 Jan 2014
                objEntDoc.Pipeline  = dr.GetValue(20).ToString();
                objEntDoc.Portfolio = dr.GetValue(19).ToString();
                objEntDoc.AAA       = dr.GetValue(21).ToString();
            }
            dr.Close();



            param = new SqlParameter[] { new SqlParameter("@iDocID", iDocDetailsID), new SqlParameter("@cType", "M"), new SqlParameter("@iUserID", iUserId), new SqlParameter("iType", itype) };
            string strReminder = "";

            dr = objConnection.ExecuteReaderQuery(clsConstant.SP_SELECT_COMMENT, CommandType.StoredProcedure, param);
            while (dr.Read())
            {
                if (strReminder == "")
                {
                    strReminder = "Date: " + dr.GetValue(0).ToString();  //Convert.ToDateTime(dr.GetValue(0).ToString()).ToString(clsConstant.DATE_FORMAT);
                }
                else
                {
                    strReminder = strReminder + "Date: " + dr.GetValue(0).ToString(); // Convert.ToDateTime(dr.GetValue(0).ToString()).ToString("dd MMM yyyy");
                }
                strReminder = strReminder + "\nFrom: " + dr.GetValue(2).ToString();
                strReminder = strReminder + "\nTo: " + dr.GetValue(3).ToString();
                strReminder = strReminder + "\nComments: " + dr.GetValue(1).ToString() + "\n";
            }
            objEntDoc.ReminderDetails = strReminder;
            dr.Close();


            param = new SqlParameter[] { new SqlParameter("@iDocID", iDocID), new SqlParameter("@cType", "R"), new SqlParameter("@iUserID", iUserId), new SqlParameter("iType", itype) };
            string strReply = "";

            dr = objConnection.ExecuteReaderQuery(clsConstant.SP_SELECT_COMMENT, CommandType.StoredProcedure, param);
            while (dr.Read())
            {
                if (strReply == "")
                {
                    strReply = "Date: " + dr.GetValue(0).ToString();
                }
                else
                {
                    //strReply = strReply + "Date: " + Convert.ToDateTime(dr.GetValue(0).ToString()).ToString("dd MMM yyyy");
                    strReply = strReply + "Date: " + dr.GetValue(0).ToString();
                }
                strReply = strReply + "\nTo: " + dr.GetValue(2).ToString();
                strReply = strReply + "\nFrom: " + dr.GetValue(3).ToString();
                strReply = strReply + "\nReply: " + dr.GetValue(1).ToString() + "\n";
            }
            objEntDoc.ReplyDetails = strReply;
            dr.Close();



            param    = new SqlParameter[] { new SqlParameter("@iDocDetailsID", iDocDetailsID) };
            strReply = string.Empty;
            dr       = objConnection.ExecuteReaderQuery(clsConstant.SP_SELECT_COMMENT_REPLY_ALL, CommandType.StoredProcedure, param);
            while (dr.Read())
            {
                if (strReply == "")
                {
                    strReply = "Date: " + dr.GetValue(0).ToString(); // Convert.ToDateTime(dr.GetValue(0).ToString()).ToString("dd MMM yyyy");
                }
                else
                {
                    strReply = strReply + "Date: " + dr.GetValue(0).ToString();  //Convert.ToDateTime(dr.GetValue(0).ToString()).ToString("dd MMM yyyy");
                }
                strReply = strReply + "\nTo: ALL User";
                strReply = strReply + "\nFrom: " + dr.GetValue(2).ToString();
                strReply = strReply + "\nReply: " + dr.GetValue(1).ToString() + "\n";
            }
            objEntDoc.ReplyDetails = objEntDoc.ReplyDetails + strReply;
            dr.Close();

            return(objEntDoc);
        }