protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True"; string selectString = "SELECT * FROM tb_Userinfo WHERE Username='******'";//select string for search currency name correspond with the input SqlDataSource dsrc = new SqlDataSource(conString, selectString); DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty); if (DV.Table.Rows.Count > 0) { string password = (string)DV.Table.Rows[0][7]; if (password.Equals(Login1.Password)) { //Label1.Text = "Congratulations! Login succeed! Please wait for redirect to Homepage!"; Session["Username"] = Login1.UserName; Session["Call"] = DV.Table.Rows[0][1].ToString(); Server.Transfer("~/WebSite2/Default.aspx"); //Response.Write("<script language=javascript>alert('Congratulations! Login succeed!')</script>"); //System.Threading.Thread.Sleep(5000); //Response.Redirect("~/WebSite2/Default.aspx"); } else e.Authenticated = false; } else e.Authenticated = false; }
protected void Button1_Click(object sender, EventArgs e) { SqlDataSource SqlDataSource2 = new SqlDataSource(); SqlDataSource2.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; try { SqlDataSource2.DeleteCommand = "delete [Account_Order_M] where id=" + Request["Id"]; int affraw = SqlDataSource2.Delete(); if (affraw == 0) { Label8.Text = "error"; Button1.Visible = false; } else { Label8.Text = "ok"; Button1.Visible = false; } } catch (Exception ex2) { Response.Write(ex2.ToString()); } finally { SqlDataSource2.Dispose(); } }
protected void Button1_Click(object sender, EventArgs e) { SqlDataSource sqldatasource2 = new SqlDataSource(); sqldatasource2.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString.ToString(); sqldatasource2.UpdateParameters.Add("Order_date", TextBox1.Text); sqldatasource2.UpdateParameters.Add("Assign_numbers", TextBox2.Text); sqldatasource2.UpdateParameters.Add("Account_numbers", DropDownList1.Text); sqldatasource2.UpdateParameters.Add("Account_abstract", TextBox3.Text); sqldatasource2.UpdateParameters.Add("Income", TextBox4.Text); sqldatasource2.UpdateParameters.Add("Spend", TextBox5.Text); sqldatasource2.UpdateCommand = "Update [Account_Order_M] set Order_date=@Order_date, Account_numbers=@Account_numbers, Assign_numbers=@Assign_numbers, Account_abstract=@Account_abstract, Income=@Income, Spend=@Spend where Id="+Request["Id"]; int affraw_update = sqldatasource2.Update(); if (affraw_update == 0) { Label1.Text = "error"; } else { Label1.Text = "ok"; Button1.Visible = false; } sqldatasource2.Dispose(); }
protected void btnAdd_Click(object sender, EventArgs e) { SqlDataSource sql1 = new SqlDataSource(); sql1 = SqlDataSource1; SqlDataSource1.InsertParameters["Course_id"].DefaultValue = TextBox3.Text; SqlDataSource1.InsertParameters["Assignment"].DefaultValue = TextBox8.Text; SqlDataSource1.InsertParameters["Subject_id"].DefaultValue = TextBox4.Text; SqlDataSource1.InsertParameters["Instructor"].DefaultValue = TextBox5.Text; SqlDataSource1.InsertParameters["Instructor_rank"].DefaultValue = Convert.ToString(TextBox6.Text); SqlDataSource1.InsertParameters["Due_Date"].DefaultValue = TextBox9.Text; try { SqlDataSource1.Insert(); TextBox3.Text = ""; TextBox8.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox9.Text = ""; } catch (Exception ex) { lblError.Text = "A DB error has occurred. " + "Message: " + ex.Message; } }
//按鈕更新 protected void btnUpdate_Click(object sender, EventArgs e) { //壓縮圖片並存檔 CImageProess.get().UploadImage(FileUpload1, 資料夾路徑, CDictionary.SET_BRAND_PX); x = new SqlDataSource(); x.ConnectionString = CDictionary.CONN_URL; string sql = "UPDATE Company set "; if (!string.IsNullOrEmpty(txtContent.Text)) { sql += " name=N'" + txtName.Text + "', "; if (FileUpload1.HasFile) sql += " picBrandPath='" + CImageProess.imageName + "', "; sql += " manager=N'" + txtManager.Text + "', "; sql += " tel=N'" + txtPhone.Text + "', "; sql += " sparEmail=N'" + txtSpareEmail.Text + "', "; sql += " addr=N'" + txtAddress.Text + "', "; sql += " content=N'" + txtContent.Text + "' "; sql += "WHERE companyID='" + companyID + "'"; x.UpdateCommand = sql; x.Update(); } else return; Response.Write("<script>alert('更改資料成功!')</script>"); Response.Write("<script>location.href='companyCheck.aspx'</script>"); }
protected void DetailsView_Route_has_Bus_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { String Route_has_Bus_ID = DetailsView_Route_has_Bus.SelectedValue.ToString(); DropDownList D_Bus_ID_NEW = (DropDownList)DetailsView_Route_has_Bus.FindControl("DropDownList3"); DropDownList D_Bus_ID_OLD = (DropDownList)DetailsView_Route_has_Bus.FindControl("DropDownList7"); String Bus_ID_NEW = D_Bus_ID_NEW.SelectedValue; String Bus_ID_OLD = D_Bus_ID_OLD.SelectedValue; if (Bus_ID_NEW != Bus_ID_OLD) { delete_seat(Route_has_Bus_ID); SqlDataSource seat = new SqlDataSource(); seat.ConnectionString = ConfigurationManager.ConnectionStrings["BusTicketConnectionString1"].ToString(); String count_seat = get_seat_count(Bus_ID_NEW).ToString(); String command = ""; command = get_insert_command(count_seat, Route_has_Bus_ID); if (command != "") { String insertCommand = "INSERT INTO [Seat] " + " (Route_has_Bus_ID, Seat_Number, Seat_Name, Seat_Status) " + " VALUES " + command + ";"; seat.InsertCommand = insertCommand; seat.Insert(); } } }
protected void Page_Load(object sender, EventArgs e) { try { String userName = Session["Username"].ToString(); string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True"; string selectString = "SELECT * FROM [tb_Userinfo] WHERE Username='******'";//select string for search currency name correspond with the input SqlDataSource dsrc = new SqlDataSource(conString, selectString); DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty); username.Text = DV.Table.Rows[0][6].ToString(); Call.Text = DV.Table.Rows[0][1].ToString(); email.Text = DV.Table.Rows[0][3].ToString(); Phone.Text = DV.Table.Rows[0][5].ToString(); if(DV.Table.Rows[0][2].ToString()=="Male") RadioGenderList.Items[0].Selected=true; else RadioGenderList.Items[1].Selected = true; switch (DV.Table.Rows[0][4].ToString()) { case "BuCentral": RadioAreaList.Items[1].Selected = true; break; case "BuWest": RadioAreaList.Items[0].Selected = true; break; case "BuEast": RadioAreaList.Items[2].Selected = true; break; case "BuOther": RadioAreaList.Items[3].Selected = true; break; } Register.Text = "Update"; } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private void FrmDataSourceWizard_Load(object sender, EventArgs e) { var sds = new SqlDataSource("ConnectionString"); var ccc = new ConfigureConnectionContext(); SqlDataSourceUIHelper.ConfigureConnection(sds, ccc); }
protected void DetailsView_Route_has_Bus_ItemInserted(object sender, DetailsViewInsertedEventArgs e) { DropDownList BS = (DropDownList)DetailsView_Route_has_Bus.FindControl("DropDownList5"); SqlDataSource seat = new SqlDataSource(); seat.ConnectionString = ConfigurationManager.ConnectionStrings["BusTicketConnectionString1"].ToString(); String count_seat = get_seat_count(BS.SelectedValue).ToString(); String command = ""; String Route_has_Bus_ID = get_Route_has_Bus_ID_Last().ToString(); command = get_insert_command(count_seat, Route_has_Bus_ID); if (command != "") { String insertCommand = "INSERT INTO [Seat] " + " (Route_has_Bus_ID, Seat_Number, Seat_Name, Seat_Status) " + " VALUES " + command + ";"; seat.InsertCommand = insertCommand; seat.Insert(); } Response.Redirect(Request.RawUrl); }
private void excuteNonQuery(string sql) { SqlDataSource x = new SqlDataSource(); x.ConnectionString = @"Data Source=iii0.database.windows.net;Initial Catalog=prjTRK;Persist Security Info=True;User ID=iii;Password=P@ssw0rd"; x.InsertCommand = sql; x.Insert(); Response.Redirect("~/windowCompany/companyCheck.aspx"); }
protected void LinkButton2_Click(object sender, EventArgs e) { int code = Convert.ToInt32((sender as LinkButton).ToolTip.ToString()); string sql = "select (select top 1 m_fa_name from tbl_modules where m_id = tbl_groups_permission.gd_module_link) as [نام ماژول] , gd_blocked as [قفل] from tbl_groups_permission where tbl_groups_permission.gd_tbl_groups_link = " + code.ToString() + " order by gd_blocked desc"; SqlDataSource sds = new SqlDataSource(new main_class().get_connection_string(), sql); GridView4.DataSource = sds; GridView4.DataBind(); }
protected void DeleteBtn_Click(object sender, EventArgs e) { //ɾ���ݸ� int formID = (int)this.ViewState["ObjectId"]; this.PersonalReimburseBLL.DeleteFormTravelReimburse(formID); this.Page.Response.Redirect("~/Home.aspx"); SqlDataSource sds = new SqlDataSource(); }
protected void delete_seat(String Route_has_Bus_ID) { SqlDataSource seat = new SqlDataSource(); seat.ConnectionString = ConfigurationManager.ConnectionStrings["BusTicketConnectionString1"].ToString(); seat.DeleteCommand = "DELETE FROM [Seat] WHERE Route_has_Bus_ID = " + Route_has_Bus_ID; seat.Delete(); }
private void Bind() { SqlDataSource SqlDataSource1 = new SqlDataSource(); this.Page.Controls.Add(SqlDataSource1); SqlDataSource1.ConnectionString = "Data Source=W8-RKOEN;Initial Catalog=PrinterMigration;User ID=sa;Password=p@ssw0rd"; SqlDataSource1.SelectCommand = "SELECT * FROM Main Order By Floor"; GridView1.DataSource = SqlDataSource1; GridView1.DataBind(); }
private void executeQuery() { x = new SqlDataSource(); x.ConnectionString = @"Data Source=iii0.database.windows.net;Initial Catalog=prjTRK;Persist Security Info=True;User ID=iii;Password=P@ssw0rd"; x.SelectCommand = "Select * from Company where companyID='" + companyID + "'"; DataView dv = x.Select(DataSourceSelectArguments.Empty) as DataView; txtCounterInput.Text = dv.Table.Rows[0]["name"].ToString(); }
private void GetData() { //第一步 SqlDataSource dataSource = new SqlDataSource(); dataSource.ConnectionString = "server=.;database=schooldb;uid=ASPNET;pwd=ASPNET"; dataSource.SelectCommand = "SELECT * FROM Student"; dgvStudent.DataSource = dataSource; dgvStudent.DataBind(); //第一步 }
public DropDownNode(string entity) { this.ddl = new DropDownList(); sds = getSelectChildren(entity); this.ddl.DataSource = sds; ddl.DataTextField = "EntityDescription"; ddl.DataValueField = "EntityID"; ddl.SelectedIndexChanged += new EventHandler(setNextParameterAndBind); ddl.AutoPostBack = true; }
protected void AddButton_Click(object sender, EventArgs e) { try { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString); conn.Open(); String insert = "insert into Vehicle (Make, Model, Color, Year, LicensePlate, Valid) VALUES(@Make, @Model, @Color, @Year, @LicensePlate, @Valid)"; SqlCommand com3 = new SqlCommand(insert, conn); com3.Parameters.AddWithValue("@Make", MakeTextBox.Text.Trim()); com3.Parameters.AddWithValue("@Model", ModelTextBox.Text.Trim()); com3.Parameters.AddWithValue("@Color", ColorTextBox.Text.Trim()); com3.Parameters.AddWithValue("@Year", YearTextBox.Text.Trim()); com3.Parameters.AddWithValue("@LicensePlate", LicenseTextBox.Text.Trim()); com3.Parameters.AddWithValue("@Valid", 1); com3.ExecuteNonQuery(); String insert2 = "insert into VehicleList (VehicleID, PersonalID) VALUES(@LicensePlate, " + Session["New"] + ")"; SqlCommand com = new SqlCommand(insert2, conn); com.Parameters.AddWithValue("@LicensePlate", LicenseTextBox.Text.Trim()); com.ExecuteNonQuery(); StatusLabel.ForeColor = System.Drawing.Color.Green; StatusLabel.Text = "Vehicle registered sucessfully"; String insert3 = "insert into Decal (VehicleID, ExpirationDate, PersonalID) VALUES(@LicensePlate, @Date, @PID)"; SqlCommand com2 = new SqlCommand(insert3, conn); com2.Parameters.AddWithValue("@LicensePlate", LicenseTextBox.Text.Trim()); com2.Parameters.Add("@Date", DateTime.Now); com2.Parameters.Add("@PID", Session["New"]); com2.ExecuteNonQuery(); SqlDataSource SqlDataSource1 = new SqlDataSource(); SqlDataSource1.ID = "SqlDataSource1"; this.Page.Controls.Add(SqlDataSource1); SqlDataSource1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString; SqlDataSource1.SelectCommand = "select vl.VehicleID, v.Make, v.Model, v.Color, v.Year from VehicleList vl, Vehicle v where v.LicensePlate = vl.VehicleID and PersonalID = " + SessionLabel.Text.Trim(); GridView1.DataSource = SqlDataSource1; GridView1.DataBind(); SqlConnection conn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString); conn2.Open(); string vehiclesQuery = "SELECT COUNT(VehicleID) FROM VehicleList where PersonalID='" + Session["New"] + "'"; SqlCommand pass4 = new SqlCommand(vehiclesQuery, conn2); string vCount = pass4.ExecuteScalar().ToString().Replace(" ", ""); if (Int32.Parse(vCount) == 0) { NoVehiclesLabel.Text = "You do not have any vehicles registered!"; } conn2.Close(); } catch(Exception) { StatusLabel.ForeColor = System.Drawing.Color.Red; StatusLabel.Text = "The vehicle is already registered"; } }
protected void Page_Load(object sender, EventArgs e) { try { RestaurantName = Session["Restaurantname"].ToString(); LabelRname.Text = RestaurantName; //Session.Remove("Restaurantname"); Image1.ImageUrl = "~/WebSite2/Image/BU Central/" + RestaurantName + ".jpg"; string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True"; string selectString = "SELECT * FROM tb_Restaurant WHERE Name='" + RestaurantName +"'";//select string for search currency name correspond with the input SqlDataSource dsrc = new SqlDataSource(conString, selectString); DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty); LabelAddress.Text = DV.Table.Rows[0][2].ToString(); LabelContact.Text = DV.Table.Rows[0][3].ToString(); LabelCuisine.Text = DV.Table.Rows[0][4].ToString(); float a = float.Parse(DV.Table.Rows[0][5].ToString()); float b = (float)(Math.Round(a * 100)) / 100; LabelRate.Text = b.ToString(); LabelDescription.Text = DV.Table.Rows[0][7].ToString(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } try { UserName = Session["Username"].ToString(); UserCall = Session["Call"].ToString(); string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True"; string selectString = "SELECT * FROM tb_Review WHERE Uname='" + UserCall + "' AND Rname='" + RestaurantName + "'";//select string for search currency name correspond with the input SqlDataSource dsrc = new SqlDataSource(conString, selectString); DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty); if (DV.Table.Rows.Count > 0) { LabelReviewRate.Visible = false; LabelReviewContent.Visible = false; TextBoxRate.Visible = false; TextBox1.Visible = false; Button1.Visible = false; } } catch (Exception ex) { LabelReviewRate.Visible = false; LabelReviewContent.Visible = false; TextBoxRate.Visible = false; TextBox1.Visible = false; Button1.Visible = false; Console.WriteLine(ex.ToString()); } }
protected SqlDataSource getSelectChildren(string entity) { string selectCommand = "[CTX].[sp_Select_Child_Entities]"; parent = new Parameter("entity_id"); parent.DefaultValue = entity; SqlDataSource sds = new SqlDataSource(ConfigurationManager.ConnectionStrings["dlgf"].ConnectionString, selectCommand); sds.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; sds.CancelSelectOnNullParameter = false; sds.SelectParameters.Add(parent); return sds; }
protected void gridViewMaster_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string customerID = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "CustomerID")); GridView gridViewNested = (GridView)e.Row.FindControl("nestedGridView"); SqlDataSource sqlDataSourceNestedGrid = new SqlDataSource(); sqlDataSourceNestedGrid.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; sqlDataSourceNestedGrid.SelectCommand = "SELECT [OrderID], [OrderDate],[Freight] FROM [Orders] WHERE [CustomerID] = '" + customerID + "'"; gridViewNested.DataSource = sqlDataSourceNestedGrid; gridViewNested.DataBind(); } }
protected void GvBind() { // string id = Session["no_pengajuan"].ToString(); string id = (string)Session["no_pengajuan"]; SqlDataSource dataSource = new SqlDataSource(); dataSource.ConnectionString = ConfigurationManager.ConnectionStrings["InventoryConn"].ToString(); dataSource.SelectCommand = "select p.id, p.id_pengajuan, p.id_jenis_inventaris, p.qty, p.memo_kabag, p.gambar,p.created_date, " + " pin.no_pengajuan, inv.nama_jenis from t_pengajuan_inventaris_detail p inner join m_jenis_inventaris inv on p.id_jenis_inventaris = inv.id " + " inner join t_pengajuan_inventaris pin on p.id_pengajuan = pin.id " + " where pin.no_pengajuan like '" + id + "'"; GridView1.DataSource = dataSource; GridView1.DataBind(); }
protected void SubmitButton_Click1(object sender, EventArgs e) { string conString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=|DataDirectory|\\Yummy.mdf;Integrated Security=True"; string selectString = "SELECT * FROM tb_Userinfo WHERE Username='******'";//select string for search currency name correspond with the input SqlDataSource dsrc = new SqlDataSource(conString, selectString); DataView DV = (DataView)dsrc.Select(DataSourceSelectArguments.Empty); if (DV.Table.Rows.Count > 0) { Session["UserForgetName"] = PasswordRecovery1.UserName; Server.Transfer("ForgetPassword.aspx"); } else PasswordRecovery1.UserNameFailureText = "Username not exists! "; }
protected void Button1_Click(object sender, EventArgs e) { SqlDataSource SqlDataSource2 = new SqlDataSource(); SqlDataSource2.ConnectionString=WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; try { //update //SqlDataSource2.UpdateParameters.Add("Order_date", TextBox1.Text); //SqlDataSource2.UpdateParameters.Add("Assign_numbers", TextBox2.Text); //SqlDataSource2.UpdateParameters.Add("Account_numbers", DropDownList1.Text); //SqlDataSource2.UpdateParameters.Add("Account_abstract", TextBox3.Text); //SqlDataSource2.UpdateParameters.Add("Income", TextBox4.Text); //SqlDataSource2.UpdateParameters.Add("Spend", TextBox5.Text); //SqlDataSource2.UpdateCommand = "Update [Joural_Order_M] set Order_date=@Order_date, Assign_numbers=@Assign_numbers, Account_numbers=@Account_numbers, Account_abstract=@Account_abstract, Income=@Income, Spend=@Spend where Id=" + Request["Id"]; //update SqlDataSource2.DeleteCommand = "delete [Account_Order_M] where Id=" + Request["Id"]; //delete table Joural_Order_M content //SqlDataSource2.DeleteParameters.Add("Order_date", Label1.Text); //SqlDataSource2.DeleteParameters.Add("Assign_numbers", Label2.Text); //SqlDataSource2.DeleteParameters.Add("Account_numbers", Label3.Text); //SqlDataSource2.DeleteParameters.Add("Account_abstract", TextBox3.Text); //SqlDataSource2.DeleteParameters.Add("Income", TextBox4.Text); //SqlDataSource2.DeleteParameters.Add("Spend", TextBox5.Text); //delete table Joural_Order_M content int affraw = SqlDataSource2.Delete(); if (affraw == 0) { Label1.Text = "Error"; } else { Label1.Text = "Delete OK"; Button1.Visible = false; } } catch (Exception ex2) { Response.Write("error" + ex2.ToString()); } finally { SqlDataSource2.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { ArrayList al = (ArrayList)Session["AnswerList"]; if (al == null) { Response.Redirect("Exam.aspx"); } resultGrid.DataSource = al; resultGrid.DataBind(); // Save the results into the database. try { if (IsPostBack == false) { double questions = al.Count; double correct = 0.0; for (int i = 0; i < al.Count; i++) { Answer a = (Answer)al[i]; if (a.Result == Answer.ResultValue.Correct) correct++; } double score = (correct / questions) * 100; SqlDataSource userExamDataSource = new SqlDataSource(); userExamDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["OnlineExamConnectionString"].ToString(); userExamDataSource.InsertCommand = "INSERT INTO [StudentExam] ([ExamID], [DateTimeComplete], [Score], [Username]) VALUES (@ExamID, @DateTimeComplete, @Score, @Username)"; userExamDataSource.InsertParameters.Add("ExamID", Session["ExamID"].ToString()); userExamDataSource.InsertParameters.Add("DateTimeComplete", DateTime.Now.ToString()); userExamDataSource.InsertParameters.Add("Score", score.ToString()); userExamDataSource.InsertParameters.Add("Username", Session["Student"].ToString()); int rowsAffected = userExamDataSource.Insert(); } } catch(Exception){ errorLabel.Text ="There was a problem saving your quiz results into our database. Therefore, the results from this quiz will not be displayed on the list on the main menu."; } }
public ronUtil2(int id) { DaysAvailable = getDaysAvailable(id); SqlDataSource SqlDataSource3 = new SqlDataSource(); SqlDataSource3.ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString(); SqlDataSource3.SelectCommand = "Select First_Name,Last_Name,Employee_ID,Dept_id,Image From Advisor Where Employee_ID='" + id.ToString() + "'"; DataView view3 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty); DataTable table3 = view3.ToTable(); if (table3.Rows.Count > 0) FullName = table3.Rows[0][0].ToString() + " " + table3.Rows[0][1].ToString(); First_Name = table3.Rows[0][0].ToString(); Last_Name = table3.Rows[0][1].ToString(); Employee_ID = table3.Rows[0][2].ToString(); Dept_id = table3.Rows[0][2].ToString(); Image = table3.Rows[0][3].ToString(); }
//This procedure prepares the query to bind the child GridView private SqlDataSource ChildDataSource(string strCustometId, string strSort) { string strQRY = ""; SqlDataSource dsTemp = new SqlDataSource(); dsTemp.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Tropix.net\Desktop\event pricing\App_Data\pricing.mdf;Integrated Security=True;User Instance=True"; strQRY = "SELECT registrationcost.pt_id,registrationcost.rc_id,participanttype.pp_id,participanttype.pp_name, registrationcost.rc_individual, registrationcost.rc_group, registrationcost.rc_guest FROM participanttype INNER JOIN registrationcost ON participanttype.pp_id = registrationcost.rc_pp_id WHERE [registrationcost].[pt_id] = '" + strCustometId + "'"; // strQRY = "SELECT pricetype.pt_id, participanttype.pp_name, registrationcost.rc_individual FROM dbo.participanttype INNER JOIN dbo.registrationcost ON dbo.participanttype.pp_id = dbo.registrationcost.rc_pp_id INNER JOIN dbo.pricetype ON dbo.registrationcost.pt_id = dbo.pricetype.pt_id"; //strQRY="SELECT dbo.pricetype.pt_name, dbo.participanttype.pp_name, dbo.registrationcost.rc_individual FROM dbo.participanttype INNER JOIN // dbo.registrationcost ON dbo.participanttype.pp_id = dbo.registrationcost.rc_pp_id INNER JOIN // dbo.pricetype ON dbo.registrationcost.pt_id = dbo.pricetype.pt_id"; dsTemp.SelectCommand = strQRY; return dsTemp; }
protected void Page_Load(object sender, EventArgs e) { PlaceHolder2.Visible = false; string connectionString = ConfigurationManager.AppSettings.Get("connString"); connSql = new SqlConnection(connectionString); int queryId; queryId = Convert.ToInt32(Request.QueryString["QueryId"]); BusinessLayer businessLayerObj = new BusinessLayer(); DataSet ds = businessLayerObj.GetQuery(queryId, connectionString); SqlDataSource dsrc = new SqlDataSource(); //IDataSource ids = (IDataSource)ds; GridView1.DataSource = ds; GridView1.DataBind(); }
protected void btnNewsUpdate_Click(object sender, EventArgs e) { //actID 已知的活動代碼 //用where查狀態是否還為"待審中" //是待審中再進行更新動作 //是上架就進行Question 警告使用者 更新後, 將重新送審 x = new SqlDataSource(); x.ConnectionString = @"Data Source=iii0.database.windows.net;Initial Catalog=prjTRK;Persist Security Info=True;User ID=iii;Password=P@ssw0rd"; x.SelectCommand = "Select *from Promotions where activityID ='" + activity.Text + "'"; DataView dv = x.Select(DataSourceSelectArguments.Empty) as DataView; statusID = dv.Table.Rows[0]["statusID"].ToString(); if (statusID == "3" || statusID == "4") { //壓縮圖片並存檔 CImageProess.get().UploadImage(FileUpload1, 資料夾路徑, CDictionary.SET_PROMOTION_PX); x = new SqlDataSource(); x.ConnectionString = @"Data Source=iii0.database.windows.net;Initial Catalog=prjTRK;Persist Security Info=True;User ID=iii;Password=P@ssw0rd"; string sql = "UPDATE Promotions set "; if (!string.IsNullOrEmpty(titleInput.Text)) { sql += " title=N'" + titleInput.Text + "', "; if (FileUpload1.HasFile) sql += " picPath='" + CImageProess.imageName + "', "; sql += " startDate='" + startDate.Text + "', "; sql += " endDate='" + endDate.Text + "', "; sql += " onShelfDate = convert(varchar, DATEADD(hour, 8, GETUTCDATE()), 113)," ; sql += " statusID = 3 ,"; sql += " content=N'" + txtNewsContent.Text + "' "; sql += " WHERE activityID='" + activity.Text + "'"; x.UpdateCommand = sql; x.Update(); Response.Redirect("~/windowCompany/companyCheck.aspx"); } else return; } else return; }
protected void Button1_Click(object sender, EventArgs e) { SqlDataSource sqldatasource2 = new SqlDataSource(); sqldatasource2.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString.ToString(); sqldatasource2.UpdateParameters.Add("Lottery", DropDownList1.Text); sqldatasource2.UpdateCommand = "Update [Account_Order_M] set Lottery=@Lottery where Id=" + Request["Id"]; int affraw_update = sqldatasource2.Update(); if (affraw_update == 0) { Label8.Text = "error"; } else { Label8.Text = "ok"; Button1.Visible = false; } sqldatasource2.Dispose(); }
protected void Button1_Click(object sender, EventArgs e) { SqlDataSource sds = new SqlDataSource(); sds.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); sds.SelectParameters.Add("Username", TypeCode.String, this.txtUserName.Text); sds.SelectParameters.Add("Email", TypeCode.String, this.txtEmail1.Text); sds.SelectCommand = "SELECT * FROM [UserTable] WHERE [Username] = @Username OR [Email] = @Email"; DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty); if (dv.Count != 0) { this.Label1.ForeColor = System.Drawing.Color.Red; this.Label1.Text = "The user already Exist!"; return; } else { this.SqlDataSource2.Insert(); this.Label1.Text = "New User Profile has been created you can login now"; Button1.Enabled = false; txtAddress.Enabled = false; txtEmail1.Enabled = false; txtEmail2.Enabled = false; txtName.Enabled = false; txtpassportNumber.Enabled = false; txtPassword1.Enabled = false; txtpassword2.Enabled = false; txtUserName.Enabled = false; } }
//Signs a person up protected void ButtonSignUp_Click(object sender, EventArgs e) { //First check if passwords match if (tboxConfirmation.Text != tboxPassword.Text) { LabelError.Text = "Password does not match"; return; } //Create Current Date DateTime myDateTime = DateTime.Now; string sqlDate = myDateTime.ToString("yyyy-MM-dd HH:mm:ss"); SqlDataSource objDS = new SqlDataSource { ProviderName = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString_myDatabase"].ProviderName, ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString_myDatabase"].ConnectionString, InsertCommand = "INSERT INTO [Forum_User] ([Email], [Username], [Password], [Date_User]) VALUES (?,?,?,?)" }; objDS.InsertParameters.Add("Email", tboxEmail.Text); objDS.InsertParameters.Add("Username", tboxUsername.Text); objDS.InsertParameters.Add("Password", tboxPassword.Text); objDS.InsertParameters.Add("Date_User", sqlDate); //load user in, checks if the user user entered all necesary info try { objDS.Insert(); Response.Redirect("Login.aspx"); } catch { LabelError.Text = "Missing Email, Username, and/or password"; } }
public List <ConfigStudentRegData> getConfigOverReg(string academic_year, string semester) { List <ConfigStudentRegData> Config_Data = new List <ConfigStudentRegData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; try { sql = "Select * From CONFIG_STD_REG Where ACADEMIC='" + academic_year + "' AND SEMESTER='" + semester + "' AND (FACULTY_CODE = '-' ) "; oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { ConfigStudentRegData config_data = new ConfigStudentRegData(); config_data.academic_year = rowData["ACADEMIC"].ToString(); config_data.semester = rowData["SEMESTER"].ToString(); config_data.degree_char = rowData["DEGREE_CHAR"].ToString();; config_data.faculty_code = rowData["FACULTY_CODE"].ToString(); config_data.student_academic_year = rowData["STUDENT_ACADEMIC_YEAR"].ToString(); config_data.start_date = rowData["START_DATE"].ToString(); config_data.end_date = rowData["STOP_DATE"].ToString(); config_data.due_date = rowData["DUE_DATE"].ToString(); Config_Data.Add(config_data); } } catch { HttpContext.Current.Session["response"] = "Unit Test:ConfigStudentReg:getConfigStudentReg" + " ไม่สามารถดำเนินการได้" + sql; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(Config_Data); }
public List <HisRegistrationData> get_HisRegistrationByPayment(string payment_id, string reg_type, string reg_datetime, string degree_char) { string tableName = getHisRegistrationTable(degree_char); List <HisRegistrationData> HisData = new List <HisRegistrationData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From " + tableName + " Where PAYMENT_ID='" + payment_id + "' AND REG_TYPE='" + reg_type + "' AND DATE_TIME='" + reg_datetime + "'"; DataView allData2 = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData2 in allData2) { HisRegistrationData his_data = new HisRegistrationData(); his_data.date_time = rowData2["DATE_TIME"].ToString(); his_data.academic_year = rowData2["ACADEMIC_YEAR"].ToString(); his_data.semester = rowData2["SEMESTER"].ToString(); his_data.reg_type = rowData2["REG_TYPE"].ToString(); his_data.student_id = rowData2["STUDENT_ID"].ToString(); his_data.nation_id = rowData2["NATION_ID"].ToString(); his_data.passport_id = rowData2["PASSPORT_ID"].ToString(); his_data.course_type = rowData2["COURSE_TYPE"].ToString(); his_data.sec = Convert.ToInt16(rowData2["SEC"].ToString()); his_data.subsec = Convert.ToInt16(rowData2["SUBSEC"].ToString()); his_data.old_sec = Convert.ToInt16(rowData2["OLD_SEC"].ToString()); his_data.old_subsec = Convert.ToInt16(rowData2["OLD_SUBSEC"].ToString()); his_data.credit = Convert.ToInt16(rowData2["CREDIT"].ToString()); his_data.fee = Convert.ToInt16(rowData2["FEE"].ToString()); his_data.course_code = rowData2["COURSE_CODE"].ToString(); his_data.payment_id = rowData2["PAYMENT_ID"].ToString(); HisData.Add(his_data); } return(HisData); }
/// <summary> ///Eliminar el acta. /// </summary> /// <param name="CodConvocatoria">id convocatoria.</param> /// <param name="CodDocumentoFormato">id documento formato.</param> /// <param name="Comentario">comentario.</param> /// <param name="Fecha">fecha.</param> /// <param name="FechaActa">fecha del acta.</param> /// <param name="Icono">icono.</param> /// <param name="Id_Acta">id del acta.</param> /// <param name="NomActa">nombre del acta.</param> /// <param name="NomDocumentoFormato">id documento formato.</param> /// <param name="NumActa">numero del acta.</param> /// <param name="URL">URL.</param> public void DeleteActa(string CodConvocatoria, string CodDocumentoFormato, string Comentario, string Fecha, string FechaActa, string Icono, string Id_Acta, string NomActa, string NomDocumentoFormato, string NumActa, string URL) { if (contextProc) { return; } var jyf = new Datos.MD_ActasFormatoResult() { CodConvocatoria = int.Parse(CodConvocatoria), CodDocumentoFormato = byte.Parse(CodDocumentoFormato ?? "0"), Comentario = Comentario ?? string.Empty, Fecha = DateTime.Parse(Fecha ?? DateTime.Now.ToShortDateString()), FechaActa = DateTime.Parse(FechaActa ?? DateTime.Now.ToShortDateString()), Icono = Icono ?? "0", Id_Acta = int.Parse(Id_Acta ?? "0"), NomActa = NomActa ?? string.Empty, NomDocumentoFormato = NomDocumentoFormato ?? "0", NumActa = NumActa ?? "0", URL = URL ?? string.Empty }; Consultas asd = new Consultas(); asd.Db.MD_ActasFormato(0).ToList().Remove(jyf); asd.Db.SubmitChanges(); var sqlInsert = "DELETE FROM [dbo].[ConvocatoriaActa] WHERE [Id_Acta] ß {0} AND [NumActa] ß ƒ{1}ƒ AND [CodConvocatoria] ß {2}"; sqlInsert = string.Format(sqlInsert, jyf.Id_Acta, jyf.NumActa, jyf.CodConvocatoria); sqlInsert = commandFormat(sqlInsert); SqlDataSource sqlDs = new SqlDataSource() { ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString, DeleteCommand = sqlInsert, DeleteCommandType = SqlDataSourceCommandType.Text, DataSourceMode = SqlDataSourceMode.DataReader }; sqlDs.Delete(); sqlDs.Dispose(); contextProc = true; }
public List <Member> getMemberFromCommand(string Command) { String commandSQL = Command; List <Member> userData = new List <Member>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = commandSQL; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { Member users_data = new Member(); users_data.MEMBER_USER_ID = rowData["USER_ID"].ToString(); users_data.MEMBER_DIVISION_ID = rowData["DIVISION_ID"].ToString(); users_data.MEMBER_DEPARTMENT_ID = rowData["DEPARTMENT_ID"].ToString(); //users_data.USERS_INFO_USER_ID = rowData["USER_ID"].ToString(); //users_data.USERS_INFO_NATIONAL_ID = rowData["NATIONAL_ID"].ToString(); //users_data.USERS_INFO_OFFICIAL_ID = rowData["OFFICIAL_ID"].ToString(); //users_data.USERS_INFO_TITLE_THAINAME = rowData["TITLE_THAINAME"].ToString(); //users_data.USERS_INFO_FIRST_THAINAME = rowData["FIRST_THAINAME"].ToString(); //users_data.USERS_INFO_FAMILY_THAINAME = rowData["FAMILY_THAINAME"].ToString(); //users_data.USERS_INFO_TITLE_ENGNAME = rowData["TITLE_ENGNAME"].ToString(); //users_data.USERS_INFO_FIRST_ENGNAME = rowData["FIRST_ENGNAME"].ToString(); //users_data.USERS_INFO_FAMILY_ENGNAME = rowData["FAMILY_ENGNAME"].ToString(); //users_data.USERS_INFO_FACULTY_ID = rowData["FACULTY_ID"].ToString(); //users_data.USERS_INFO_DEPARTMENT_ID = rowData["DEPARTMENT_ID"].ToString(); //users_data.USERS_INFO_INTERNAL_PHONE = rowData["INTERNAL_PHONE"].ToString(); //users_data.USERS_INFO_EXTERNAL_PHONE = rowData["EXTERNAL_PHONE"].ToString(); userData.Add(users_data); } return(userData); }
public void FilterCustomerReturnSlip(SqlDataSource DataSource, string PostedStatus) { string CommandText = string.Empty; CommandText = "SELECT [ID], [CRSID], [CRSNo], [CRSDate], [Customer], [PUSNo], [TotalAmt], [PkgNo], [ItemStatus] FROM [CRS] "; if (PostedStatus != "CONFIRMED") { if (PostedStatus == "POSTED") { if (CRSConfirmationCount() > 0) { CommandText += " INNER JOIN CRS_CONFIRMATIONS ON CRS.CRSNo != CRS_CONFIRMATIONS.CRS_NUMBER WHERE ynPosted=1 AND ynCancelled=0 order by CRSDate DESC"; } else { CommandText += " WHERE ynPosted=1 AND ynCancelled=0 order by CRSDate DESC"; } } else { if (CRSConfirmationCount() > 0) { CommandText += " INNER JOIN CRS_CONFIRMATIONS ON CRS.CRSNo != CRS_CONFIRMATIONS.CRS_NUMBER WHERE ynPosted=0 AND ynCancelled=0 order by CRSDate DESC"; } else { CommandText += " WHERE ynPosted=0 AND ynCancelled=0 order by CRSDate DESC"; } } } else { CommandText = "SELECT [ID], [CRSID], [CRSNo], [CRSDate], [Customer], [PUSNo], [TotalAmt], [PkgNo], [ItemStatus] FROM [CRS] "; CommandText += " INNER JOIN CRS_CONFIRMATIONS ON CRS.CRSNo = CRS_CONFIRMATIONS.CRS_NUMBER order by CRSDate DESC"; } DataSource.SelectCommand = CommandText; DataSource.DataBind(); }
public List <StudentGroupData> getStudentGroupByCurriculum(string curr_code, string degree_char) { string tableName = getTableName(degree_char); SystemConfigData system_config = new SystemConfigData(); system_config = new SystemConfig().getConfig(); Status_Variable status_var = new Status_Variable(); List <StudentGroupData> studentGroup = new List <StudentGroupData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = ""; try { sql = "Select CURR_CODE,STD_CATEGORY_CODE,STD_GROUP_CODE,SECTION_CODE From " + tableName + " Where ACADEMIC_YEAR='" + system_config.AcademicYear + "' AND SEMESTER='" + system_config.Semester + "' AND CURR_CODE='" + curr_code + "' AND STD_CATEGORY_CODE != '-' Group By CURR_CODE,STD_CATEGORY_CODE,STD_GROUP_CODE,SECTION_CODE"; oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { StudentGroupData student_group = new StudentGroupData(); student_group.curri_code = rowData["CURR_CODE"].ToString(); student_group.std_category = rowData["STD_CATEGORY_CODE"].ToString(); student_group.std_group = rowData["STD_GROUP_CODE"].ToString(); student_group.section = rowData["SECTION_CODE"].ToString(); studentGroup.Add(student_group); } } catch { HttpContext.Current.Session["response"] = "Unit Test:StudentGroup:getStudentGroupByCurriculum" + " ไม่สามารถดำเนินการได้" + sql; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(studentGroup); }
/// <summary> /// 查询数据根据SQL语句 /// </summary> /// <param name="id">SQL编号</param> /// <param name="sql">SQL语句</param> /// <returns>数据结果</returns> public DataSet getDataSet(string id, string sql) { resultSql = sql; DataSet rtnDataSet = new DataSet(); IDataSource dataSource = null; daoStruct = parseDao.ObtainConfig(id); switch (daoStruct.DbType) { case "oracle": dataSource = new OracleDataSource(daoStruct); break; case "mysql": dataSource = new MySqlDataSource(daoStruct); break; case "sql": dataSource = new SqlDataSource(daoStruct); break; case "access": dataSource = new AccessDataSource(daoStruct); break; case "sqllite": dataSource = new SqlLiteDataSource(daoStruct); break; } if (dataSource != null) { return(dataSource.SelectExecute(sql)); } else { return(null); } }
//匯出EXCEL public void export_excel(string v_verion, SqlDataSource v_sds, string v_Sqlcmd, string v_filename) { //匯出excel檔 HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Charset = "UTF-8"; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; //Response.ContentType = "application/vnd.ms-excel"; switch (v_verion) { case "2003": HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + DateTime.Today.ToString("yyyyMMdd") + "_" + v_filename + ".xls");//excel檔名 HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; break; case "2007": HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + DateTime.Today.ToString("yyyyMMdd") + "_" + v_filename + ".xlsx");//excel檔名 HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break; default: break; } HttpContext.Current.Response.Charset = ""; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); v_sds.SelectCommand = v_Sqlcmd; v_sds.DataBind(); dg.DataSource = v_sds.Select(DataSourceSelectArguments.Empty); dg.DataBind(); dg.RenderControl(htw); HttpContext.Current.Response.Write(sw.ToString()); HttpContext.Current.Response.End(); }
// V1.0.0 public StudentIDConfigData getConfig(uint id) { StudentIDConfigData config_data = new StudentIDConfigData(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); try { oracleObj.SelectCommand = "Select * From STUDENT_ID_CONFIG Where ID=" + id; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { config_data.ID = Convert.ToInt32(rowData["ID"].ToString()); config_data.Faculty_Code = rowData["FACULTY_CODE"].ToString(); config_data.Department_Code = rowData["DEPARTMENT_CODE"].ToString(); config_data.Major_Code = rowData["MAJOR_CODE"].ToString(); config_data.Degree_Admission = rowData["DEGREE_ADMISSION"].ToString(); config_data.Admission_Type = rowData["ADMISSION_TYPE"].ToString(); config_data.Gen_Type = rowData["GEN_TYPE"].ToString(); config_data.Sec_No = rowData["SEC_NO"].ToString(); config_data.Project_Selected = rowData["PROJECT_SELECTED"].ToString(); config_data.Project_Code = rowData["PROJECT_CODE"].ToString(); config_data.Major_Student_ID = rowData["MAJOR_STUDENT_ID"].ToString(); config_data.num_of_student = Convert.ToUInt32(rowData["NUM_OF_STUDENT"].ToString()); } } catch { HttpContext.Current.Session["response"] = "Unit Test:StudentIDConfig:getConfig" + " ไม่สามารถดำเนินการได้"; HttpContext.Current.Response.Redirect("err_response.aspx"); } return(config_data); }
protected void Page_Load(object sender, EventArgs e) { SqlDataSource SrcEmailsDetails = new SqlDataSource(); string connectionString = ConfigurationSettings.AppSettings["ConnectionString"] + "password="******"password"] + ";"; SrcEmailsDetails.ConnectionString = connectionString; string OrganisationName; OrganisationName = Request.QueryString["OrganisationName"]; bool EmailinHour = false; Boolean.TryParse(Request.QueryString["EmailinHour"], out EmailinHour); bool EmailinDay = false; Boolean.TryParse(Request.QueryString["EmailinHour"], out EmailinDay); if (EmailinHour || EmailinDay) { if (EmailinHour) { SrcEmailsDetails.SelectCommand = "SELECT e.EmailId,e.ToEmail,e.ToName,e.FromEmail,e.FromName,e.CC,e.BCC,e.Subject,e.Body,dbo.udfUTCtoDaylightSavingTime(e.DateCreated, " + UserContext.UserData.OrgID + ") as DateCreated ,o.OrganisationName FROM tblEmail e JOIN tblOrganisation o ON e.OrganisationId = o.OrganisationId WHERE o.OrganisationName='" + OrganisationName + "' AND e.DateCreated BETWEEN DATEADD(hour, -1, GETUTCDATE()) AND GETUTCDATE()"; } if (EmailinDay) { SrcEmailsDetails.SelectCommand = "SELECT e.EmailId,e.ToEmail,e.ToName,e.FromEmail,e.FromName,e.CC,e.BCC,e.Subject,e.Body,dbo.udfUTCtoDaylightSavingTime(e.DateCreated, " + UserContext.UserData.OrgID + ") as DateCreated,o.OrganisationName FROM tblEmail e JOIN tblOrganisation o ON e.OrganisationId = o.OrganisationId WHERE o.OrganisationName='" + OrganisationName + "' AND e.DateCreated BETWEEN DATEADD(day, -1, GETUTCDATE()) AND GETUTCDATE()"; } } else { SrcEmailsDetails.SelectCommand = "SELECT e.EmailId,e.ToEmail,e.ToName,e.FromEmail,e.FromName,e.CC,e.BCC,e.Subject,e.Body,dbo.udfUTCtoDaylightSavingTime(e.DateCreated, " + UserContext.UserData.OrgID + ") as DateCreated,o.OrganisationName FROM tblEmail e JOIN tblOrganisation o ON e.OrganisationId = o.OrganisationId WHERE o.OrganisationName='" + OrganisationName + "'"; } grdMailThroughputDetails.DataSource = SrcEmailsDetails; grdMailThroughputDetails.DataBind(); }
/// <summary> /// เรียกดูข้อมูลจากตาราง CURRFORMAT /// </summary> /// <returns>ข้อมูลจากตาราง CURRFORMAT</returns> public List <CurrFormat> getCurrFormat() { List <CurrFormat> CurrFormatData = new List <CurrFormat>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From CURRFORMAT Order By CURRFORMATCODE"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { CurrFormat CurrFormatRow = new CurrFormat(); CurrFormatRow.CurrFormatCode = rowData["CURRFORMATCODE"].ToString(); CurrFormatRow.LevelCode = rowData["LEVELCODE"].ToString(); CurrFormatRow.CurrFormatName = rowData["CURRFORMATNAME"].ToString(); CurrFormatData.Add(CurrFormatRow); } return(CurrFormatData); }
/// <summary> /// เรียกดูข้อมูลจากตาราง LECTUREREXPRIENCE /// </summary> /// <param name="LectIdentity">บัตรประจำตัวประชาชน</param> /// <returns>ข้อมูลจากตาราง LECTUREREXPRIENCE</returns> public LecturerExprience getLecturerExprience(string LectIdentity) { LecturerExprience data = new LecturerExprience(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From LECTUREREXPRIENCE Where LECTIDENTITY='" + LectIdentity + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { data.LectIdentity = rowData["LECTIDENTITY"].ToString(); data.SubjectName = rowData["SUBJECTNAME"].ToString(); data.LecturerType = rowData["LECTURERTYPE"].ToString(); data.BeginYear = rowData["BEGINYEAR"].ToString(); data.EndYear = rowData["ENDYEAR"].ToString(); data.QuitIssue = rowData["QUITISSUE"].ToString(); data.ExprienceId = rowData["EXPRIENCEID"].ToString(); } return(data); }
protected void PayButton_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString); conn.Open(); String insert2 = "update ParkingTickets set Paid='" + 1 + "' where PersonalID ='" + Session["New"] + "'"; SqlCommand com3 = new SqlCommand(insert2, conn); com3.ExecuteNonQuery(); SqlDataSource SqlDataSource1 = new SqlDataSource(); SqlDataSource1.ID = "SqlDataSource1"; this.Page.Controls.Add(SqlDataSource1); SqlDataSource1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString; SqlDataSource1.SelectCommand = "select pt.PersonalID, vt.ViolationName, vt.ViolationPrice, pt.Paid from ParkingTickets pt, ViolationType vt where pt.ViolationID = vt.ViolationID and PersonalID = " + Session["New"]; GridView1.DataSource = SqlDataSource1; GridView1.DataBind(); StatusLabel.Text = "All fines have been paid."; updatePaidStatus(); }
public List <DegreeNameData> getDegreeName() { List <DegreeNameData> DegreeName_data = new List <DegreeNameData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From DEGREE_NAME Order By DEGREE_NAME_CODE"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { DegreeNameData DegreeName = new DegreeNameData(); DegreeName.DegreeName_Code = rowData["DEGREE_NAME_CODE"].ToString(); DegreeName.DegreeName_Thai = rowData["DEGREE_NAME_THAI"].ToString(); DegreeName.DegreeName_Eng = rowData["DEGREE_NAME_ENG"].ToString(); DegreeName.DegreeName_ShortThai = rowData["DEGREE_NAME_SHORTTHAI"].ToString(); DegreeName.DegreeName_ShortEng = rowData["DEGREE_NAME_SHORTENG"].ToString(); DegreeName_data.Add(DegreeName); } return(DegreeName_data); }
public string deleteOtherOffice(string OtherOffice_Code) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Delete From OTHER_OFFICE Where OTHEROFFICE_CODE ='" + OtherOffice_Code + "'"; oracleObj.DeleteCommand = sql; try { if (oracleObj.Delete() > 0) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString() + " "; } return(response); }
/// <summary> /// Table GRAD_INSTITUTE /// </summary> /// <param name="User_Id"></param> /// <returns></returns> public string deletePreInstitute(string Institute_Code) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Delete From GRAD_INSTITUTE Where INSTITUTE_CODE ='" + Institute_Code + "'"; oracleObj.DeleteCommand = sql; try { if (oracleObj.Delete() > 0) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString() + " "; } return(response); }
/// <summary> /// เรียกข้อมูลจากตาราง LEVELS /// </summary> /// <param name="sql">SQL command</param> /// <returns></returns> public List <Levels> getLevelsrManual(string sql) { List <Levels> LevelsData = new List <Levels>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { Levels LevelsRow = new Levels(); LevelsRow.LevelCode = rowData["LEVELCODE"].ToString(); LevelsRow.LevelName = rowData["LEVELNAME"].ToString(); LevelsData.Add(LevelsRow); } return(LevelsData); }
//Pongsarun 26/9/2015: use for config system public string deleteDivision(string DivisionId) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Delete From DIVISION Where DIVISION_CODE ='" + DivisionId + "'"; oracleObj.DeleteCommand = sql; try { if (oracleObj.Delete() > 0) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString() + " "; } return(response); }
public List <ConstVarData> getConstVar() { List <ConstVarData> varData = new List <ConstVarData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From CONST_VAR Order By VAR_CODE"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { ConstVarData var_data = new ConstVarData(); var_data.Var_Code = rowData["VAR_CODE"].ToString(); var_data.Var_Thai = rowData["VAR_THAI"].ToString(); var_data.Var_Eng = rowData["VAR_ENG"].ToString(); var_data.Var_ShortThai = rowData["VAR_SHORT_THAI"].ToString(); var_data.Var_ShortEng = rowData["VAR_SHORT_ENG"].ToString(); var_data.Var_Data = rowData["VAR_DATA"].ToString(); varData.Add(var_data); } return(varData); }
protected void btnOK_Click(object sender, EventArgs e) { SqlDataSource sds = new SqlDataSource(); sds.ConnectionString = @"Data Source=.;Initial Catalog=Guardian_Angel;Integrated Security=True"; sds.InsertCommand = getInsertSql(); sds.Insert(); //新增成功通知 //btnOK.Attributes["OnClick"] = "return confirm('資料新增成功!')"; Response.Write("<script language=javascript>alert('資料新增成功!');</script>"); //lblMsg.Visible = true; //lblMsg.Text = "被照顧者【" + tbxName.Text + "】資料新增成功!"; //btnOK.Enabled = false; //跳出訊息告知新增成功 //Response.Write("<script language=javascript>alert('資料新增成功!將返回資料頁')</script>"); //Response.Redirect("GaCare.aspx"); btnOK.Visible = false; btnNext.Visible = true; }
public DivisionData getDivision(String Division_Code) { DivisionData Division = new DivisionData(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From DIVISION Where DIVISION_CODE='" + Division_Code + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { Division.Division_Code = rowData["DIVISION_CODE"].ToString(); Division.Division_Thai = rowData["DIVISION_THAINAME"].ToString(); Division.Division_Eng = rowData["DIVISION_ENGNAME"].ToString(); Division.Division_ShortName = rowData["DIVISION_SHORTNAME"].ToString(); Division.Division_OfficeCode = rowData["OFFICE_CODE"].ToString(); Division.Division_Status = rowData["DIVISION_STATUS"].ToString(); Division.Division_CodeStudent = rowData["DIVISION_CODE_STUDENTID"].ToString(); } return(Division); }
public List <OtherOfficeData> getOtherOfficeManual(string sql) { List <OtherOfficeData> data = new List <OtherOfficeData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { OtherOfficeData Office = new OtherOfficeData(); Office.OtherOffice_Code = rowData["OTHEROFFICE_CODE"].ToString(); Office.OtherOffice_ThaiName = rowData["OTHEROFFICE_THAINAME"].ToString(); Office.OtherOffice_EngName = rowData["OTHEROFFICE_ENGNAME"].ToString(); Office.OtherOffice_ShortName = rowData["OTHEROFFICE_SHORTNAME"].ToString(); Office.OtherOffice_Status = rowData["OTHEROFFICE_STATUS"].ToString(); data.Add(Office); } return(data); }
public void FilterCustomer(SqlDataSource CustomerSqldataSource, string search_parameter, string BrandName = "") { StringBuilder command = new StringBuilder(); command.Append("SELECT [CustNo], [CompName], [brand] FROM [CustInfoEx] "); if (BrandName != "") { if (search_parameter != string.Empty) { command.Append(" WHERE MainCustNo is not null and brand='" + BrandName + "' and CompName LIKE '%" + search_parameter + "%' "); } } else { if (search_parameter != string.Empty) { command.Append(" WHERE MainCustNo is not null and CompName LIKE '%" + search_parameter + "%' "); } } CustomerSqldataSource.SelectCommand = command.ToString(); CustomerSqldataSource.DataBind(); }
/// <summary> /// Table GRAD_INSTITUTE /// </summary> /// <param name="sql"></param> /// <returns></returns> public List <PreInstituteData> getPreInstituteManual(string sql) { List <PreInstituteData> data = new List <PreInstituteData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { PreInstituteData users = new PreInstituteData(); users.Institute_Code = rowData["INSTITUTE_CODE"].ToString(); users.Institute_Thainame = rowData["INSTITUTE_THAINAME"].ToString(); users.Institute_Engname = rowData["INSTITUTE_ENGNAME"].ToString(); users.Institute_Province_Code = rowData["INSTITUTE_PROVINCE_CODE"].ToString(); data.Add(users); } return(data); }
/// <summary> /// Table USERS_FACULTY_AUTHORIZED /// </summary> /// <param name="sql"></param> /// <returns></returns> public string deleteFacultyAuthorizeManual(string sql) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.DeleteCommand = sql; try { if (oracleObj.Delete() > 0) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString() + " "; } return(response); }
protected void btnOK_Click(object sender, EventArgs e) { string myMessage = null; for (int i = 0; i < GridView2.Rows.Count; i++) { CheckBox myCheckBox = (CheckBox)GridView2.Rows[i].FindControl("CheckBox1"); Label pid = (Label)GridView2.Rows[i].FindControl("Label1"); DropDownList quantity = (DropDownList)GridView2.Rows[i].FindControl("dropDownList1"); if (myCheckBox.Checked == true) { myMessage = myMessage + "(" + pid.Text + "," + nid + "," + quantity.SelectedValue + ")" + ","; } } myMessage = myMessage.TrimEnd(','); SqlDataSource sds = new SqlDataSource(); sds.ConnectionString = @"Data Source=.;Initial Catalog=Guardian_Angel;Integrated Security=True;"; sds.InsertCommand = "insert [dbo].[NPGrouping]([P_id],[N_id],[P_number]) values" + myMessage; sds.Insert(); Session["nId"] = nid; Response.Redirect(Request.Url.ToString()); }
/// <summary> /// Table USERS_GROUP /// </summary> /// <param name="User_Id"></param> /// <returns></returns> public string deleteUserGroup(string Group_Id) { string response = ""; ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); string sql = "Delete From USERS_GROUP Where USERS_GROUP_ID ='" + Group_Id + "'"; oracleObj.DeleteCommand = sql; try { if (oracleObj.Delete() > 0) { response = "OK"; } } catch (Exception e) { response = e.Message.ToString() + " "; } return(response); }
/// <summary> /// เรียกดูข้อมูลจากตาราง SUFLAGE /// </summary> /// <returns>ข้อมูลจากตาราง SUFLAGE</returns> public List <SuFlage> getSuFlage() { List <SuFlage> SuFlageData = new List <SuFlage>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle_tqf2(); oracleObj.SelectCommand = "Select * From SUFLAGE Order By SUFLAGCODE"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { SuFlage SuFlageRow = new SuFlage(); SuFlageRow.SuFlagCode = rowData["SUFLAGCODE"].ToString(); SuFlageRow.SuFlageName = rowData["SUFLAGNAME"].ToString(); SuFlageRow.SuFlageEnName = rowData["SUFLAGEENNAME"].ToString(); SuFlageData.Add(SuFlageRow); } return(SuFlageData); }