Пример #1
0
        public override bool ExecuteProcedure(string ProcedureName, List<System.Data.IDbDataParameter> parameters, System.Data.DataSet ds)
        {
            bool result = false;

            try
            {

                this.DBCommand.CommandType = CommandType.StoredProcedure;
                this.DBCommand.CommandText = ProcedureName;
                this.DBCommand.Connection = this.DBConnection;
                this.DBCommand.Parameters.Clear();

                foreach (IDataParameter parameter in parameters)
                {
                    this.DBCommand.Parameters.Add(parameter);
                }

                OracleParameter paramRefCursor = new OracleParameter();
                paramRefCursor.OracleDbType = OracleDbType.RefCursor;
                paramRefCursor.Direction = ParameterDirection.Output;
                paramRefCursor.ParameterName = PARAM_REF_CURSOR;
                this.DBCommand.Parameters.Add(paramRefCursor);

                OracleDataAdapter da = new OracleDataAdapter((OracleCommand)this.DBCommand);
                da.Fill(ds);
                result = true;

            }
            catch (Exception ex)
            {
                throw ex;
            }

            return result;
        }
Пример #2
0
        private void LoginRandomEmployee()
        {
            DataTable employeeTable = new DataTable();
            Person employee = null;

            using (OracleConnection objConn = new OracleConnection(Global.ConnectionString))
            {
                OracleCommand objCmd = new OracleCommand("TICKETS_QUERIES.getRandomEmployee", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure };

                objCmd.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue);

                try
                {
                    objConn.Open();
                    OracleDataAdapter adapter = new OracleDataAdapter(objCmd);
                    adapter.Fill(employeeTable);
                    employee = Mapper.DynamicMap<IDataReader, List<Person>>(employeeTable.CreateDataReader()).FirstOrDefault();
                }
                catch (Exception)
                {
                    Response.Redirect("../Default.aspx");
                }

                objConn.Close();
            }
            if (employee != null)
            {
                Global.CurrentPerson = employee;
                Global.CurrentPerson.accountType = Account.Faculty;
            }
            else
                Response.Redirect("../Default.aspx");
        }
        protected void GridView_stuff_list_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Del_Btn")
            {
                int index = Convert.ToInt32(e.CommandArgument);

                GridViewRow selectedRow = GridView_stuff_list.Rows[index];
                TableCell SID = selectedRow.Cells[0];
                Session["SID"] = SID.Text;
                string ConnectionString = @"DATA SOURCE=127.0.0.1:1521/XE;PERSIST SECURITY INFO=True;USER ID=TAHMID; Password=anik";
                string cmdQuery = "delete from STUFF where STUFF_ID = '" +Session["SID"]+"'";
                OracleDataAdapter a = new OracleDataAdapter(cmdQuery, ConnectionString);
                OracleCommandBuilder builder = new OracleCommandBuilder(a);
                DataSet ds = new DataSet();
                a.Fill(ds, "STUFF_delete");
                Response.Redirect("stuff_list.aspx");
            }
            else if (e.CommandName == "edit_Btn")
            {
                int index = Convert.ToInt32(e.CommandArgument);
                GridViewRow selectedRow = GridView_stuff_list.Rows[index];
                TableCell SID = selectedRow.Cells[0];
                Session["U_SID"] = SID.Text;
                Response.Redirect("edit_stuff.aspx");
            }
        }
        void MgfLoad()
        {
            try
            {
                conn.Open();
              //  string sqlquery = "SELECT MED_ID,MED_NAME,MED_STG,MED_MGF,MED_BATCH,MED_GROUP,MED_TYPE,COST_PRICE,SELL_PRICE,NOTES FROM MED_INFO";
                string sqlquery = "SELECT * FROM MFG_INFO";
                OracleCommand cmd = new OracleCommand(sqlquery, conn);
                OracleDataAdapter oda = new OracleDataAdapter();
                oda.SelectCommand = cmd;
                dt = new DataTable();
                //     dt.Columns["MED_NAME"].ColumnName = "Name";

                oda.Fill(dt);
                BindingSource bsource = new BindingSource();
                bsource.DataSource = dt;
                dataGridView1.DataSource = bsource;
                oda.Update(dt);
                dt.Columns[0].ColumnName = "ID";
                dt.Columns[1].ColumnName = "Name";
                dt.Columns[2].ColumnName = "Address";
                dt.Columns[3].ColumnName = "Mobile";
                dt.AcceptChanges();

                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        void stuffload()
        {
            try
            {
                conn.Open();
                string sqlquery = "SELECT EMP_ID,EMP_NAME,MOBILE,JOIN_DATE,POSITION,SALARY FROM EMPLOYE_INFO";
                //string sqlquery = "SELECT * FROM MED_INFO";
                OracleCommand cmd = new OracleCommand(sqlquery, conn);
                OracleDataAdapter oda = new OracleDataAdapter();
                oda.SelectCommand = cmd;
                dt = new DataTable();
                //     dt.Columns["MED_NAME"].ColumnName = "Name";

                oda.Fill(dt);
                BindingSource bsource = new BindingSource();
                bsource.DataSource = dt;
                dataGridView1.DataSource = bsource;
                oda.Update(dt);
                dt.Columns[0].ColumnName = "ID";
                dt.Columns[1].ColumnName = "Name";
                dt.Columns[2].ColumnName = "Mobile";
                dt.Columns[3].ColumnName = "Joining Date";
                dt.Columns[4].ColumnName = "Position";
                dt.Columns[4].ColumnName = "Salary";

                dt.AcceptChanges();

                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #6
0
        public DataTable throwSelect(string sql)
        {
            DataTable dt = new DataTable();

            string ConnectionString = "";
            ConnectionString = "DATA SOURCE = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.70)(PORT = 1521)))";
            ConnectionString += "(CONNECT_DATA = (SERVICE_NAME = UBIZDB)));";
            ConnectionString += "USER ID=RCS;PASSWORD=RCS";

            OracleConnection conn = new OracleConnection(ConnectionString);

            conn.Open();

            OracleCommand oracmd = new OracleCommand();
            oracmd.Connection = conn;
            oracmd.CommandType = CommandType.Text;

            oracmd.CommandText = sql;

            OracleDataAdapter adapter = new OracleDataAdapter();

            adapter.SelectCommand = oracmd;

            //adapter.Fill(ds);
            adapter.Fill(dt);

            return dt;
        }
Пример #7
0
        private GroupRequest addPersonToGroup(int personId, int seriesId)
        {
            DataTable groupTable = new DataTable();
            GroupRequest groupResult = new GroupRequest();

            using (OracleConnection objConn = new OracleConnection(Global.ConnectionString))
            {
                // Set up the searchPeople command
                var command = new OracleCommand("TICKETS_API.insertGroupRequests", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure };
                command.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue);
                command.Parameters.Add("p_PersonId", OracleDbType.Int64, Global.CurrentPerson.person_id, ParameterDirection.Input);
                command.Parameters.Add("p_RequestedId", OracleDbType.Int64, personId, ParameterDirection.Input);
                command.Parameters.Add("p_SeriesId", OracleDbType.Int64, seriesId, ParameterDirection.Input);

                // Execute the query and map the results to models
                objConn.Open();
                var groupAdapter = new OracleDataAdapter(command);
                groupAdapter.Fill(groupTable);
                groupResult.group_id = long.Parse(groupTable.Rows[0]["group_id"].ToString());
                groupResult.requested_id = long.Parse(groupTable.Rows[0]["requested_id"].ToString());
                groupResult.requested_firstname = groupTable.Rows[0]["requested_firstname"].ToString();
                groupResult.requested_lastname = groupTable.Rows[0]["requested_lastname"].ToString();

                objConn.Close();
            }

            return groupResult;
        }
Пример #8
0
        public void changeChartView()
        {
            
            using (OracleConnection connection = new OracleConnection(FormLogin.connString))
            {
                connection.Open();
                String query = "SELECT m.idround as round, p.Match_Rating FROM participates p JOIN match m ON(p.idMatch = m.idMatch) WHERE p.idPlayer = "+Player.Id+" ORDER BY m.idRound";
                DataTable table = new DataTable();
                OracleDataAdapter dataAdapter = new OracleDataAdapter(query, connection);
                dataAdapter.Fill(table);
                chartPlayerRating.DataSource = table;
                chartPlayerRating.Series["Series1"].XValueMember = "Round";
                chartPlayerRating.Series["Series1"].YValueMembers = "Match_Rating";
                

            }

            chartPlayerRating.ChartAreas["ChartArea1"].AxisX.Title = "Rounds";
            chartPlayerRating.ChartAreas["ChartArea1"].AxisX.Minimum = 1;
            chartPlayerRating.ChartAreas["ChartArea1"].AxisX.Maximum = 38;
            chartPlayerRating.ChartAreas["ChartArea1"].AxisX.Interval = 1;


            chartPlayerRating.ChartAreas["ChartArea1"].AxisY.Title = "Rankings";
            chartPlayerRating.ChartAreas["ChartArea1"].AxisY.Minimum = 1000;
            chartPlayerRating.ChartAreas["ChartArea1"].AxisY.Maximum = 3000;

            chartPlayerRating.ChartAreas["ChartArea1"].Visible = true;
            chartPlayerRating.Series["Series1"].BorderWidth = 3;
        }
 private void btn_hyouji_Click(object sender, EventArgs e)
 {
     try
     {
         dt.Rows.Clear();
         dt.Columns.Clear();
         dt.Clear();
         TssSystemLibrary tssdb = new TssSystemLibrary();
         string connStr = tssdb.GetConnectionString();
         OracleConnection conn = new OracleConnection(connStr);
         OracleCommand cmd = new OracleCommand();
         cmd.Connection = conn;
         cmd.CommandType = CommandType.Text;
         string sql = "select * from " + cb_table_name.Text;
         if (tb_sql.Text.Length >= 1)
         {
             sql = sql + " " + tb_sql.Text;
         }
         cmd.CommandText = sql;
         da = new OracleDataAdapter(cmd);
         cb = new OracleCommandBuilder(da);
         das = new DataSet();
         da.Fill(dt);
         dgv_table.DataSource = null;
         dgv_table.DataSource = dt;
     }
     catch
     {
         dgv_table.DataSource = null;
     }
 }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //todo: (003-xxxDataAdapter) implementar paginação e ordenação para o gridview

            #region solução de "implementar paginação e ordenação para o gridview"

            GridView1.AllowPaging = GridView1.AllowSorting = true;
            GridView1.PageIndexChanging += GridView1PageIndexChanging;
            GridView1.Sorting += GridView1Sorting;

            ViewState["SORT_DIRECTION"] = ViewState["SORT_DIRECTION"] ?? " ASC";
            ViewState["SORT_EXPRESSION"] = ViewState["SORT_EXPRESSION"] ?? "GENREID";

            #endregion

            var da = new OracleDataAdapter("SELECT * FROM GENRE",
                @"DATA SOURCE=127.0.0.1/ORCL;USER ID=chinook;PASSWORD=p4ssw0rd;");

            var ds = new DataSet();

            da.Fill(ds);

            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string cmdQuery = "Select * from DESIGNATION";
         OracleDataAdapter a = new OracleDataAdapter(cmdQuery, ConnectionString);
         OracleCommandBuilder builder = new OracleCommandBuilder(a);
         DataSet ds = new DataSet();
         try
         {
             a.Fill(ds, "DESIGNATION");
             foreach (DataRow r in ds.Tables["DESIGNATION"].Rows)
             {
                 ListItem i = new ListItem();
                 i.Text = r["D_NAME"].ToString();
                 i.Value = r["D_ID"].ToString();
                 Stuff_position_DropDownList.Items.Add(i);
             }
             show_ts(1);
         }
         catch (Exception er)
         {
             Response.Write("<script language= 'javascript'>alart('Connection Problem');</script>");
         }
         finally { }
     }
 }
Пример #12
0
        public static DataTable GetItensEstoque()
        {
            DataTable dt = new DataTable();
            OracleDataAdapter da = new OracleDataAdapter();

            OracleConnection conn = Conexao.GetInstance();

            OracleCommand cmd = new OracleCommand();
            try
            {
                cmd.CommandText = "SELECT * FROM ITEM_ESTOQUE ";

                cmd.CommandType = CommandType.Text;
                cmd.Connection = conn;
                da.SelectCommand = cmd;
                da.Fill(dt);

                return dt;
            }
            catch (Exception ex)
            {
                strErrMsg = "Atenção, o sistema detectou o seguinte problema: " + "\r\n" +
                    "Descrição: " + Convert.ToString(ex.Message) + "\r\n" +
                    "Origem: " + Convert.ToString(ex.Source);
                MessageBox.Show(strErrMsg, "Procedimento: " + Convert.ToString(ex.TargetSite),
                      MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string ab =  Session["B_c_package"].ToString();
                string cmdQuery = "Select * from Decuration_Package where dec_pack_service = '"+ ab +"' ";
                OracleDataAdapter a = new OracleDataAdapter(cmdQuery, ConnectionString);
                OracleCommandBuilder builder = new OracleCommandBuilder(a);
                DataSet ds = new DataSet();
                a.Fill(ds, "Decuration_Package");
                foreach (DataRow r in ds.Tables["Decuration_Package"].Rows)
                {
                    ListItem i = new ListItem();
                    i.Text = r["DEC_PACK_NAME"].ToString();
                    i.Value = r["DEC_PACK_ID"].ToString();
                    Session["Decuration_price"]= r["DEC_PACK_PRICE"].ToString();
                    DropDownList_decuration.Items.Add(i);
                }
                string cmdQuery2 = "Select * from FOOD_PACKAGE where f_pack_service = '" + ab + "' ";
                OracleDataAdapter b = new OracleDataAdapter(cmdQuery2, ConnectionString);
                OracleCommandBuilder builder2 = new OracleCommandBuilder(b);
                DataSet ds2 = new DataSet();
                b.Fill(ds2, "FOOD_PACKAGEes");
                foreach (DataRow r in ds2.Tables["FOOD_PACKAGEes"].Rows)
                {
                    ListItem i = new ListItem();
                    i.Text = r["f_pack_name"].ToString();
                    i.Value = r["f_pack_id"].ToString();
                    Session["FOOD_price"] = r["f_pack_price"].ToString();
                    DropDownList_food_package.Items.Add(i);
                }

            }
        }
Пример #14
0
        public DataSet GetProdOCRData(string queryName,string startDate, string endDate)
        {
            string queryPath = string.Format(@"{0}\Query\{1}", Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),queryName);
            string query = File.ReadAllText(queryPath);
            query = string.Format(query, startDate, endDate);
            DataSet ds = new DataSet();
            using (oraconnection = new OracleConnection(ConfigurationManager.AppSettings["DSN_PNRP"]))
            {
                try
                {
                    oraconnection.Open();
                    oracommand = new OracleCommand(query, oraconnection);
                    oracommand.CommandType = CommandType.Text;
                    OracleDataAdapter adp = new OracleDataAdapter(oracommand);
                    ds = new DataSet();
                    adp.Fill(ds);
                }
                catch (Exception)
                {

                }
                finally
                {
                    oraconnection.Close();
                }

                return ds;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //DataTable dt = new DataTable();
            //dt.Columns.Add("STUFF_NAME");
            //dt.Columns.Add("STUFF_GENDER");
            //dt.Columns.Add("STUFF_PHONE");
            //dt.Columns.Add("STUFF_DOB");
            //dt.Columns.Add("STUFF_NID");
            //dt.Columns.Add("STUFF_DESIGNATION");
            //dt.Columns.Add("STUFF_Salary");
            //DataRow dr;

            string ConnectionString = @"DATA SOURCE=127.0.0.1:1521/XE;PERSIST SECURITY INFO=True;USER ID=TAHMID; Password=anik";
            string cmdQuery = "Select STUFF.STUFF_ID as SID, STUFF.STUFF_NAME as name, STUFF.STUFF_GENDER as gen, STUFF.STUFF_PHONE as phone, STUFF.STUFF_DOB as dob, STUFF.STUFF_NID as nid, DESIGNATION.D_NAME as d_name, DESIGNATION.SALARY as salary, TIME_SHIFT.TS as ts from STUFF, DESIGNATION, TIME_SHIFT where STUFF.STUFF_DESIGNATION = DESIGNATION.D_ID and STUFF.STUFF_TS = TIME_SHIFT.TS_ID ";
            OracleDataAdapter a = new OracleDataAdapter(cmdQuery, ConnectionString);
            OracleCommandBuilder builder = new OracleCommandBuilder(a);
            DataSet ds = new DataSet();
            a.Fill(ds, "STUFF_details");
            GridView_stuff_list.DataSource = ds;
            GridView_stuff_list.DataBind();

            //foreach (DataRow r in ds.Tables["STUFF"].Rows)
            //{
            //    dr = dt.NewRow();
            //    dr["STUFF_NAME"] = r["STUFF_NAME"].ToString();
            //    dr["STUFF_GENDER"] = r["STUFF_GENDER"].ToString();
            //    dr["STUFF_PHONE"] = r["STUFF_PHONE"].ToString();
            //    dr["STUFF_DOB"] = r["STUFF_DOB"].ToString();
            //    dr["STUFF_NID"] = r["STUFF_NID"].ToString();
            //    string i;
            //    i = r["STUFF_DESIGNATION"].ToString();
            //    dt.Rows.Add(dr);
            //    dt.AcceptChanges();
            //}
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Global.CurrentPerson == null)
                    Response.Redirect("Index.aspx");

                DataTable seasonsTable = new DataTable();
                List<Season> seasons = new List<Season>();

                using (OracleConnection objConn = new OracleConnection(Global.ConnectionString))
                {
                    // Set up the seasons command
                    var seasonsCommand = new OracleCommand("TICKETS_QUERIES.getSeasonsForPurchase", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure };
                    seasonsCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue);
                    seasonsCommand.Parameters.Add("p_PersonId", OracleDbType.Int64, Global.CurrentPerson.person_id, ParameterDirection.Input);

                    try
                    {
                        // Execute the queries and auto map the results to models
                        objConn.Open();
                        var seasonsAdapter = new OracleDataAdapter(seasonsCommand);
                        seasonsAdapter.Fill(seasonsTable);
                        seasons = Mapper.DynamicMap<IDataReader, List<Season>>(seasonsTable.CreateDataReader());
                    }
                    catch (Exception)
                    {
                        Response.Redirect("Index.aspx");
                    }

                    objConn.Close();
                }

                // Fill list dropdowns with data from the database
                if (seasons.Count > 0)
                {
                    var seasonsWithEvents = seasons.GroupBy(s => s.season_id).Select(season => new Season()
                    {
                        season_id = season.First().season_id,
                        name = season.First().name,
                        price = season.First().price,
                        ticket_count = season.First().ticket_count,
                        event_names = seasons.Where(ev => ev.season_id == season.First().season_id).Select(en => en.event_name).ToList()
                    }).ToList();

                    SeasonDropDown.DataTextField = "name";
                    SeasonDropDown.DataValueField = "season_id";
                    SeasonDropDown.DataSource = seasonsWithEvents;
                    SeasonDropDown.DataBind();

                    SeasonListView.DataSource = seasonsWithEvents;
                    SeasonListView.DataBind();
                }
                if (Request.QueryString["Success"] != null)
                {
                    Error.Text = "Successfully purchased season ticket!";
                    Error.Visible = true;
                }
            }
        }
Пример #17
0
        public DataTable Consulta
        (
            string pQuery,
            string pConnectionString
        )
        {
            DataTable lTable = new DataTable();
            DataSet lDataSet = new DataSet();
            OracleConnection lConnection = new OracleConnection(pConnectionString);

            try
            {
                lConnection.Open();

                OracleDataAdapter lDataAdapter = new OracleDataAdapter(pQuery, pConnectionString);

                lDataAdapter.Fill(lDataSet);

                lTable = lDataSet.Tables[0];

                return lTable;
            }
            finally
            {
                lConnection.Close();
            }
        }
Пример #18
0
        /// <summary>
        /// 将数据读取到 DataSet 中.
        /// </summary>
        public void ReadDataToDataSet()
        {

            Console.WriteLine("使用DataAdapter,将数据填充到DataSet中,然后脱离数据库,直接对DataSet进行处理。");

            // 建立数据库连接.
            OracleConnection conn = new OracleConnection(connString);

            // 创建一个适配器
            OracleDataAdapter adapter = new OracleDataAdapter(SQL, conn);

            // 创建DataSet,用于存储数据.
            DataSet testDataSet = new DataSet();

            // 执行查询,并将数据导入DataSet.
            adapter.Fill(testDataSet, "result_data");

            // 关闭数据库连接.
            conn.Close();

            // 处理DataSet中的每一行数据.
            foreach (DataRow testRow in testDataSet.Tables["result_data"].Rows)
            {
                // 将检索出来的数据,输出到屏幕上.
                Console.WriteLine("NO:{0} ;  Date:{1} ; Money:{2}   ",
                    testRow["NO"], testRow["SALE_DATE"], testRow["SUM_MONEY"]
                    );
            }
        }
Пример #19
0
        public static DataTable GetItensCompra(int id_ficha_compra)
        {
            DataTable dt = new DataTable();
            OracleDataAdapter da = new OracleDataAdapter();

            OracleConnection conn = Conexao.GetInstance();

            OracleCommand cmd = new OracleCommand();
            try
            {
                cmd.CommandText = "SELECT * FROM FICHA_DE_COMPRA_ITEM " +
                                    "WHERE ID_FICHA_DE_COMPRA = :Id";

                cmd.Parameters.Add(":Id", OracleDbType.Int32).Value = id_ficha_compra;

                cmd.CommandType = CommandType.Text;
                cmd.Connection = conn;
                da.SelectCommand = cmd;
                da.Fill(dt);

                return dt;
            }
            catch (Exception ex)
            {
                strErrMsg = "Atenção, o sistema detectou o seguinte problema: " + "\r\n" +
                    "Descrição: " + Convert.ToString(ex.Message) + "\r\n" +
                    "Origem: " + Convert.ToString(ex.Source);
                MessageBox.Show(strErrMsg, "Procedimento: " + Convert.ToString(ex.TargetSite),
                      MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }
        }
Пример #20
0
        private void changeChartView()
        {
            using (OracleConnection connection = new OracleConnection(FormLogin.connString))
            {
                connection.Open();
                String query = "SELECT m.idRound AS ROUND, ROUND(SUM(part.match_Rating)/COUNT(part.match_Rating)) AS TEAMRATING"
                    + " FROM participates part JOIN player p ON (part.idPlayer = p.idPlayer) JOIN match m ON (part.idMatch = m.idMatch)"
                    + " WHERE p.idTeam = " + Team.Id
                    + " GROUP BY m.idRound"
                    + " ORDER BY m.idRound";
                OracleDataAdapter adapter = new OracleDataAdapter(query, connection);
                DataTable table = new DataTable();
                adapter.Fill(table);

                chartTeamRating.DataSource = table;
                chartTeamRating.Series["Series1"].XValueMember = "Round";
                chartTeamRating.Series["Series1"].YValueMembers = "TeamRating";
            }

            chartTeamRating.ChartAreas["ChartArea1"].AxisX.Title = "Rounds";
            chartTeamRating.ChartAreas["ChartArea1"].AxisY.Title = "Rating";
            chartTeamRating.ChartAreas["ChartArea1"].AxisX.Minimum = 1;
            chartTeamRating.ChartAreas["ChartArea1"].AxisX.Maximum = 38;
            chartTeamRating.ChartAreas["ChartArea1"].AxisX.Interval = 1;
            chartTeamRating.ChartAreas["ChartArea1"].AxisY.Minimum = 1000;
            chartTeamRating.ChartAreas["ChartArea1"].AxisY.Maximum = 3000;
            chartTeamRating.ChartAreas["ChartArea1"].Visible = true;
            chartTeamRating.Series["Series1"].BorderWidth = 3;



        }
Пример #21
0
        void MedStoreLoad()
        {
            try
            {
                conn.Open();
                string sqlquery = "SELECT * FROM MED_STORE";
                //string sqlquery = "SELECT * FROM MED_INFO";
                OracleCommand cmd = new OracleCommand(sqlquery, conn);
                OracleDataAdapter oda = new OracleDataAdapter();
                oda.SelectCommand = cmd;
                dt = new DataTable();
                //     dt.Columns["MED_NAME"].ColumnName = "Name";

                oda.Fill(dt);
                BindingSource bsource = new BindingSource();
                bsource.DataSource = dt;
                dataGridView1.DataSource = bsource;
                oda.Update(dt);
                dt.Columns[0].ColumnName = "ID";
                dt.Columns[1].ColumnName = "Name";
                dt.Columns[2].ColumnName = "Quantity";
                dt.Columns[3].ColumnName = "Damage Qty";
                dt.Columns[4].ColumnName = "Reorder Level";

                dt.AcceptChanges();

                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #22
0
 private void setDataGrid()
 {
     
     DataTable table = new DataTable();
     using (OracleConnection connection = new OracleConnection(FormLogin.connString))
     {
         String query = "SELECT c.description as Tip, c.value as Coefficient, r.homeTeam as HomeTeam, r.goalshome || ' - ' || r.goalsguest as Result, r.guestteam as GuestTeam"
             + " FROM Computegain c JOIN Results r ON (c.idMatch = r.idMatch) WHERE c.idTipster = "+idTipster;
         OracleDataAdapter adapter = new OracleDataAdapter(query, connection);
         adapter.Fill(table);
         
     }
     dataGrid.DataSource = table;
     dataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
     dataGrid.AutoSize = true;
     dataGrid.DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter;
     dataGrid.Columns["Tip"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomRight;
     dataGrid.Columns["HomeTeam"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomRight;
     dataGrid.Columns["GuestTeam"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomLeft;
     dataGrid.Columns["GuestTeam"].HeaderText = "Guest Team";
     dataGrid.Columns["HomeTeam"].HeaderText = "Home Team";
     dataGrid.Columns["Tip"].HeaderText = "Tip";
     dataGrid.Columns["Coefficient"].HeaderText = "Coefficient";
     dataGrid.Columns["Result"].HeaderText = "Result";
     
     
 }
Пример #23
0
        public DataTable ChiTietDuAn(string mdv, string nsd, string pas, string maDonVi, long idDuAn)
        {
            try
            {
                ConnectDB.CloseConnection(_connectGs);
                _connectGs = new OracleConnection();
                _connectGs = ConnectDB.GetOracleConnection(_connectGs);
                var cm = _connectGs.CreateCommand();
                cm.CommandText = "usp_ChiTiet_DuAn";
                cm.CommandType = CommandType.StoredProcedure;
                cm.Parameters.Add(new OracleParameter("ma_donvi", OracleDbType.Varchar2)).Value = "";
                cm.Parameters.Add(new OracleParameter("nsd", OracleDbType.Varchar2)).Value = "";
                cm.Parameters.Add(new OracleParameter("pas", OracleDbType.Varchar2)).Value = "";
                cm.Parameters.Add(new OracleParameter("id_duan", OracleDbType.Long)).Value = idDuAn;
                cm.Parameters.Add(new OracleParameter("ma_donvi_thuchien", OracleDbType.Varchar2)).Value = maDonVi;
                cm.Parameters.Add(new OracleParameter("cs_lke", OracleDbType.RefCursor)).Direction =
                    ParameterDirection.Output;

                var tableGs = new DataTable();
                _oracleAdapter = new OracleDataAdapter(cm);
                _oracleAdapter.Fill(tableGs);
                return tableGs;
            }
            catch (Exception)
            {
                return null;
            }
            finally
            {
                ConnectDB.CloseConnection(_connectGs);
            }
        }
Пример #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            OracleConnection conn = new OracleConnection();
            conn.ConnectionString = "User ID=SYSTEM; Password=19; Data Source=PC";

            try
            {
                conn.Open();
                MessageBox.Show("Veritabanına Baglantı Basarılı.");
            }
            catch
            {
                MessageBox.Show("Veritabanına Baglanılamadı.");
            }

            OracleCommand cmd = new OracleCommand();
            cmd.CommandText = "SELECT ogrenci_tablosu.ogrenci_ad, fakulte_tablosu.fakulte_ad FROM ogrenci_tablosu, bolum_tablosu, fakulte_tablosu WHERE ogrenci_tablosu.ogrenci_bolum = bolum_tablosu.bolum_id AND bolum_tablosu.bolum_fakulte = fakulte_tablosu.fakulte_id";
            cmd.Connection = conn;

            OracleDataAdapter adapter = new OracleDataAdapter();
            adapter.SelectCommand = cmd;

            DataSet dataset = new DataSet();

            adapter.Fill(dataset);

            dataGridView1.DataSource = dataset.Tables[0];

            conn.Close();
        }
        protected void con_btn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TextBox_ad_pay.Text))
            {
                LabelMessage.Text = "Advance Payment is empty";
                TextBox_ad_pay.Focus();
            }
            else
            {
            int advanced = Convert.ToInt32(TextBox_ad_pay.Text);
            int due = Convert.ToInt32( Session["total_price"]) - advanced;

            string ConnectionString = @"DATA SOURCE=127.0.0.1:1521/XE;PERSIST SECURITY INFO=True;USER ID=TAHMID; Password=anik";

            string cmdQuery = "insert into CLIENT(C_ID, C_NAME, C_PHONE, C_EMAIL, C_ADDRESS, C_GUEST, C_SERVICE_ID, C_F_PACK_ID, C_D_PACK_ID, C_R_TIME, C_R_DATE) values (client_seq.NEXTVAL, '" + Session["B_c_name"] + "', '" + Session["B_c_phone"] + "', '" + Session["B_c_email"] + "', '" + Session["B_c_address"] + "', '" + Session["gest"] + "', '" + Session["B_c_package"] + "', '" + Session["f_package"] + "', '" + Session["d_package"] + "', '" + Session["r_date"] + "', '" + Session["r_time"] + "' )";
            OracleDataAdapter a = new OracleDataAdapter(cmdQuery, ConnectionString);
            OracleCommandBuilder builder = new OracleCommandBuilder(a);
            DataSet ds = new DataSet();
            a.Fill(ds, "client");

            string cmdquery2 = "Select C_ID from CLIENT where C_NAME = '" + Session["B_c_name"] + "' and C_PHONE = '" + Session["B_c_phone"] + "' ";
            OracleDataAdapter b = new OracleDataAdapter(cmdquery2, ConnectionString);
            OracleCommandBuilder builder2 = new OracleCommandBuilder(b);
            DataSet ds2 = new DataSet();
            b.Fill(ds2, "client_id");
            int cid = Convert.ToInt32(ds2.Tables["client_id"].Rows[0]["C_ID"]);

            string cmdQuery3 = "insert into COST(CO_ID, CO_C_ID, CO_DEC, CO_F_PR, CO_F_TOTAL, CO_TOTAL, CO_ADVANCED, CO_DUE) values (cost_seq.NEXTVAL, '" + cid + "','" + Session["Decuration_price"] + "', '" + Session["FOOD_price"] + "' ,'" + Session["total_f_price"] + "', '" + Session["total_price"] + "', '" + advanced + "', '" + due + "')";
            OracleDataAdapter c = new OracleDataAdapter(cmdQuery3, ConnectionString);
            OracleCommandBuilder builder3 = new OracleCommandBuilder(c);
            DataSet ds3 = new DataSet();
            c.Fill(ds3, "COST");
            Response.Redirect("booking.aspx");
            }
        }
 /// <summary>
 /// Reads raw fact data from a database.
 /// </summary>
 /// <param name="sqlcode">Generated SQL statement</param>
 /// <returns>Raw data table</returns>
 /// <author>Jannik Arndt, Bernd Nottbeck</author>
 public override DataTable GetFactDataTable(string sqlcode)
 {
     DataTable factDataTable = new DataTable();
     OracleCommand getFactsSql = new OracleCommand(sqlcode, (OracleConnection)Connection);
     OracleDataAdapter factAdapter = new OracleDataAdapter(getFactsSql);
     factAdapter.Fill(factDataTable);
     return factDataTable;
 }
Пример #27
0
 /// <summary>
 /// 执行SQL语句,返回数据到DataSet中
 /// </summary>
 /// <param name="sql">sql语句</param>
 /// <param name="DataSetName">自定义返回的DataSet表名</param>
 /// <returns>返回DataSet</returns>
 public DataSet ReturnDataSet(string sql, string DataSetName)
 {
     DataSet dataSet = new DataSet();
     OpenConn();
     var OraDA = new OracleDataAdapter(sql, Connection);
     OraDA.Fill(dataSet, DataSetName);
     //   CloseConn();
     return dataSet;
 }
Пример #28
0
        public DataTable GetDataTable(string tableName)
        {
            currentAdapter = repo.GetDataAdapter(tableName);
            var dataTable = new DataTable();
            currentAdapter.Fill(dataTable);
            new OracleCommandBuilder(currentAdapter);

            return dataTable;
        }
Пример #29
0
 private void allemp_Load(object sender, EventArgs e)
 {
     string srch = "select * from employee";
     OracleDataAdapter adapt = new OracleDataAdapter(srch, conn);
     DataSet ds = new DataSet();
     adapt.Fill(ds);
     DataTable dt = ds.Tables[0];
     dataGridView1.DataSource = dt;
 }
Пример #30
0
 private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
 {
     comboBox2.Items.Clear();
     comboBox4.Items.Clear();
     day   = comboBox3.SelectedItem.ToString();
     route = comboBox1.SelectedItem.ToString();
     try
     {
         String           oradb = "Data Source=DESKTOP-C9VNRJB;Persist Security Info=True;User ID=SYSTEM;Password=pogkaku";
         OracleConnection conn  = new OracleConnection(oradb);
         conn.Open();
         OracleCommand comm = new OracleCommand();
         comm.CommandText = "select train_id from TRAIN natural join TRAIN_SCHEDULE where route = '" + route + "' and day = '" + day + "'";
         comm.CommandType = CommandType.Text;
         DataSet           ds = new DataSet();
         OracleDataAdapter da = new OracleDataAdapter(comm.CommandText, conn);
         da.Fill(ds, "Tbl_train_schedule");
         DataTable dt = ds.Tables["Tbl_train_schedule"];
         int       t1 = dt.Rows.Count;
         if (t1 == 0)
         {
             MessageBox.Show("No such train exists!");
         }
         else
         {
             for (int j = 0; j < t1; j++)
             {
                 DataRow dr = dt.Rows[j];
                 comboBox2.Items.Add(dr["TRAIN_ID"].ToString());
             }
         }
     }
     catch (IndexOutOfRangeException ex)
     {
         MessageBox.Show(ex + "");
     }
 }
Пример #31
0
    public string GetZone(string division)
    {
        string msg = "";
        OracleDBConnectionClass objOracleDB = new OracleDBConnectionClass();

        try
        {
            OracleConnection conn = new OracleConnection(objOracleDB.OracleConnectionString());
            conn.Open();

            string            query = @"SELECT ZONE_ID,ZONE_NAME FROM T_ZONE
                            WHERE DIVISION_ID='" + division + "' ORDER BY ZONE_NAME";
            OracleCommand     cmd   = new OracleCommand(query, conn);
            OracleDataAdapter da    = new OracleDataAdapter(cmd);
            DataSet           ds    = new DataSet();
            da.Fill(ds);
            int c = ds.Tables[0].Rows.Count;
            if (c > 0)
            {
                for (int i = 0; i < c; i++)
                {
                    string comId   = ds.Tables[0].Rows[i]["ZONE_ID"].ToString();
                    string comName = ds.Tables[0].Rows[i]["ZONE_NAME"].ToString();
                    msg = msg + ";" + comId + ";" + comName;
                }
            }
            else
            {
                msg = "NotExist";
            }

            conn.Close();
        }
        catch (Exception ex) { }

        return(msg);
    }
Пример #32
0
        private void button3_Click(object sender, EventArgs e)
        {
            string constr = "Data source=orcl;User Id=hr; Password=hr;";
            string cmdstr = "";

            if (comboBox1.SelectedItem.ToString() == "UserName")
            {
                cmdstr  = "update REGISTER_USER set USERNAME=:x where USERNAME=:y and SSN=:z";
                adapter = new OracleDataAdapter(cmdstr, constr);
                adapter.SelectCommand.Parameters.Add("x", textBox3.Text);
                adapter.SelectCommand.Parameters.Add("y", textBox1.Text);
                adapter.SelectCommand.Parameters.Add("z", Int32.Parse(textBox2.Text));
                DataSet ds = new DataSet();
                adapter.Fill(ds);
            }
            else if (comboBox1.SelectedItem.ToString() == "Passward")
            {
                cmdstr  = "update REGISTER_USER set SSN=:x where USERNAME=:y and SSN=:z";
                adapter = new OracleDataAdapter(cmdstr, constr);
                adapter.SelectCommand.Parameters.Add("x", Int32.Parse(textBox4.Text));
                adapter.SelectCommand.Parameters.Add("y", textBox1.Text);
                adapter.SelectCommand.Parameters.Add("z", Int32.Parse(textBox2.Text));
                DataSet ds = new DataSet();
                adapter.Fill(ds);
            }
            else if (comboBox1.SelectedItem.ToString() == "Both")
            {
                cmdstr  = "update REGISTER_USER set USERNAME=:w,SSN=:x where USERNAME=:y and SSN=:z";
                adapter = new OracleDataAdapter(cmdstr, constr);
                adapter.SelectCommand.Parameters.Add("w", textBox3.Text);
                adapter.SelectCommand.Parameters.Add("x", Int32.Parse(textBox4.Text));
                adapter.SelectCommand.Parameters.Add("y", textBox1.Text);
                adapter.SelectCommand.Parameters.Add("z", Int32.Parse(textBox2.Text));
                DataSet ds = new DataSet();
                adapter.Fill(ds);
            }
        }
Пример #33
0
        private void getDrivers(String sortOrder)
        {
            string oradb = "Data Source=Oracle;User Id=t00171168;Password=p9udna7n;";

            try
            {
                OracleConnection conn = new OracleConnection(oradb);


                OracleCommand cmd = new OracleCommand("SELECT Driver_ID AS ID,Driver_Name AS Name,D.Country ,Team_Name AS Team " +
                                                      "FROM Drivers D,Teams T WHERE D.Status = 'A' AND T.Team_ID = D.Team_ID ORDER BY " + sortOrder, conn);


                cmd.CommandType = CommandType.Text;


                OracleDataAdapter da = new OracleDataAdapter(cmd);


                DataSet ds = new DataSet();


                da.Fill(ds, "ss".Trim());


                grdData.DataSource = ds.Tables["ss".Trim()];

                conn.Close();
            }


            catch (OracleException ex)
            {
                MessageBox.Show("The System was unable to connect to the database");
                MessageBox.Show(ex.Message);
            }
        }
Пример #34
0
        public static List <SupportModel> Supports()
        {
            List <SupportModel> Support = new List <SupportModel>();

            DBConnection Connection = new DBConnection();

            Connection.Open();
            OracleDataAdapter DataAdapter = new OracleDataAdapter();
            OracleCommand     cmd         = new OracleCommand("PKG_WEB.PR_SUPPORT_GET", Connection.Connection);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;


            cmd.Parameters.Add("t_list", OracleType.Cursor).Direction = System.Data.ParameterDirection.Output;
            DataAdapter.SelectCommand = cmd;
            try
            {
                DataTable Table = new DataTable();
                DataAdapter.Fill(Table);
                for (int i = 0; i < Table.Rows.Count; i++)
                {
                    SupportModel theSupportModel = new SupportModel();
                    theSupportModel.ID      = Convert.ToInt32(Table.Rows[i]["ID"].ToString());
                    theSupportModel.Name    = Table.Rows[i]["Name"].ToString();
                    theSupportModel.Smsmail = Table.Rows[i]["Smsmail"].ToString();
                    theSupportModel.email   = Table.Rows[i]["Email"].ToString();
                    theSupportModel.Phone   = Table.Rows[i]["Phone"].ToString();
                    Support.Insert(i, theSupportModel);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }

            return(Support);
        }
Пример #35
0
        public void salvarReservas(Voo voo)
        {
            string str = "select * from RESERVA Where ID_VOO = " + voo._id;

            dtReservas.Clear();

            OracleDataAdapter da = new OracleDataAdapter(str, Bd.Instance.obterConexao());

            OracleCommandBuilder cb = new OracleCommandBuilder(da);

            da.Fill(dtReservas);

            foreach (Reserva reserva in voo.reservas())
            {
                if (reserva._id.Equals(0))
                {
                    DataRow row = dtReservas.NewRow();

                    string mapa = "";
                    foreach (Assento assento in reserva.assentos())
                    {
                        mapa += assento.assento() + " ";
                    }

                    row["ID"]          = obterSequenciaReserva();
                    reserva._id        = (int)row["ID"];
                    row["ID_VOO"]      = voo._id;
                    row["VAL_PRECO"]   = voo.preco();
                    row["QTD_ASSENTO"] = mapa;
                    row["ID_CLIENTE"]  = reserva.clienteId().Id;

                    dtReservas.Rows.Add(row);
                }
            }

            da.Update(dtReservas);
        }
Пример #36
0
 public static DataSet Query(string SQLString, params OracleParameter[] cmdParms)
 {
     try
     {
         using (OracleConnection connection = new OracleConnection(connectionString))
         {
             OracleCommand cmd = new OracleCommand();
             PrepareCommand(cmd, connection, null, SQLString, cmdParms);
             using (OracleDataAdapter da = new OracleDataAdapter(cmd))
             {
                 DataSet ds = new DataSet();
                 try
                 {
                     da.Fill(ds, "ds");
                     cmd.Parameters.Clear();
                 }
                 catch (System.Data.OracleClient.OracleException ex)
                 {
                     throw new Exception(ex.Message);
                 }
                 finally
                 {
                     if (connection.State != ConnectionState.Closed)
                     {
                         connection.Close();
                     }
                 }
                 return(ds);
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(SQLString, ex);
         throw ex;
     }
 }
Пример #37
0
        private void deletesearch_Click(object sender, RoutedEventArgs e)
        {
            deletegrid.Visibility = Visibility.Visible;
            string str = delemployeenumber.Text;

            if (str == "")
            {
                MessageBox.Show("Please fill all details", "ERROR");
            }
            else
            {
                connection();
                string            strsql = "select * from employee where employee_id =" + str + "";
                OracleDataAdapter da1    = new OracleDataAdapter(strsql, con);
                DataSet           ds1    = new DataSet();
                da1.Fill(ds1, "set");
                DataTable dt1 = new DataTable();
                dt1 = ds1.Tables[0];
                if (dt1.Rows.Count == 0)
                {
                    MessageBox.Show("Invalid Employee ID", "ERROR");
                    delemployeenumber.Text = "";
                }
                else
                {
                    string        comd = "delete from employee where  employee_id= " + str + "";
                    OracleCommand cmd1 = con.CreateCommand();
                    cmd1.CommandText = comd;
                    cmd1.ExecuteNonQuery();
                    MessageBox.Show("Your record has Been Successfully Deleted", "Deleted Record");
                    empadd.Visibility     = Visibility.Visible;
                    maincancel.Visibility = Visibility.Visible;
                    empdelete.Visibility  = Visibility.Visible;
                    deletegrid.Visibility = Visibility.Collapsed;
                }
            }
        }
Пример #38
0
        public DataTable ExecuteDataTable(string aQuery, Hashtable aParam)
        {
            if (this.m_trans == null)
            {
                this.Connect();
            }

            OracleDataAdapter da  = new OracleDataAdapter();
            DataSet           ds  = new DataSet();
            OracleCommand     cmd = new OracleCommand(aQuery, this.m_OraCn);

            if (m_trans != null)
            {
                cmd.Transaction = this.m_trans;
            }

            if (aParam != null)
            {
                foreach (string paramName in aParam.Keys)
                {
                    cmd.Parameters.AddWithValue(paramName, aParam[paramName]);
                }
            }

            try
            {
                da.SelectCommand = cmd;
                da.Fill(ds);

                return(ds.Tables[0]);
            }
            catch (Exception ex)
            {
                ErrorMessage(ex, aQuery, aParam);
                return(null);
            }
        }
Пример #39
0
        /// <summary>
        /// Altyazıları listeler
        /// </summary>
        /// <param name="filmID">Filmin ID sine göre arama yapılır.</param>
        /// <returns>Geriye Datatable olarak döndürür</returns>
        public DataTable altyaziListesiFilm(string filmID)
        {
            try
            {
                /*"SELECT f.Name ""Film Adı"",s.Name as ""Altyazı Adı"" ,s.Directory ,u.Name as ""Yükleyenin Adı""                 +"FROM Subtitles s"
                 + "Inner join Films f on f.FilmsID = s.FilmsID"
                 + "inner join Users u on u.UsersID = s.UsersID"
                 + "where f.FilmsID = 1*/

                connection = new OracleConnection(connStr);
                da         = new OracleDataAdapter();
                dt         = new DataTable();
                query      = "SELECT f.Name film_Adi ,s.Name Altyazi_Adi ,s.Directory ,"
                             + "u.Name Yukleyenin_Adi FROM Subtitles s Inner join Films f on f.FilmsID=s.FilmsID "
                             + "inner join Users u on u.UsersID = s.UsersID where f.FilmsID = :1";
                command = new OracleCommand(query, connection);

                /*command.Parameters.Add(new OracleParameter("@filmAdi", "FilmAdı"));
                 * command.Parameters.Add(new OracleParameter("@AltyaziAdi", "AltyazıAdı"));
                 * command.Parameters.Add(new OracleParameter("@YukleyeninAdi", "YükleyeninAdı"));*/
                command.Parameters.Add(new OracleParameter("@1", filmID));
                connection.Open();
                command.Connection = connection;
                da.SelectCommand   = command;
                da.Fill(dt);
                return(dt);
            }
            catch (OracleException)
            {
                connection.Close();
                throw new Exception("SQL Bağlantı Hatası");
            }
            finally
            {
                connection.Close();
            }
        }
/************************************** tabPage 3 **************************************/
        private void tabPage3_Enter(object sender, EventArgs e)
        {
            ds  = new DataSet();
            oda = new OracleDataAdapter("select * from store_products order by name_pr", oc);
            oda.Fill(ds);
            dataGridView4.DataSource = ds.Tables[0];
            Products.printDataGridTitle(dataGridView4);

            ds  = new DataSet();
            oda = new OracleDataAdapter("select id_client, fio from store_clients order by fio", oc);
            oda.Fill(ds);
            dataGridView6.DataSource = ds.Tables[0];
            Clients.demo_printDataGridTitle(dataGridView6);

            ds  = new DataSet();
            oda = new OracleDataAdapter("select id_booking,id_product_fk,id_client_fk from store_bookings order by id_booking", oc);
            oda.Fill(ds);
            dataGridView5.DataSource = ds.Tables[0];
            Bookings.demo_printDataGridTitle(dataGridView5);

            string temp_s = dataGridView5.Rows[dataGridView5.RowCount - 2].Cells[0].Value.ToString();
            int    temp_i = System.Convert.ToInt32(temp_s);

            ++temp_i;
            textBox1.Text    = System.Convert.ToString(temp_i);
            textBox1.Enabled = false;

            textBox6.Text    = DateTime.Today.ToString();
            textBox6.Enabled = false;

            textBox2.Enabled = true;
            textBox3.Enabled = true;
            textBox2.Text    = "";
            textBox3.Text    = "";
            textBox4.Text    = "";
            textBox5.Text    = "";
        }
Пример #41
0
        protected void linkSelectClick(object sender, EventArgs e)
        {
            OracleConnection conn = new OracleConnection(strConnString);

            conn.Open();
            LinkButton btn = (LinkButton)sender;

            Session["user_page_data_id"] = btn.CommandArgument;
            int USER_DATA_ID = Convert.ToInt32(Session["user_page_data_id"]);


            DataTable dtUserTypeID = new DataTable();
            DataSet   ds           = new DataSet();
            string    makeSQL      = " select *  from WP_CATEGORY where CATEGORY_ID = '" + USER_DATA_ID + "'";

            cmdl    = new OracleCommand(makeSQL);
            oradata = new OracleDataAdapter(cmdl.CommandText, conn);
            dt      = new DataTable();
            oradata.Fill(dt);
            RowCount = dt.Rows.Count;

            for (int i = 0; i < RowCount; i++)
            {
                TextItemCategoreyID.Text   = dt.Rows[i]["CATEGORY_ID"].ToString();
                TextItemCategoreyName.Text = dt.Rows[i]["CATEGORY_NAME"].ToString();
                TextItemCategoreyDes.Text  = dt.Rows[i]["CATEGORY_DES"].ToString();
                TextItemCatCode.Text       = dt.Rows[i]["CATEGORY_CODE"].ToString();
                CheckIsActive.Checked      = Convert.ToBoolean(dt.Rows[i]["IS_ACTIVE"].ToString() == "Enable" ? true : false);
            }

            conn.Close();
            Display();
            CheckItemCategoreyName.Text = "";
            alert_box.Visible           = false;
            BtnAdd.Attributes.Add("aria-disabled", "false");
            BtnAdd.Attributes.Add("class", "btn btn-primary disabled");
        }
        void loadGridview()
        {
            OracleConnection con = new OracleConnection(constr);

            con.Open();
            OracleDataAdapter oda = new OracleDataAdapter("select * from ordertab ", con);
            DataTable         dt  = new DataTable();


            this.dgvCustAssign.AutoGenerateColumns = false;
            oda.Fill(dt);

            dgvCustAssign.DataSource = dt;
            //  dgvCustAssign.Rows


            /*   foreach(DataRow item in dt.Rows)
             * {
             *     int n = dgvCustAssign.Rows.Add();
             *     dgvCustAssign.Rows[n].Cells[0].Value ="false";
             *     dgvCustAssign.Rows[n].Cells[1].Value = item["ORDER_ID"].ToString();
             *     dgvCustAssign.Rows[n].Cells[2].Value = item["CUST_ID"].ToString();
             *     dgvCustAssign.Rows[n].Cells[3].Value = item["CUST_NAME"].ToString();
             *     dgvCustAssign.Rows[n].Cells[4].Value = item["PRO_ID"].ToString();
             *     dgvCustAssign.Rows[n].Cells[5].Value = item["PRODUCT_NAME"].ToString();
             *     dgvCustAssign.Rows[n].Cells[6].Value = item["QUANTITY"].ToString();
             *     dgvCustAssign.Rows[n].Cells[7].Value = item["PRICEPER"].ToString();
             *     dgvCustAssign.Rows[n].Cells[8].Value = item["TOTAL_PRICE"].ToString();
             *     dgvCustAssign.Rows[n].Cells[9].Value = item["CUST_LOC"].ToString();
             *     dgvCustAssign.Rows[n].Cells[10].Value = item["CUST_PHONE"].ToString();
             *     dgvCustAssign.Rows[n].Cells[11].Value = item["EXPIRE_DATE"].ToString();
             *     dgvCustAssign.Rows[n].Cells[12].Value = item["ORDER_DATE"].ToString();
             *     dgvCustAssign.Rows[n].Cells[13].Value = item["FINAL_TOTALPRICE"].ToString();
             * }*/
            count();
            con.Close();
        }
        private void LoadDGV()
        {
            string divisions = null;

            DGV_Classement.AllowUserToResizeColumns = false; // Empêche le resize des colonnes
            DGV_Classement.AllowUserToResizeRows    = false; // Empêche le resize des rangées
            DGV_Classement.AllowUserToAddRows       = false; // Enlève la ligne vide à la fin du DGV
            dataSetClassement.Clear();                       // Vide le dataset afin de ne pas avoir de doublons

            int lastIndex = -1;

            if (DGV_Classement.SelectedRows.Count > 0)
            {
                lastIndex = DGV_Classement.SelectedRows[0].Index;
            }
            OracleCommand     oraSelect  = oracon.CreateCommand();
            OracleDataAdapter oraAdapter = new OracleDataAdapter(oraSelect);

            divisions = CB_Division.Text;
            if (divisions == "Toutes")
            {
                oraSelect.CommandText = "SELECT * from classement ";
            }
            else
            {
                divisions            += "' ";
                oraSelect.CommandText = "SELECT * from classement " +
                                        "where nomdivision= '" + divisions;
            }
            oraAdapter.Fill(dataSetClassement, "tableclassement");
            DGV_Classement.DataSource = dataSetClassement.Tables[0];
            // SetDGVLargeurColonne();
            if (lastIndex > -1 && DGV_Classement.Rows.Count > 0)
            {
                DGV_Classement.Rows[Math.Min(lastIndex, DGV_Classement.Rows.Count - 1)].Selected = true;
            }
        }
Пример #44
0
        /****************************************************************************
         * The purpose of this method is to populate the "productsDataGrid' with data
         * from 'Products' database table. This method is called from Main method.
         *****************************************************************************/
        private void populateProductsDataGrid()
        {
            try
            {
                //Instantiate OracleDataAdapter to create DataSet
                //Fetch Product Details
                productsAdapter = new OracleDataAdapter("SELECT " +
                                                        "Product_ID ID, " +
                                                        "Product_Name Name, " +
                                                        "Product_Desc Description, " +
                                                        "Category, " +
                                                        "Price, " +
                                                        "Product_Status " +
                                                        " FROM Products", conn);

                //For automatically generating commands
                productsCmdBuilder = new OracleCommandBuilder(productsAdapter);

                //Creating Dataset
                productsDataSet = new DataSet("productsDataSet");

                //AddWithKey sets the Primary Key information to complete the
                //schema information
                productsAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

                //Fill the DataSet
                productsAdapter.Fill(productsDataSet, "Products");

                //Binding DataSet to the DataGrid
                productsDataGrid.SetDataBinding(productsDataSet, "Products");
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #45
0
        public DataTable Fetch_User_History(string mname, string pass)
        {
            string    s   = string.Empty;
            int       mid = 0;
            DataTable dt  = new DataTable();

            try
            {
                con.Open();

                string q = string.Format("SELECT member.id FROM member WHERE member.username = '******' and member.password = '******'", mname, pass);

                OracleCommand cmd1 = new OracleCommand(q, con);
                mid = Convert.ToInt16(cmd1.ExecuteScalar().ToString());

                con.Close();
                con.Open();


                string            qr  = string.Format("SELECT * FROM History WHERE History.mid = {0} and History.Status='{1}'", mid, "Issued");
                OracleCommand     cmd = new OracleCommand(qr, con);
                OracleDataAdapter da  = new OracleDataAdapter(cmd);
                da.Fill(dt);



                con.Close();
            }

            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            return(dt);
            //return s;
        }
Пример #46
0
        protected void Page_Init(object sender, EventArgs e)
        {
            DataSetAssetClass imageDataSet = new DataSetAssetClass();

            string           connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            OracleConnection con     = new OracleConnection(connStr);

            string AsMonthYear = Request.QueryString["MonthYear"].ToString();

            string MakeMonthYear = Request.QueryString["MonthYear"].ToString();

            string[] MakeMonthYearSplit = MakeMonthYear.Split('-');
            String   MonthYearTemp      = MakeMonthYearSplit[0].Replace("/", "-");
            DateTime AsMonthYearNew     = DateTime.ParseExact(MonthYearTemp, "MM-yyyy", CultureInfo.InvariantCulture);

            string sqlString = "  SELECT PSM.SALES_INTER_DIV_ID, PSM.WB_SLIP_NO, HED.DIVISION_NAME AS CUSTOMER_NAME, PI.ITEM_NAME, PSI.CATEGORY_NAME, PSM.ITEM_WEIGHT, PSM.ITEM_RATE, PSM.ITEM_AMOUNT, PSM.REMARKS AS SEAL_NO,  TO_CHAR(PSM.ENTRY_DATE, 'DD-Mon-YYYY') AS ENTRY_DATE  FROM WP_SALES_INTER_DIV_MASTER PSM LEFT JOIN HR_EMP_DIVISIONS HED ON HED.DIVISION_ID = PSM.INTER_DIVISION_ID LEFT JOIN WP_ITEM PI ON PI.ITEM_ID = PSM.ITEM_ID LEFT JOIN WP_CATEGORY PSI ON PSI.CATEGORY_ID = PSM.CATEGORY_ID  WHERE  to_char(PSM.ENTRY_DATE, 'mm/yyyy') = '" + AsMonthYear + "' ORDER BY PSM.CREATE_DATE DESC ";


            OracleCommand cmd = new OracleCommand(sqlString, con);

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = sqlString;
            OracleDataAdapter dt = new OracleDataAdapter(cmd);

            con.Open();
            dt.Fill(imageDataSet.Tables["reportTable"]);
            con.Close();

            crystalReport.Load(Server.MapPath("~/WP/WP_Reports/Wp_Sales_Inter_Division_Report.rpt"));
            crystalReport.SetDataSource(imageDataSet.Tables["reportTable"]);
            crystalReport.SetParameterValue("AsMonthYear", AsMonthYearNew);
            string datetime = DateTime.Now.ToString("dd-MM-yyyy");

            CrystalReportViewer1.ID = "Sales_Sales_Inter_Division_Report_(As_On_Date)_Waste_Paper_" + datetime + "";

            CrystalReportViewer1.ReportSource = crystalReport;
        }
        private DataTable InternalExecuteQuery(string tableName, string commandText, ParameterList parameterList = null)
        {
            lock (lockOb)
            {
                DataTable dt = new DataTable(tableName);
                try
                {
                    ConnectionData currentConnection = GetConnectionData();

                    //se achou uma conexao, continue
                    if (OpenConnection(currentConnection) == ConnectionState.Open)
                    {
                        if (EnvironmentInformation.DatabaseType == DatabaseType.Oracle)
                        {
                            OracleDataAdapter oracleDataAdapter =
                                new OracleDataAdapter(
                                    (OracleCommand)CreateCommand(commandText,
                                                                 currentConnection, parameterList));
                            oracleDataAdapter.Fill(dt);
                        }
                        else if (EnvironmentInformation.DatabaseType == DatabaseType.MSSQL)
                        {
                            SqlDataAdapter sqlDataAdapter =
                                new SqlDataAdapter((SqlCommand)CreateCommand(commandText,
                                                                             currentConnection, parameterList));
                            sqlDataAdapter.Fill(dt);
                        }
                    }
                }
                catch (Exception exception)
                {
                    Utils.ShowExceptionStack(exception);
                }

                return(dt);
            }
        }
Пример #48
0
        private void getTableList()
        {
            //List<ProgramList> programIdList = new List<ProgramList>();

            if (mOraSourceConn == null)
            {
                return;
            }

            try
            {
                String sUpdatedListQuery = String.Format(@"select T.TABLE_NAME, T.TABLESPACE_NAME, C.COMMENTS
from USER_TABLES T, USER_TAB_COMMENTS C
where
  T.TABLE_NAME = C.TABLE_NAME
order by T.TABLE_NAME", mFrameworkUserID);

                mOraSourceConn.Open();
                DataSet           ds = new DataSet();
                OracleDataAdapter da = new OracleDataAdapter(sUpdatedListQuery, mOraSourceConn);
                da.Fill(ds, "tableList");
                gridTable.DataSource = ds.Tables["tableList"];
                gridTableView.BestFitColumns();
            }
            catch (OracleException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                mOraSourceConn.Close();
            }
        }
Пример #49
0
        private void btSatinAl_Click(object sender, EventArgs e)
        {
            con.Open();
            DataTable dt = new DataTable();

            adapt = new OracleDataAdapter("select S.ID,S.URUN_ID,S.KULLANICI_ID, S.MIKTARI, U.TANIM, U.URUN_GRUP_ID, U.FIYAT, U.ACIKLAMA from SEPET S, URUNLER U WHERE S.URUN_ID = U.ID", con);
            adapt.Fill(dt);
            con.Close();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                OracleCommand cmd = new OracleCommand("insert into SATIS(URUN_ID,KULLANICI_ID,MIKTARI,TANIM,URUN_GRUP_ID,FIYAT,ACIKLAMA,TARIH) values(:urun_id,:kullanici_id,:miktari,:tanim,:urun_grup_id,:fiyat,:aciklama,:tarih)", con);
                con.Open();
                cmd.Parameters.Add(":urun_id", Convert.ToInt32(dt.Rows[i][1].ToString()));
                cmd.Parameters.Add(":kullanici_id", Convert.ToInt32(dt.Rows[i][2].ToString()));
                cmd.Parameters.Add(":miktari", Convert.ToInt32(dt.Rows[i][3].ToString()));
                cmd.Parameters.Add(":tanim", dt.Rows[i][4].ToString());
                cmd.Parameters.Add(":urun_grup_id", Convert.ToInt32(dt.Rows[i][5].ToString()));
                cmd.Parameters.Add(":fiyat", Convert.ToInt32(dt.Rows[i][6].ToString()));
                cmd.Parameters.Add(":aciklama", dt.Rows[i][7].ToString());
                cmd.Parameters.Add(":tarih", Convert.ToDateTime(DateTime.Now));

                cmd.ExecuteNonQuery();
                con.Close();
            }

            OracleCommand cmd1 = new OracleCommand("delete SEPET", con);

            con.Open();
            cmd1.ExecuteNonQuery();
            con.Close();

            sepettekiToplamUrunSayisi();
            toplamUrunSayisi();

            MessageBox.Show("Tüm ürünler satın alındı ve sepet boşaltıldı !");
        }
Пример #50
0
        /// <summary>
        /// Get User role Details.
        /// </summary>
        /// <returns>An instance of <c>DataTable</c>.</returns>
        public static DataTable GetUserRoleDetails()
        {
            DataTable dtUserDetails = null;

            try
            {
                using (OracleConnection conn = ConnectionDB.GetOracleConnection())
                {
                    using (OracleCommand command = conn.CreateCommand())
                    {
                        command.CommandText = "USER_MANAGEMENT.GET_ASSIGNED_USERS_WITH_ROLES";
                        command.CommandType = CommandType.StoredProcedure;

                        command.Parameters.Add("PORC_USER_ROLES", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

                        using (OracleDataAdapter oraAdpt = new OracleDataAdapter(command))
                        {
                            dtUserDetails = new DataTable();
                            try
                            {
                                oraAdpt.Fill(dtUserDetails);
                            }
                            catch (OracleException)
                            {
                                throw;
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(dtUserDetails);
        }
Пример #51
0
        public void displayData()
        {
            using (OracleConnection orcCont = new OracleConnection(connectionString))
            {
                orcCont.Open();
                OracleDataAdapter orcData1 = new OracleDataAdapter("select GRANTED_ROLE from DBA_ROLE_PRIVS WHERE GRANTEE = '" + txtEdit_username.Text + "'", orcCont);
                DataTable         dtbl     = new DataTable();
                orcData1.Fill(dtbl);
                dgvRole.DataSource          = dtbl;
                dgvRole.AutoSizeColumnsMode = (DataGridViewAutoSizeColumnsMode)DataGridViewAutoSizeColumnMode.Fill;


                OracleDataAdapter orcData2 = new OracleDataAdapter("select PRIVILEGE from DBA_SYS_PRIVS WHERE GRANTEE = '" + txtEdit_username.Text + "'", orcCont);
                DataTable         dtb2     = new DataTable();
                orcData2.Fill(dtb2);
                dgvSys.DataSource          = dtb2;
                dgvSys.AutoSizeColumnsMode = (DataGridViewAutoSizeColumnsMode)DataGridViewAutoSizeColumnMode.Fill;



                OracleDataAdapter orcData3 = new OracleDataAdapter("select TABLE_NAME, PRIVILEGE from USER_TAB_PRIVS WHERE GRANTEE = '" + txtEdit_username.Text + "'", orcCont);
                DataTable         dtb3     = new DataTable();
                orcData3.Fill(dtb3);
                dgvTbl.DataSource          = dtb3;
                dgvTbl.AutoSizeColumnsMode = (DataGridViewAutoSizeColumnsMode)DataGridViewAutoSizeColumnMode.Fill;


                OracleDataAdapter orcData4 = new OracleDataAdapter("select TABLE_NAME, COLUMN_NAME, PRIVILEGE from USER_COL_PRIVS WHERE GRANTEE = '" + txtEdit_username.Text + "'", orcCont);
                DataTable         dtb4     = new DataTable();
                orcData4.Fill(dtb4);
                dgvCol.DataSource          = dtb4;
                dgvCol.AutoSizeColumnsMode = (DataGridViewAutoSizeColumnsMode)DataGridViewAutoSizeColumnMode.Fill;


                orcCont.Close();
            }
        }
    private void total_seleccion()
    {
        String rutaXml = Server.MapPath("./sessiones/") + "usuario_" + Session.SessionID + ".xml";

        PRO.recSession(rutaXml, "RUT_EMPRESA");
        String rutRegion = PRO.recSession(rutaXml, "RUT_EMPRESA");

        OracleConnection  objConexion = new OracleConnection(conexion_cliente_oracle);
        OracleDataAdapter objComando;
        DataTable         dtOrdenes = new DataTable();


        objComando = new OracleDataAdapter("REPORTE_EFEC_MED.TOTAL_SELECCION", objConexion);


        PRO.agrega_parametro_sp(objComando, "o_cursor", OracleType.Cursor, ParameterDirection.Output, "");
        PRO.agrega_parametro_sp(objComando, "i_rut_empresa", OracleType.NVarChar, ParameterDirection.Input, rutRegion);
        PRO.agrega_parametro_sp(objComando, "i_id_zona", OracleType.Number, ParameterDirection.Input, ddZona.SelectedValue);
        PRO.agrega_parametro_sp(objComando, "i_id_region", OracleType.Number, ParameterDirection.Input, ddRegion.SelectedValue);
        PRO.agrega_parametro_sp(objComando, "i_id_localidad", OracleType.Number, ParameterDirection.Input, ddLocalidad.SelectedValue);
        PRO.agrega_parametro_sp(objComando, "i_cod_instalador", OracleType.Number, ParameterDirection.Input, ddlTrabajador.SelectedValue);
        PRO.agrega_parametro_sp(objComando, "i_id_contratista", OracleType.Number, ParameterDirection.Input, combo_contratista.SelectedValue);
        PRO.agrega_parametro_sp(objComando, "i_id_tipo_proceso", OracleType.Number, ParameterDirection.Input, ddlProceso.SelectedValue);
        PRO.agrega_parametro_sp(objComando, "i_FECHA_INICIO", OracleType.NVarChar, ParameterDirection.Input, txtDesde.Text);
        PRO.agrega_parametro_sp(objComando, "i_FECHA_FIN", OracleType.NVarChar, ParameterDirection.Input, txtHasta.Text);

        objComando.SelectCommand.CommandType = CommandType.StoredProcedure;
        objConexion.Open();
        objComando.Fill(dtOrdenes);
        objConexion.Close();
        objConexion.Dispose();

        foreach (DataRow drOrdenItem in dtOrdenes.Rows)
        {
            lblTotales.Text = drOrdenItem["TOTAL"].ToString();
        }
    }
Пример #53
0
        public void ExportToExcell()
        {
            DataTable dt = new DataTable();

            dt.TableName = "Categories";
            using (OracleConnection con = new OracleConnection(AppConfig.ConnectionString))
            {
                con.Open();
                using (OracleCommand cmd = con.CreateCommand())
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = SqlQueries.Category.GetAll;
                    OracleDataAdapter oda = new OracleDataAdapter(cmd);
                    oda.Fill(dt);
                }
            }

            using (XLWorkbook wb = new XLWorkbook())
            {
                wb.Worksheets.Add(dt);
                wb.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
                wb.Style.Font.Bold            = true;

                Response.Clear();
                Response.Buffer      = true;
                Response.Charset     = "";
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Response.AddHeader("content-disposition", "attachment;filename= Categories Report.xlsx");

                using (MemoryStream memoryStream = new MemoryStream())
                {
                    wb.SaveAs(memoryStream);
                    memoryStream.WriteTo(Response.OutputStream);
                    Response.End();
                }
            }
        }
Пример #54
0
        private void loadDataGridView()
        {
            string sql = "select e.id, e.serialNumber, e.goodsName, e.specifications, e.unit, e.goodsWeight, e.goodsNum ,f.nums as ordernums "
                         + " from zc_processgoods_items e left join (select sum(nums) as nums,wasterate,goods_state,name,goods_specifications,serialNumber,goodsfile_id "
                         + " from (select b.goodstype_id,b.wasterate,a.createtime,a.goods_state,a.name, "
                         + " a.nums,b.goods_specifications,b.id as goodsfile_id,b.serialNumber "
                         + " from ZC_ORDER_process_ITEM a left join ZC_ORDER_process e on e.id = a.order_id "
                         + " left join zc_goods_master b on a.goodsfile_id = b.id where a.goods_state = '2' "
                         + " )group by name,wasterate,goods_specifications,serialNumber,goodsfile_id,goods_state order by serialNumber asc "
                         + " )f on e.serialNumber = f.serialnumber where e.processgoodsId = :processId "
                         + " and e.typeflag = '2' order by e.UPDATETIME desc ";
            DataSet          ds   = new DataSet();
            OracleConnection conn = null;
            OracleCommand    cmd  = new OracleCommand();

            try
            {
                conn            = OracleUtil.OpenConn();
                cmd.CommandText = sql;
                cmd.Connection  = conn;
                cmd.Parameters.Add(":processId", processGoodsId);
                OracleDataAdapter da = new OracleDataAdapter(cmd);
                da.Fill(ds, "zc_processgoods_items");
                this.itemDataGird.DataSource          = ds;
                this.itemDataGird.DataMember          = "zc_processgoods_items";
                this.itemDataGird.AutoGenerateColumns = false;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                cmd.Dispose();
                OracleUtil.CloseConn(conn);
            }
        }
Пример #55
0
    private void Llena_combo_codContratista(string IDPerfil, string EMPRESA_USER)
    {
        string    sql_empresas;
        DataTable dtEmpresas = new DataTable();

        sql_empresas = "select * from CONTRATISTA"; // Para rellenar combo
        OracleDataAdapter objComando_Empresa;

        objComando_Empresa = new OracleDataAdapter(sql_empresas, conexion_cliente_oracle);
        objComando_Empresa.Fill(dtEmpresas);
        string valueCombo, textoCombo;

        comboCodContratista.Items.Clear();

        if (IDPerfil == "3")
        {
            foreach (DataRow drEmpresaItem in dtEmpresas.Rows)
            {
                valueCombo = drEmpresaItem["cod_contratista"].ToString();
                textoCombo = drEmpresaItem["nombre"].ToString();
                comboCodContratista.Items.Add(new ListItem(textoCombo, valueCombo));
            }
        }

        if (IDPerfil == "1")
        {
            foreach (DataRow drEmpresaItem in dtEmpresas.Rows)
            {
                if (EMPRESA_USER == drEmpresaItem["nombre"].ToString())
                {
                    valueCombo = drEmpresaItem["cod_contratista"].ToString();
                    textoCombo = drEmpresaItem["nombre"].ToString();
                    comboCodContratista.Items.Add(new ListItem(textoCombo, valueCombo));
                }
            }
        }
    }
Пример #56
0
    internal string validadacion_RUT_PERFIL(string P_ID_PERFIL, string P_RUT_USUARIO)
    {
        string            resp;
        OracleConnection  CnOra     = new OracleConnection(conexion_cliente_oracle);
        OracleCommand     cmdAcceso = new OracleCommand("PK_USUARIO.VALIDA_RUT_PERFIL_AGREGA", CnOra);
        OracleDataAdapter da        = new OracleDataAdapter(cmdAcceso);

        PRO.agrega_parametro_sp(da, "o_cursor", OracleType.Cursor, ParameterDirection.Output, "");
        PRO.agrega_parametro_sp(da, "i_id_perfil", OracleType.Int32, ParameterDirection.Input, P_ID_PERFIL);
        PRO.agrega_parametro_sp(da, "i_rut", OracleType.NVarChar, ParameterDirection.Input, P_RUT_USUARIO);

        da.SelectCommand.CommandType = CommandType.StoredProcedure;
        CnOra.Open();
        DataSet dsUsuarios = new DataSet();

        da.Fill(dsUsuarios, "ASIGNACIONES");
        CnOra.Close();
        CnOra.Dispose();

        if (dsUsuarios.Tables["ASIGNACIONES"].Rows.Count != 0)
        {
            //Response.Write("<script>")
            //Response.Write("alert('Eliminación Denegada, Lector tiene asignaciones relacionadas!');")
            //Response.Write("</script>")
            //Response.Write("Nombre de Usuario Existe en la Base de Datos! Elija Otro.")
            resp = "EL RUT DE USUARIO YA EXISTE PARA ESTE PERFIL!";
            return(resp);
        }
        else
        {
            //Response.Write("<script>")
            //Response.Write("if (confirm('Mensaje de confirmación !  \n \n Esta seguro que desea eliminar el registro del Lector Seleccionado ?')) { document.location.href='EliminarLector.aspx?idlector=" & GrillaLectores.Items(indice).Cells(0).Text & "'; }")
            //Response.Write("</script>")
            resp = "OK";
            return(resp);
        }
    }
Пример #57
0
        protected void ddlFaculty_SelectedIndexChanged(object sender, EventArgs e)
        {
            try {
                using (OracleConnection sqlConn = new OracleConnection(DatabaseManager.CONNECTION_STRING)) {
                    using (OracleCommand sqlCmd = new OracleCommand()) {
                        sqlCmd.CommandText = "select * from TB_DIVISION where FACULTY_ID = " + ddlFaculty.SelectedValue;
                        sqlCmd.Connection  = sqlConn;
                        sqlConn.Open();
                        OracleDataAdapter da = new OracleDataAdapter(sqlCmd);
                        DataTable         dt = new DataTable();
                        da.Fill(dt);
                        ddlDivision.DataSource     = dt;
                        ddlDivision.DataValueField = "DIVISION_ID";
                        ddlDivision.DataTextField  = "DIVISION_NAME";
                        ddlDivision.DataBind();
                        sqlConn.Close();

                        ddlDivision.Items.Insert(0, new ListItem("--กรุณาเลือกกอง / สำนักงานเลขา / ภาควิชา--", "0"));
                        ddlWorkDivision.Items.Clear();
                        ddlWorkDivision.Items.Insert(0, new ListItem("--กรุณาเลือกงาน / ฝ่าย--", "0"));
                    }
                }
            } catch { }
        }
Пример #58
0
 public List<Rol> listarRol()
 {
     List<Rol> Rol = null;
     ora.Open();
     OracleCommand comando = new OracleCommand("SP_LISTAR_ROL", ora);
     comando.CommandType = System.Data.CommandType.StoredProcedure;
     comando.Parameters.Add("rol", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
     OracleDataAdapter da = new OracleDataAdapter(comando);
     DataSet ds = new DataSet();
     da.Fill(ds);
     if (ds.Tables.Count > 0)
     {
         DataTable dt = ds.Tables[0];
         Rol = (from DataRow row in dt.Rows
                select new Rol
                {
                    ID_ROL = short.Parse(row["ID_ROL"].ToString()),
                    TIPO = row["TIPO"].ToString(),
                    ESTADO = row["ESTADO"].ToString()                                                      
                }).ToList();
     }
     ora.Close();
     return Rol;
 }
        private void Form1_Load(object sender, EventArgs e)
        {
            string oradb = "Data Source=localhost:1521/XE; User Id=SYSTEM;Password=1";

            oc = new OracleConnection(oradb);
            oc.Open();
            ds = new DataSet();
            comboBox1.SelectedIndex = 0;

            // заполнение groupBox'а названиями стадионов
            ds  = new DataSet();
            oda = new OracleDataAdapter("select title from football_stadiums order by id_stadium", oc);
            oda.Fill(ds);
            dataGridView6.DataSource = ds.Tables[0];

            for (int i = 0; i < dataGridView6.RowCount - 1; ++i)
            {
                comboBox2.Items.Add(dataGridView6[0, i].Value.ToString());
                comboBox6.Items.Add(dataGridView6[0, i].Value.ToString());
            }

            // заполнение groupBox'ов названиями команд
            ds  = new DataSet();
            oda = new OracleDataAdapter("select name_team from football_teams order by id_team", oc);
            oda.Fill(ds);
            dataGridView6.DataSource = ds.Tables[0];

            for (int i = 0; i < dataGridView6.RowCount - 1; ++i)
            {
                comboBox3.Items.Add(dataGridView6[0, i].Value.ToString());
                comboBox4.Items.Add(dataGridView6[0, i].Value.ToString());
            }
            comboBox2.SelectedIndex = 0;
            comboBox3.SelectedIndex = 0;
            comboBox4.SelectedIndex = 1;
        }
Пример #60
-2
        public static DataTable ExecuteDataTable(string connectionString, CommandType cmdType, string cmdText, params OracleParameter[] commandParameters)
        {
            using (OracleConnection connection = new OracleConnection(connectionString))
            {
                OracleCommand cmd = new OracleCommand();

                try
                {
                    PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
                    OracleDataAdapter MyAdapter = new OracleDataAdapter();
                    MyAdapter.SelectCommand = cmd;
                    DataSet ds = new DataSet();
                    MyAdapter.Fill(ds);
                    cmd.Parameters.Clear();
                    DataTable table = ds.Tables[0];
                    ds.Dispose();
                    connection.Close();
                    return table;
                }
                catch
                {
                    connection.Close();
                    throw;
                }
            }
        }