예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DropDownList1.Items.Add("Income");
         DropDownList1.Items.Add("Expenditure");
         DropDownList1.Items.Add("Audit");
         DropDownList1.Items.Add("Profit-Loss");
         DropDownList1.Items.Add("Assets");
         DropDownList1.Items.Add("Liabilities");
         DropDownList2.Items.Add("Processing");
         DropDownList2.Items.Add("Done");
         ConsultationRequestClass c = ConnectionClass.GetRequestById(Session["id"].ToString(), "RqstConsultation");
         TextBox1.Text = c.RequestId.ToString();
         TextBox2.Text = c.UserName;
         TextBox3.Text = c.Name;
         TextBox4.Text = c.ConsultationTitle;
         TextBox5.Text = c.Deadline.ToString();
         TextBox6.Text = c.Description;
         DropDownList2.SelectedItem.Text = c.RequestStatus;
         DropDownList1.SelectedItem.Text = c.ConsultationType;
         ViewState["mail"] = c.Email;
         ViewState["file"] = c.UploadFile;
     }
 }
예제 #2
0
    public static ConsultationRequestClass GetRequestById(string i, string tablename)
    {
        int id = Convert.ToInt32(i);

        try
        {
            conn.Open();
            string query = String.Format("SELECT * FROM {0} WHERE requestId={1}", tablename, i);
            com.CommandText = query;
            ConsultationRequestClass c      = null;
            SqlDataReader            reader = com.ExecuteReader();
            while (reader.Read())
            {
                int      requestid   = reader.GetInt32(0);
                string   name        = reader.GetString(1);
                string   username    = reader.GetString(2);
                string   email       = reader.GetString(3);
                string   title       = reader.GetString(4);
                string   type        = reader.GetString(5);
                DateTime deadline    = reader.GetDateTime(6);
                string   description = reader.GetString(7);
                string   uploadfile  = reader.GetString(8);
                string   status      = reader.GetString(9);
                string   resultfile  = reader.GetString(10);

                c = new ConsultationRequestClass(requestid, name, username, email, title, type, deadline, description, uploadfile, status, resultfile);
            }
            return(c);
        }
        finally
        {
            conn.Close();
        }
    }
예제 #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            if (FileUpload1.PostedFile.ContentType == "application/pdf")
            {
                try
                {
                    FileUpload1.PostedFile.SaveAs(Server.MapPath("~/ResultFiles/Consultation/") + TextBox1.Text + ".pdf");
                }
                catch (Exception ex)
                {
                    lblError.Text = "File could not be uploaded" + ex.Message;
                }
            }
            else
            {
                lblError.Text = "File must be a PDF";
            }

            if (lblError.Text == "")
            {
                ConsultationRequestClass c = new ConsultationRequestClass(Convert.ToInt32(Session["id"]), TextBox3.Text, TextBox2.Text, ViewState["mail"].ToString(), TextBox4.Text, DropDownList1.SelectedItem.Text, Convert.ToDateTime(TextBox5.Text), TextBox6.Text, ViewState["file"].ToString(), DropDownList2.SelectedItem.Text, Session["id"].ToString());
                string result = ConnectionClass.UpdateRequest(c, "RqstConsultation");
                Label1.Text = result;
            }
            else
            {
                Label1.Text = "";
            }
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            if (FileUpload1.PostedFile.ContentType.Equals("application/pdf"))
            {
                if (flag == true)
                {
                    try
                    {
                        string filename = Path.GetFileName(FileUpload1.FileName);
                        FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Files/" + Session["login"] + "/Business/") + filename);
                    }

                    catch (Exception ex)
                    {
                        lblFileUpload.Text = "File could not be uploaded" + ex.Message;
                    }
                }
            }
            else
            {
                lblFileUpload.Text = "File must be a PDF File";
            }
            if (lblFileUpload.Text == "")
            {
                if (flag == true)
                {
                    string   selectedDate = txtDeadline.Text;
                    DateTime dt1          = DateTime.Parse(selectedDate);

                    ConsultationRequestClass consultationrequestclass = new ConsultationRequestClass(txtName.Text, Session["login"].ToString(), txtMail.Text, txtTitle.Text, DropDownList1.SelectedItem.Text, dt1, txtDescription.Text, FileUpload1.PostedFile.FileName.ToString(), "Processing", "");
                    string result = ConnectionClass.AddBusinessRequest(consultationrequestclass);
                    int    a      = ConnectionClass.RetrieveLastId("RqstBusiness");
                    ConnectionClass.UpdateBusinessFilenamebyId(a);
                    string oldname = Server.MapPath("~/Files/" + Session["login"] + "/Business/") + FileUpload1.PostedFile.FileName;
                    string newname = Server.MapPath("~/Files/" + Session["login"] + "/Business/") + Convert.ToString(a) + ".pdf";
                    File.Move(oldname, newname);

                    lblResult.Text = result;
                    Label1.Visible = false;
                }
            }
            else
            {
                lblResult.Text = "";
            }
        }
    }
예제 #5
0
 public static string UpdateRequest(ConsultationRequestClass c, string tablename)
 {
     try
     {
         conn.Open();
         string query = String.Format("UPDATE {0} SET requestStatus='{1}',resultFile='{2}' WHERE requestId='{3}'", tablename, c.RequestStatus, c.ResultFile, c.RequestId);
         com.CommandText = query;
         com.ExecuteNonQuery();
         return("Request updated successfully");
     }
     finally
     {
         conn.Close();
     }
 }
예제 #6
0
 public static string AddOthersRequest(ConsultationRequestClass consultationrequest)
 {
     try
     {
         conn.Open();
         string query = string.Format("INSERT INTO RqstOthers VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", consultationrequest.Name, consultationrequest.UserName, consultationrequest.Email, consultationrequest.ConsultationTitle, consultationrequest.ConsultationType, consultationrequest.Deadline, consultationrequest.Description, consultationrequest.UploadFile, consultationrequest.RequestStatus, consultationrequest.ResultFile);
         com.CommandText = query;
         com.ExecuteNonQuery();
         return("Request Added Successfully");
     }
     finally
     {
         conn.Close();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DropDownList1.Items.Add("Salary");
         DropDownList1.Items.Add("Bonus");
         DropDownList1.Items.Add("Deduction");
         DropDownList1.Items.Add("Pension");
         DropDownList1.Items.Add("Other Benefits");
         DropDownList2.Items.Add("Processing");
         DropDownList2.Items.Add("Done");
         ConsultationRequestClass c = ConnectionClass.GetRequestById(Session["id"].ToString(), "RqstPayroll");
         TextBox1.Text = c.RequestId.ToString();
         TextBox2.Text = c.UserName;
         TextBox3.Text = c.Name;
         TextBox4.Text = c.ConsultationTitle;
         TextBox5.Text = c.Deadline.ToString();
         TextBox6.Text = c.Description;
         DropDownList2.SelectedItem.Text = c.RequestStatus;
         DropDownList1.SelectedItem.Text = c.ConsultationType;
         ViewState["mail"] = c.Email;
         ViewState["file"] = c.UploadFile;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DropDownList2.Items.Add("Processing");
         DropDownList2.Items.Add("Done");
         DropDownList1.Items.Add("Marketing");
         DropDownList1.Items.Add("Business Modelling");
         DropDownList1.Items.Add("Organization Restructure");
         DropDownList1.Items.Add("Financial Planning");
         DropDownList1.Items.Add("SWOT Analysis");
         ConsultationRequestClass c = ConnectionClass.GetRequestById(Session["id"].ToString(), "RqstBusiness");
         TextBox1.Text = c.RequestId.ToString();
         TextBox2.Text = c.UserName;
         TextBox3.Text = c.Name;
         TextBox4.Text = c.ConsultationTitle;
         TextBox5.Text = c.Deadline.ToString();
         TextBox6.Text = c.Description;
         DropDownList2.SelectedItem.Text = c.RequestStatus;
         DropDownList1.SelectedItem.Text = c.ConsultationType;
         ViewState["mail"] = c.Email;
         ViewState["file"] = c.UploadFile;
     }
 }