protected void Page_Load(object sender, EventArgs e) { bool isLogin; if (Session["isLogin"] != null) { isLogin = (bool)Session["isLogin"]; if (!isLogin) { Response.Redirect("~/loginForm.aspx"); } } if (!IsPostBack) { this.selectCustomer.DataSource = new TMS.BLL.CustomerBLL().GetAllUsersInTable(); this.selectCustomer.DataTextField = "FullName"; this.selectCustomer.DataValueField = "FullName"; this.selectCustomer.DataBind(); string m2 = new TMS.BLL.CustomerBLL().getM(this.selectCustomer.Text); this.TextBox1.Text = m2; this.GridView1.DataSource = new TMS.BLL.AssignWork1BLL().getAllWorkAssignmentInList(); this.GridView1.DataBind(); this.selectWorker.DataSource = new TMS.BLL.WorkerBLL().GetAllWorkersInTable(); this.selectWorker.DataTextField = "FullName"; this.selectWorker.DataValueField = "FullName"; this.selectWorker.DataBind(); } }
protected void Delete_Click(object sender, EventArgs e) { if (this.name.Text == "") { Response.Write("<script> alert('Name is required for deletion'); </script>"); this.clearForm(); } else { TMS.Common.Customer cust = new TMS.Common.Customer(); cust.FullName = Convert.ToString(this.name.Text); TMS.BLL.CustomerBLL customers = new TMS.BLL.CustomerBLL(); if (customers.delCustomer(cust) == true) { Response.Write("<script> alert('User Deleted'); </script>"); this.clearForm(); } else { Response.Write("<script> alert('Deletion failed'); </script>"); this.clearForm(); } } }
protected void selectCustomer_SelectedIndexChanged(object sender, EventArgs e) { string m2 = new TMS.BLL.CustomerBLL().getM(this.selectCustomer.Text); this.TextBox1.Text = m2; }