예제 #1
0
        public void bindTable(string table, DataTable dt, string colomn = "Naziv")
        {
            switch (table)
            {
            case "Artikal":
                ListBox4.DataSource     = chgStanjeArt.DataSource = newStanjeArt.DataSource = dt;
                ListBox4.DataTextField  = chgStanjeArt.DataTextField = newStanjeArt.DataTextField = colomn;
                ListBox4.DataValueField = chgStanjeArt.DataValueField = newStanjeArt.DataValueField = "ID";
                ListBox4.DataBind();
                chgStanjeArt.DataBind();
                newStanjeArt.DataBind();
                break;

            case "KatArt":
                ListBox3.DataSource     = newItemsCatArt.DataSource = updItemsCatArt.DataSource = dt;
                ListBox3.DataTextField  = newItemsCatArt.DataTextField = updItemsCatArt.DataTextField = colomn;
                ListBox3.DataValueField = newItemsCatArt.DataValueField = updItemsCatArt.DataValueField = "ID";
                ListBox3.DataBind();
                newItemsCatArt.DataBind();
                updItemsCatArt.DataBind();
                break;

            case "Dobavljac":
                ListBox1.DataSource     = updItemsSupplier.DataSource = newItemsSupplier.DataSource = dt;
                ListBox1.DataTextField  = updItemsSupplier.DataTextField = newItemsSupplier.DataTextField = colomn;
                ListBox1.DataValueField = updItemsSupplier.DataValueField = newItemsSupplier.DataValueField = "ID";
                ListBox1.DataBind();
                updItemsSupplier.DataBind();
                newItemsSupplier.DataBind();
                break;

            case "Korisnik":
                ListBox5.DataSource     = dt;
                ListBox5.DataTextField  = colomn;
                ListBox5.DataValueField = "ID";
                ListBox5.DataBind();
                break;

            case "Prodavnica":
                ListBox2.DataSource     = chgStanjeShop.DataSource = newStanjeShop.DataSource = dt;
                ListBox2.DataTextField  = chgStanjeShop.DataTextField = newStanjeShop.DataTextField = colomn;
                ListBox2.DataValueField = chgStanjeShop.DataValueField = newStanjeShop.DataValueField = "ID";
                ListBox2.DataBind();
                chgStanjeShop.DataBind();
                newStanjeShop.DataBind();
                break;

            case "Grad":
                newSupplierCity.DataSource     = updSupplierCity.DataSource = newShopCity.DataSource = updShopCity.DataSource = newUserCity.DataSource = updUserCity.DataSource = dt;
                newSupplierCity.DataTextField  = updSupplierCity.DataTextField = newShopCity.DataTextField = updShopCity.DataTextField = newUserCity.DataTextField = updUserCity.DataTextField = colomn;
                newSupplierCity.DataValueField = updSupplierCity.DataValueField = newShopCity.DataValueField = updShopCity.DataValueField = newUserCity.DataValueField = updUserCity.DataValueField = "ID";
                updUserCity.DataBind();
                newUserCity.DataBind();
                newShopCity.DataBind();
                updShopCity.DataBind();
                updSupplierCity.DataBind();
                newSupplierCity.DataBind();
                break;
            }
        }
예제 #2
0
    protected void ListBox2_OnTextChanged()
    {
        string sql_productiontype = combine_List_box(ListBox2);

        #region sql_area
        sql_temp1 = " select  distinct(ot1.productspecname) as productspecname                   " +
                    "                                                                            " +
                    " from (                                                                     " +
                    "                                                                            " +
                    " select to_char(t.lasteventtime - 7 / 24, 'yyyy/MM/dd') as shift_day_key,   " +
                    "        t.lasteventtime,                                                    " +
                    "        t.factoryname,                                                      " +
                    "        t.productspecname,                                                  " +
                    "        t.processflowname,                                                  " +
                    "        t2.producttype,                                                     " +
                    "        t.lotname,                                                          " +
                    "        t2.productname,                                                     " +
                    "        t2.processoperationname,                                            " +
                    "        t.lasteventname,                                                    " +
                    "        t.productiontype,                                                   " +
                    "        t.carriername,                                                      " +
                    "        t.lasteventuser,                                                    " +
                    "        t2.subproductquantity1,                                             " +
                    "        round((sysdate-t.lasteventtime)*24,2) as hold_hrs,                  " +
                    "        t.reasoncode                                                        " +
                    "   from lot t, product t2                                                   " +
                    "  where t.lasteventname = 'HOLD'                                            " +
                    "    and to_char(t.lasteventtime - 7 / 24, 'yyyy/MM/dd') >=                  " +
                    "        to_char(to_date('" + txtEstimateStartDate.SelectedDate.Value.ToString("yyyy/MM/dd") + "', 'yyyy/MM/dd') , 'yyyy/MM/dd')         " +
                    "        and to_char(t.lasteventtime - 7 / 24, 'yyyy/MM/dd') <               " +
                    "        to_char(to_date('" + txtEstimateEndDate.SelectedDate.Value.ToString("yyyy/MM/dd") + "', 'yyyy/MM/dd') , 'yyyy/MM/dd')         " +
                    "        and t.factoryname='" + DropDownList1.SelectedValue + "'                                             " +
                    "        and round((sysdate-t.lasteventtime)*24,2)>100                       " +
                    "        and  t.productiontype in (" + sql_productiontype + ")                                         " +
                    "      order by t.lasteventname desc                                         " +
                    "                                                                            " +
                    " )ot1                                                                       ";
        #endregion

        //string sql = "";
        //sql="select distinct(t.productname) from ("++") t";

        ListBox3.Items.Clear();


        DataSet ds_process = new DataSet();
        ds_process = func.get_dataSet_access(sql_temp1, conn);

        ListBox3.DataTextField  = "productspecname";
        ListBox3.DataValueField = "productspecname";
        ListBox3.DataSource     = ds_process.Tables[0];
        ListBox3.DataBind();



        //ListBox1.DataTextField = "productiontype";
        //ListBox1.DataValueField = "productiontype";
        //ListBox1.DataSource = ds_temp1.Tables[0];
        //ListBox1.DataBind();
    }
예제 #3
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            DateTime thisDay = DateTime.Today;

            if (ExisteUsuario(TextBox1.Text, CodigoCentroCarcelario(ListBox1.Text)) == false)
            {
                if (ListBox2.Text == "FICHA" || ListBox3.Text == "COMPUTO")
                {
                    MessageBox.Show("SELECCIONE CORRECTAMENTE FICHA O COMPUTO");
                }
                else
                {
                    InsertarPrivado(NumeroExpediente(CodigoCentroCarcelario(ListBox1.Text), thisDay.Year),
                                    thisDay.Year, TextBox1.Text, TextBox2.Text, TextBox3.Text, CodigoCentroCarcelario(ListBox1.Text),
                                    ListBox2.Text, ListBox3.Text);

                    MessageBox.Show("PRIVADO REGISTRADO");
                }
            }
            else
            {
                MessageBox.Show("ERROR PRIVADO YA EXISTE");
            }
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            ListBox1.DataBind();
            ListBox2.DataBind();
            ListBox3.DataBind();
            Response.Redirect("RegistroPrivado.aspx");
        }
    protected void ListBox2_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        sds3.SelectParameters[0].DefaultValue = (ListBox2.SelectedIndex != -1 ? ListBox2.SelectedValue : "");

        ListBox3.Enabled = (ListBox2.SelectedIndex != -1);
        ListBox3.Items.Clear();
        ListBox3.SelectedIndex = -1;
        ListBox3.DataBind();
    }
예제 #5
0
 public void Enlazar()
 {
     ListBox1.DataSource    = (List <BE.Permiso>)Application["ListaPermisos"];
     ListBox3.DataSource    = (List <BE.Permiso>)Application["ListaRoles"];
     ListBox3.DataTextField = "Nombre";
     ListBox3.DataBind();
     ListBox1.DataTextField = "Nombre";
     ListBox1.DataBind();
 }
    protected void ConfigureHeaderTemplates()
    {
        ListBox1.HeaderTemplate = new HeaderTemplate("CUSTOMERS");
        ListBox2.HeaderTemplate = new HeaderTemplate((ListBox1.SelectedText != String.Empty ? ListBox1.SelectedText : ""));
        ListBox3.HeaderTemplate = new HeaderTemplate((ListBox2.SelectedText != String.Empty ? "Order #" + ListBox2.SelectedText : ""));

        ListBox1.DataBind();
        ListBox2.DataBind();
        ListBox3.DataBind();
    }
예제 #7
0
 protected void lbRole2_Fill(string qrSobese)
 {
     sdsZakaz.ConnectionString = DBconnection.connection.ConnectionString.ToString();
     sdsZakaz.SelectCommand    = qrSobese;
     sdsZakaz.DataSourceMode   = SqlDataSourceMode.DataReader;
     ListBox3.DataSource       = sdsZakaz;
     //ListBox1.DataTextField = "Логин";
     ListBox3.DataValueField = "FIOK";
     ListBox3.DataBind();
 }
예제 #8
0
 protected void lbRole1_Fill(string qrSobese)
 {
     sdsSotrudnik.ConnectionString = DBconnection.connection.ConnectionString.ToString();
     sdsSotrudnik.SelectCommand    = qrSobese;
     sdsSotrudnik.DataSourceMode   = SqlDataSourceMode.DataReader;
     ListBox3.DataSource           = sdsSotrudnik;
     ListBox3.DataTextField        = "Название должности";
     ListBox3.DataValueField       = "id_Doljnost";
     ListBox3.DataBind();
 }
예제 #9
0
    protected void ListBox2_TextChanged(object sender, EventArgs e)
    {
        PlaceHolder4.Visible = true;
        ListBox1.ClearSelection();
        ListBox3.ClearSelection();
        ddeven.Items.Clear();
        int value = int.Parse(ListBox2.SelectedItem.Value);

        if (value == 2)
        {
            bindlist(value.ToString());
            PlaceHolder1.Visible = true;
            PlaceHolder2.Visible = false;
            PlaceHolder3.Visible = false;
            ddeven.Items.Insert(0, new ListItem("显示二级菜单", "0"));
            ddeven.Items.Insert(1, new ListItem("点击事件", "click"));
            ddeven.Items.Insert(2, new ListItem("链接地址", "url"));
        }
        else
        {
            ddeven.Items.Insert(0, new ListItem("点击事件", "click"));
            ddeven.Items.Insert(1, new ListItem("链接地址", "url"));
            Cms.BLL.wx_menu wm = new Cms.BLL.wx_menu();

            DataTable dt = wm.GetList("id=" + value).Tables[0];
            if (dt.Rows.Count > 0)
            {
                DataRow dr   = dt.Rows[0];
                string  type = dr["type"].ToString();
                if (type == "click")
                {
                    ddeven.SelectedValue = "click";
                    PlaceHolder1.Visible = false;
                    PlaceHolder2.Visible = true;
                    PlaceHolder3.Visible = false;
                    tbkey.Text           = dr["keys"].ToString();
                    tinfo.Value          = dr["info"].ToString();
                    tcontent.Value       = dr["content"].ToString();
                }
                else
                {
                    ddeven.SelectedValue = "url";
                    PlaceHolder1.Visible = false;
                    PlaceHolder2.Visible = false;
                    PlaceHolder3.Visible = true;
                    tburl.Text           = dr["url"].ToString();
                }
            }
        }

        tbname.Text = ListBox2.SelectedItem.Text;
    }
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DropDownList1.SelectedItem.Text == "数学科学学院")
     {
         ArrayList ListBoxValue = new ArrayList();
         ListBoxValue.Add("请选择专业");
         ListBoxValue.Add("数学与应用数学");
         ListBoxValue.Add("信息与计算科学");
         ListBoxValue.Add("应用统计学");
         ListBoxValue.Add("金融数学");
         ListBox3.DataSource = ListBoxValue;
         ListBox3.DataBind();
     }
     if (DropDownList1.SelectedItem.Text == "计算机科学与技术学院")
     {
         ArrayList ListBoxValue = new ArrayList();
         ListBoxValue.Add("请选择专业");
         ListBoxValue.Add("计算机科学与技术");
         ListBoxValue.Add("软件工程");
         ListBoxValue.Add("网络工程");
         ListBoxValue.Add("信息安全");
         ListBoxValue.Add("数字媒体");
         ListBox3.DataSource = ListBoxValue;
         ListBox3.DataBind();
     }
     if (DropDownList1.SelectedItem.Text == "外语学院")
     {
         ArrayList ListBoxValue = new ArrayList();
         ListBoxValue.Add("请选择专业");
         ListBoxValue.Add("英语");
         ListBoxValue.Add("俄语");
         ListBoxValue.Add("日语");
         ListBoxValue.Add("法语");
         ListBox3.DataSource = ListBoxValue;
         ListBox3.DataBind();
     }
     if (DropDownList1.SelectedItem.Text == "艺术学院")
     {
         ArrayList ListBoxValue = new ArrayList();
         ListBoxValue.Add("请选择专业");
         ListBoxValue.Add("视觉传达设计");
         ListBoxValue.Add("环境设计");
         ListBoxValue.Add("绘画");
         ListBoxValue.Add("戏剧影视导演");
         ListBoxValue.Add("音乐表演");
         ListBox3.DataSource = ListBoxValue;
         ListBox3.DataBind();
     }
 }
        private void Filllocationdrp()
        {
            string        strSql = "select OCE_ID,replace(convert(char(31),ltrim(OCE_DESCRIPTION  ))+OCE_ID,' ','�' )  as LOCATIONNAME from ENT_ORG_COMMON_ENTITIES where OCE_ISDELETED='0' AND CEM_ENTITY_ID='LOC'";
            SqlConnection con    = new SqlConnection(m_connectons);

            con.Open();
            SqlCommand     cmd         = new SqlCommand(strSql, con);
            SqlDataAdapter adpt        = new SqlDataAdapter(cmd);
            DataSet        thisDataSet = new DataSet();

            adpt.Fill(thisDataSet);
            ListBox3.DataValueField = "oce_id";
            ListBox3.DataTextField  = "LOCATIONNAME";
            ListBox3.DataSource     = thisDataSet.Tables[0];
            ListBox3.DataBind();
        }
예제 #12
0
        protected void ListBox4_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox1.ClearSelection();
            ListBox2.ClearSelection();
            ListBox3.ClearSelection();
            ListBox5.ClearSelection();
            ListBox6.Items.Clear();

            String selection = ListBox4.SelectedItem.Text;

            System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
            conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" +
                                    @"Data source= C:\Users\OK\Documents\Ecafe.accdb";

            conn.Open();

            String       my_querry1 = "select Item from Items where Type = '" + selection + "'";
            OleDbCommand cmd1       = new OleDbCommand(my_querry1, conn);

            var dr1 = cmd1.ExecuteReader();

            // MessageBox.Show("Query executed");
            while (dr1.Read())
            {
                ListBox6.Items.Add(dr1[0].ToString());
                //MessageBox.Show(dr1[1].ToString());
            }
            Label2.Text = selection;

            ListBox6.Visible = true;
            ListBox7.Visible = true;
            ListBox8.Visible = true;
            ListBox9.Visible = true;
            Label1.Visible   = true;
            Label2.Visible   = true;
            Label3.Visible   = true;
            Label5.Visible   = true;
            Label6.Visible   = true;
            Label7.Visible   = true;
            Label8.Visible   = true;
            Label9.Visible   = true;
            Label10.Visible  = true;
            TextBox2.Visible = true;
            Button1.Visible  = true;
            Button2.Visible  = true;
        }
예제 #13
0
    protected void ListBox2_OnTextChanged()
    {
        string sql_productiontype = combine_List_box(ListBox2);

        string sql = " select distinct (op1.lotname) as lotname              " +
                     "   from (select t2.factoryname,                        " +
                     "                t2.productrequestname,                 " +
                     "                t.productspecname,                     " +
                     "                t.processflowname,                     " +
                     "                t2.producttype,                        " +
                     "                t.lotname,                             " +
                     "                t2.productname,                        " +
                     "                t2.processoperationname,               " +
                     "                t.eventname,                           " +
                     "                t.eventtime,                           " +
                     "                t.productiontype,                      " +
                     "                t.carriername,                         " +
                     "                t.eventcomment,                        " +
                     "                t.eventuser,                           " +
                     "                t2.subproductquantity1                 " +
                     "           from lothistory t, product t2               " +
                     "          where t.lotname in                           " +
                     "                (select t3.lotname                     " +
                     "                   from cl_scrap t3                    " +
                     "                  where t3.shift_date >= '" + txtEstimateStartDate.SelectedDate.Value.ToString("yyyy/MM/dd").Replace("/", "") + "'    " +
                     "                    and t3.shift_date < '" + txtEstimateEndDate.SelectedDate.Value.ToString("yyyy/MM/dd").Replace("/", "") + "')    " +
                     "            and t.eventname in ('SCRAP', 'UNSCRAP')    " +
                     "            and t.timekey = t2.lasteventtimekey        " +
                     "            and t2.factoryname = '" + DropDownList1.SelectedValue + "'                 " +
                     "            and t.eventname = '" + DropDownList2.SelectedValue + "'                  " +
                     "            and t.productiontype in (" + sql_productiontype + ")) op1     ";

        ListBox3.Items.Clear();
        ListBox3.DataTextField  = "lotname";
        ListBox3.DataValueField = "lotname";

        DataSet ds_process = new DataSet();

        ds_process = func.get_dataSet_access(sql, conn);


        ListBox3.DataSource = ds_process.Tables[0];
        ListBox3.DataBind();
    }
예제 #14
0
    protected void ListBox2_OnTextChanged()
    {
        string conn = System.Configuration.ConfigurationSettings.AppSettings["DBCONN_Meeting"];

        string sql_fab = combine_List_box(ListBox2);

        string sql = "select distinct(t.process) as process from tlms_main t where t.fab in(" + sql_fab + ") and t.process is not null";

        ListBox3.Items.Clear();
        ListBox3.DataTextField  = "process";
        ListBox3.DataValueField = "process";

        DataSet ds_process = new DataSet();

        ds_process = func.get_dataSet_access(sql, conn);


        ListBox3.DataSource = ds_process.Tables[0];
        ListBox3.DataBind();
    }
예제 #15
0
        public void CargarListBox3()
        {
            //string mainconn = ConfigurationManager.ConnectionStrings["Myconnection"].ConnectionString;
            SqlConnection sqlconn = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=Tutorial;Integrated Security=True");

            //SqlConnection sqlconn = new SqlConnection(mainconn);
            string     sqlquery = "SELECT * FROM estado";
            SqlCommand sqlcomm  = new SqlCommand(sqlquery, sqlconn);

            sqlconn.Open();
            SqlDataReader sdr = sqlcomm.ExecuteReader();

            if (sdr.HasRows)
            {
                ListBox3.DataSource     = sdr;
                ListBox3.DataTextField  = "UF";
                ListBox3.DataValueField = "IdEstado";
                ListBox3.DataBind();
            }
            sqlconn.Close();
        }
예제 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ListBox1.Items.Clear();
            dt.Clear();
            komanda = "EXEC listItems 'Dobavljac'";
            da      = new SqlDataAdapter(komanda, conn);
            da.Fill(dt);
            ListBox1.DataSource    = dt;
            ListBox1.DataTextField = "Naziv";
            ListBox1.DataBind();

            ListBox2.Items.Clear();
            dt.Clear();
            komanda = "EXEC listItems 'Prodavnica'";
            da      = new SqlDataAdapter(komanda, conn);
            da.Fill(dt);
            ListBox2.DataSource    = dt;
            ListBox2.DataTextField = "Naziv";
            ListBox2.DataBind();

            ListBox3.Items.Clear();
            dt.Clear();
            komanda = "EXEC listItems 'KatArt'";
            da      = new SqlDataAdapter(komanda, conn);
            da.Fill(dt);
            ListBox3.DataSource    = dt;
            ListBox3.DataTextField = "Naziv";
            ListBox3.DataBind();
            ListBox3.SelectedIndex = 0;

            ListBox4.Items.Clear();
            dt.Clear();
            komanda = "SELECT Naziv FROM Artikal WHERE KatArtID='" + (ListBox3.SelectedIndex + 1).ToString() + "'";
            da      = new SqlDataAdapter(komanda, conn);
            da.Fill(dt);
            ListBox4.DataSource    = dt;
            ListBox4.DataTextField = "Naziv";
            ListBox4.DataBind();
            dt.Clear();
        }
        private void FillReaderDrp()
        {
            string strSql = "SELECT READER_ID ,replace(convert(char(31),ltrim(READER_DESCRIPTION))+Convert(varchar(100),READER_ID)+'('+Convert(varchar(100),CTLR_ID)+')',' ','�' ) as READER_DESCRIPTION ,Convert(varchar(100),READER_ID)+'|'+Convert(varchar(100),CTLR_ID)as CompleteDesc   FROM ACS_READER where READER_ISDELETED='0'";

            SqlConnection con = new SqlConnection(m_connectons);

            con.Open();
            SqlCommand     cmd         = new SqlCommand(strSql, con);
            SqlDataAdapter adpt        = new SqlDataAdapter(cmd);
            DataSet        thisDataSet = new DataSet();

            adpt.Fill(thisDataSet);

            //CHANGE TO FETCH CONTROLLER ID
            ListBox3.DataValueField = "READER_ID";
            ListBox3.DataTextField  = "READER_DESCRIPTION";

            //CHANGE TO FETCH CONTROLLER ID

            ListBox3.DataSource = thisDataSet.Tables[0];
            ListBox3.DataBind();
        }
예제 #18
0
 protected void ListBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ListBox2.SelectedValue == "")
     {
         ListBox3.Items.Clear();
     }
     else
     {
         List <GoodsType> gts = new DAL.GoodsTypeDAO().getGoodsTypesByParentNum(ListBox2.SelectedValue.ToString());
         if (gts.Count > 0)
         {
             ListBox3.DataSource     = gts;
             ListBox3.DataTextField  = "goodsTypeName";
             ListBox3.DataValueField = "goodsTypeNum";
             ListBox3.DataBind();
             ListItem lt4 = new ListItem();
             lt4.Value = "";
             ListBox3.Items.Add(lt4);
             ListBox3.SelectedValue = "";
         }
     }
 }
예제 #19
0
    public void refre_databind()
    {
        ListItem lt2 = new ListItem();

        lt2.Value = "";

        ListBox3.DataSource = new DAL.GoodsTypeDAO().getParentGoodsTypes();

        ListBox3.DataTextField  = "goodsTypeName";
        ListBox3.DataValueField = "goodsTypeNum";
        ListBox3.DataBind();
        ListBox3.Items.Add(lt2);
        ListBox3.SelectedValue = "";

        ListBox2.DataSource = new DAL.GoodsDAO().getAllGoods();

        ListBox2.DataTextField  = "goodsName";
        ListBox2.DataValueField = "goodsNum";
        ListBox2.DataBind();
        ListBox2.Items.Add(lt2);
        ListBox2.SelectedValue = "";
    }
예제 #20
0
        public void bindTable(string table, DataTable dt, string colomn = "Naziv")
        {
            switch (table)
            {
            case "Artikal":
                ListBox4.DataSource     = dt;
                ListBox4.DataTextField  = colomn;
                ListBox4.DataValueField = "ID";
                ListBox4.DataBind();
                break;

            case "KatArt":
                KatArt.DataSource     = ListBox3.DataSource = dt;
                KatArt.DataTextField  = ListBox3.DataTextField = colomn;
                KatArt.DataValueField = ListBox3.DataValueField = "ID";
                KatArt.DataBind();
                ListBox3.DataBind();
                ListBox3.SelectedIndex = 0;
                break;

            case "Dobavljac":
                Supplier.DataSource     = ListBox1.DataSource = dt;
                Supplier.DataTextField  = ListBox1.DataTextField = colomn;
                Supplier.DataValueField = ListBox1.DataValueField = "ID";
                Supplier.DataBind();
                ListBox1.DataBind();
                break;

            case "Korisnik":
                ListBox2.DataSource     = dt;
                ListBox2.DataTextField  = colomn;
                ListBox2.DataValueField = "ID";
                ListBox2.DataBind();
                break;
            }
        }
예제 #21
0
    protected void Button1_Click1(object sender, EventArgs e)
    {
        //get current user
        List <double> FocusScale   = new List <double>();
        List <double> CompleteTime = new List <double>();
        List <String> Name         = new List <String>();

        //get current user - hobby
        for (int i = 0; i < Hobby.Count; i++)
        {
            if (Hobby[i].user_id.ToString().Equals(Session["id"]))
            {
                Name.Add(Hobby[i].name);
                FocusScale.Add(double.Parse(Hobby[i].focus_scale.ToString()));
                CompleteTime.Add(double.Parse(Hobby[i].complete_time.ToString()));
            }
        }
        //get current user - coco
        for (int i = 0; i < Extracoco.Count; i++)
        {
            if (Extracoco[i].user_id.ToString().Equals(Session["id"]))
            {
                Name.Add(Extracoco[i].name);
                FocusScale.Add(double.Parse(Extracoco[i].focus_scale.ToString()));
                CompleteTime.Add(double.Parse(Extracoco[i].complete_time.ToString()));
            }
        }
        //get current user - subject
        for (int i = 0; i < Timetable.Count; i++)
        {
            if (Timetable[i].user_id.ToString().Equals(Session["id"]))
            {
                Name.Add(Timetable[i].subject);
                FocusScale.Add(double.Parse(Timetable[i].focus_scale.ToString()));
                CompleteTime.Add(double.Parse(Timetable[i].complete_time.ToString()));
            }
        }


        //key value pair between priority, complete time and algorithm result sequence
        List <KeyValuePair <double, string> > priority = new List <KeyValuePair <double, string> >();
        List <KeyValuePair <double, string> > focus    = new List <KeyValuePair <double, string> >();
        List <KeyValuePair <double, string> > time     = new List <KeyValuePair <double, string> >();

        double[] f = FocusScale.ToArray();
        double[] t = CompleteTime.ToArray();
        string[] n = Name.ToArray();

        //Greedy algorithm
        for (int i = 0; i < Name.Count; i++)
        {
            priority.Add(new KeyValuePair <double, string>(Math.Round(f[i] / t[i], 3), n[i])); // <-- greedy
            time.Add(new KeyValuePair <double, string>(t[i], n[i]));
            focus.Add(new KeyValuePair <double, string>(f[i], n[i]));
        }

        //Sort key value pair
        focus = focus.OrderBy(o => o.Key).ToList();
        focus.Reverse();
        ListBox1.DataSource = focus;
        ListBox1.DataBind();

        time = time.OrderBy(o => o.Key).ToList();
        time.Reverse();
        ListBox2.DataSource = time;
        ListBox2.DataBind();

        priority = priority.OrderBy(o => o.Key).ToList();
        priority.Reverse();
        ListBox3.DataSource = priority;
        ListBox3.DataBind();



        //Create dictionary
        Dictionary <int, string[]> planner = new Dictionary <int, string[]>();

        planner.Add(0, new string[15]);
        planner.Add(1, new string[15]);
        planner.Add(2, new string[15]);
        planner.Add(3, new string[15]);
        planner.Add(4, new string[15]);
        planner.Add(5, new string[15]);
        planner.Add(6, new string[15]);

        int j    = 0;
        int full = 0;

        planner[0][0] = "Monday";
        planner[1][0] = "Tuesday";
        planner[2][0] = "Wednesday";
        planner[3][0] = "Thursday";
        planner[4][0] = "Friday";
        planner[5][0] = "Saturday";
        planner[6][0] = "Sunday";

        //optimal option
        foreach (KeyValuePair <double, string> pair in priority)
        {
            if (j >= 7)
            {
                j    = 0;
                full = 1;
            }

            for (int i = 1; i < 15; i++)
            {
                if (full == 0)
                {
                    planner[j][i] = " ~" + pair.Value;
                }
                else
                {
                    planner[j][i] = planner[j][i] + ", " + "\n" + " ~" + pair.Value;
                }

                for (int c = 0; c < Timetable.Count; c++)
                {
                    if (Timetable[c].user_id.ToString().Equals(Session["id"]) && Timetable[c].subject.ToString().Equals(pair.Value))
                    {
                        String[] Wassignment = Timetable[c].assignment; // Split('-')
                        String[] Wquiz       = Timetable[c].quiz;
                        String[] Wtest       = Timetable[c].test;

                        string str = Convert.ToString(i);

                        for (int a = 0; a < Wassignment.Length; a++)
                        {
                            if (Wassignment[a].Equals(str))
                            {
                                planner[j][i] = planner[j][i] + ", " + "\n" + string.Join(" ", " ~Assignment " + (a + 1) + " " + pair.Value);
                            }
                        }
                        for (int a = 0; a < Wquiz.Length; a++)
                        {
                            if (Wquiz[a].Equals(str))
                            {
                                planner[j][i] = planner[j][i] + ", " + "\n" + string.Join(" ", " ~Quiz " + (a + 1) + " " + pair.Value);
                            }
                        }
                        for (int a = 0; a < Wtest.Length; a++)
                        {
                            if (Wtest[a].Equals(str))
                            {
                                planner[j][i] = planner[j][i] + ", " + "\n" + string.Join(" ", " ~Test " + (a + 1) + " " + pair.Value);
                            }
                        }
                    }
                }
            }
            j++;
        }


        DataTable dt = new DataTable();

        dt.Columns.AddRange(new DataColumn[15] {
            new DataColumn("Day", typeof(string)), new DataColumn("Week 1", typeof(string)), new DataColumn("Week 2", typeof(string)), new DataColumn("Week 3", typeof(string)), new DataColumn("Week 4", typeof(string)), new DataColumn("Week 5", typeof(string)), new DataColumn("Week 6", typeof(string)), new DataColumn("Week 7", typeof(string)), new DataColumn("Week 8", typeof(string)), new DataColumn("Week 9", typeof(string)), new DataColumn("Week 10", typeof(string)), new DataColumn("Week 11", typeof(string)), new DataColumn("Week 12", typeof(string)), new DataColumn("Week 13", typeof(string)), new DataColumn("Week 14", typeof(string))
        });

        for (int i = 0; i < planner.Count; i++)
        {
            dt.Rows.Add();

            for (int z = 0; z < 15; z++)
            {
                if (planner[i][z] == null)
                {
                    dt.Rows[i][z] = "-";
                }
                else
                {
                    dt.Rows[i][z] = planner[i][z].ToString();
                }
            }
        }

        this.GridView1.DataSource = dt;
        this.GridView1.DataBind();
    }
예제 #22
0
    public void Bind()
    {
        // Response.Write(setmenu());
        Cms.BLL.wx_info   wx  = new Cms.BLL.wx_info();
        Cms.Model.wx_info mwx = new Cms.Model.wx_info();
        DataTable         dt  = wx.GetList("").Tables[0];

        if (dt.Rows.Count > 0)
        {
            mwx = wx.GetModel(1);
            if (mwx != null)
            {
                AppId.Text     = mwx.AppId;
                AppSecret.Text = mwx.AppSecret;
                hdid.Text      = mwx.access_token;
            }
            mwx = wx.GetModel(2);
            if (mwx != null)
            {
                tbid.Text   = mwx.AppId;
                tburls.Text = mwx.AppSecret;
            }
        }
        Cms.BLL.wx_menu   wm  = new Cms.BLL.wx_menu();
        Cms.Model.wx_menu wmd = new Cms.Model.wx_menu();
        dt = wm.GetList("pid=0").Tables[0];

        foreach (DataRow dr in dt.Rows)
        {
            int    id   = int.Parse(dr["id"].ToString());
            string name = dr["name"].ToString();
            int    pid  = int.Parse(dr["pid"].ToString());
            if (id == 1)
            {
                DataTable dts = wm.GetList("pid=" + id).Tables[0];


                ListBox1.DataSource     = dts.DefaultView;
                ListBox1.DataTextField  = "name";
                ListBox1.DataValueField = "id";
                ListBox1.DataBind();
                ListBox1.Items.Insert(0, new ListItem(name, id.ToString()));
            }
            if (id == 2)
            {
                DataTable dts = wm.GetList("pid=" + id).Tables[0];

                ListBox2.DataSource     = dts.DefaultView;
                ListBox2.DataTextField  = "name";
                ListBox2.DataValueField = "id";
                ListBox2.DataBind();
                ListBox2.Items.Insert(0, new ListItem(name, id.ToString()));
            }
            if (id == 3)
            {
                DataTable dts = wm.GetList("pid=" + id).Tables[0];

                ListBox3.DataSource     = dts.DefaultView;
                ListBox3.DataTextField  = "name";
                ListBox3.DataValueField = "id";
                ListBox3.DataBind();
                ListBox3.Items.Insert(0, new ListItem(name, id.ToString()));
            }
        }
    }
예제 #23
0
        private void fillEntities()
        {
            string mgrId = Session["uid"].ToString();

            string levelId = Session["levelId"].ToString();

            //SqlConnection con = new SqlCOConnection(m_connectons);

            if (conString.State == ConnectionState.Closed)
            {
                conString.Open();
            }

            SqlCommand cmd = new SqlCommand("spFillEntities2", conString);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@levelid", levelId);

            SqlDataAdapter adpt        = new SqlDataAdapter(cmd);
            DataSet        thisDataSet = new DataSet();

            adpt.Fill(thisDataSet);
            if (conString.State == ConnectionState.Open)
            {
                conString.Close();
            }
            ListBox1.DataValueField = "EOD_EMPID";
            ListBox1.DataTextField  = "EmployeeName";
            ListBox1.DataSource     = thisDataSet.Tables[0];
            ListBox1.DataBind();


            ListBox7.DataValueField = "EOD_EMPID";
            ListBox7.DataTextField  = "EmployeeName";
            ListBox7.DataSource     = thisDataSet.Tables[0];
            ListBox7.DataBind();



            DataTable dtDivision = thisDataSet.Tables[3].DefaultView.ToTable(true, "DivisionID", "Division_NAME");

            ListBox4.DataValueField = "DivisionID";
            ListBox4.DataTextField  = "Division_NAME";

            ListBox4.DataSource = dtDivision;

            ListBox4.DataBind();

            ListBox10.DataValueField = "DivisionID";
            ListBox10.DataTextField  = "Division_NAME";
            ListBox10.DataSource     = thisDataSet.Tables[3];
            ListBox10.DataBind();



            DataTable dtLocation = thisDataSet.Tables[1].DefaultView.ToTable(true, "LocationID", "Location_NAME");

            ListBox3.DataValueField = "LocationID";
            ListBox3.DataTextField  = "Location_NAME";

            ListBox3.DataSource = dtLocation;

            ListBox3.DataBind();

            ListBox9.DataValueField = "LocationID";
            ListBox9.DataTextField  = "Location_NAME";
            ListBox9.DataSource     = thisDataSet.Tables[1];
            ListBox9.DataBind();
        }
예제 #24
0
        protected void Button2_Click(object sender, EventArgs e) // single destination
        {
            var accounts1 = new Dictionary <string, int>();

            accounts1["Gilgit"]         = 0;
            accounts1["Chitral"]        = 1;
            accounts1["Dasu"]           = 2;
            accounts1["Dir"]            = 3;
            accounts1["Malakand"]       = 4;
            accounts1["Noshera"]        = 5;
            accounts1["Mansehra"]       = 6;
            accounts1["Hassan Abdal"]   = 7;
            accounts1["Peshawar"]       = 8;
            accounts1["Attock"]         = 9;
            accounts1["Kohat"]          = 10;
            accounts1["Islamabad"]      = 11;
            accounts1["Murree"]         = 12;
            accounts1["Rawat"]          = 13;
            accounts1["Balkasar"]       = 14;
            accounts1["Chakwal"]        = 15;
            accounts1["Mianwali"]       = 16;
            accounts1["Bhera"]          = 17;
            accounts1["Sargoda"]        = 18;
            accounts1["Pindi Bhattian"] = 19;
            accounts1["Jhang"]          = 20;
            accounts1["Faisalabad"]     = 21;
            accounts1["Lahore"]         = 22;
            accounts1["Dina"]           = 23;
            accounts1["Gujranwala"]     = 24;
            accounts1["Multan"]         = 25;
            accounts1["DG Khan"]        = 26;
            accounts1["Bahwalpur"]      = 27;
            accounts1["Sukkur"]         = 28;
            accounts1["Rajanpur"]       = 29;
            accounts1["Loralai"]        = 30;
            accounts1["Jacobabad"]      = 31;
            accounts1["Quetta"]         = 32;
            accounts1["Khuzdar"]        = 33;
            accounts1["Karachi"]        = 34;
            accounts1["Lasbela"]        = 35;
            accounts1["Gwadar"]         = 36;
            accounts1["Awaran"]         = 37;
            accounts1["Turbat"]         = 38;


            var accounts = new Dictionary <int, string>();

            accounts[0]  = "Gilgit";
            accounts[1]  = "Chitral";
            accounts[2]  = "Dasu";
            accounts[3]  = "Dir";
            accounts[4]  = "Malakand";
            accounts[5]  = "Noshera";
            accounts[6]  = "Mansehra";
            accounts[7]  = "Hassan Abdal";
            accounts[8]  = "Peshawar";
            accounts[9]  = "Attock";
            accounts[10] = "Kohat";
            accounts[11] = "Islamabad";
            accounts[12] = "Murree";
            accounts[13] = "Rawat";
            accounts[14] = "Balkasar";
            accounts[15] = "Chakwal";
            accounts[16] = "Mianwali";
            accounts[17] = "Bhera";
            accounts[18] = "Sargoda";
            accounts[19] = "Pindi Bhattian";
            accounts[20] = "Jhang";
            accounts[21] = "Faisalabad";
            accounts[22] = "Lahore";
            accounts[23] = "Dina";
            accounts[24] = "Gujranwala";
            accounts[25] = "Multan";
            accounts[26] = "DG Khan";
            accounts[27] = "Bahwalpur";
            accounts[28] = "Sukkur";
            accounts[29] = "Rajanpur";
            accounts[30] = "Loralai";
            accounts[31] = "Jacobabad";
            accounts[32] = "Quetta";
            accounts[33] = "Khuzdar";
            accounts[34] = "Karachi";
            accounts[35] = "Lasbela";
            accounts[36] = "Gwadar";
            accounts[37] = "Awaran";
            accounts[38] = "Turbat";
            string            src         = TextBox1.Text;
            int               src1        = accounts1[src];
            List <dstthrough> throughlist = new List <dstthrough>();

            for (int i = 0; i < mygraph.Vertices.Count(); i++)
            {
                dstthrough obj;
                if (!src.Equals(mygraph.Vertices[i].Name))
                {
                    int dst = accounts1[mygraph.Vertices[i].Name.ToString()];
                    obj.dstination = mygraph.Vertices[i].Name;

                    string res = findpath(D, src1, dst, 39);
                    obj.throughdst = res;
                    throughlist.Add(obj);
                }
            }

            List <string> dstt = new List <string>();
            List <string> pth  = new List <string>();

            for (int i = 0; i < throughlist.Count(); i++)
            {
                string thr = "";
                dstt.Add(throughlist[i].dstination);
                string[] values = throughlist[i].throughdst.Split(',');
                for (int j = 0; j < values.Length - 1; j++)
                {
                    Label2.Text = values[j];
                    thr        += accounts[Convert.ToInt32(values[j])] + "->";
                }

                pth.Add(thr);
            }
            Label1.Text         = dstt[37];
            ListBox2.DataSource = dstt;
            ListBox2.DataBind();
            ListBox3.DataSource = pth;

            ListBox3.DataBind();

            Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "  <script>singlesrgraph();</script>");
            //  Label2.Text = throughlist.Count().ToString();
        }
예제 #25
0
        private void Lst_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox listBox = (ListBox)sender;
            ListBox list    = new ListBox();

            if (listBox == ListBox1)
            {
                ListBox2.Items.Clear();
                ListBox3.Items.Clear();
                ListBox4.Items.Clear();
                ListBox5.Items.Clear();

                cat_2.Visible = false;
                cat_3.Visible = false;
                cat_4.Visible = false;
                cat_5.Visible = false;

                list = ListBox2;

                IEnumerable <kategori> sonuc = ktg.list(Convert.ToInt32(listBox.SelectedValue));
                if (sonuc.Any())
                {
                    cat_2.Visible = true;

                    list.DataSource     = sonuc;
                    list.DataTextField  = "kategoriAdi";
                    list.DataValueField = "kategoriId";
                    list.DataBind();
                    devam.Enabled = false;
                }
                else
                {
                    Label lbl = new Label();
                    lbl.Text = "Seçim Tamamlandı !";
                    lbl.Attributes["class"] = "tamam";

                    Panel pnl = new Panel();
                    pnl.Attributes["class"] = "col-xs-12 col-sm-2";
                    pnl.Controls.Add(lbl);

                    cats.Controls.Add(pnl);
                    ViewState["id"] = Convert.ToInt32(ListBox1.SelectedValue);
                    devam.Enabled   = true;
                }
            }
            else if (listBox == ListBox2)
            {
                ListBox3.Items.Clear();
                ListBox4.Items.Clear();
                ListBox5.Items.Clear();

                cat_3.Visible = false;
                cat_4.Visible = false;
                cat_5.Visible = false;

                list = ListBox3;

                // Her ik tablodan da bilgi çekiyoruz ilk önce kategoriTur tablosundaki verileri karşılaştırıyoruz.
                IEnumerable <object>   sonuclar = (IEnumerable <object>)ktgT.list(1, ListBox2.SelectedValue);
                IEnumerable <kategori> sonuc    = ktg.list(Convert.ToInt32(ListBox2.SelectedValue));

                if (sonuclar.Any()) // kategoriTur tablosunda satılık kiralık vb. değeri var mı
                {
                    cat_3.Visible = true;
                    foreach (object key in sonuclar.ToList())
                    {
                        if (key.ToString() == "{ turId = 1 }")
                        {
                            ListItem li = new ListItem();
                            li.Text  = "Satılık";
                            li.Value = "1";
                            ListBox3.Items.Add(li);
                        }
                        if (key.ToString() == "{ turId = 2 }")
                        {
                            ListItem li = new ListItem();
                            li.Text  = "Kiralık";
                            li.Value = "2";
                            ListBox3.Items.Add(li);
                        }
                        if (key.ToString() == "{ turId = 3 }")
                        {
                            ListItem li = new ListItem();
                            li.Text  = "Günlük Kiralık";
                            li.Value = "3";
                            ListBox3.Items.Add(li);
                        }
                        if (key.ToString() == "{ turId = 4 }")
                        {
                            ListItem li = new ListItem();
                            li.Text  = "Devren";
                            li.Value = "4";
                            ListBox3.Items.Add(li);
                        }
                        if (key.ToString() == "{ turId = 5 }")
                        {
                            ListItem li = new ListItem();
                            li.Text  = "Devren Kiralık";
                            li.Value = "5";
                            ListBox3.Items.Add(li);
                        }
                        if (key.ToString() == "{ turId = 6 }")
                        {
                            ListItem li = new ListItem();
                            li.Text  = "Devren Satılık Konut";
                            li.Value = "6";
                            ListBox3.Items.Add(li);
                        }
                    }
                    devam.Enabled = false;
                }
                else if (sonuc.Any()) // kategori tablosunda alt kategoriler var mı
                {
                    cat_3.Visible           = true;
                    ListBox3.DataSource     = sonuc;
                    ListBox3.DataTextField  = "kategoriAdi";
                    ListBox3.DataValueField = "kategoriId";
                    ListBox3.DataBind();
                    devam.Enabled = false;
                }
                else
                {
                    Label lbl = new Label();
                    lbl.Text = "Seçim Tamamlandı !";
                    lbl.Attributes["class"] = "tamam";

                    Panel pnl = new Panel();
                    pnl.Attributes["class"] = "col-xs-12 col-sm-2";
                    pnl.Controls.Add(lbl);

                    cats.Controls.Add(pnl);
                    ViewState["id"] = Convert.ToInt32(ListBox2.SelectedValue);
                    devam.Enabled   = true;
                }
            }
            else if (listBox == ListBox3)
            {
                ListBox4.Items.Clear();
                ListBox5.Items.Clear();

                cat_4.Visible = false;
                cat_5.Visible = false;

                list = ListBox4;


                IEnumerable <object>   sonuclar = (IEnumerable <object>)ktgT.list(2, ListBox2.SelectedValue, ListBox3.SelectedValue);
                IEnumerable <kategori> sonuc    = ktg.list(Convert.ToInt32(ListBox3.SelectedValue));
                if (sonuclar.Any())
                {
                    cat_4.Visible           = true;
                    ListBox4.DataSource     = sonuclar;
                    ListBox4.DataTextField  = "kategoriAdi";
                    ListBox4.DataValueField = "kategoriId";
                    ListBox4.DataBind();
                    devam.Enabled        = false;
                    ViewState["ilanTur"] = Convert.ToInt32(ListBox3.SelectedValue);
                }
                else if (ListBox1.SelectedValue != "1" || (ListBox2.SelectedValue != "4" && ListBox2.SelectedValue != "5")) // emlak kategorisi değiise veya (arsa ve bina değilse)
                {
                    if (sonuc.Any())
                    {
                        cat_4.Visible           = true;
                        ListBox4.DataSource     = sonuc;
                        ListBox4.DataTextField  = "kategoriAdi";
                        ListBox4.DataValueField = "kategoriId";
                        ListBox4.DataBind();
                        devam.Enabled = false;
                    }
                    else
                    {
                        Label lbl = new Label();
                        lbl.Text = "Seçim Tamamlandı !";
                        lbl.Attributes["class"] = "tamam";

                        Panel pnl = new Panel();
                        pnl.Attributes["class"] = "col-xs-12 col-sm-2";
                        pnl.Controls.Add(lbl);

                        cats.Controls.Add(pnl);
                        devam.Enabled   = true;
                        ViewState["id"] = Convert.ToInt32(ListBox3.SelectedValue);
                    }
                }
                else
                {
                    Label lbl = new Label();
                    lbl.Text = "Seçim Tamamlandı !";
                    lbl.Attributes["class"] = "tamam";

                    Panel pnl = new Panel();
                    pnl.Attributes["class"] = "col-xs-12 col-sm-2";
                    pnl.Controls.Add(lbl);

                    cats.Controls.Add(pnl);
                    devam.Enabled        = true;
                    ViewState["ilanTur"] = Convert.ToInt32(ListBox3.SelectedValue);
                    ViewState["id"]      = Convert.ToInt32(ListBox2.SelectedValue);
                }
            }
            else if (listBox == ListBox4)
            {
                ListBox5.Items.Clear();

                cat_5.Visible = false;
                list          = ListBox5;

                IEnumerable <kategori> sonuc = ktg.list(Convert.ToInt32(ListBox4.SelectedValue));
                if (sonuc.Any())
                {
                    cat_5.Visible           = true;
                    ListBox5.DataSource     = sonuc;
                    ListBox5.DataTextField  = "kategoriAdi";
                    ListBox5.DataValueField = "kategoriId";
                    ListBox5.DataBind();
                    devam.Enabled = false;
                }
                else
                {
                    Label lbl = new Label();
                    lbl.Text = "Seçim Tamamlandı !";
                    lbl.Attributes["class"] = "tamam";

                    Panel pnl = new Panel();
                    pnl.Attributes["class"] = "col-xs-12 col-sm-2";
                    pnl.Controls.Add(lbl);

                    cats.Controls.Add(pnl);
                    devam.Enabled   = true;
                    ViewState["id"] = Convert.ToInt32(ListBox4.SelectedValue);
                }
            }
        }