resume

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sriharikabattula
    New Member
    • Feb 2009
    • 5

    resume

    hi,

    i am uploading .doc,.docX,rtf files during registration level and that path can be saved in database(i am using database MYSQL).when user want to see his resume he/she can login and retrive his details by clicking on retrive button.my problem is the code will be working in local system it not working in server.i am attaching my code shown below
    Code:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Microsoft.Office.Interop;
    using System.IO;
    using System.Reflection;
    
    #endregion
    
    public partial class ResUploadOrCompDesc : System.Web.UI.Page
    {
        #region "Global Variables                   "
    
        DataAccess ObjDA;
    
        #endregion
    
        #region "Page_Load                          "
    
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string UName = "";
                string TblType = "";
                ObjDA = new DataAccess();            
                lblErrMsg.Text = "";
    
                if (!IsPostBack)
                {
                    Session["MyAccount"] = "false";
                    if (Session["UserName"] == null)
                        Response.Redirect("Home.aspx");
                    else
                    {
                        UName = Session["UserName"].ToString();
    
                        if (Session["TblType"] != null)
                            TblType = Session["TblType"].ToString();
    
                        Session["MyPhoto"] = "~/UserPhotos/" + UName + @"\" + ObjDA.GetScalarValues(TblType + "MyAcc", "", "username='" + UName + "'");
                       
                        if (TblType == "PRD4")
                        {
                            imgbtnGetResInfo.Visible = false;
                            fudResume.Visible = false;
                            lblUpload.Visible = false;
                            lblValMsg.Visible = false;
                            txtResume.Text = ObjDA.GetScalarValues(TblType, "compdesc", "username='" + UName + "'");
                        }
                        else
                        {
                            imgbtnGetResInfo.Visible = true;
                            fudResume.Visible = true;
                            lblUpload.Visible = true;
                            lblValMsg.Visible = true;
                        }
                        //if (IsPostBack)
                        //{
                        //    if (Request.Form["hid_f"] == "1")   //if user clicks "OK" to confirm 
                        //    {
                        //        int i = 0;
                        //        Request.Form["hid_f"].Replace("1", "0");
                        //        i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "", UName, "D");
                        //        ObjDA.InsertOrUpdateOrDeleteData("Ref", "", Session["a"].ToString(), "D");
                        //        if (i == 1)
                        //        {
                        //            MsgBox1.alert("Account deleted sucessfully");
                        //            Response.Redirect("home.aspx");
                        //        }
                        //        else
                        //        {
                        //            MsgBox1.alert("Unable to delete the selected record and try again");
                        //        }
                        //    }
                        //}
                    }
                }
            }
            catch (Exception ex)
            {
                lblErrMsg.Text = ex.Message;
            }
            finally
            {
                if (ObjDA != null)
                    ObjDA = null;
            }
        }
    
        #endregion
    
        #region "imgbtnGetResInfo_Click             "
    
        protected void imgbtnGetResInfo_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string UName = "";
                string TblType = "";
                string ResumeFilePath = "";
                ObjDA = new DataAccess();
    
                if (Session["UserName"] != null)
                    UName = Session["UserName"].ToString();
                if (Session["TblType"] != null)
                    TblType = Session["TblType"].ToString();
    
                //Request.Form["hid_f"].Replace("1", "0");
                
                ResumeFilePath = AppDomain.CurrentDomain.BaseDirectory + @"UserResumes\" + UName + "\\" + ObjDA.GetScalarValues(TblType, "resume", "UserName='" + UName + "'");
    
                if (File.Exists(ResumeFilePath))
                {
                    Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
                    object FileName = ResumeFilePath;
                    object nullobj = System.Reflection.Missing.Value;
                    Microsoft.Office.Interop.Word.Document DocOne = wordApp.Documents.Open(ref FileName, ref nullobj, ref nullobj,
                                                                                        ref nullobj, ref nullobj, ref nullobj,
                                                                                        ref nullobj, ref nullobj, ref nullobj,
                                                                                        ref nullobj, ref nullobj, ref nullobj,
                                                                                        ref nullobj, ref nullobj, ref nullobj, ref nullobj);
    
                    Microsoft.Office.Interop.Word.Document DocTwo = wordApp.ActiveDocument;
                    txtResume.Text = DocTwo.Content.Text;
                    DocOne.Close(ref nullobj, ref nullobj, ref nullobj);
                }
                else
                {
                    lblErrMsg.Text = "No File Uploaded";
                }
            }
            catch (Exception ex)
            {
                lblErrMsg.Text = ex.Message;
            }
            finally
            {
                if (ObjDA != null)
                    ObjDA = null;
            }
        }
    
        #endregion
    
        #region "imgbtnUpdateResume_Click           "
    
        protected void imgbtnUpdateResume_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                int FilesCount = 0;
                string UName = "";
                string TblType = "";
                string DirName = "";
                int i = 0;
                ObjDA = new DataAccess();
    
                if (Session["UserName"] != null)
                    UName = Session["UserName"].ToString();
                if (Session["TblType"] != null)
                    TblType = Session["TblType"].ToString();
    
                DirName = AppDomain.CurrentDomain.BaseDirectory + @"UserResumes\" + UName;
    
                if (imgbtnGetResInfo.Visible == true)
                {
                    if (Directory.Exists(DirName) == false)
                        Directory.CreateDirectory(DirName);
                    else
                    {
                        FilesCount = Directory.GetFiles(DirName).Length;
                        if (FilesCount > 0)
                        {
                            for (int j = 0; j < FilesCount; j++)
                            {
                                if (File.Exists(Directory.GetFiles(DirName)[j].ToString()))
                                    File.Delete(Directory.GetFiles(DirName)[j].ToString());
                            }
                        }
                    }
    
                    fudResume.SaveAs(DirName + @"\" + fudResume.FileName.ToString());
    
                    ObjDA.InsertOrUpdateOrDeleteData(TblType, "resume=''", "UserName='" + UName + "'", "U");
                    i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "resume='" + fudResume.FileName.ToString() + "'", "UserName='" + UName + "'", "U");
    
                    if (i == 1)
                    {
                        lblErrMsg.Text = "Resume uploaded successfully";
                        txtResume.Text = "";
                    }
                }
                else
                {
                    ObjDA.InsertOrUpdateOrDeleteData(TblType, "compdesc=''", "UserName='" + UName + "'", "U");
                    i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "compdesc='" + txtResume.Text + "'", "UserName='" + UName + "'", "U");
                    if (i == 1)
                        lblErrMsg.Text = "Company Description updated successfully";
                }
    
            }
            catch (Exception ex)
            {
                lblErrMsg.Text = ex.Message;
            }
            finally
            {
            }
        }
    
        #endregion
    (***here is no server problem*****)ca n any one help me plzzzz
    Last edited by NeoPa; Feb 24 '09, 12:51 AM. Reason: Please use the [CODE] tags provided
  • sriharikabattula
    New Member
    • Feb 2009
    • 5

    #2
    resume

    hi,

    i am uploading resume in registration levels.the user want to see his/her resume he/she can login and click on 'getresume' button all the information could be displayed in multiline text box.my problem is it will be working on local system when we are hosting the resume will not be displayed. i am using my sql database.my code will be shown below

    Code:
    #region "imgbtnGetResInfo_Click             "
    
        protected void imgbtnGetResInfo_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                string UName = "";
                string TblType = "";
                string ResumeFilePath = "";
                ObjDA = new DataAccess();
    
                if (Session["UserName"] != null)
                    UName = Session["UserName"].ToString();
                if (Session["TblType"] != null)
                    TblType = Session["TblType"].ToString();
    
                //Request.Form["hid_f"].Replace("1", "0");
                
                ResumeFilePath = AppDomain.CurrentDomain.BaseDirectory + @"UserResumes\" + UName + "\\" + ObjDA.GetScalarValues(TblType, "resume", "UserName='" + UName + "'");
    
                if (File.Exists(ResumeFilePath))
                {
                    Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
                    object FileName = ResumeFilePath;
                    object nullobj = System.Reflection.Missing.Value;
                    Microsoft.Office.Interop.Word.Document DocOne = wordApp.Documents.Open(ref FileName, ref nullobj, ref nullobj,
                                                                                        ref nullobj, ref nullobj, ref nullobj,
                                                                                        ref nullobj, ref nullobj, ref nullobj,
                                                                                        ref nullobj, ref nullobj, ref nullobj,
                                                                                        ref nullobj, ref nullobj, ref nullobj, ref nullobj);
    
                    Microsoft.Office.Interop.Word.Document DocTwo = wordApp.ActiveDocument;
                    txtResume.Text = DocTwo.Content.Text;
                    DocOne.Close(ref nullobj, ref nullobj, ref nullobj);
                }
                else
                {
                    lblErrMsg.Text = "No File Uploaded";
                }
            }
            catch (Exception ex)
            {
                lblErrMsg.Text = ex.Message;
            }
            finally
            {
                if (ObjDA != null)
                    ObjDA = null;
            }
        }
    
        #endregion
    
        #region "imgbtnUpdateResume_Click           "
    
        protected void imgbtnUpdateResume_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                int FilesCount = 0;
                string UName = "";
                string TblType = "";
                string DirName = "";
                int i = 0;
                ObjDA = new DataAccess();
    
                if (Session["UserName"] != null)
                    UName = Session["UserName"].ToString();
                if (Session["TblType"] != null)
                    TblType = Session["TblType"].ToString();
    
                DirName = AppDomain.CurrentDomain.BaseDirectory + @"UserResumes\" + UName;
    
                if (imgbtnGetResInfo.Visible == true)
                {
                    if (Directory.Exists(DirName) == false)
                        Directory.CreateDirectory(DirName);
                    else
                    {
                        FilesCount = Directory.GetFiles(DirName).Length;
                        if (FilesCount > 0)
                        {
                            for (int j = 0; j < FilesCount; j++)
                            {
                                if (File.Exists(Directory.GetFiles(DirName)[j].ToString()))
                                    File.Delete(Directory.GetFiles(DirName)[j].ToString());
                            }
                        }
                    }
    
                    fudResume.SaveAs(DirName + @"\" + fudResume.FileName.ToString());
    
                    ObjDA.InsertOrUpdateOrDeleteData(TblType, "resume=''", "UserName='" + UName + "'", "U");
                    i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "resume='" + fudResume.FileName.ToString() + "'", "UserName='" + UName + "'", "U");
    
                    if (i == 1)
                    {
                        lblErrMsg.Text = "Resume uploaded successfully";
                        txtResume.Text = "";
                    }
                }
                else
                {
                    ObjDA.InsertOrUpdateOrDeleteData(TblType, "compdesc=''", "UserName='" + UName + "'", "U");
                    i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "compdesc='" + txtResume.Text + "'", "UserName='" + UName + "'", "U");
                    if (i == 1)
                        lblErrMsg.Text = "Company Description updated successfully";
                }
    
            }
            catch (Exception ex)
            {
                lblErrMsg.Text = ex.Message;
            }
            finally
            {
            }
        }
    (****there is no server problem its working fine***)

    can any one help me plz
    Last edited by tlhintoq; Feb 21 '09, 10:31 PM. Reason: [CODE] ... code goes here ... [/CODE] tags added

    Comment

    • rvarshney
      New Member
      • Feb 2009
      • 10

      #3
      Hi,
      If the application is working in localhost but not on webserver there can be these possibilites in my opinion:
      1. You have not given access to read/write to the UserResumes directory. So the application is failing for writing the given resume.
      2. Your Office components are not properly installed on the server.

      Try to eliminate the above two. As far as I know, if server is working fine, client should not have any problem.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        What do you mean when you say your code is "not working" on the web server?
        Is your website working but you are not able to upload files?
        What is the error you are getting when you attempt to run the site on the web server?

        If you have access to the web server, check the Windows Event Logs for any error messages generated by ASP.NET and please post them so that we have an idea of what's going on.

        Do you have ASP.NET installed on the web server?

        Is your web server configured to run your site with the same .NET Framework that your application was developed with?

        Do you have all permissions set correctly?

        Comment

        Working...