protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SqlCommand cmd = new SqlCommand("Select distinct boarding_point from Trip", con);

                con.Open();

                DropDownList5.DataSource     = cmd.ExecuteReader();
                DropDownList5.DataTextField  = "boarding_point";
                DropDownList5.DataValueField = "boarding_point";
                DropDownList5.DataBind();

                con.Close();

                Session["board"] = DropDownList5.SelectedValue.ToString();
            }

            if (!IsPostBack)
            {
                SqlCommand cmd = new SqlCommand("Select distinct arrival_point from Trip", con);

                con.Open();

                DropDownList9.DataSource     = cmd.ExecuteReader();
                DropDownList9.DataTextField  = "arrival_point";
                DropDownList9.DataValueField = "arrival_point";
                DropDownList9.DataBind();

                Session["arrive"] = DropDownList9.SelectedValue.ToString();

                con.Close();
            }
        }
Exemple #2
0
    protected void DropDownList8_SelectedIndexChanged(object sender, EventArgs e)
    {
        string a = DropDownList8.SelectedValue;
        string b = DropDownList10.SelectedValue;

        string  sql2 = "select Medicine" + b + " from Medicine_Information where MedicineType='" + a + "'";
        DataSet ds2  = new DataSet();

        ds2 = dataOperate.getDataset(sql2, "Medicine_Information");
        DataView rowview2 = ds2.Tables["Medicine_Information"].DefaultView;

        DropDownList9.DataSource     = rowview2;
        DropDownList9.DataValueField = "Medicine" + b + "";
        DropDownList9.DataBind();

        if (b == "ID")
        {
            b = "Name";
        }
        else
        {
            b = "ID";
        }

        string  sql3 = "select * from Medicine_Information where MedicineType='" + a + "'";
        DataSet ds3  = new DataSet();

        ds3 = dataOperate.getDataset(sql3, "Medicine_Information");
        DataRowView rowview3 = ds3.Tables["Medicine_Information"].DefaultView[0];

        this.Label19.Text = rowview3["Medicine" + b + ""].ToString();
        this.Label20.Text = rowview3["MedicinePrice"].ToString();
    }
Exemple #3
0
        private void BindDropDown9()
        {
            try
            {
                using (OracleConnection sqlConn = new OracleConnection(strConn))
                {
                    using (OracleCommand sqlCmd = new OracleCommand())
                    {
                        sqlCmd.CommandText = "select * from TB_FACULTY";
                        sqlCmd.Connection  = sqlConn;
                        sqlConn.Open();
                        OracleDataAdapter da = new OracleDataAdapter(sqlCmd);
                        DataTable         dt = new DataTable();
                        da.Fill(dt);
                        DropDownList9.DataSource     = dt;
                        DropDownList9.DataValueField = "FACULTY_ID";
                        DropDownList9.DataTextField  = "FACULTY_NAME";
                        DropDownList9.DataBind();
                        sqlConn.Close();

                        DropDownList9.Items.Insert(0, new ListItem("-- กรุณาเลือก --", "0"));
                    }
                }
            }
            catch { }
        }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.Label10.Visible = false;
            this.Label11.Visible = false;
            string  drbj         = DropDownList1.SelectedValue.ToString();
            string  sqlallMember = "select * from Bill_Information join Member_Information on Bill_Information.PatientID=Member_Information.MemberID";
            DataSet ds           = new DataSet();
            ds = dataOperate.getDataset(sqlallMember, "Bill_Information");
            if (ds.Tables["Bill_Information"].Rows.Count > 0)
            {
                DataRowView rowview = ds.Tables["Bill_Information"].DefaultView[0];
                this.Label11.Text    = "all";
                this.Label10.Visible = true;
                this.Label11.Visible = true;
                ds.Clear();
            }

            DropDownList1.Visible = true;
            string a1 = DropDownList6.SelectedValue;


            string  sql3 = "select distinct(" + a1 + "ID) from Bill_Information";
            DataSet ds3  = new DataSet();
            ds3 = dataOperate.getDataset(sql3, "Bill_Information");
            DataView rowview3 = ds3.Tables["Bill_Information"].DefaultView;
            DropDownList1.DataSource     = rowview3;
            DropDownList1.DataValueField = "" + a1 + "ID";
            DropDownList1.DataBind();


            string  sql = "select distinct(PatientID) from Record_Information";
            DataSet ds1 = new DataSet();
            ds1 = dataOperate.getDataset(sql, "Record_Information");
            DataView rowview1 = ds1.Tables["Record_Information"].DefaultView;
            DropDownList8.DataSource     = rowview1;
            DropDownList8.DataValueField = "PatientID";
            DropDownList8.DataBind();

            DropDownList9.Visible = true;
            string a = DropDownList8.SelectedValue;

            string  sql2 = "select RecordID from Record_Information where PatientID='" + a + "'";
            DataSet ds2  = new DataSet();
            ds2 = dataOperate.getDataset(sql2, "Record_Information");
            DataView rowview2 = ds2.Tables["Record_Information"].DefaultView;
            DropDownList9.DataSource     = rowview2;
            DropDownList9.DataValueField = "RecordID";
            DropDownList9.DataBind();

            this.GridView1.Visible    = true;
            this.GridView1.DataSource = dataOperate.getDataset(sqlallMember, "Bill_Information");
            this.GridView1.DataBind();
            Session["search"]     = sqlallMember;
            Session["Department"] = "";
            Session["ID"]         = "";
        }
    }
 protected void Button3_Click(object sender, EventArgs e)
 {
     SqlDataSource1.Insert();
     DropDownList7.ClearSelection();
     DropDownList9.ClearSelection();
     DropDownList7.DataBind();
     DropDownList9.DataBind();
 }
        protected void Button15_Click(object sender, EventArgs e)
        {
            int dt = controllerObj.DeleteOFFER(Convert.ToInt32(DropDownList4.Text), DropDownList8.Text.ToString());

            DropDownList3.DataBind();
            DropDownList4.DataBind();
            DropDownList9.DataBind();
        }
 public void drop9()
 {
     ds.Clear();
     ds = db.discont("select sub_main_role from tb_Sub_main_role where role='" + DropDownList5.Text + "'");
     DropDownList9.DataSource    = ds;
     DropDownList9.DataTextField = "sub_main_role";
     DropDownList9.DataBind();
     DropDownList9.Items.Insert(0, "Select sub_main_role............");
 }
Exemple #8
0
    protected void DropDownList8_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList9.Visible = true;
        string a = DropDownList8.SelectedValue;

        string  sql = "select distinct(Authorization_Information.RecordID) from Authorization_Information join Record_Information on Record_Information.DoctorID=Authorization_Information.DoctorID where Authorization_Information.AuthorizationID='" + Convert.ToString(Session["IDLogin"]) + "' and Authorization_Information.PatientID='" + a + "'";
        DataSet ds  = new DataSet();

        ds = dataOperate.getDataset(sql, "Record_Information");
        DataView rowview = ds.Tables["Record_Information"].DefaultView;

        DropDownList9.DataSource     = rowview;
        DropDownList9.DataValueField = "RecordID";
        DropDownList9.DataBind();
    }
Exemple #9
0
    protected void DropDownList8_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList9.Visible = true;
        string a = DropDownList8.SelectedValue;

        string  sql = "select RecordID from Record_Information where PatientID='" + a + "'";
        DataSet ds  = new DataSet();

        ds = dataOperate.getDataset(sql, "Record_Information");
        DataView rowview = ds.Tables["Record_Information"].DefaultView;

        DropDownList9.DataSource     = rowview;
        DropDownList9.DataValueField = "RecordID";
        DropDownList9.DataBind();
    }
 protected void Button5_Click(object sender, EventArgs e)
 {
     if (Calendar2.SelectedDate < Calendar1.SelectedDate || Calendar2.SelectedDate < Calendar1.TodaysDate)
     {
         Label79.Text = "please Enter valid Dates";
     }
     if (TextBox12.Text.Trim() == "" || TextBox11.Text.Trim() == "")
     {
         Label79.Text = "please Enter All the values";
     }
     else
     {
         Label79.Text = "";
         int dt = controllerObj.InsertAnewOffer(Convert.ToInt32(TextBox12.Text.ToString()), Calendar1.SelectedDate, Calendar2.SelectedDate, Convert.ToInt32(TextBox11.Text.ToString()), DropDownList8.Text.ToString());
     }
     DropDownList4.DataBind();
     DropDownList9.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     empno = Convert.ToInt32(Request.QueryString["Empno"].ToString());
     if (!IsPostBack)
     {
         string         Q    = "Select * from mstrCategory";
         SqlCommand     com  = new SqlCommand(Q, dbcls.CONN());
         SqlDataAdapter adpt = new SqlDataAdapter(com);
         DataTable      dt   = new DataTable();
         adpt.Fill(dt);
         TextBox38.DataSource = dt;
         TextBox38.DataBind();
         TextBox38.DataTextField  = "category";
         TextBox38.DataValueField = "cid";
         TextBox38.DataBind();
         DropDownList7.DataSource = dt;
         DropDownList7.DataBind();
         DropDownList7.DataTextField  = "category";
         DropDownList7.DataValueField = "cid";
         DropDownList7.DataBind();
         DropDownList9.DataSource = dt;
         DropDownList9.DataBind();
         DropDownList9.DataTextField  = "category";
         DropDownList9.DataValueField = "cid";
         DropDownList9.DataBind();
         DropDownList11.DataSource = dt;
         DropDownList11.DataBind();
         DropDownList11.DataTextField  = "category";
         DropDownList11.DataValueField = "cid";
         DropDownList11.DataBind();
         DropDownList13.DataSource = dt;
         DropDownList13.DataBind();
         DropDownList13.DataTextField  = "category";
         DropDownList13.DataValueField = "cid";
         DropDownList13.DataBind();
         DropDownList15.DataSource = dt;
         DropDownList15.DataBind();
         DropDownList15.DataTextField  = "category";
         DropDownList15.DataValueField = "cid";
         DropDownList15.DataBind();
         BindTextBoxvalues();
     }
 }
    public void area()
    {
        con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\Pratik\\Desktop\\Jobadda\\App_Data\\JobportalDB.mdf;Integrated Security=True;User Instance=True");
        con.Open();

        string query = "select * from Area where Area.category_id=" + DropDownList8.SelectedValue;

        adp = new SqlDataAdapter(query, con);
        DataSet ds = new DataSet();

        adp.Fill(ds);

        DropDownList9.DataSource     = ds.Tables[0];
        DropDownList9.DataTextField  = "area_name";
        DropDownList9.DataValueField = "area_id";
        DropDownList9.DataBind();
        DropDownList9.Items.Insert(0, new ListItem("select", "0"));

        con.Close();
    }
Exemple #13
0
    private void showsource()
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connection"]);
        SqlCommand    cmd = new SqlCommand("Select * from Lead_source ORDER BY No asc", con);

        con.Open();
        DataSet        ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(cmd);

        da.Fill(ds);


        DropDownList9.DataSource     = ds;
        DropDownList9.DataTextField  = "Lead_source";
        DropDownList9.DataValueField = "No";
        DropDownList9.DataBind();
        DropDownList9.Items.Insert(0, new ListItem("-- Choose Option --", "0"));

        con.Close();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         string         Q    = "Select * from mstrCategory";
         SqlCommand     com  = new SqlCommand(Q, dbcls.CONN());
         SqlDataAdapter adpt = new SqlDataAdapter(com);
         DataTable      dt   = new DataTable();
         adpt.Fill(dt);
         TextBox38.DataSource = dt;
         TextBox38.DataBind();
         TextBox38.DataTextField  = "category";
         TextBox38.DataValueField = "cid";
         TextBox38.DataBind();
         DropDownList7.DataSource = dt;
         DropDownList7.DataBind();
         DropDownList7.DataTextField  = "category";
         DropDownList7.DataValueField = "cid";
         DropDownList7.DataBind();
         DropDownList9.DataSource = dt;
         DropDownList9.DataBind();
         DropDownList9.DataTextField  = "category";
         DropDownList9.DataValueField = "cid";
         DropDownList9.DataBind();
         DropDownList11.DataSource = dt;
         DropDownList11.DataBind();
         DropDownList11.DataTextField  = "category";
         DropDownList11.DataValueField = "cid";
         DropDownList11.DataBind();
         DropDownList13.DataSource = dt;
         DropDownList13.DataBind();
         DropDownList13.DataTextField  = "category";
         DropDownList13.DataValueField = "cid";
         DropDownList13.DataBind();
         DropDownList15.DataSource = dt;
         DropDownList15.DataBind();
         DropDownList15.DataTextField  = "category";
         DropDownList15.DataValueField = "cid";
         DropDownList15.DataBind();
     }
 }
    private void shownoofemployee()
    {
        company_id = Convert.ToInt32(Session["company_id"].ToString());
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connection"]);
        SqlCommand    cmd = new SqlCommand("Select * from Account_No_of_employees where com_id='" + company_id + "' ORDER BY No asc", con);

        con.Open();
        DataSet        ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(cmd);

        da.Fill(ds);


        DropDownList9.DataSource     = ds;
        DropDownList9.DataTextField  = "Account_No_of_employees";
        DropDownList9.DataValueField = "No";
        DropDownList9.DataBind();
        DropDownList9.Items.Insert(0, new ListItem("-- Choose Option --", "0"));

        con.Close();
    }
Exemple #16
0
        protected void Button4_Click(object sender, EventArgs e)
        {
            if (TextBox12.Text.Length == 0 || DropDownList8.SelectedIndex == 0 || TextBox13.Text.Length == 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "alertMessage",
                                                        "alert('Δεν έχουν συμπληρωθεί τα πεδία !!!!');", true);
            }
            else
            {
                if (GridView5.Rows[0].Cells[0].Text != "&nbsp;")
                {
                    if (Convert.ToDecimal(TextBox13.Text) > Convert.ToDecimal(GridView5.Rows[0].Cells[0].Text))
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                                "alertMessage",
                                                                "alert('Το υπόλοιπο των ενσήμων δεν επαρκεί !!!!');", true);
                    }
                    else
                    {
                        Kinisi_Ensimou.Insert();
                        GridView5.DataBind();
                        GridView4.DataBind();

                        TextBox13.Text = "";
                        DropDownList8.SelectedIndex = 0;
                        DDL_Report.DataBind();
                        DropDownList9.DataBind();
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                            "alertMessage",
                                                            "alert('Το υπόλοιπο των ενσήμων δεν επαρκεί !!!!');", true);
                }
            }
        }
Exemple #17
0
    private void BindDropDownList9()
    {
        DataSet        ds      = new DataSet();
        DatabaseHelper DbQuery = new DatabaseHelper();
        DataTable      dt      = new DataTable();
        DataRow        ndr     = dt.NewRow();

        dt.Columns.Add("Filed1", typeof(String));
        dt.Columns.Add("Filed2", typeof(String));
        //1.現金、2.電匯、3.支票、4.其他

        dt.Rows.Add(new Object[] { "1", "1現金" });
        dt.Rows.Add(new Object[] { "2", "2電匯" });
        dt.Rows.Add(new Object[] { "3", "3支票" });
        dt.Rows.Add(new Object[] { "4", "4其他" });



        DropDownList9.DataSource     = dt;
        DropDownList9.DataTextField  = "Filed2";
        DropDownList9.DataValueField = "Filed1";
        DropDownList9.DataBind();
    }
Exemple #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.ImageButton1.Visible = false;
            string  sqlallMember = "select * from Billdetail_Information where BillID='" + Request.QueryString["BillID"] + "' and RecordID='" + Request.QueryString["RecordID"] + "'";
            DataSet ds           = new DataSet();
            ds = dataOperate.getDataset("select * from Member_Information where MemberID='" + Request.QueryString["PatientID"] + "'", "Member_Information");

            if (ds.Tables["Member_Information"].Rows.Count > 0)
            {
                DataRowView rowview = ds.Tables["Member_Information"].DefaultView[0];
                this.xingming.Text = rowview["MemberName"].ToString();
                ds.Clear();
            }

            this.GridView1.Visible    = true;
            this.GridView1.DataSource = dataOperate.getDataset(sqlallMember, "Billdetail_Information");
            this.GridView1.DataBind();
            Session["search"] = sqlallMember;
            pid.Text          = Request.QueryString["PatientID"];
            rid.Text          = Request.QueryString["RecordID"];
            bid.Text          = Request.QueryString["BillID"];
            did.Text          = Request.QueryString["DoctorID"];

            string  sql = "select MedicinetypeName from Medicinetype_Information";
            DataSet ds1 = new DataSet();
            ds1 = dataOperate.getDataset(sql, "Medicinetype_Information");
            DataView rowview1 = ds1.Tables["Medicinetype_Information"].DefaultView;
            DropDownList8.DataSource     = rowview1;
            DropDownList8.DataValueField = "MedicinetypeName";
            DropDownList8.DataBind();

            DropDownList9.Visible = true;
            string a = DropDownList8.SelectedValue;
            string b = DropDownList10.SelectedValue;

            string  sql2 = "select Medicine" + b + " from Medicine_Information where MedicineType='" + a + "'";
            DataSet ds2  = new DataSet();
            ds2 = dataOperate.getDataset(sql2, "Medicine_Information");
            DataView rowview2 = ds2.Tables["Medicine_Information"].DefaultView;
            DropDownList9.DataSource     = rowview2;
            DropDownList9.DataValueField = "Medicine" + b + "";
            DropDownList9.DataBind();

            if (b == "ID")
            {
                b = "Name";
            }
            else
            {
                b = "ID";
            }

            string  sql3 = "select * from Medicine_Information where MedicineType='" + a + "'";
            DataSet ds3  = new DataSet();
            ds3 = dataOperate.getDataset(sql3, "Medicine_Information");
            int count1 = ds3.Tables["Medicine_Information"].Rows.Count;
            if (count1 != 0)
            {
                DataRowView rowview3 = ds3.Tables["Medicine_Information"].DefaultView[0];
                this.Label19.Text = rowview3["Medicine" + b + ""].ToString();
                this.Label20.Text = rowview3["MedicinePrice"].ToString();
            }
            else
            {
                this.Label19.Text = "";
                this.Label20.Text = "";
            }
        }
    }
Exemple #19
0
 protected void DropDownList2_DataBound(object sender, EventArgs e)
 {
     DropDownList9.DataBind();
 }
Exemple #20
0
    protected void FillDeptDropdownList()
    {
        BLItem objBL = new BLItem();

        DataTable dt  = objBL.get_available_courses(int.Parse(Session["New"].ToString()), 3);
        DataTable dt1 = objBL.get_available_courses(int.Parse(Session["New"].ToString()), 1);

        DropDownList0.DataSource     = dt;
        DropDownList0.DataTextField  = "courseName";
        DropDownList0.DataValueField = "courseID";
        DropDownList0.DataBind();
        //DropDownList0.Items.Insert(0, "Select Course");
        DropDownList0.Items.Insert(0, new ListItem("Select Course", "-1"));

        DropDownList1.DataSource     = dt;
        DropDownList1.DataTextField  = "courseName";
        DropDownList1.DataValueField = "courseID";
        DropDownList1.DataBind();
        //DropDownList1.Items.Insert(0, "Select Course");
        DropDownList1.Items.Insert(0, new ListItem("Select Course", "-1"));

        DropDownList2.DataSource     = dt;
        DropDownList2.DataTextField  = "courseName";
        DropDownList2.DataValueField = "courseID";
        DropDownList2.DataBind();
        //DropDownList2.Items.Insert(0, "Select Course");
        DropDownList2.Items.Insert(0, new ListItem("Select Course", "-1"));

        DropDownList3.DataSource     = dt;
        DropDownList3.DataTextField  = "courseName";
        DropDownList3.DataValueField = "courseID";
        DropDownList3.DataBind();
        //DropDownList3.Items.Insert(0, "Select Course");
        DropDownList3.Items.Insert(0, new ListItem("Select Course", "-1"));

        DropDownList4.DataSource     = dt;
        DropDownList4.DataTextField  = "courseName";
        DropDownList4.DataValueField = "courseID";
        DropDownList4.DataBind();
        //DropDownList4.Items.Insert(0, "Select Course");
        DropDownList4.Items.Insert(0, new ListItem("Select Course", "-1"));

        DropDownList5.DataSource     = dt1;
        DropDownList5.DataTextField  = "courseName";
        DropDownList5.DataValueField = "courseID";
        DropDownList5.DataBind();
        //DropDownList5.Items.Insert(0, "Select Course");
        DropDownList5.Items.Insert(0, new ListItem("Select Course", "-1"));

        DropDownList6.DataSource     = dt1;
        DropDownList6.DataTextField  = "courseName";
        DropDownList6.DataValueField = "courseID";
        DropDownList6.DataBind();
        //DropDownList6.Items.Insert(0, "Select Course");
        DropDownList6.Items.Insert(0, new ListItem("Select Course", "-1"));

        DropDownList7.DataSource     = dt1;
        DropDownList7.DataTextField  = "courseName";
        DropDownList7.DataValueField = "courseID";
        DropDownList7.DataBind();
        //DropDownList7.Items.Insert(0, "Select Course");
        DropDownList7.Items.Insert(0, new ListItem("Select Course", "-1"));

        DropDownList8.DataSource     = dt1;
        DropDownList8.DataTextField  = "courseName";
        DropDownList8.DataValueField = "courseID";
        DropDownList8.DataBind();
        //DropDownList8.Items.Insert(0, "Select Course");
        DropDownList8.Items.Insert(0, new ListItem("Select Course", "-1"));

        DropDownList9.DataSource     = dt1;
        DropDownList9.DataTextField  = "courseName";
        DropDownList9.DataValueField = "courseID";
        DropDownList9.DataBind();
        //DropDownList9.Items.Insert(0, "Select Course");
        DropDownList9.Items.Insert(0, new ListItem("Select Course", "-1"));
    }
Exemple #21
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGridToSource();
                string  sqlstring = "SELECT * FROM carname";
                DBClass db        = new DBClass(sqlstring);
                DropDownList1.DataSource     = db.returndr();
                DropDownList1.DataTextField  = "车辆名称";
                DropDownList1.DataValueField = "车辆名称";
                DropDownList1.DataBind();
                db.dbClose();
            }

            if (!IsPostBack)
            {
                BindGridToSource();
                string  sqlstring = "SELECT * FROM cartype";
                DBClass db        = new DBClass(sqlstring);
                DropDownList2.DataSource     = db.returndr();
                DropDownList2.DataTextField  = "车辆类型";
                DropDownList2.DataValueField = "车辆类型";
                DropDownList2.DataBind();
                db.dbClose();
            }
            if (!IsPostBack)
            {
                BindGridToSource();
                string  sqlstring = "SELECT * FROM state";
                DBClass db        = new DBClass(sqlstring);
                DropDownList3.DataSource     = db.returndr();
                DropDownList3.DataTextField  = "车辆状态";
                DropDownList3.DataValueField = "车辆状态";
                DropDownList3.DataBind();
                db.dbClose();
            }
            if (!IsPostBack)
            {
                BindGridToSource();
                string  sqlstring = "SELECT * FROM carcolor";
                DBClass db        = new DBClass(sqlstring);
                DropDownList4.DataSource     = db.returndr();
                DropDownList4.DataTextField  = "车辆颜色名";
                DropDownList4.DataValueField = "车辆颜色名";
                DropDownList4.DataBind();
                db.dbClose();
            }
            if (!IsPostBack)
            {
                BindGridToSource();
                string  sqlstring = "SELECT * FROM subpoint";
                DBClass db        = new DBClass(sqlstring);
                DropDownList5.DataSource     = db.returndr();
                DropDownList5.DataTextField  = "业务部编号";
                DropDownList5.DataValueField = "业务部编号";
                DropDownList5.DataBind();
                db.dbClose();
            }
            if (!IsPostBack)
            {
                BindGridToSource();
                string  sqlstring = "SELECT * FROM insuretype";
                DBClass db        = new DBClass(sqlstring);
                DropDownList6.DataSource     = db.returndr();
                DropDownList6.DataTextField  = "保险类型";
                DropDownList6.DataValueField = "保险类型";
                DropDownList6.DataBind();
                db.dbClose();
            }
            if (!IsPostBack)
            {
                BindGridToSource();
                string  sqlstring = "SELECT * FROM insurecompany";
                DBClass db        = new DBClass(sqlstring);
                DropDownList7.DataSource     = db.returndr();
                DropDownList7.DataTextField  = "保险公司";
                DropDownList7.DataValueField = "保险公司";
                DropDownList7.DataBind();
                db.dbClose();
            }
            if (!IsPostBack)
            {
                BindGridToSource();
                string  sqlstring = "SELECT * FROM oiltype";
                DBClass db        = new DBClass(sqlstring);
                DropDownList9.DataSource     = db.returndr();
                DropDownList9.DataTextField  = "油类型";
                DropDownList9.DataValueField = "油类型";
                DropDownList9.DataBind();
                db.dbClose();
            }            // 在此处放置用户代码以初始化页面
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection SQLConn = new SqlConnection("Data Source=FTP\\SQLEXPRESS;Initial Catalog=DhruvTest;User ID=sa;Password=pass$1234;pooling=false;pooling=false");

        bindgrid();

        if (Session["PsNo"] == null)
        {
            // Response.Redirect("test1.aspx?val=" + "done");
            Response.Redirect("Login.aspx");
        }
        else
        {
            String PsNo = Convert.ToString((int)Session["PsNo"]);
            txtno.Text = PsNo;
            if (txtno.Text != "")
            {
                SqlCommand sql = new SqlCommand("select * from admin where PsNo='" + txtno.Text + "'", SQLConn);
                sql.Parameters.AddWithValue("@psno", txtno.Text);
                SqlDataAdapter sda = new SqlDataAdapter(sql);
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    TextBox4.Text = dt.Rows[0]["Name"].ToString();
                    TextBox5.Text = dt.Rows[0]["Email"].ToString();
                }
            }
            if (txtno.Text != "")
            {
                SqlCommand sql = new SqlCommand("select * from employee where PsNo='" + txtno.Text + "'", SQLConn);
                sql.Parameters.AddWithValue("@psno", txtno.Text);
                SqlDataAdapter sld = new SqlDataAdapter(sql);
                DataTable      dt1 = new DataTable();
                sld.Fill(dt1);
                if (dt1.Rows.Count > 0)
                {
                    TextBox4.Text = dt1.Rows[0]["Name"].ToString();
                    TextBox5.Text = dt1.Rows[0]["Email"].ToString();
                }
            }


            DDLRM1.Items[0].Attributes.Add("disabled", "disabled");
            DropDownList2.Items[0].Attributes.Add("disabled", "disabled");
            DropDownList3.Items[0].Attributes.Add("disabled", "disabled");
            DropDownList4.Items[0].Attributes.Add("disabled", "disabled");
            DropDownList6.Items[0].Attributes.Add("disabled", "disabled");
            DropDownList7.Items[0].Attributes.Add("disabled", "disabled");
            DropDownList8.Items[0].Attributes.Add("disabled", "disabled");
            DropDownList9.Items[0].Attributes.Add("disabled", "disabled");
        }

        /*
         *      if (!Page.IsPostBack)
         *      {
         *          SqlConnection con = new SqlConnection("Data Source=FTP\\SQLEXPRESS;Initial Catalog=DhruvTest;User ID=sa;Password=pass$1234;pooling=false");
         *          SqlCommand cmd = new SqlCommand("select * from Master", con);
         *          SqlDataAdapter sda = new SqlDataAdapter(cmd);
         *          DataTable dt = new DataTable();
         *          sda.Fill(dt);
         *          DropDownList1.DataSource = dt;
         *          DropDownList1.DataBind();
         *
         *      }
         */

        if (!IsPostBack)
        {
            string CS = System.Configuration.ConfigurationManager.ConnectionStrings["conf"].ConnectionString;
            using (SqlConnection con = new SqlConnection(CS))
            {
                SqlCommand cmd = new SqlCommand("Select DISTINCT(Block) from Master", con);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                DropDownList2.DataTextField  = "Block";
                DropDownList2.DataValueField = "Block";
                DropDownList2.DataSource     = rdr;
                DropDownList2.DataBind();

                con.Close();
            }

            string QW = System.Configuration.ConfigurationManager.ConnectionStrings["conf"].ConnectionString;
            using (SqlConnection con = new SqlConnection(QW))
            {
                SqlCommand cmd = new SqlCommand("Select DISTINCT(Floor) from Master", con);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                DropDownList3.DataTextField  = "Floor";
                DropDownList3.DataValueField = "Floor";
                DropDownList3.DataSource     = rdr;
                DropDownList3.DataBind();
                con.Close();
            }

            string WE = System.Configuration.ConfigurationManager.ConnectionStrings["conf"].ConnectionString;
            using (SqlConnection con = new SqlConnection(WE))
            {
                SqlCommand cmd = new SqlCommand("Select DISTINCT(RoomSt) from Master", con);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                DropDownList4.DataTextField  = "RoomSt";
                DropDownList4.DataValueField = "RoomSt";
                DropDownList4.DataSource     = rdr;
                DropDownList4.DataBind();

                con.Close();
            }

            string ER = System.Configuration.ConfigurationManager.ConnectionStrings["conf"].ConnectionString;
            using (SqlConnection con = new SqlConnection(ER))
            {
                SqlCommand cmd = new SqlCommand("Select DISTINCT(Nos) from Master", con);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                DropDownList5.DataTextField  = "Nos";
                DropDownList5.DataValueField = "Nos";
                DropDownList5.DataSource     = rdr;
                DropDownList5.DataBind();
                con.Close();
            }

            string RT = System.Configuration.ConfigurationManager.ConnectionStrings["conf"].ConnectionString;
            using (SqlConnection con = new SqlConnection(RT))
            {
                SqlCommand cmd = new SqlCommand("Select DISTINCT(WebEx) from Master", con);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                DropDownList6.DataTextField  = "WebEx";
                DropDownList6.DataValueField = "WebEx";
                DropDownList6.DataSource     = rdr;
                DropDownList6.DataBind();
                con.Close();
            }

            string TY = System.Configuration.ConfigurationManager.ConnectionStrings["conf"].ConnectionString;
            using (SqlConnection con = new SqlConnection(TY))
            {
                SqlCommand cmd = new SqlCommand("Select DISTINCT(Sparkboard) from Master", con);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                DropDownList7.DataTextField  = "Sparkboard";
                DropDownList7.DataValueField = "Sparkboard";
                DropDownList7.DataSource     = rdr;
                DropDownList7.DataBind();
                con.Close();
            }

            string YU = System.Configuration.ConfigurationManager.ConnectionStrings["conf"].ConnectionString;
            using (SqlConnection con = new SqlConnection(YU))
            {
                SqlCommand cmd = new SqlCommand("Select DISTINCT(Desktop) from Master", con);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                DropDownList8.DataTextField  = "Desktop";
                DropDownList8.DataValueField = "Desktop";
                DropDownList8.DataSource     = rdr;
                DropDownList8.DataBind();
                con.Close();
            }

            string UI = System.Configuration.ConfigurationManager.ConnectionStrings["conf"].ConnectionString;
            using (SqlConnection con = new SqlConnection(UI))
            {
                SqlCommand cmd = new SqlCommand("Select DISTINCT(Projector) from Master", con);
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                DropDownList9.DataTextField  = "Projector";
                DropDownList9.DataValueField = "Projector";
                DropDownList9.DataSource     = rdr;
                DropDownList9.DataBind();
                con.Close();
            }
        }
    }
Exemple #23
0
        public void binddata()
        {
            string        connetionString;
            SqlConnection cnn;

            connetionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString;

            cnn = new SqlConnection(connetionString);
            string com = "select content.id,'Link: ' + link + '  Category/SubCategory  Type: ' + category_type + '/' + subcategory_name+ '  Type: ' + [type] as 'Info' from content, Original_content where content.id = Original_content.id and Original_content.rating >= 4;";

            SqlDataAdapter adpt = new SqlDataAdapter(com, cnn);
            DataTable      dt   = new DataTable();

            adpt.Fill(dt);
            DropDownList1.DataSource     = dt;
            DropDownList1.DataTextField  = "Info";
            DropDownList1.DataValueField = "id";
            DropDownList1.DataBind();
            com = "Select [user].id,first_name+' '+middle_name+' '+last_name as 'Fullname'" +
                  " from [user],contributor where [user].id=contributor.id";
            adpt = new SqlDataAdapter(com, cnn);
            DataTable dt1 = new DataTable();

            adpt.Fill(dt1);
            DropDownList2.DataSource     = dt1;
            DropDownList2.DataTextField  = "Fullname";
            DropDownList2.DataValueField = "ID";
            DropDownList2.DataBind();
            DropDownList2.Items.Insert(0, new ListItem("No Specific Contributor", ""));
            com  = "select information,id from new_request where  (accept_status=0 or accept_status is null) and viewer_id=" + s + ";";
            adpt = new SqlDataAdapter(com, cnn);
            dt1  = new DataTable();
            adpt.Fill(dt1);
            DropDownList3.DataSource     = dt1;
            DropDownList3.DataTextField  = "information";
            DropDownList3.DataValueField = "id";
            DropDownList3.DataBind();

            com  = "select content.id,'Link: ' + link + '  Category/SubCategory  Type: ' + category_type + '/' + subcategory_name+ '  Type: ' + [type] as 'Info' from content, Original_content where content.id = Original_content.id ;";
            adpt = new SqlDataAdapter(com, cnn);
            dt1  = new DataTable();
            adpt.Fill(dt1);
            DropDownList4.DataSource     = dt1;
            DropDownList4.DataTextField  = "Info";
            DropDownList4.DataValueField = "id";
            DropDownList4.DataBind();
            com  = "select content.id,'Link: ' + link + '  Category/SubCategory  Type: ' + category_type + '/' + subcategory_name+ '  Type: ' + [type] as 'Info' from content, Original_content where content.id = Original_content.id ;";
            adpt = new SqlDataAdapter(com, cnn);
            dt1  = new DataTable();
            adpt.Fill(dt1);
            DropDownList5.DataSource     = dt1;
            DropDownList5.DataTextField  = "Info";
            DropDownList5.DataValueField = "id";
            DropDownList5.DataBind();

            com  = "select convert(varchar(40),viewer_id)+'#'+convert(varchar(40),original_content_id)+ '#' + convert(varchar(40),[date],21) + '#' +[text] as 'key',' Comment: '+[text]+ ' Link: ' + link + '  Category/SubCategory  Type: ' + category_type + '/' + subcategory_name + '  Type: ' + [type] as 'Info' from Comment, Original_content, content where original_content_id = Original_content.id and Original_content.id = content.id and viewer_id=" + s + ";";
            adpt = new SqlDataAdapter(com, cnn);
            dt1  = new DataTable();
            adpt.Fill(dt1);
            DropDownList6.DataSource     = dt1;
            DropDownList6.DataTextField  = "Info";
            DropDownList6.DataValueField = "key";
            DropDownList6.DataBind();
            com  = "select convert(varchar(40),viewer_id)+'#'+convert(varchar(40),original_content_id)+ '#' + convert(varchar(40),[date],21) + '#' +[text] as 'key',' Comment: '+[text]+ ' Link: ' + link + '  Category/SubCategory  Type: ' + category_type + '/' + subcategory_name + '  Type: ' + [type] as 'Info' from Comment, Original_content, content where original_content_id = Original_content.id and Original_content.id = content.id and viewer_id=" + s + ";";
            adpt = new SqlDataAdapter(com, cnn);
            dt1  = new DataTable();
            adpt.Fill(dt1);
            DropDownList7.DataSource     = dt1;
            DropDownList7.DataTextField  = "Info";
            DropDownList7.DataValueField = "key";
            DropDownList7.DataBind();

            com  = "select advertisement.id,'Description: '+[Description]+'  Location: '+[location] as 'Info' from advertisement where viewer_id=" + s + ";";
            adpt = new SqlDataAdapter(com, cnn);
            dt1  = new DataTable();
            adpt.Fill(dt1);
            DropDownList9.DataSource     = dt1;
            DropDownList9.DataTextField  = "Info";
            DropDownList9.DataValueField = "id";
            DropDownList9.DataBind();
            com  = "select  content.contributer_id as 'id','Link: ' + link + '  Category/SubCategory  Type: ' + category_type + '/' + subcategory_name + '  Type: ' + [type] as 'Info' from content, new_content, new_request where content.id = New_content.id and New_content.new_request_id = new_request.id and new_request.viewer_id=" + s + ";";
            adpt = new SqlDataAdapter(com, cnn);
            dt1  = new DataTable();
            adpt.Fill(dt1);
            ListBox1.DataSource     = dt1;
            ListBox1.DataTextField  = "Info";
            ListBox1.DataValueField = "id";
            ListBox1.DataBind();
        }
Exemple #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            sql_str = " select distinct(t.offday) as offday from onduty t " +
                      " where t.offday not in ('OFF','ON')      ";
            ds_temp = func.get_dataSet_access(sql_str, conn);



            RadioButtonList1.DataSource = ds_temp.Tables[0];

            RadioButtonList1.DataTextField  = "offday";
            RadioButtonList1.DataValueField = "offday";
            RadioButtonList1.DataBind();
            // RadioButtonList1.Items.Insert(0, "請選擇");

            txtEstimateStartDate.SelectedDate = Convert.ToDateTime(DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd"));


            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\hour.txt");

            DropDownList5.DataSource = arlist_temp1;
            DropDownList5.DataBind();
            DropDownList5.Text = DateTime.Now.ToString("HH");
            DropDownList5.Text = "08";



            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\min.txt");

            DropDownList8.DataSource = arlist_temp1;
            DropDownList8.DataBind();
            DropDownList8.Text = DateTime.Now.ToString("mm");
            DropDownList8.Text = "00";



            txtEstimateEndDate.SelectedDate = Convert.ToDateTime(DateTime.Now.AddDays(+0).ToString("yyyy/MM/dd"));


            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\hour.txt");

            DropDownList15.DataSource = arlist_temp1;
            DropDownList15.DataBind();
            DropDownList15.Text = DateTime.Now.ToString("HH");



            arlist_temp1 = func.FileToArray(Server.MapPath(".") + "\\config\\min.txt");

            DropDownList18.DataSource = arlist_temp1;
            DropDownList18.DataBind();
            DropDownList18.Text = DateTime.Now.ToString("mm");
            DropDownList18.Text = "59";

            #region MyRegion 值班工程師
            sql_str = " select distinct (t.engineer) as engineer                                                                      " +
                      "   from onduty t                                                                                   " +
                      "  where t.engineer not in                                                                          " +
                      "        ('何宗彥', '吳泳潔', '廖建賀', '張松騰', '徐展文', '林校平', '林豐裕',                     " +
                      "         '羅盛平', '胡慶祥', '邵朝文', '賴岳汶', '陳品辰', '陳盈仁', '魏武慶',                     " +
                      "         '黃建友', '黃紹煒','蔡丞','楊炎煌','蕭寶棋','蔡育倫','陳鏞企','吳宗哲','吳宜蓁','呂政達') ";
            // ds_temp.Clear();
            ds_temp = func.get_dataSet_access(sql_str, conn);
            DropDownList4.DataSource     = ds_temp.Tables[0];
            DropDownList4.DataTextField  = "engineer";
            DropDownList4.DataValueField = "engineer";

            DropDownList4.DataBind();
            DropDownList4.Items.Insert(0, "請選擇");

            #endregion

            #region fab
            sql_str = " select distinct (t.fab) as fab                                                                      " +
                      "   from onduty t                                                                                   ";

            // ds_temp.Clear();
            string [] fab_array = { "T0T1*", "T2*", "T0Array", "T1Array", "T0Cell", "T1Cell", "T1CF", "T2Array", "T2Cell", "T2CF", "T0T1_OTHERS", "T2_OTHERS", "C3", "WIS" };
            ds_temp = func.get_dataSet_access(sql_str, conn);

            DropDownList1.DataSource = ds_temp.Tables[0];
            DropDownList1.DataSource = fab_array;
            //DropDownList1.DataTextField = "fab";
            //DropDownList1.DataValueField = "fab";

            DropDownList1.DataBind();
            DropDownList1.Items.Insert(0, "請選擇");


            #endregion


            #region fab
            sql_str = " select distinct (t.system) as system                                                                      " +
                      "   from onduty t                                                                                   ";

            // ds_temp.Clear();
            ds_temp = func.get_dataSet_access(sql_str, conn);
            DropDownList2.DataSource     = ds_temp.Tables[0];
            DropDownList2.DataTextField  = "system";
            DropDownList2.DataValueField = "system";

            DropDownList2.DataBind();
            DropDownList2.Items.Insert(0, "請選擇");


            #endregion



            #region close_flag
            sql_str = "select distinct(t.close_flag) as close_flag  from onduty t" +
                      " where t.close_flag is not null";
            // ds_temp.Clear();
            ds_temp = func.get_dataSet_access(sql_str, conn);
            DropDownList3.DataSource     = ds_temp.Tables[0];
            DropDownList3.DataTextField  = "close_flag";
            DropDownList3.DataValueField = "close_flag";
            DropDownList3.DataBind();
            DropDownList3.Items.Insert(0, "請選擇");


            #endregion



            #region ars_flag
            sql_str = "select distinct(t.ars_flag) as ars_flag  from onduty t" +
                      " where t.ars_flag is not null";
            // ds_temp.Clear();
            ds_temp = func.get_dataSet_access(sql_str, conn);
            DropDownList12.DataSource     = ds_temp.Tables[0];
            DropDownList12.DataTextField  = "ars_flag";
            DropDownList12.DataValueField = "ars_flag";
            DropDownList12.DataBind();
            DropDownList12.Items.Insert(0, "請選擇");



            #endregion


            #region alarm_flag
            sql_str = "select distinct(t.alarm_flag) as alarm_flag  from onduty t" +
                      " where t.alarm_flag is not null";
            // ds_temp.Clear();
            ds_temp = func.get_dataSet_access(sql_str, conn);
            DropDownList10.DataSource     = ds_temp.Tables[0];
            DropDownList10.DataTextField  = "alarm_flag";
            DropDownList10.DataValueField = "alarm_flag";
            DropDownList10.DataBind();
            DropDownList10.Items.Insert(0, "請選擇");



            #endregion



            #region type
            sql_str = " select distinct(t.type) as type  from onduty t                                                       " +
                      " where t.type not in ('資料異常','MO+過帳失敗','交辦事項','支援部門','設備(搬運系統)','過帳失敗')     ";
            // ds_temp.Clear();
            ds_temp = func.get_dataSet_access(sql_str, conn);
            DropDownList6.DataSource     = ds_temp.Tables[0];
            DropDownList6.DataTextField  = "type";
            DropDownList6.DataValueField = "type";
            DropDownList6.DataBind();
            DropDownList6.Items.Insert(0, "請選擇");



            #endregion


            #region product_impact
            sql_str = " select distinct(t.product_impact) as product_impact  from onduty t " +
                      " where t.product_impact is not null                                 ";
            ds_temp = func.get_dataSet_access(sql_str, conn);
            DropDownList7.DataSource     = ds_temp.Tables[0];
            DropDownList7.DataTextField  = "product_impact";
            DropDownList7.DataValueField = "product_impact";
            DropDownList7.DataBind();
            DropDownList7.Items.Insert(0, "請選擇");

            #endregion



            #region 處理者
            sql_str = " select distinct(t.bywhom) as bywhom  from onduty t " +
                      " where t.bywhom is not null                                 ";
            ds_temp = func.get_dataSet_access(sql_str, conn);
            DropDownList9.DataSource     = ds_temp.Tables[0];
            DropDownList9.DataTextField  = "bywhom";
            DropDownList9.DataValueField = "bywhom";
            DropDownList9.DataBind();
            DropDownList9.Items.Insert(0, "請選擇");


            #endregion



            #region Assign To
            sql_str = " select distinct(t.assign_owner) as assign_owner  from onduty t                                       " +
                      " where t.assign_owner  not in ('何宗彥', '吳泳潔', '廖建賀', '張松騰', '徐展文', '林校平', '林豐裕',  " +
                      "         '羅盛平', '胡慶祥', '邵朝文', '賴岳汶', '陳品辰', '陳盈仁', '魏武慶',                        " +
                      "         '黃建友', '黃紹煒','蔡丞','楊炎煌','蕭寶棋','蔡育倫','陳鏞企','吳宗哲','吳宜蓁','呂政達')    ";
            ds_temp = func.get_dataSet_access(sql_str, conn);
            DropDownList11.DataSource     = ds_temp.Tables[0];
            DropDownList11.DataTextField  = "assign_owner";
            DropDownList11.DataValueField = "assign_owner";
            DropDownList11.DataBind();
            DropDownList11.Items.Insert(0, "請選擇");
            DropDownList11.Items.Insert(1, "*");


            #endregion

            Label1.Text = "0";
            Label2.Text = "0";
            Label3.Text = "0";
            Label4.Text = "0";
            Label5.Text = "0";

            Label1.ForeColor = Color.Red;
            Label2.ForeColor = Color.Red;
            Label3.ForeColor = Color.Red;
            Label4.ForeColor = Color.Red;
            Label5.ForeColor = Color.Red;

            bind_data();
            //MappTextProvider omapp = new MappTextProvider();

            //omapp.SendMessage("12574", "值班紀錄被查詢發送測試");
        }
    }
Exemple #25
0
    protected void Btn_deleting_Click(object sender, EventArgs e)
    {
        //label_Hedangongxu.Text = "";
        //TextBox9.Text = "";
        //  TextBox8.Text = "";
        //TextBox5.Text = "";
        // TextBox6.Text = "";
        //TextBox1.Text = "";
        // DropDownList8.SelectedIndex = 0;

        string ptname = "";
        int    sum    = 0;
        int    pnum   = 0;

        for (int i = 0; i <= GridView_WOmain.Rows.Count - 1; i++)
        {
            CheckBox CheckBox = (CheckBox)GridView_WOmain.Rows[i].FindControl("CheckBox1");
            if (CheckBox.Checked == true)
            {
                if (label_hedanxinghao.Text.Trim() == "")
                {
                    ptname = GridView_WOmain.DataKeys[i].Values["WO_ProType"].ToString().Trim();
                    label_hedanxinghao.Text = ptname;
                    WO_PT_ID.Text           = GridView_WOmain.DataKeys[i].Values["WO_PT_ID"].ToString().Trim();
                }
                else
                {
                    if (label_hedanxinghao.Text.Trim() != GridView_WOmain.DataKeys[i].Values["WO_ProType"].ToString().Trim())
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('合单的产品型号必须一致!,请您再核对!')", true);
                        //  label_hedanxinghao.Text = "";
                        return;
                    }
                }



                if (TextBox8.Text.Trim() == "")
                {
                    TextBox8.Text = GridView_WOmain.DataKeys[i].Values["WO_Num"].ToString().Trim();
                }
                else
                {
                    string[] a;
                    if (TextBox8.Text.Contains(","))
                    {
                        a = TextBox8.Text.Trim().Split(new char[] { ',' });
                        int id = Array.IndexOf(a, GridView_WOmain.DataKeys[i].Values["WO_Num"].ToString().Trim()); // 这里的1就是你要查找的值
                        if (id == -1)
                        {
                            TextBox8.Text = TextBox8.Text + "," + GridView_WOmain.DataKeys[i].Values["WO_Num"].ToString().Trim();
                        }
                    }
                    else
                    {
                        if (TextBox8.Text != GridView_WOmain.DataKeys[i].Values["WO_Num"].ToString().Trim())
                        {
                            TextBox8.Text = TextBox8.Text + "," + GridView_WOmain.DataKeys[i].Values["WO_Num"].ToString().Trim();
                        }
                    }
                }
                if (GridView_WOmain.DataKeys[i].Values["WO_State"].ToString().Trim() == "已被合单")
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('选择的随工单中不能含有已被合单的随工单!请您再核对!')", true);

                    return;
                }
                if (GridView_WOmain.DataKeys[i].Values["WOD_QNum"].ToString().Trim() != "")
                {
                    pnum = pnum + Convert.ToInt32(GridView_WOmain.DataKeys[i].Values["WOD_QNum"].ToString().Trim());
                }


                sum++;
            }
        }
        if (sum == 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('您没选择任何要合单的随工单!,请您再核对!')", true);
            return;
        }
        DataSet ds = ppd.S_WorkOrder_CombiningNum(TextBox8.Text.Trim());

        TextBox5.Text                = ds.Tables[0].Rows[0]["num"].ToString();
        DropDownList9.DataSource     = erl.S_WOError_Rework_PBCraft();
        DropDownList9.DataTextField  = "PBC_Name";
        DropDownList9.DataValueField = "PBC_ID";
        DropDownList9.DataBind();
        DropDownList9.SelectedIndex = 0;

        Panel2.Visible = true;
        //  TextBox5.Text = pnum.ToString();
        UpdatePanel2.Update();
    }
Exemple #26
0
 protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DropDownList3.SelectedIndex != 0)
     {
         //int b=new int();
         //DataTable ds=(DataTable)ViewState["dt1"];
         //foreach(DataRow dr in ds.Rows)
         //{
         //    if (DropDownList3.SelectedValue==dr["Item_Id"].ToString())
         //{
         //    b = Convert.ToInt32(dr["NoOfConstraints"]);
         //}
         //}
         SqlCommand cmd = con.CreateCommand();
         //if (a == "yes")
         //{
         //    if (b == 1)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Options from Item Where Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a",id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //    if (b == 2)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Unit1,Constraint_Options,Constraint_Options1 from Item Where Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a", id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //    if (b == 3)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Unit1,Constraint_Unit2,Constraint_Options,Constraint_Options1,Constraint_Options2 from Item Where Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a", id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //    if (b == 4)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Unit1,Constraint_Unit2,Constraint_Unit3,Constraint_Options,Constraint_Options1,Constraint_Options2,Constraint_Options3 from Item Where Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a", id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //    if (b == 5)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Unit1,Constraint_Unit2,Constraint_Unit3,Constraint_Unit4,Constraint_Options,Constraint_Options1,Constraint_Options2,Constraint_Options3,Constraint_Options4 from Item Where Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a", id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //}
         //if (a == "sub")
         //{
         //    if (b == 1)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Options from Item Where Sub_Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a", id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //    if (b == 2)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Unit1,Constraint_Options,Constraint_Options1 from Item Where Sub_Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a", id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //    if (b == 3)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Unit1,Constraint_Unit2,Constraint_Options,Constraint_Options1,Constraint_Options2 from Item Where Sub_Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a", id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //    if (b == 4)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Unit1,Constraint_Unit2,Constraint_Unit3,Constraint_Options,Constraint_Options1,Constraint_Options2,Constraint_Options3 from Item Where Sub_Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a", id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //    if (b == 5)
         //    {
         //        cmd.CommandText = "Select Constraint_Unit,Constraint_Unit1,Constraint_Unit2,Constraint_Unit3,Constraint_Unit4,Constraint_Options,Constraint_Options1,Constraint_Options2,Constraint_Options3,Constraint_Options4 from Item Where Sub_Category_Id=@a and Item_Id=@c and Active=@b";
         //        cmd.Parameters.AddWithValue("@a", id);
         //        cmd.Parameters.AddWithValue("@b", "yes");
         //        cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
         //    }
         //}
         a = ViewState["a"].ToString();
         if (a == "yes")
         {
             cmd.CommandText = "Select NoOfConstraints,Constraint_Unit,Constraint_Unit1,Constraint_Unit2,Constraint_Unit3,Constraint_Unit4,Constraint_Options,Constraint_Options1,Constraint_Options2,Constraint_Options3,Constraint_Options4 from Item Where Item_Id=@c and Active=@b";
             cmd.Parameters.AddWithValue("@b", "yes");
             cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
             ViewState["Item"] = DropDownList3.SelectedValue;
         }
         if (a == "sub")
         {
             cmd.CommandText = "Select NoOfConstraints,Constraint_Unit,Constraint_Unit1,Constraint_Unit2,Constraint_Unit3,Constraint_Unit4,Constraint_Options,Constraint_Options1,Constraint_Options2,Constraint_Options3,Constraint_Options4 from Item Where Item_Id=@c and Active=@b";
             cmd.Parameters.AddWithValue("@b", "yes");
             cmd.Parameters.AddWithValue("@c", DropDownList3.SelectedValue);
             ViewState["Item"] = DropDownList3.SelectedValue;
         }
         con.Open();
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         dt2 = new DataTable();
         da.Fill(dt2);
         con.Close();
         b = new int();
         foreach (DataRow dr in dt2.Rows)
         {
             b = Convert.ToInt32(dr["NoOfConstraints"]);
         }
         if (b == 1)
         {
             foreach (DataRow dr in dt2.Rows)
             {
                 d       = (dr["Constraint_Options"]).ToString();
                 options = d.Split(',');
                 unit    = dr["Constraint_Unit"].ToString();
                 int i = 0;
                 foreach (string s in options)
                 {
                     options[i] = s + unit;
                     i++;
                 }
             }
             DropDownList5.DataSource = options;
             DropDownList5.DataBind();
             ListItem Item = new ListItem("Select Constraint", "-1");
             DropDownList5.Items.Insert(0, Item);
             DropDownList5.Visible = true;
             DropDownList6.Visible = false;
             DropDownList7.Visible = false;
             DropDownList8.Visible = false;
             DropDownList9.Visible = false;
             ViewState["b"]        = b;
         }
         if (b == 2)
         {
             foreach (DataRow dr in dt2.Rows)
             {
                 d       = dr["Constraint_Options"].ToString();
                 options = d.Split(',');
                 unit    = dr["Constraint_Unit"].ToString();
                 int i = 0;
                 foreach (string s in options)
                 {
                     options[i] = s + unit;
                     i++;
                 }
                 d        = dr["Constraint_Options1"].ToString();
                 options1 = d.Split(',');
                 unit1    = dr["Constraint_Unit1"].ToString();
                 i        = 0;
                 foreach (string s in options1)
                 {
                     options1[i] = s + unit1;
                     i++;
                 }
             }
             DropDownList5.DataSource = options;
             DropDownList5.DataBind();
             ListItem Item = new ListItem("Select Constraint", "-1");
             DropDownList5.Items.Insert(0, Item);
             DropDownList5.Visible    = true;
             DropDownList6.DataSource = options1;
             DropDownList6.DataBind();
             DropDownList6.Items.Insert(0, Item);
             DropDownList6.Visible = true;
             DropDownList7.Visible = false;
             DropDownList8.Visible = false;
             DropDownList9.Visible = false;
             ViewState["b"]        = b;
         }
         if (b == 3)
         {
             foreach (DataRow dr in dt2.Rows)
             {
                 d       = dr["Constraint_Options"].ToString();
                 options = d.Split(',');
                 unit    = dr["Constraint_Unit"].ToString();
                 int i = 0;
                 foreach (string s in options)
                 {
                     options[i] = options[i] + unit;
                     i++;
                 }
                 d        = dr["Constraint_Options1"].ToString();
                 options1 = d.Split(',');
                 unit1    = dr["Constraint_Unit1"].ToString();
                 i        = 0;
                 foreach (string s in options1)
                 {
                     options1[i] = s + unit1;
                     i++;
                 }
                 d        = dr["Constraint_Options2"].ToString();
                 options2 = d.Split(',');
                 unit2    = dr["Constraint_Unit2"].ToString();
                 i        = 0;
                 foreach (string s in options2)
                 {
                     options2[i] = s + unit2;
                     i++;
                 }
             }
             DropDownList5.DataSource = options;
             DropDownList5.DataBind();
             ListItem Item = new ListItem("Select Constraint", "-1");
             DropDownList5.Items.Insert(0, Item);
             DropDownList5.Visible    = true;
             DropDownList6.DataSource = options1;
             DropDownList6.DataBind();
             DropDownList6.Items.Insert(0, Item);
             DropDownList6.Visible    = true;
             DropDownList7.DataSource = options2;
             DropDownList7.DataBind();
             DropDownList7.Items.Insert(0, Item);
             DropDownList7.Visible = true;
             DropDownList8.Visible = false;
             DropDownList9.Visible = false;
             ViewState["b"]        = b;
         }
         if (b == 4)
         {
             foreach (DataRow dr in dt2.Rows)
             {
                 d       = dr["Constraint_Options"].ToString();
                 options = d.Split(',');
                 unit    = dr["Constraint_Unit"].ToString();
                 int i = 0;
                 foreach (string s in options)
                 {
                     options[i] = s + unit;
                     i++;
                 }
                 d        = dr["Constraint_Options1"].ToString();
                 options1 = d.Split(',');
                 unit1    = dr["Constraint_Unit1"].ToString();
                 i        = 0;
                 foreach (string s in options1)
                 {
                     options1[i] = s + unit1;
                     i++;
                 }
                 d        = dr["Constraint_Options2"].ToString();
                 options2 = d.Split(',');
                 unit2    = dr["Constraint_Unit2"].ToString();
                 i        = 0;
                 foreach (string s in options2)
                 {
                     options2[i] = s + unit2;
                     i++;
                 }
                 d        = dr["Constraint_Options3"].ToString();
                 options3 = d.Split(',');
                 unit3    = dr["Constraint_Unit3"].ToString();
                 i        = 0;
                 foreach (string s in options3)
                 {
                     options3[i] = s + unit3;
                     i++;
                 }
             }
             DropDownList5.DataSource = options;
             DropDownList5.DataBind();
             ListItem Item = new ListItem("Select Constraint", "-1");
             DropDownList5.Items.Insert(0, Item);
             DropDownList5.Visible    = true;
             DropDownList6.DataSource = options1;
             DropDownList6.DataBind();
             DropDownList6.Items.Insert(0, Item);
             DropDownList6.Visible    = true;
             DropDownList7.DataSource = options2;
             DropDownList7.DataBind();
             DropDownList7.Items.Insert(0, Item);
             DropDownList7.Visible    = true;
             DropDownList8.DataSource = options3;
             DropDownList8.DataBind();
             DropDownList8.Items.Insert(0, Item);
             DropDownList8.Visible = true;
             DropDownList9.Visible = false;
             ViewState["b"]        = b;
         }
         if (b == 5)
         {
             foreach (DataRow dr in dt2.Rows)
             {
                 d       = dr["Constraint_Options"].ToString();
                 options = d.Split(',');
                 unit    = dr["Constraint_Unit"].ToString();
                 int i = 0;
                 foreach (string s in options)
                 {
                     options[i] = s + unit;
                     i++;
                 }
                 d        = (dr["Constraint_Options1"]).ToString();
                 options1 = d.Split(',');
                 unit1    = dr["Constraint_Unit1"].ToString();
                 i        = 0;
                 foreach (string s in options1)
                 {
                     options1[i] = s + unit1;
                     i++;
                 }
                 d        = dr["Constraint_Options2"].ToString();
                 options2 = d.Split(',');
                 unit2    = dr["Constraint_Unit2"].ToString();
                 i        = 0;
                 foreach (string s in options2)
                 {
                     options2[i] = s + unit2;
                     i++;
                 }
                 d        = dr["Constraint_Options3"].ToString();
                 options3 = d.Split(',');
                 unit3    = dr["Constraint_Unit3"].ToString();
                 i        = 0;
                 foreach (string s in options3)
                 {
                     options3[i] = s + unit3;
                     i++;
                 }
                 d        = dr["Constraint_Options4"].ToString();
                 options4 = d.Split(',');
                 unit4    = dr["Constraint_Unit4"].ToString();
                 i        = 0;
                 foreach (string s in options4)
                 {
                     options4[i] = s + unit4;
                     i++;
                 }
             }
             DropDownList5.DataSource = options;
             DropDownList5.DataBind();
             ListItem Item = new ListItem("Select Constraint", "-1");
             DropDownList5.Items.Insert(0, Item);
             DropDownList5.Visible    = true;
             DropDownList6.DataSource = options1;
             DropDownList6.DataBind();
             DropDownList6.Items.Insert(0, Item);
             DropDownList6.Visible    = true;
             DropDownList7.DataSource = options2;
             DropDownList7.DataBind();
             DropDownList7.Items.Insert(0, Item);
             DropDownList7.Visible    = true;
             DropDownList8.DataSource = options3;
             DropDownList8.DataBind();
             DropDownList8.Items.Insert(0, Item);
             DropDownList8.Visible    = true;
             DropDownList9.DataSource = options4;
             DropDownList9.DataBind();
             DropDownList9.Items.Insert(0, Item);
             DropDownList9.Visible = true;
             ViewState["b"]        = b;
         }
     }
     else
     {
         photo.Visible         = false;
         DropDownList5.Visible = false;
         DropDownList6.Visible = false;
         DropDownList7.Visible = false;
         DropDownList8.Visible = false;
         DropDownList9.Visible = false;
         Label1.Visible        = false;
         Label1.Text           = null;
     }
 }
Exemple #27
0
        private void BindAreaDP()
        {
            List <RSSMWeb.Code.Utils.CustomClass> mylist = Utils.GetUserList();

            RSSMWeb.Code.Utils.CustomClass tmp = new RSSMWeb.Code.Utils.CustomClass("0", "无", "0");
            List <RSSMWeb.Code.Utils.CustomClassForDropdownlist> mylist_username_dpt = Utils.GetUserListForDropdownlist_dpt();

            mylist.Insert(0, tmp);


            DropDownList7.DataTextField  = "Name";
            DropDownList7.DataValueField = "ID";
            DropDownList7.DataSource     = mylist;
            DropDownList7.DataBind();

            //DropDownList6.DataTextField = "Name";
            //DropDownList6.DataValueField = "ID";
            //DropDownList6.DataSource = mylist;
            //DropDownList6.DataBind();

            DropDownList6.EnableSimulateTree         = true;
            DropDownList6.DataTextField              = "Name";
            DropDownList6.DataValueField             = "ID";
            DropDownList6.DataSimulateTreeLevelField = "Group";
            DropDownList6.DataEnableSelectField      = "Enableselect";

            DropDownList6.DataSource = mylist_username_dpt;
            DropDownList6.DataBind();
            DropDownList6.SelectedValue = "0";



            //DropDownList9.DataTextField = "Name";
            //DropDownList9.DataValueField = "ID";
            //DropDownList9.DataSource = mylist;
            //DropDownList9.DataBind();

            DropDownList9.EnableSimulateTree         = true;
            DropDownList9.DataTextField              = "Name";
            DropDownList9.DataValueField             = "ID";
            DropDownList9.DataSimulateTreeLevelField = "Group";
            DropDownList9.DataEnableSelectField      = "Enableselect";

            DropDownList9.DataSource = mylist_username_dpt;
            DropDownList9.DataBind();
            DropDownList9.SelectedValue = "0";

            DropDownList10.EnableSimulateTree         = true;
            DropDownList10.DataTextField              = "Name";
            DropDownList10.DataValueField             = "ID";
            DropDownList10.DataSimulateTreeLevelField = "Group";
            DropDownList10.DataEnableSelectField      = "Enableselect";

            DropDownList10.DataSource = mylist_username_dpt;
            DropDownList10.DataBind();
            DropDownList10.SelectedValue = "0";

            DropDownList12.EnableSimulateTree         = true;
            DropDownList12.DataTextField              = "Name";
            DropDownList12.DataValueField             = "ID";
            DropDownList12.DataSimulateTreeLevelField = "Group";
            DropDownList12.DataEnableSelectField      = "Enableselect";

            DropDownList12.DataSource = mylist_username_dpt;
            DropDownList12.DataBind();
            DropDownList12.SelectedValue = "0";

            mylist.Clear();
            mylist   = Utils.GetPJList();
            tmp.ID   = "0";
            tmp.Name = "无";
            mylist.Insert(0, tmp);

            DropDownList4.DataTextField  = "Name";
            DropDownList4.DataValueField = "ID";
            DropDownList4.DataSource     = mylist;
            DropDownList4.DataBind();

            mylist.Clear();
            mylist   = Utils.GetPDList();
            tmp.ID   = "0";
            tmp.Name = "无";
            mylist.Insert(0, tmp);

            DropDownList2.DataTextField  = "Name";
            DropDownList2.DataValueField = "ID";
            DropDownList2.DataSource     = mylist;
            DropDownList2.DataBind();
        }
 protected void TextBox5_TextChanged(object sender, EventArgs e)
 {
     DropDownList9.DataBind();
 }
Exemple #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var x = Request.QueryString["page"].ToString();
                int y = int.Parse(x);
                if (y == 1)
                {
                    Panel2.Visible = true;
                    var x1 = Request.QueryString["id"].ToString();
                    int y1 = int.Parse(x1);

                    Tbl_department rr      = db.Tbl_department.First(u => u.Department_ID == y1);
                    int            dep     = Convert.ToInt32(rr.Level_ID);
                    var            stateid = from Tbl_Level in db.Tbl_Level where Tbl_Level.Level_ID.Equals(dep) select new { Tbl_Level.Name_Ar, Tbl_Level.Name_Er, Tbl_Level.Level_ID };
                    var            le      = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID, Tbl_Level.Name_Ar };
                    DropDownList1.DataSource     = le.ToList();
                    DropDownList1.DataValueField = "Level_ID";
                    DropDownList1.DataTextField  = "Name_Er";
                    DropDownList1.DataBind();
                    DropDownList1.SelectedValue = dep.ToString();

                    name_ar_dep.Text = rr.Name_Ar;
                    name_en_dep.Text = rr.Name_En;
                }

                else if (y == 112)
                {
                    Panel7.Visible = true;
                    var x1 = Request.QueryString["id"].ToString();
                    int y1 = int.Parse(x1);

                    Tbl_department rr      = db.Tbl_department.First(u => u.Department_ID == y1);
                    int            dep     = Convert.ToInt32(rr.Level_ID);
                    var            stateid = from Tbl_Level in db.Tbl_Level where Tbl_Level.Level_ID.Equals(dep) select new { Tbl_Level.Name_Ar, Tbl_Level.Name_Er, Tbl_Level.Level_ID };
                    var            le      = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID, Tbl_Level.Name_Ar };
                    DropDownList9.DataSource     = le.ToList();
                    DropDownList9.DataValueField = "Level_ID";
                    DropDownList9.DataTextField  = "Name_Ar";
                    DropDownList9.DataBind();
                    DropDownList9.SelectedValue = dep.ToString();

                    TextBox14.Text = rr.Name_Ar;
                    TextBox13.Text = rr.Name_En;
                }



                else if (y == 21)
                {
                    Panel8.Visible = true;

                    var x1 = Request.QueryString["id"].ToString();
                    int y1 = int.Parse(x1);

                    Tbl_Subject rr      = db.Tbl_Subject.First(u => u.Subject_ID == y1);
                    int         pro     = Convert.ToInt32(rr.Prof_ID);
                    var         stateid = from Tbl_Prof in db.Tbl_Prof where Tbl_Prof.Approval.Equals("1") select new { Tbl_Prof.Prof_ID, Tbl_Prof.Name };
                    //var pr = from Tbl_Prof in db.Tbl_Prof select new { Tbl_Prof.Name, Tbl_Prof.Prof_ID };
                    DropDownList10.DataSource     = stateid.ToList();
                    DropDownList10.DataValueField = "Prof_ID";
                    DropDownList10.DataTextField  = "Name";
                    DropDownList10.DataBind();
                    DropDownList10.SelectedValue = pro.ToString();

                    int            dep = Convert.ToInt32(rr.Department_ID);
                    Tbl_department de  = db.Tbl_department.First(d => d.Department_ID == dep);
                    int            lev = Convert.ToInt32(de.Level_ID);
                    var            le  = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID, Tbl_Level.Name_Ar };
                    DropDownList11.DataSource     = le.ToList();
                    DropDownList11.DataValueField = "Level_ID";
                    DropDownList11.DataTextField  = "Name_Ar";
                    DropDownList11.DataBind();
                    DropDownList11.SelectedValue = lev.ToString();

                    var stateidDep = from Tbl_department in db.Tbl_department where Tbl_department.Level_ID.Equals(lev) select new { Tbl_department.Department_ID, Tbl_department.Level_ID, Tbl_department.Name_En, Tbl_department.Name_Ar };

                    var statename = stateidDep.ToList();
                    if (statename.Count > 0)
                    {
                        DropDownList12.DataSource     = statename;
                        DropDownList12.DataValueField = "Department_ID";
                        DropDownList12.DataTextField  = "Name_Ar";
                        DropDownList12.DataBind();
                        DropDownList12.SelectedValue = dep.ToString();
                    }

                    TextBox15.Text = rr.Name_Er;
                    TextBox16.Text = rr.Name_Ar;
                }

                else if (y == 2)
                {
                    Panel3.Visible = true;

                    var x1 = Request.QueryString["id"].ToString();
                    int y1 = int.Parse(x1);

                    Tbl_Subject rr      = db.Tbl_Subject.First(u => u.Subject_ID == y1);
                    int         pro     = Convert.ToInt32(rr.Prof_ID);
                    var         stateid = from Tbl_Prof in db.Tbl_Prof where Tbl_Prof.Approval.Equals("1") select new { Tbl_Prof.Prof_ID, Tbl_Prof.Name };
                    //var pr = from Tbl_Prof in db.Tbl_Prof select new { Tbl_Prof.Name, Tbl_Prof.Prof_ID };
                    DropDownList4.DataSource     = stateid.ToList();
                    DropDownList4.DataValueField = "Prof_ID";
                    DropDownList4.DataTextField  = "Name";
                    DropDownList4.DataBind();
                    DropDownList4.SelectedValue = pro.ToString();

                    int            dep = Convert.ToInt32(rr.Department_ID);
                    Tbl_department de  = db.Tbl_department.First(d => d.Department_ID == dep);
                    int            lev = Convert.ToInt32(de.Level_ID);
                    var            le  = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID };
                    DropDownList2.DataSource     = le.ToList();
                    DropDownList2.DataValueField = "Level_ID";
                    DropDownList2.DataTextField  = "Name_Er";
                    DropDownList2.DataBind();
                    DropDownList2.SelectedValue = lev.ToString();

                    var stateidDep = from Tbl_department in db.Tbl_department where Tbl_department.Level_ID.Equals(lev) select new { Tbl_department.Department_ID, Tbl_department.Level_ID, Tbl_department.Name_En };

                    var statename = stateidDep.ToList();
                    if (statename.Count > 0)
                    {
                        DropDownList3.DataSource     = statename;
                        DropDownList3.DataValueField = "Department_ID";
                        DropDownList3.DataTextField  = "Name_En";
                        DropDownList3.DataBind();
                        DropDownList3.SelectedValue = dep.ToString();
                    }

                    TextBox1.Text = rr.Name_Er;
                    TextBox2.Text = rr.Name_Ar;
                }


                else if (y == 31)
                {
                    Panel9.Visible = true;
                    var      x1 = Request.QueryString["id"].ToString();
                    int      y1 = int.Parse(x1);
                    Tbl_Prof rr = db.Tbl_Prof.First(u => u.Prof_ID == y1);
                    TextBox17.Text = rr.Name.ToString();
                    TextBox18.Text = rr.Password.ToString();
                    TextBox19.Text = rr.Email.ToString();
                }

                else if (y == 3)
                {
                    Panel1.Visible = true;
                    var      x1 = Request.QueryString["id"].ToString();
                    int      y1 = int.Parse(x1);
                    Tbl_Prof rr = db.Tbl_Prof.First(u => u.Prof_ID == y1);
                    TextBox4.Text = rr.Name.ToString();
                    TextBox5.Text = rr.Password.ToString();
                    TextBox6.Text = rr.Email.ToString();
                }



                else if (y == 41)
                {
                    Panel10.Visible = true;
                    var         x1 = Request.QueryString["id"].ToString();
                    int         y1 = int.Parse(x1);
                    Tbl_Student rr = db.Tbl_Student.First(u => u.Student_ID == y1);
                    TextBox20.Text = rr.Name.ToString();
                    TextBox21.Text = rr.Password.ToString();
                    TextBox22.Text = rr.Email.ToString();
                    var lev = rr.Level_ID;
                    var dep = rr.Department_ID;

                    var le = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID, Tbl_Level.Name_Ar };
                    DropDownList13.DataSource     = le.ToList();
                    DropDownList13.DataValueField = "Level_ID";
                    DropDownList13.DataTextField  = "Name_Ar";
                    DropDownList13.DataBind();
                    DropDownList13.SelectedValue = lev.ToString();

                    var stateidDep = from Tbl_department in db.Tbl_department where Tbl_department.Level_ID.Equals(lev) select new { Tbl_department.Department_ID, Tbl_department.Level_ID, Tbl_department.Name_En, Tbl_department.Name_Ar };

                    var statename = stateidDep.ToList();
                    if (statename.Count > 0)
                    {
                        DropDownList14.DataSource     = statename;
                        DropDownList14.DataValueField = "Department_ID";
                        DropDownList14.DataTextField  = "Name_Ar";
                        DropDownList14.DataBind();
                        DropDownList14.SelectedValue = dep.ToString();
                    }
                }



                else if (y == 4)
                {
                    Panel4.Visible = true;
                    var         x1 = Request.QueryString["id"].ToString();
                    int         y1 = int.Parse(x1);
                    Tbl_Student rr = db.Tbl_Student.First(u => u.Student_ID == y1);
                    TextBox3.Text = rr.Name.ToString();
                    TextBox7.Text = rr.Password.ToString();
                    TextBox8.Text = rr.Email.ToString();
                    var lev = rr.Level_ID;
                    var dep = rr.Department_ID;

                    var le = from Tbl_Level in db.Tbl_Level select new { Tbl_Level.Name_Er, Tbl_Level.Level_ID };
                    DropDownList5.DataSource     = le.ToList();
                    DropDownList5.DataValueField = "Level_ID";
                    DropDownList5.DataTextField  = "Name_Er";
                    DropDownList5.DataBind();
                    DropDownList5.SelectedValue = lev.ToString();

                    var stateidDep = from Tbl_department in db.Tbl_department where Tbl_department.Level_ID.Equals(lev) select new { Tbl_department.Department_ID, Tbl_department.Level_ID, Tbl_department.Name_En };

                    var statename = stateidDep.ToList();
                    if (statename.Count > 0)
                    {
                        DropDownList6.DataSource     = statename;
                        DropDownList6.DataValueField = "Department_ID";
                        DropDownList6.DataTextField  = "Name_En";
                        DropDownList6.DataBind();
                        DropDownList6.SelectedValue = dep.ToString();
                    }
                }



                else if (y == 61)
                {
                    Panel11.Visible = true;
                    var x1 = Request.QueryString["id"].ToString();
                    int y1 = int.Parse(x1);

                    Tbl_chapter rr  = db.Tbl_chapter.First(u => u.Chapter_ID == y1);
                    int         dep = Convert.ToInt32(rr.Subject_ID);

                    var x2        = Request.QueryString["pr"].ToString();
                    int y2        = int.Parse(x2);
                    var stateid   = from Tbl_Subject in db.Tbl_Subject where Tbl_Subject.Prof_ID.Equals(y2) select new { Tbl_Subject.Subject_ID, Tbl_Subject.Name_Ar };
                    var statename = stateid.ToList();
                    if (statename.Count > 0)
                    {
                        DropDownList15.DataValueField = "Subject_ID";
                        DropDownList15.DataTextField  = "Name_Ar";
                        DropDownList15.DataSource     = statename;
                        DropDownList15.DataBind();
                        DropDownList15.Items.Insert(0, "--- select sub----");
                    }
                    DropDownList15.SelectedValue = dep.ToString();

                    TextBox24.Text = rr.Name_Ar;
                    TextBox23.Text = rr.Name_En;
                }

                else if (y == 6)
                {
                    Panel5.Visible = true;
                    var x1 = Request.QueryString["id"].ToString();
                    int y1 = int.Parse(x1);

                    Tbl_chapter rr  = db.Tbl_chapter.First(u => u.Chapter_ID == y1);
                    int         dep = Convert.ToInt32(rr.Subject_ID);

                    var x2        = Request.QueryString["pr"].ToString();
                    int y2        = int.Parse(x2);
                    var stateid   = from Tbl_Subject in db.Tbl_Subject where Tbl_Subject.Prof_ID.Equals(y2) select new { Tbl_Subject.Subject_ID, Tbl_Subject.Name_Er };
                    var statename = stateid.ToList();
                    if (statename.Count > 0)
                    {
                        DropDownList7.DataValueField = "Subject_ID";
                        DropDownList7.DataTextField  = "Name_Er";
                        DropDownList7.DataSource     = statename;
                        DropDownList7.DataBind();
                        DropDownList7.Items.Insert(0, "--- select sub----");
                    }
                    DropDownList7.SelectedValue = dep.ToString();

                    TextBox10.Text = rr.Name_Ar;
                    TextBox9.Text  = rr.Name_En;
                }



                else if (y == 71)
                {
                    Panel12.Visible = true;
                    var          x1 = Request.QueryString["id"].ToString();
                    int          y1 = int.Parse(x1);
                    Tbl_Question rr = db.Tbl_Question.First(u => u.Question_ID == y1);
                    TextBox26.Text = rr.Question_Ar.ToString();
                    TextBox25.Text = rr.Question_En.ToString();
                    DropDownList16.SelectedValue = rr.Question_Level.ToString();
                    var x2 = Request.QueryString["pr"].ToString();
                    int y2 = int.Parse(x2);
                }

                else if (y == 7)
                {
                    Panel6.Visible = true;
                    var          x1 = Request.QueryString["id"].ToString();
                    int          y1 = int.Parse(x1);
                    Tbl_Question rr = db.Tbl_Question.First(u => u.Question_ID == y1);
                    TextBox12.Text = rr.Question_Ar.ToString();
                    TextBox11.Text = rr.Question_En.ToString();
                    DropDownList8.SelectedValue = rr.Question_Level.ToString();
                    var x2 = Request.QueryString["pr"].ToString();
                    int y2 = int.Parse(x2);
                }
            }
        }
Exemple #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Panel4.Visible = false;
                Panel2.Visible = false;
                Panel3.Visible = false;
                string cs = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                using (SqlConnection con = new SqlConnection(cs))
                {
                    SqlCommand cmd = new SqlCommand("Select subjectcode,subjectname from subjectdetails", con);
                    con.Open();
                    SqlDataReader sd;
                    sd = cmd.ExecuteReader();
                    DropDownList4.DataSource = sd;
                    DropDownList4.DataBind();
                    DropDownList4.Items.Insert(0, new ListItem("Select Subject", "NA"));
                    sd.Close();
                    SqlCommand cmd1 = new SqlCommand("Select teacherid,teachername,email,contact from Teacherdeatils", con);
                    sd = cmd1.ExecuteReader();
                    DropDownList5.DataSource = sd;
                    DropDownList5.DataBind();
                    DropDownList5.Items.Insert(0, new ListItem("Select Teacher", "NA"));
                    sd.Close();
                    SqlCommand cmd2 = new SqlCommand("Select teacherid,teachername,email,contact from Teacherdeatils", con);
                    sd = cmd2.ExecuteReader();
                    DropDownList6.DataSource = sd;
                    DropDownList6.DataBind();
                    DropDownList6.Items.Insert(0, new ListItem("Select Assisstant", "NA"));
                    sd.Close();
                    SqlCommand cmd3 = new SqlCommand("Select teacherid,teachername,email,contact from Teacherdeatils", con);
                    sd = cmd3.ExecuteReader();
                    DropDownList9.DataSource = sd;
                    DropDownList9.DataBind();
                    DropDownList9.Items.Insert(0, new ListItem("Select Teacher", "NA"));
                    sd.Close();
                    SqlCommand cmd4 = new SqlCommand("Select teacherid,teachername,email,contact from Teacherdeatils", con);
                    sd = cmd4.ExecuteReader();
                    DropDownList12.DataSource = sd;
                    DropDownList12.DataBind();
                    DropDownList12.Items.Insert(0, new ListItem("Select Teacher", "NA"));
                    sd.Close();
                    SqlCommand cmd5 = new SqlCommand("Select teacherid,teachername,email,contact from Teacherdeatils", con);
                    sd = cmd5.ExecuteReader();
                    DropDownList14.DataSource = sd;
                    DropDownList14.DataBind();
                    DropDownList14.Items.Insert(0, new ListItem("Select Teacher", "NA"));
                    sd.Close();
                    SqlCommand cmd6 = new SqlCommand("Select subjectcode,subjectname from subjectdetails", con);
                    sd = cmd6.ExecuteReader();
                    DropDownList8.DataSource = sd;
                    DropDownList8.DataBind();
                    DropDownList8.Items.Insert(0, new ListItem("Select Subject", "NA"));
                    sd.Close();
                    SqlCommand cmd7 = new SqlCommand("Select subjectcode,subjectname from subjectdetails", con);
                    sd = cmd7.ExecuteReader();
                    DropDownList11.DataSource = sd;
                    DropDownList11.DataBind();
                    DropDownList11.Items.Insert(0, new ListItem("Select Subject", "NA"));
                    sd.Close();
                    SqlCommand cmd8 = new SqlCommand("Select subjectcode,subjectname from subjectdetails", con);
                    sd = cmd8.ExecuteReader();
                    DropDownList13.DataSource = sd;
                    DropDownList13.DataBind();
                    DropDownList13.Items.Insert(0, new ListItem("Select Subject", "NA"));
                    sd.Close();
                    SqlCommand cmd9 = new SqlCommand("Select Id,classroom,lab from Room", con);
                    sd = cmd9.ExecuteReader();
                    DropDownList3.DataSource = sd;
                    DropDownList3.DataBind();
                    DropDownList3.Items.Insert(0, new ListItem("Select Lab Room", "NA"));
                    sd.Close();
                    SqlCommand cmd10 = new SqlCommand("Select Id,classroom,lab from Room", con);
                    sd = cmd10.ExecuteReader();
                    DropDownList7.DataSource = sd;
                    DropDownList7.DataBind();
                    DropDownList7.Items.Insert(0, new ListItem("Select Class Room", "NA"));
                    sd.Close();
                    //SqlCommand cmd11 = new SqlCommand("Insert into ROOM 1,"+DropDownList7.SelectedItem.Text+", "+DropDownList3.SelectedItem.Text, con);

                    /*  if (DropDownList11.Items.Contains(DropDownList8.SelectedItem))
                     * {
                     *    DropDownList11.Items.IndexOf(DropDownList8.SelectedItem);
                     *    DropDownList11.SelectedItem.Enabled = false;
                     * }*/
                }
            }
            //Panel1.Visible = true;
        }