protected void Button6_Click(object sender, EventArgs e) { if (FileUpload4.HasFile == true) { SqlDataSource4.Insert(); } }
protected void ddlMin_SelectedIndexChanged(object sender, EventArgs e) { if (ddlMin.SelectedIndex != 0) { StringBuilder strSQL = new StringBuilder(); strSQL.Append("select m.mi_code, m.mi_name, d.d_name, d_code, d.d_id as d_id, d.id, m.mi_id from department d, ministry m "); strSQL.Append("where d.mi_id = m.mi_id and d.mi_id = " + ddlMin.SelectedValue); SqlDataSource4.SelectCommand = strSQL.ToString(); SqlDataSource4.DataBind(); GridView1.DataSource = SqlDataSource4; GridView1.DataBind(); } else { StringBuilder strSQL = new StringBuilder(); strSQL.Append("select m.mi_code, m.mi_name, d.d_name, d_code, d.d_id as d_id, d.id, m.mi_id from department d, ministry m "); strSQL.Append("where d.mi_id = m.mi_id and d.mi_id = 0"); SqlDataSource4.SelectCommand = strSQL.ToString(); SqlDataSource4.DataBind(); GridView1.DataSource = SqlDataSource4; GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); if (ck != null) { String strPJid = ck.pj_id; string strPjType = string.Empty; StringBuilder strSQL = new StringBuilder(); strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_background, pj_urgency, pj_type"); strSQL.Append(" from projects p, department d, ministry m, yutasad y"); strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = '" + strPJid + "'"); SqlDataSource4.SelectCommand = strSQL.ToString(); SqlDataSource4.DataBind(); DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); foreach (DataRow dRow in dv1.Table.Rows) { lblDeptCode.Text = dRow["mi_code"].ToString(); lblDeptName.Text = dRow["mi_name"].ToString(); lblDivisionCode.Text = dRow["d_code"].ToString(); lblDivisionName.Text = dRow["d_name"].ToString(); lblProjectName.Text = dRow["pj_name"].ToString(); lblProjectCode.Text = dRow["pj_code"].ToString(); lblYutasard.Text = dRow["yut_name"].ToString(); //lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString(); //lblRelateDept.Text = dRow["pj_relateDept"].ToString(); lblBudget.Text = dRow["pj_budget"].ToString(); lblYear.Text = dRow["pj_year"].ToString(); strPjType = dRow["pj_type"].ToString(); } if (strPjType.Trim() == "โครงการใหม่") { linkQuestionE.Visible = false; } else if (strPjType.Trim() == "โครงการต่อเนื่องหรือโครงการขยายผล") { linkQuestionE.Visible = true; } else { Response.Redirect("default.aspx"); } } else { //redirect to login page Response.Redirect("default.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.UsageChartDataBinding(); LoadCompany(); } List <UsageItem> us = new List <UsageItem>(); DataView dv = (DataView)SqlDataSource4.Select(System.Web.UI.DataSourceSelectArguments.Empty); if (dv != null) { foreach (DataRowView dr in dv) { UsageItem v = new UsageItem(); v.BillDt = dr["BillDt"].ToString(); v.UsageSummary = (double)dr["UsageSummary"]; us.Add(v); } RadChart1.DataSource = us; RadChart1.Series[0].DataYColumn = "UsageSummary"; RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt"; RadChart1.DataBind(); } }
protected void Button2_Click(object sender, EventArgs e) { if (TextBox3.Text != "") { int msj; SqlDataSource4.InsertParameters["MontoSalida"].DefaultValue = TextBox3.Text; SqlDataSource4.InsertParameters["Fecha"].DefaultValue = TextBox4.Text; SqlDataSource4.InsertParameters["ID_Concepto"].DefaultValue = DropDownList3.SelectedValue; SqlDataSource4.InsertParameters["ID_Caja"].DefaultValue = DropDownList2.SelectedValue; SqlDataSource4.InsertParameters["Informacion"].DefaultValue = TextBox5.Text; msj = SqlDataSource4.Insert(); if (msj == 1) { Response.Write("<script>alert('Datos ingresados correctatmente')</script>"); TextBox3.Text = ""; Label2.Text = "Se retiro de la caja: " + TextBox3.Text; } else { Response.Write("<script>alert('Error, No se guardaron los datos')</script>"); Label2.Text = "Error."; } } else { Response.Write("<script>alert('Ingrese un monto')</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { try { SqlDataSource4.UpdateParameters["CardNO"].DefaultValue = Session["CardNo"].ToString(); SqlDataSource4.UpdateParameters["deposit"].DefaultValue = TextBox1.Text; SqlDataSource4.Update(); SqlDataSource2.InsertParameters["deposit"].DefaultValue = "True"; SqlDataSource2.InsertParameters["withdrow"].DefaultValue = "False"; SqlDataSource2.InsertParameters["Ammount"].DefaultValue = TextBox1.Text; SqlDataSource2.InsertParameters["BranchID"].DefaultValue = DropDownList1.Text; SqlDataSource2.InsertParameters["CardNO"].DefaultValue = Session["CardNo"].ToString(); SqlDataSource2.InsertParameters["date"].DefaultValue = DateTime.Today.ToString("dd-MM-yyyy") + " " + DateTime.Now.ToString("HH: mm:ss"); SqlDataSource2.Insert(); Label1.Text = "Successfull!! Done ! , Go to view Balance To Check your Update Balance!!"; } catch (Exception ee) { Label1.Text = ee.StackTrace; } }
protected void Button3_Click(object sender, EventArgs e) { DataView dv3 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); int row_num1 = -1; for (int i = 0; i < dv3.Table.Rows.Count; i++) { if (TextBox1.Text != "" && TextBox2.Text != "" && TextBox3.Text != "" && TextBox4.Text != "") { if (TextBox1.Text.Trim().ToString() == (string)dv3.Table.Rows[i][1].ToString().Trim() && TextBox2.Text.Trim().ToString() == (string)dv3.Table.Rows[i][2].ToString().Trim() && TextBox3.Text.Trim().ToString() == (string)dv3.Table.Rows[i][3].ToString().Trim() && TextBox4.Text.Trim().ToString() == (string)dv3.Table.Rows[i][4].ToString().Trim()) { row_num1 = i; } } } int cl_id = -1; if (row_num1 > -1) { cl_id = (int)dv3.Table.Rows[row_num1][0]; } if (cl_id > 0) { Label3.Text = "Your number is: " + cl_id.ToString(); } else { Label3.Text = "Please, enter button Add. You are not in our database."; } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (!DropDownList1.SelectedItem.Text.Equals("Select Student")) { SqlConnection conn = new SqlConnection (@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Ceng.mdf;Integrated Security=True"); int courseId = int.Parse(Request.QueryString["id"]); string studentName = DropDownList1.SelectedItem.Text; SqlCommand cmd = new SqlCommand ("Select * from Enrolment as e, Students as s where e.StudentID = s.StudentID and " + "CourseID = " + courseId + " and StudentName = '" + studentName + "'", conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { Label1.Visible = true; Label1.Text = "The selected student is already registered to the course!"; Label1.ForeColor = Color.Red; } else { Label1.Visible = true; Label1.Text = "Registered!"; Label1.ForeColor = Color.Blue; SqlDataSource4.Insert(); GridView1.DataBind(); } reader.Close(); conn.Close(); } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedValue == "Inner") { DataView mydata = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty); GridView3.DataSource = mydata; GridView3.AutoGenerateColumns = true; GridView3.DataBind(); } else if (DropDownList1.SelectedValue == "Left") { DataView mydata = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); GridView3.DataSource = mydata; GridView3.AutoGenerateColumns = true; GridView3.DataBind(); } else if (DropDownList1.SelectedValue == "Right") { DataView mydata = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty); GridView3.DataSource = mydata; GridView3.AutoGenerateColumns = true; GridView3.DataBind(); } else { DataView mydata = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty); GridView3.DataSource = mydata; GridView3.AutoGenerateColumns = true; GridView3.DataBind(); } }
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e) { string id = ((Label)e.Item.FindControl("Label8")).Text; string pid = ((Label)e.Item.FindControl("Label7")).Text; if (e.CommandName == "Details") { Response.RedirectToRoute("ServiceDetails", new { ID = id, PID = pid }); } if (e.CommandName == "favorite") { if (Page.User.Identity.Name == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "ShowPopup();", true); } else { SqlDataSource4.InsertParameters.Add("UserName", Page.User.Identity.Name); SqlDataSource4.InsertParameters.Add("ProductId", id); SqlDataSource4.Insert(); ListView1.DataBind(); } } }
protected void ddlDept_SelectedIndexChanged(object sender, EventArgs e) { var mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); if (ck != null) { var strSql = new StringBuilder(); strSql.Append("select pj_id, pj_code, d_id, pj_name, pj_year, pj_budget, pj_complete_status, pj_category, "); strSql.Append(" pj_approval_status, pj_lastupdate from projects "); strSql.Append(" where pj_status = 'real' and pj_complete_status = N'ไม่อยู่ในเกณฑ์การประเมิน/กรอกสมบูรณ์' and "); strSql.Append(" d_id = " + ddlDept.SelectedValue); SqlDataSource4.SelectCommand = strSql.ToString(); SqlDataSource4.DataBind(); GridView1.DataSource = SqlDataSource4; GridView1.DataBind(); var dtView = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments()); var listt = (from t in dtView.Table.AsEnumerable() group t by t.Field <string>("pj_year") into g orderby g.Key select new { pj_year = g.Key, }); ddlProjectYear.DataSource = listt; ddlProjectYear.DataBind(); ddlProjectYear.Items.Insert(0, new ListItem("[ทุกปีงบประมาณ]", String.Empty)); ddlProjectYear.SelectedIndex = 0; } }
protected void btnCreate_Click2(object sender, EventArgs e) { int i = 0; try { DataView dv = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); foreach (DataRowView dr in dv) { i = int.Parse(dr[0].ToString()); } i++; } catch { i = 1; } Session["id"] = i; byte[] defimg = File.ReadAllBytes(Server.MapPath("~/") + "App_Themes/Theme1/noimg.jpg"); Session["logo"] = defimg; SqlDataSource3.Insert(); DSdelRequest.Delete(); string ss = "Trainer Name is: " + txtTrainerName.Text + " / Email to login: "******" / Password to login: "******"mailto:" + txtEmail.Text + "&body=" + ss + "&subject=Trainer Account Successful"); }
protected void DelButton1_Click(object sender, EventArgs e) { SqlDataSource4.Delete(); SqlDataSource5.Delete(); }
protected void OnClick_LinkButton2(object sender, EventArgs e) { GridViewRow tabla = (GridViewRow)(((LinkButton)sender).Parent.Parent); //IdProducto = ((Label)tabla.FindControl("Label1")).Text.ToString(); SqlDataSource10.SelectParameters["ID_Existencia"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString(); SqlDataSource10.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader PRECIOPROD; PRECIOPROD = (SqlDataReader)SqlDataSource10.Select(DataSourceSelectArguments.Empty); if (PRECIOPROD.Read()) { precioProducto = PRECIOPROD["PrecioUnitario"].ToString(); } SqlDataSource10.InsertParameters["Cantidad"].DefaultValue = ((Label)tabla.FindControl("Label4")).Text.ToString(); SqlDataSource10.InsertParameters["Precio"].DefaultValue = precioProducto; SqlDataSource10.InsertParameters["Total"].DefaultValue = (Convert.ToDecimal(precioProducto) * Convert.ToDecimal(((Label)tabla.FindControl("Label4")).Text.ToString())).ToString(); SqlDataSource10.InsertParameters["ID_Existencia"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString(); SqlDataSource10.InsertParameters["ID_Compra"].DefaultValue = ((Label)tabla.FindControl("Label10")).Text.ToString(); SqlDataSource10.Insert(); //SqlDataSource10.UpdateParameters["Cantidad"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString(); //SqlDataSource10.UpdateParameters["ID_Existencia"].DefaultValue = ((Label)tabla.FindControl("Label4")).Text.ToString(); //SqlDataSource10.Update(); SqlDataSource4.UpdateParameters["ID_DevProPro"].DefaultValue = ((Label)tabla.FindControl("Label1")).Text.ToString(); SqlDataSource4.UpdateParameters["Cantidad"].DefaultValue = ((Label)tabla.FindControl("Label4")).Text.ToString(); SqlDataSource4.UpdateParameters["idStock"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString(); SqlDataSource4.Update(); Response.Redirect("DevProPro.aspx"); }
protected void generateJSON_Click(object sender, EventArgs e) { DataView view = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); DataTable dt = view.ToTable(); GridView GridView2 = new GridView(); GridView2.AllowPaging = false; GridView2.DataSource = dt; GridView2.DataBind(); Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=RecipesSearch.doc"); Response.Charset = ""; Response.ContentType = "application/vnd.ms-word "; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); GridView2.RenderControl(hw); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); }
protected void GridView4_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = int.Parse(e.CommandArgument.ToString()); String cmd = e.CommandName; GridViewRow gvr = GridView4.Rows[rowIndex]; int id = int.Parse(gvr.Cells[1].Text); if (cmd == "Allocate") { DropDownList allocation = gvr.FindControl("cmbAccount") as DropDownList; int allVal = int.Parse(allocation.SelectedValue); if (allVal != 0) { DateTime trnDate = DateTime.Parse(gvr.Cells[2].Text); String description = gvr.Cells[3].Text; double drVal = double.Parse(gvr.Cells[4].Text); double crVal = double.Parse(gvr.Cells[5].Text); double val = (drVal != 0 ? drVal * -1 : crVal); String[] accs = getAccounts(allVal); if (accs != null) { String sql = "INSERT INTO tblRentalRecon(rentalId, trnDate, value, account, contra) VALUES(" + id.ToString(); sql += " , '" + trnDate.ToString() + "', " + val.ToString() + ", '" + accs[0] + "', '" + accs[1] + "')"; utils.executeQuery(sql, null); SqlDataSource4.DataBind(); GridView4.DataBind(); } } } else if (cmd == "Delete") { } }
protected void RadGridM_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; RadGrid gridP = item["PastDueReleaseNo"].FindControl("RadGridP") as RadGrid; RadGrid grid0 = item["Day0ReleaseNo"].FindControl("RadGrid0") as RadGrid; RadGrid grid1 = item["Day1ReleaseNo"].FindControl("RadGrid1") as RadGrid; RadGrid grid2 = item["Day2ReleaseNo"].FindControl("RadGrid2") as RadGrid; RadGrid grid3 = item["Day3ReleaseNo"].FindControl("RadGrid3") as RadGrid; RadGrid grid4 = item["Day4ReleaseNo"].FindControl("RadGrid4") as RadGrid; SqlDataSourceP.SelectParameters[0].DefaultValue = item.GetDataKeyValue("PastDueReleaseNo").ToString(); SqlDataSource0.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day0ReleaseNo").ToString(); SqlDataSource1.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day1ReleaseNo").ToString(); SqlDataSource2.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day2ReleaseNo").ToString(); SqlDataSource3.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day3ReleaseNo").ToString(); SqlDataSource4.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day4ReleaseNo").ToString(); gridP.DataSource = SqlDataSourceP.Select(DataSourceSelectArguments.Empty); grid0.DataSource = SqlDataSource0.Select(DataSourceSelectArguments.Empty); grid1.DataSource = SqlDataSource1.Select(DataSourceSelectArguments.Empty); grid2.DataSource = SqlDataSource2.Select(DataSourceSelectArguments.Empty); grid3.DataSource = SqlDataSource3.Select(DataSourceSelectArguments.Empty); grid4.DataSource = SqlDataSource4.Select(DataSourceSelectArguments.Empty); gridP.DataBind(); grid0.DataBind(); grid1.DataBind(); grid2.DataBind(); grid3.DataBind(); grid4.DataBind(); } }
private void check_id() { SqlDataSource4.SelectCommand = "SELECT * FROM [ticket_details]"; System.Data.DataView dv = (System.Data.DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); lbl.Text = dv.Count.ToString(); id_From_db = dv.Count + 1; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); if (ck != null) { String strPJid = ck.pj_id; //String strPJCode = "01001-100"; StringBuilder strSQL = new StringBuilder(); strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_background, pj_urgency, pj_category"); strSQL.Append(" from projects p, department d, ministry m, yutasad y"); strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = " + strPJid); SqlDataSource4.SelectCommand = strSQL.ToString(); SqlDataSource4.DataBind(); DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); foreach (DataRow dRow in dv1.Table.Rows) { lblDeptCode.Text = dRow["mi_code"].ToString(); lblDeptName.Text = dRow["mi_name"].ToString(); lblDivisionCode.Text = dRow["d_code"].ToString(); lblDivisionName.Text = dRow["d_name"].ToString(); lblProjectName.Text = dRow["pj_name"].ToString(); lblProjectCode.Text = dRow["pj_code"].ToString(); lblYutasard.Text = dRow["yut_name"].ToString(); lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString(); lblRelateDept.Text = dRow["pj_relateDept"].ToString(); lblBudget.Text = dRow["pj_budget"].ToString(); lblYear.Text = dRow["pj_year"].ToString(); if (dRow["pj_category"].ToString() != string.Empty) { if (dRow["pj_category"].ToString() == "บริหารทั่วไป") { radProjectCate.SelectedIndex = 0; } else if (dRow["pj_category"].ToString() == "บริหารสังคม") { radProjectCate.SelectedIndex = 1; } else if (dRow["pj_category"].ToString() == "เศรษฐกิจ") { radProjectCate.SelectedIndex = 2; } } } } else { //redirect to login page } } }
protected void lbInsert_Click3(object sender, EventArgs e) { SqlDataSource4.InsertParameters["boname"].DefaultValue = ((TextBox)GridView4.FooterRow.FindControl("txtboname")).Text; SqlDataSource4.InsertParameters["bocontact"].DefaultValue = ((TextBox)GridView4.FooterRow.FindControl("txtbocontact")).Text; SqlDataSource4.InsertParameters["bosocietyid"].DefaultValue = ((DropDownList)GridView4.FooterRow.FindControl("ddlbosocietyid")).SelectedValue; SqlDataSource4.InsertParameters["botype"].DefaultValue = ((DropDownList)GridView4.FooterRow.FindControl("ddlbotype")).SelectedValue; SqlDataSource4.Insert(); }
protected void btnAddRtr_Click(object sender, EventArgs e) { if (Page.IsValid) { SqlDataSource4.Insert(); txtRtrClub.Text = ""; } }
protected void Page_Load(object sender, EventArgs e) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); if (ck != null) { string strDeptID = ck.d_code; //Redirect Login users to pending page //redirectToPendingPage(); //string strDeptID = "01001"; string strProjectStatus = ck.pj_status; //keep project code in cookie for usage in follwing pages mgCookie.UpdateCookies("pj_status", strProjectStatus); string strSQL1 = "select * from dbo.department d, dbo.ministry m where d.mi_id = m.mi_id and d.d_code = '" + strDeptID + "'"; SqlDataSource4.SelectCommand = strSQL1; SqlDataSource4.DataBind(); DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); foreach (DataRow dRow in dv1.Table.Rows) { lblDeptCode.Text = dRow["mi_code"].ToString(); lblDeptName.Text = dRow["mi_name"].ToString(); lblDivisionCode.Text = dRow["d_code"].ToString(); lblDivisionName.Text = dRow["d_name"].ToString(); mgCookie.UpdateCookies("mi_id", dRow["mi_id"].ToString()); } if (!Page.IsPostBack) { string strSQL = "SELECT * from dbo.projects where pj_id = " + ck.pj_id; SqlDataSource2.SelectCommand = strSQL; SqlDataSource2.DataBind(); DataView dv = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); lblProjectCode.Text = dv.Table.Rows[0]["pj_code"].ToString(); txtProjectName.Text = dv.Table.Rows[0]["pj_name"].ToString(); ddlYudtasad.SelectedValue = dv.Table.Rows[0]["pj_yut_id"].ToString(); ddlYear.SelectedValue = dv.Table.Rows[0]["pj_year"].ToString(); txtBudget.Text = dv.Table.Rows[0]["pj_budget"].ToString(); DropDownList2.SelectedValue = dv.Table.Rows[0]["pj_budget_type"].ToString(); //txtIntegrate.Text = dv.Table.Rows[0]["pj_integrateproject"].ToString(); //txtRelate.Text = dv.Table.Rows[0]["pj_relateDept"].ToString(); } } }
protected void getData() { DataView stud_Address = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in stud_Address) { DataRow row = drv.Row; lblSadd.Text = row["Address1"].ToString(); lblSadd1.Text = row["Address2"].ToString(); lblPost.Text = row["Postcode"].ToString(); lblCity.Text = row["City"].ToString(); lblState.Text = row["State"].ToString(); } DataView parentF = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in parentF) { DataRow row = drv.Row; lblFname.Text = row["Name"].ToString(); lblFOcc.Text = row["Occupation"].ToString(); lblFsalary.Text = row["Salary"].ToString(); lblphone.Text = row["Contact"].ToString(); } DataView parentAdd = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in parentAdd) { DataRow row = drv.Row; lblFadd.Text = row["Address1"].ToString(); lblFpost.Text = row["Postcode"].ToString(); lblFstate.Text = row["State"].ToString(); lblFcity.Text = row["City"].ToString(); } DataView parentM = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in parentM) { DataRow row = drv.Row; lblMname.Text = row["Name"].ToString(); lblMOcc.Text = row["Occupation"].ToString(); lblMsalary.Text = row["Salary"].ToString(); } DataView stud_Acad = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in stud_Acad) { DataRow row = drv.Row; lblSIns.Text = row["Name_of_Institution"].ToString(); lblSGrad.Text = row["Date"].ToString(); lblcgpa.Text = row["CGPA"].ToString(); lblField.Text = row["Field_of_Study"].ToString(); } }
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e) { string id = ((Label)e.Item.FindControl("Label8")).Text; string featurestatus = ((Label)e.Item.FindControl("Label7")).Text; string adminapproval = ((Label)e.Item.FindControl("Label6")).Text; if (e.CommandName == "Auction") { Response.Redirect("~/admin/product-setup/AllAuctions?ID=" + id); } if (e.CommandName == "Feature") { string fs; if (featurestatus == "Yes") { fs = "No"; } else { fs = "Yes"; } SqlDataSource3.UpdateParameters.Add("FeatureStatus", fs.ToString()); SqlDataSource3.UpdateParameters.Add("ID", id); SqlDataSource3.Update(); ListView1.DataBind(); } if (e.CommandName == "Approval") { string AA; if (adminapproval == "Active") { AA = "Reject"; } else { AA = "Active"; } SqlDataSource4.UpdateParameters.Add("Approval", AA.ToString()); SqlDataSource4.UpdateParameters.Add("ID", id); SqlDataSource4.Update(); ListView1.DataBind(); } if (e.CommandName == "Edit") { Response.Redirect("~/Seller/addproduct.aspx?ID=" + id); } }
protected void DataListCommentsofPost_DeleteCommand(object source, DataListCommandEventArgs e) { DataList1.SelectedIndex = e.Item.ItemIndex; int idkomentarz = int.Parse(((Label)(DataList1.SelectedItem.FindControl("LabelIdKomentarze"))).Text); SqlDataSource4.UpdateCommand = "UPDATE Komentarze SET k_usun = 1 FROM Komentarze INNER JOIN Posty ON Komentarze.Posty_id_posty = Posty.id_posty INNER JOIN Uzytkownik ON Komentarze.Uzytkownik_id_uzytkownik = Uzytkownik.id_uzytkownik WHERE (Komentarze.id_komentarze = " + idkomentarz + ")"; SqlDataSource4.Update(); DataBind(); }
protected void LinkButton4_Click(object sender, EventArgs e) { SqlDataSource4.InsertParameters["aadhar"].DefaultValue = ((TextBox)GridView4.FooterRow.FindControl("txtaadhar")).Text; SqlDataSource4.InsertParameters["spname"].DefaultValue = ((TextBox)GridView4.FooterRow.FindControl("txtspname")).Text; SqlDataSource4.InsertParameters["contact"].DefaultValue = ((TextBox)GridView4.FooterRow.FindControl("txtcontact")).Text; SqlDataSource4.InsertParameters["societyid"].DefaultValue = ((DropDownList)GridView4.FooterRow.FindControl("ddlsocietyid")).SelectedValue; SqlDataSource4.InsertParameters["type"].DefaultValue = ((DropDownList)GridView4.FooterRow.FindControl("ddltype")).SelectedValue; SqlDataSource4.InsertParameters["rating"].DefaultValue = ((TextBox)GridView4.FooterRow.FindControl("txtrating")).Text; SqlDataSource4.Insert(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); if (ck != null) { string strPJCode = ck.pj_code; string strPJStatus = ck.pj_status; string strPJ_ID = ck.pj_id; StringBuilder strSQL = new StringBuilder(); strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_filter_q1, pj_filter_q2, pj_filter_q3, pj_filter_q4 "); strSQL.Append(" from projects p, department d, ministry m, yutasad y"); strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = " + strPJ_ID); SqlDataSource4.SelectCommand = strSQL.ToString(); SqlDataSource4.DataBind(); DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); if (dv1.Table.Rows.Count > 0) { foreach (DataRow dRow in dv1.Table.Rows) { lblDeptCode.Text = dRow["mi_code"].ToString(); lblDeptName.Text = dRow["mi_name"].ToString(); lblDivisionCode.Text = dRow["d_code"].ToString(); lblDivisionName.Text = dRow["d_name"].ToString(); lblProjectName.Text = dRow["pj_name"].ToString(); lblProjectCode.Text = dRow["pj_code"].ToString(); lblYutasard.Text = dRow["yut_name"].ToString(); lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString(); lblRelateDept.Text = dRow["pj_relateDept"].ToString(); lblBudget.Text = dRow["pj_budget"].ToString(); lblYear.Text = dRow["pj_year"].ToString(); radQ1.SelectedValue = dRow["pj_filter_q1"].ToString(); radQ2.SelectedValue = dRow["pj_filter_q2"].ToString(); } } else { //cannot display project details, redirect to login page } } else { //cannot find user login cookie, redirect to login page } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); if (ck != null) { String strPJid = ck.pj_id; StringBuilder strSQL = new StringBuilder(); strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_background, pj_urgency, pj_type, pj_complete_status "); strSQL.Append(" from projects p, department d, ministry m, yutasad y"); strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = '" + strPJid + "'"); SqlDataSource4.SelectCommand = strSQL.ToString(); SqlDataSource4.DataBind(); DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); foreach (DataRow dRow in dv1.Table.Rows) { lblDeptCode.Text = dRow["mi_code"].ToString(); lblDeptName.Text = dRow["mi_name"].ToString(); lblDivisionCode.Text = dRow["d_code"].ToString(); lblDivisionName.Text = dRow["d_name"].ToString(); lblProjectName.Text = dRow["pj_name"].ToString(); lblProjectCode.Text = dRow["pj_code"].ToString(); lblYutasard.Text = dRow["yut_name"].ToString(); //lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString(); //lblRelateDept.Text = dRow["pj_relateDept"].ToString(); lblBudget.Text = dRow["pj_budget"].ToString(); lblYear.Text = dRow["pj_year"].ToString(); } gUtilities gt = new gUtilities(); litRisk1.Text = gt.getReportTammaTotal(ck.pj_id); litRisk2.Text = gt.getReportFactorRiskTotal(ck.pj_id); // litRisk12.Text = gt.getReportTammaMainTotal(ck.pj_id); // litRisk13.Text = gt.getReportTammaSubTotal(ck.pj_id); if (dv1.Table.Rows[0]["pj_complete_status"].ToString() == null) { Response.Redirect("project_summary.aspx"); } } else { //redirect Response.Redirect("project_summary.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["OrderNo"] != null & Page.User.Identity.Name != "admin") { Session.Abandon(); Label2.Text = Request.QueryString["OrderNo"].ToString(); SqlDataSource1.Update(); dview = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); SMTP = (string)dview.Table.Rows[0]["SMTP"]; BCC = (string)dview.Table.Rows[0]["BCC"]; EmailFrom = (string)dview.Table.Rows[0]["EmailFrom"]; Password = (string)dview.Table.Rows[0]["Password"]; //Ports = (int)dview.Table.Rows[0]["Port"]; string host = HttpContext.Current.Request.Url.Host; // localhost MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient(SMTP.ToString()); mail.From = new MailAddress(EmailFrom.ToString()); //Email acpe = new Email(); mail.To.Add(Page.User.Identity.Name); mail.Bcc.Add(BCC.ToString()); StreamReader reader = new StreamReader(Server.MapPath("~/email/orderreceive.html")); string readFile = reader.ReadToEnd(); string myString = ""; myString = readFile; //string name = HttpUtility.UrlEncode(Encrypt(Session["UserName"].ToString().Trim())); //string technology = HttpUtility.UrlEncode(Encrypt(ddlTechnology.SelectedItem.Value)); myString = myString.Replace("{#Order}", Label2.Text); myString = myString.Replace("{#OrderDate}", DateTime.Now.ToString()); mail.Subject = "Order Receipt " + DateTime.Now.ToString("dd/MMM/yyyy hh:mm:ss tt"); mail.IsBodyHtml = true; mail.Body = myString.ToString(); SmtpServer.Port = 25; SmtpServer.Credentials = new System.Net.NetworkCredential(EmailFrom.ToString(), Password.ToString()); SmtpServer.EnableSsl = false; object userState = mail; SmtpServer.SendCompleted += new SendCompletedEventHandler(SMTPClientForAsy.SmtpClient_OnCompleted); SmtpServer.SendAsync(mail, userState); } } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { try { SqlDataSource4.Insert(); GridView1.DataBind(); } catch { Label4.Text = "The selected student is already registered to the course"; } }