-
Notifications
You must be signed in to change notification settings - Fork 0
/
Create_AgencyBoard.aspx.cs
executable file
·78 lines (65 loc) · 2.65 KB
/
Create_AgencyBoard.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;
using System.Web.Security;
public partial class Master_Create_AgencyBoard : System.Web.UI.Page
{
private string Contents = ConfigurationManager.AppSettings["Contents"].ToString();
private string repository = ConfigurationManager.AppSettings["repository"].ToString();
private string URL = ConfigurationManager.AppSettings["URL"].ToString();
SqlConnection c = new SqlConnection(ConfigurationManager.ConnectionStrings["terrible1ConnectionString"].ToString());
protected void Page_Load(object sender, System.EventArgs e)
{
if (IsPostBack)
{
// If this is a Postback, execute these statements.
}
else
{
// Put code to execute for non postback here
}
}
protected void BtnSave_Click(object sender, System.EventArgs e)
{
string strFileNameWithPath = FileUpload1.PostedFile.FileName;
string strExtensionName = System.IO.Path.GetExtension(strFileNameWithPath);
if (FileUpload1.HasFile)
{
//if (strExtensionName.Equals(".mp4"))
//{
string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.SaveAs(repository + FileName);
AgencyBoard myAgencyBoard;
myAgencyBoard = new AgencyBoard();
//myAgencyBoard.AgencyID = System.Convert.ToInt32(txtAgencyID.Text);
myAgencyBoard.ImageFile = System.Convert.ToString(FileName);
myAgencyBoard.ImagePath = System.Convert.ToString(URL + FileName);
myAgencyBoard.CreatedBy = System.Convert.ToString(Session["Username"]);
myAgencyBoard.CreatedDate = System.Convert.ToDateTime(DateTime.Now);
myAgencyBoard.ModifiedBy = System.Convert.ToString(Session["Username"]);
myAgencyBoard.ModifiedDate = System.Convert.ToDateTime(DateTime.Now);
clsagencyBoard.Insert(myAgencyBoard);
Response.Redirect("AgencyBoardGrid.aspx", false);
//}
//else
//{
// lblErrorAdd.Text = "cannot accept this file type";
//}
}
else
{
lblErrorAdd.Text = "Please choose video file to upload";
}
}
protected void BtnCancel_Click(object sender, System.EventArgs e)
{
Response.Redirect("AgencyBoardGrid.aspx", false);
}
}