Clear() public method

Clears the of any data by removing all rows in all tables.
public Clear ( ) : void
return void
Example #1
1
        static void Main(string[] args)
        {
     // Создание Таблицы DataTable с именем "Cars"
            DataTable tablCars = new DataTable("Cars");
            // Создание столбцов
            DataColumn carsId = new DataColumn("Id", typeof(int));
            DataColumn carsName = new DataColumn("Name", typeof(string));
            DataColumn carsCountry = new DataColumn("Country", typeof(string));
            DataColumn carsPrice = new DataColumn("Price", typeof(double));
            tablCars.Columns.AddRange(new DataColumn[] { carsId, carsName, carsCountry, carsPrice });
            // Создание строки с данными 
            DataRow newRow1 = tablCars.NewRow();
            newRow1["Name"] = "BMW"; newRow1["Country"] = "Germany";
            newRow1["Price"] = "50000";
            tablCars.Rows.Add(newRow1);

            DataRow newRow2 = tablCars.NewRow();
            newRow2["Name"] = "Audi"; newRow2["Country"] = "Germany";
            newRow2["Price"] = "37500";
            tablCars.Rows.Add(newRow2);

            // Сохранить ТАБЛИЦЫ  tablCars  в виде XML
            tablCars.WriteXml("Cars.xml");
            tablCars.WriteXmlSchema("CarsSchema.xsd");
         

      // Создание Таблицы DataTable с именем "Drivers"
            DataTable tablDrivers = new DataTable("Drivers");
            // Создание столбцов
            DataColumn drId = new DataColumn("Id", typeof(int));
            DataColumn drName = new DataColumn("Name", typeof(string));
            DataColumn drAge = new DataColumn("Age", typeof(string));
            tablDrivers.Columns.AddRange(new DataColumn[] { drId, drName, drAge });
            // Создание строки с данными 
            DataRow newRow3 = tablDrivers.NewRow();
            newRow3["Name"] = "Ivan"; newRow3["Age"] = "33";
            tablDrivers.Rows.Add(newRow3);

            DataSet dataSet = new DataSet("AutoPark");
            dataSet.Tables.AddRange(new DataTable[] { tablCars, tablDrivers});


            // Сохранить DATASET  в виде XML
            dataSet.WriteXmlSchema("AutoParkSchema.xsd");
            dataSet.WriteXml("AutoPark.xml");
            
            
            // Очистить DataSet.
            dataSet.Clear();

            Console.WriteLine("XML успешно сформированы!");

            Console.ReadKey();

        }
 /// <summary>
 /// 根据sql查询数据
 /// </summary>
 /// <param name="xmlIndex">查询主索引 </param>
 /// <param name="strWhere">筛选条件</param>
 /// <returns></returns>
 public int SearchInfo(string xmlIndex, string strWhere)
 {
     try
     {
         if (ds != null)
         {
             ds.Clear();//清空
         }
         else
         {
             ds = new System.Data.DataSet();
         }
         SearMan.GetSearchInfo(xmlIndex, ds, strWhere);
         if (ds != null)
         {
             if (ds.Tables.Count > 0)
             {
                 this.fpSpread1_Sheet1.DataSource = ds.Tables[0];
             }
         }
         LockFp();
         return(0);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(-1);
     }
 }
Example #3
0
        void btnClose_Click(object sender, EventArgs e)
        {
            using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand("doCloseFinancialperiod", connect)
                {
                    CommandType = CommandType.StoredProcedure
                };
                _command.Parameters.Add(new SqlParameter("@period", SqlDbType.VarChar)).Value = cboMonth.SelectedValue;
                _command.Parameters.Add(new SqlParameter("@years", SqlDbType.VarChar)).Value  = cboYear.SelectedValue;

                using (System.Data.DataSet ds = new System.Data.DataSet())
                {
                    ds.Clear();
                    adp = new SqlDataAdapter(_command);
                    adp.Fill(ds);
                    connect.Close();

                    if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                    {
                        Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                        return;
                    }
                    else
                    {
                        Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                        return;
                    }
                }
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                Session["voter"] = TextBox2.Text;
                Session["voter_nic"] = TextBox1.Text;

                ds = new DataSet();
                SqlDataAdapter ad = new SqlDataAdapter("select * from reg where nic =" + TextBox1.Text + " and fam=" + TextBox2.Text, con);
                SqlCommandBuilder cb = new SqlCommandBuilder(ad);
                ds.Clear();
                ad.Fill(ds);

                if (ds.Tables[0].Rows.Count == 0)
                {

                    Response.Redirect("login_voter.aspx");
                    Label1.Text="Invalid Username Or Password";
                    // Response.Write(" <script >alert ('Wrong') </script>");

                }
                else
                {
                    //Response.Write(" <script >alert ('congrates') </script>");

                    Response.Redirect("voter_Home.aspx");
                    con.Close();

                }
            }
            catch(Exception ex){
             Label1.Text="Invalid Username Or Password";
            }
        }
Example #5
0
        void setloadOffice()
        {
            sessions = new SessionManager();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(String.Format("SELECT  LTRIM(RTRIM(RevenueOfficeName)) RevenueOfficeName,RevenueOfficeID FROM Setting.RevenueOffice WHERE MerchantCode='{0}' ORDER BY  LTRIM(RTRIM(RevenueOfficeName)) ASC ", sessions.MerchantCode.ToString()), connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1)
            {
                gridOffence.DataSource = responses.Tables[0];
                gridOffence.DataBind();
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["Nordwind"].ConnectionString;
            var selectStatement = "SELECT * FROM Categories";
            using (SqlConnection connection = new SqlConnection(connectionString)) {
                using (SqlCommand command = new SqlCommand(selectStatement)) {
                    command.Connection = connection;
                    SqlDataAdapter adapter = new SqlDataAdapter(command);
                    DataSet ds = new DataSet();
                    connection.Open();
                    adapter.Fill(ds, "Categories");
                    ds.WriteXml("ds.xml"); // Save this DataSet as XML
                    ds.WriteXmlSchema("ds.xsd");
                    ds.Clear();

                    ds.ReadXml("ds.xml");
                    DataTable categories = ds.Tables["Categories"];
                    foreach(DataRow item in categories.Rows)
                    {
                        Console.WriteLine("id: {0},    {1} {2}:",
                            item["CategoryID"],
                            item["CategoryName"],
                            item["Description"]);
                    }
                    Console.ReadLine();
                }
            }
        }
Example #7
0
        public static string GetTaxAgent()
        {
            SessionManager sessions = null;

            sessions = new SessionManager();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(String.Format("SELECT DISTINCT TaxAgentUtin,RTRIM(LTRIM(TaxAgentName)) TaxAgentName FROM vwTaxAgents  WHERE MerchantCode='{0}' and TaxAgentName IS NOT NULL ORDER BY TaxAgentName ASC ", sessions.MerchantCode.ToString()), connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            return(JsonConvert.SerializeObject(responses));
        }
Example #8
0
        //[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public static string GetOffices()
        {
            SessionManager sessions = null;

            sessions = new SessionManager(); String daresult = null;

            CollectionRanking bn = new CollectionRanking();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(String.Format("SELECT  LTRIM(RTRIM(RevenueOfficeName)) RevenueOfficeName,RevenueOfficeID FROM Setting.RevenueOffice WHERE MerchantCode='{0}' ORDER BY  LTRIM(RTRIM(RevenueOfficeName)) ASC ", sessions.MerchantCode.ToString()), connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }
            return(JsonConvert.SerializeObject(responses));
        }
 public DataSet GetAll(string empresaid, tb_cm_ordendecompradet BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCmOrdendecompradet_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                 cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local;
                 cmd.Parameters.Add("@tipodoc", SqlDbType.Char, 2).Value = BE.tipodoc;
                 cmd.Parameters.Add("@serdoc", SqlDbType.Char, 4).Value = BE.serdoc;
                 cmd.Parameters.Add("@numdoc", SqlDbType.Char, 10).Value = BE.numdoc;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     ds.Clear();
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
Example #10
0
        void setloadOffice()
        {
            sessions = new SessionManager();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(String.Format("SELECT DISTINCT TaxAgentUtin,RTRIM(LTRIM(TaxAgentName)) TaxAgentName FROM vwTaxAgents  WHERE MerchantCode='{0}' and TaxAgentName IS NOT NULL ORDER BY TaxAgentName ASC ", sessions.MerchantCode.ToString()), connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            //if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1)
            //{
            //    gridOffence.DataSource = responses.Tables[0];
            //    gridOffence.DataBind();
            //}
        }
        // 2 methodes:
        // - Lezen uit database
        // - Uitvoeren ander command (update, insert, delete)
        public static DataTable ExecuteSelect(string SQL)
        {
            // Aanmaken van dataset
            // Hierin komt de uitvoer (=dynaset) van de query
            DataSet DS = new DataSet();

            // Aanmaken dataAdapter
            // Deze zorgt voor de vertaling van SQL naar C#
            // Denk maar aan een soort tolk
            SqlDataAdapter DA;

            // Het configureren van de dataAdapter
            DA = new SqlDataAdapter(SQL, clStam.Connstr);

            // Voordat je een dataset gaat gebruiken moet je deze leegmaken
            DS.Clear();

            // Gebruik de dataAdapter om de dataset te vullen
            DA.Fill(DS);

            // Pak uit de dataset de EERSTE tabel omdat de dataset leeg was, is dit het resultaat van de query
            DataTable DT = DS.Tables[0];

            // Geef de datatable terug
            return DT;
        }
Example #12
0
        public void AutoIncrementColumns()
        {
            execSQL("DROP TABLE IF EXISTS Test");
            execSQL("CREATE TABLE Test (id int(10) unsigned NOT NULL auto_increment primary key)");
            execSQL("INSERT INTO Test VALUES(NULL)");

            MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Test", conn);
            MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
            DataSet ds = new DataSet();
            da.Fill(ds);
            Assert.AreEqual(1, ds.Tables[0].Rows[0]["id"]);
            DataRow row = ds.Tables[0].NewRow();
            ds.Tables[0].Rows.Add(row);

            try
            {
                da.Update(ds);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }

            ds.Clear();
            da.Fill(ds);
            Assert.AreEqual(1, ds.Tables[0].Rows[0]["id"]);
            Assert.AreEqual(2, ds.Tables[0].Rows[1]["id"]);
            cb.Dispose();
        }
Example #13
0
        public int GetSampleProgram_ID(string strSample_ID)
        {
            int nProgram_ID = -1;
            int nCountDetections = 0;
            string SQL_Statement = "Select Detection,Name,idsample_programs FROM sample_programs ";
            DataSet ds_SamplePrograms = new DataSet();
            ds_SamplePrograms.Clear();

            ds_SamplePrograms = myHC.GetDataSetFromSQLCommand(SQL_Statement);
            DataTable dt_SamplePrograms = null;
            if (ds_SamplePrograms.Tables[0] != null)
            {
                dt_SamplePrograms = ds_SamplePrograms.Tables[0];
                foreach (DataRow dr_SampleProgram in dt_SamplePrograms.Rows)
                {
                    if (CheckDetection(dr_SampleProgram["Detection"].ToString(), strSample_ID))
                    {
                        nProgram_ID = (int)dr_SampleProgram["idsample_programs"];
                        nCountDetections++;
                        mySave.InsertRow((int)Definition.Message.D_MESSAGE, strSample_ID + " match to " + dr_SampleProgram["Detection"].ToString() + "   --> Program " + dr_SampleProgram["Name"].ToString() + "");
                    }
                }
            }
            if(nProgram_ID == -1)
            {
                nProgram_ID = GetDefaultProgram();
                mySave.InsertRow((int)Definition.Message.D_ALARM,  @"no match for " + strSample_ID + " found in program detection pool, got "
                 + myHC.GetNameFromID((int)Definition.SQLTables.SAMPLE_PROGRAM,nProgram_ID) + " (id:"  + nProgram_ID + ") as default");

            }
              //  MessageBox.Show(nProgram_ID.ToString());
            if (nCountDetections > 1) { mySave.InsertRow((int)Definition.Message.D_ALARM, "found more than one(" + nCountDetections + ") matches to " + strSample_ID + " in programm detection pool"); }
            return nProgram_ID;
        }
        public void fnPopulatedgv1()
        {
            //  Show default datagrid - Hap[pens to be a Donations file at the moment - Change CRH???

            SqlConnection conDGV1;
            SqlDataAdapter daDGV1;
            DataSet dsdgv1 = new DataSet();

            conDGV1 = new SqlConnection(VARtxtGAPConnection);
            dsdgv1.Clear();
            conDGV1.Open();

            daDGV1 = new SqlDataAdapter("select * from vw_RECENT_BUILDS", conDGV1);

            daDGV1.Fill(dsdgv1);
            conDGV1.Close();
            conDGV1.Dispose();
            dgv1.DataSource = dsdgv1.Tables[0];

            // Code to force seconds to be shown
            // http://social.msdn.microsoft.com/Forums/en-US/2055d187-1d71-4771-8113-d590f62731b6/datagridviewcolumn-display-datetime-with-seconds-milliseconds-?forum=winforms
            foreach (DataGridViewColumn dc in dgv1.Columns)
            {

                if (dc.ValueType == typeof(System.DateTime))
                {

                    dc.DefaultCellStyle.Format = "dd/MM/yyyy HH:mm:ss";

                }
            }

            // Resize columns in datagrid
            dgv1.AutoResizeColumns();
        }
Example #15
0
        void calReport()
        {
            var vrsearch = Session["Search"].ToString();

            XtraRepTCCDetailsbyAll obj_Rpt = new XtraRepTCCDetailsbyAll();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            string strquery = String.Format("SELECT * FROM dbo.ViewTccDetails  where Utin ='{0}' OR PayerName LIKE '{0}%' ", vrsearch);

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 0)
            {
                obj_Rpt.xrLabel10.Text    = string.Format("By Individual Record Search");
                obj_Rpt.Report.DataSource = responses;
                obj_Rpt.Report.DataMember = responses.Tables[0].TableName;

                ASPxWebDocumentViewer1.OpenReport(obj_Rpt);
            }
        }
 public static DataSet SortDataSet(DataSet ds,DataView view)
 {
     ds.Clear();
     DataRow dr;
     foreach (DataRowView row in view)
     {
         dr = ds.Tables[0].NewRow();
         dr["ID"] = row["ID"];
         dr["NV_ID"] = row["NV_ID"];
         dr["TEN_NV"] = row["TEN_NV"];
         dr["NGAY_DAU_TUAN"] = row["NGAY_DAU_TUAN"];
         dr["ST2"] = row["ST2"];
         dr["CT2"] = row["CT2"];
         dr["ST3"] = row["ST3"];
         dr["CT3"] = row["CT3"];
         dr["ST4"] = row["ST4"];
         dr["CT4"] = row["CT4"];
         dr["ST5"] = row["ST5"];
         dr["CT5"] = row["CT5"];
         dr["ST6"] = row["ST6"];
         dr["CT6"] = row["CT6"];
         dr["ST7"] = row["ST7"];
         dr["CT7"] = row["CT7"];
         if(ds.Tables[0].Select("NV_ID=" + HelpNumber.ParseInt64(row["NV_ID"])).Length==0)
             ds.Tables[0].Rows.Add(dr);
     }
     return ds;
 }
        public void CargarDatos(ComboBox cmb, DataSet data, String str,String consulta)
        {
            try
            {
                Command.CommandText = consulta;
                Adapter.SelectCommand = Command;
                data.Clear();
                Adapter.Fill(data, str);

                cmb.Items.Clear();
                foreach (DataRow r in data.Tables[0].Rows)
                {
                    if (r[1].ToString() != "")
                    {
                        cmb.Items.Add(r[2].ToString() + " - " + r[1].ToString() + "," + r[0].ToString());
                    }
                    else
                    {
                        cmb.Items.Add(r[2].ToString() + " - " + r[0].ToString());
                    }
                }
            }
            catch { }
          
        }
Example #18
0
        DataSet dts()
        {
            sessions = new SessionManager();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            var stringstin = Session["STIN"].ToString();


            string strquery = String.Format("SELECT * FROM ViewCertificateInformation WHERE MerchantCode='{0}' AND PayerUtin= '{1}'", sessions.MerchantCode.ToString(), stringstin.ToString());


            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1)
            {
            }

            return(responses);
        }
Example #19
0
 private void UpdateMySQLData()
 {
     try
     {
         if (con == null)
         {
             con = new MySql.Data.MySqlClient.MySqlConnection(sqlstr);
             con.Open();
         }
         if (adapter == null)
         {
             adapter = new MySql.Data.MySqlClient.MySqlDataAdapter("select * from QQHotList", con);
         }
         if (ds == null)
         {
             ds = new System.Data.DataSet();
         }
         ds.Clear();
         adapter.Fill(ds, "QQHotList");
         if (dt == null)
         {
             dt = ds.Tables["QQHotList"];
         }
         Mic_List.ItemsSource = dt.DefaultView;
         con.Close();
     }
     catch
     {
         MessageBox.Show("歌单获取失败,请重新启动……");
     }
 }
        protected void Button1_Click1(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(3000);
            if (TextBox1.Text == "" && TextBox2.Text == "")
            {
                Label1.Text = "Invalid ID or Password";
            }
            else
            {
                Session["a"] = TextBox1.Text;

                ds = new DataSet();
                SqlDataAdapter ad = new SqlDataAdapter("select * from adm_info where username ='******' and pass='******'", con);
                SqlCommandBuilder cb = new SqlCommandBuilder(ad);
                ds.Clear();
                ad.Fill(ds);

                if (TextBox2.Text == "" || ds.Tables[0].Rows.Count == 0)
                {

                    Label1.Text = "Invalid ID or Password";

                }
                else
                {
                    //Response.Write(" <script >alert ('congrates') </script>");

                    Response.Redirect("default.aspx");
                    con.Close();

                }
                Label1.Text = "Invalid ID or Password";
            }
        }
Example #21
0
        void loadRevenue()
        {
            //ViewRevenue
            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            string strquery = String.Format("SELECT  RevenueCode, RevenueName FROM ViewRevenue WHERE AgencyId ='{0}' ", ddlAgency.SelectedValue.ToString());

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1)
            {
                ddlRevenue.DataSource     = responses.Tables[0];
                ddlRevenue.DataValueField = "RevenueCode";
                ddlRevenue.DataTextField  = "RevenueName";
                ddlRevenue.DataBind();
                ddlRevenue.Items.Insert(0, new ListItem("--- Select Revenue Name ---", "0"));
            }
        }
        void calReport()
        {
            var varyear = Session["TaxYear"].ToString();

            XtraRepTccYearSummaryChild obj_Rpt = new XtraRepTccYearSummaryChild();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            string strquery = String.Format("SELECT RevenueOfficeId, RevenueOfficeName, COUNT( DISTINCT TccNo) Reccount,   COUNT(DISTINCT CASE WHEN IncomeSourceClassifyId = 1 THEN TccNo END) AS DA, COUNT(DISTINCT CASE WHEN IncomeSourceClassifyId = 2 THEN TccNo END) AS PA, COUNT( DISTINCT CASE WHEN IncomeSourceClassifyId = 3 THEN TccNo END) AS PN, COUNT(DISTINCT CASE WHEN IncomeSourceClassifyId = 4 THEN TccNo END) AS ST, COUNT(DISTINCT CASE WHEN IncomeSourceClassifyId = 5 THEN TccNo END ) AS NR, COUNT(DISTINCT CASE WHEN IncomeSourceClassifyId = 6 THEN  TccNo END ) AS UE, COUNT(DISTINCT CASE WHEN IncomeSourceClassifyId = 7 THEN TccNo END) AS DU FROM dbo.ViewTccDetails WHERE YEAR(IssuedDate)='{0}' AND AssessmentYear = YEAR(IssuedDate) - 1 GROUP BY RevenueOfficeId,  RevenueOfficeName", varyear);

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 0)
            {
                obj_Rpt.xrLabel11.Text    = string.Format("{0}", varyear);
                obj_Rpt.Report.DataSource = responses;
                obj_Rpt.Report.DataMember = responses.Tables[0].TableName;

                ASPxWebDocumentViewer1.OpenReport(obj_Rpt);
            }
        }
        public void llenaGrid()
        {

            DataSet dsGrid = new DataSet();
            dsGrid.Clear();
       
            if (cbGrupo.SelectedValue != null)
            {

                int selectedValue = ((ComboBoxItem)cbGrupo.SelectedItem).intValue;

                dsGrid = datamanager.ConsultaDatos("exec dbo.[segGrupoMiembro] " + selectedValue.ToString());

                dataGrid.IsReadOnly = !permiteModificar;

                dataGrid.ItemsSource = dsGrid.Tables[0].DefaultView;
                dataGrid.Columns[2].Visibility = System.Windows.Visibility.Hidden;
                dataGrid.Columns[3].Visibility = System.Windows.Visibility.Hidden;
                dataGrid.Columns[4].Visibility = System.Windows.Visibility.Hidden;
             
                dataGrid.Columns[0].Width = 250;
                dataGrid.Columns[0].IsReadOnly = true;
                dataGrid.Columns[0].Header = "Usuario";
                dataGrid.Columns[1].Header = "Miembro";

                datamanager.ConexionCerrar();
            }

            btnAceptar.IsEnabled = false;
            btnAceptar_png.IsEnabled = false;
        }
Example #24
0
        DataSet getuserrequest(string strrequest)
        {
            SqlCommand _command;

            SqlDataAdapter _adp;

            System.Data.DataSet response = new System.Data.DataSet();

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                if (connect.State != ConnectionState.Closed)
                {
                    connect.Close();
                }

                connect.Open();
                _command = new SqlCommand("GetMerchantMailSetting", connect)
                {
                    CommandType = CommandType.StoredProcedure
                };
                _command.Parameters.Add(new SqlParameter("@strul", SqlDbType.VarChar)).Value = strrequest;
                _command.CommandTimeout = 0;
                response.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(response);

                connect.Close();
            }

            return(response);
        }
Example #25
0
        public static string GetAgency()
        {
            SessionManager sessions = null;

            sessions = new SessionManager(); String daresult = null;

            CollectionRanking bn = new CollectionRanking();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(String.Format("SELECT AgencyCode,AgencyName FROM ViewAgency ORDER BY AgencyName ASC "), connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            return(JsonConvert.SerializeObject(responses));
        }
        void loadAssementyearto()
        {
            //ViewAgency

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            string strquery = String.Format("SELECT AssessmentYear FROM [dbo].[ViewAssessmentYear]");

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1)
            {
                ddlto.DataSource     = responses.Tables[0];
                ddlto.DataValueField = "AssessmentYear";
                ddlto.DataTextField  = "AssessmentYear";
                ddlto.DataBind();
                ddlto.Items.Insert(0, new ListItem("--- Select Year To ---", "0"));
            }
        }
Example #27
0
        void deleteRecord(string parameter2)
        {
            using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand("doDeleteReconciliationPeriod", connect)
                {
                    CommandType = CommandType.StoredProcedure
                };
                _command.Parameters.Add(new SqlParameter("@periodID", SqlDbType.Int)).Value = Convert.ToInt32(parameter2);
                _command.CommandTimeout = 0;
                using (System.Data.DataSet ds = new System.Data.DataSet())
                {
                    ds.Clear();
                    adp = new SqlDataAdapter(_command);
                    adp.Fill(ds);
                    connect.Close();

                    if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                    {
                        Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                        return;
                    }
                    else
                    {
                        Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);
                        return;
                    }
                }
            }
        }
        void calReport()
        {
            var varyear = Session["TaxYear"].ToString();

            XtraRepAssessmentYearSummaryChild obj_Rpt = new XtraRepAssessmentYearSummaryChild();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            string strquery = String.Format("SELECT a.AssessmentYear, a.RevenueOfficeName,a.RevenueOfficeId, COUNT(DISTINCT a.AssessmentNo) AS Reccount, SUM(a.TaxPayable) TotalPayable, COUNT(DISTINCT CASE  WHEN a.IncomeSourceClassifyId = 1 THEN a.AssessmentNo END ) AS DA, COUNT(DISTINCT CASE WHEN a.IncomeSourceClassifyId = 2 THEN a.AssessmentNo END) AS PA, COUNT(DISTINCT CASE WHEN a.IncomeSourceClassifyId = 3 THEN  a.AssessmentNo END ) AS PN,COUNT(DISTINCT CASE WHEN a.IncomeSourceClassifyId = 4 THEN a.AssessmentNo  END ) AS ST, COUNT(DISTINCT CASE WHEN a.IncomeSourceClassifyId = 5 THEN a.AssessmentNo END ) AS NR, COUNT(DISTINCT CASE WHEN a.IncomeSourceClassifyId = 6 THEN a.AssessmentNo END) AS UE,COUNT(DISTINCT CASE WHEN a.IncomeSourceClassifyId = 7 THEN a.AssessmentNo END) AS DU, COALESCE(SUM( CASE WHEN a.IncomeSourceClassifyId = 1 THEN a.TaxPayable END), 0) DAAmount,COALESCE(SUM(CASE WHEN a.IncomeSourceClassifyId = 2 THEN a.TaxPayable END),0) PAAmount,COALESCE(SUM(CASE WHEN a.IncomeSourceClassifyId = 3 THEN a.TaxPayable END ), 0) PNAmount,COALESCE(SUM( CASE WHEN a.IncomeSourceClassifyId = 4 THEN a.TaxPayable END ),0 ) STAmount, COALESCE(SUM(CASE WHEN a.IncomeSourceClassifyId = 5 THEN a.TaxPayable END),0) NRAmount,COALESCE(SUM( CASE WHEN a.IncomeSourceClassifyId = 6 THEN a.TaxPayable END),0) UEAmount,COALESCE(SUM( CASE WHEN a.IncomeSourceClassifyId = 7 THEN a.TaxPayable END),0) DUAmount FROM ViewAssessmentInfor a WHERE a.AssessmentYear = {0}  GROUP BY  a.AssessmentYear, a.RevenueOfficeName,a.RevenueOfficeId ORDER BY a.RevenueOfficeName asc", varyear);

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 0)
            {
                obj_Rpt.xrLabel11.Text    = string.Format("{0}", varyear);
                obj_Rpt.Report.DataSource = responses;
                obj_Rpt.Report.DataMember = responses.Tables[0].TableName;

                ASPxWebDocumentViewer1.OpenReport(obj_Rpt);
            }
        }
Example #29
0
        void calReport()
        {
            var vastin = Session["UTIN"].ToString();


            XtraRepPayerledge obj_Rpt = new XtraRepPayerledge();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            string strquery = String.Format("SELECT * FROM dbo.ViewPayerLedger  where PayerUtin='{0}'", vastin);

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1)
            {
                obj_Rpt.xrLabel10.Text    = string.Format("As At: {0:dddd, d MMMM,yyyy} ", DateTime.Now);
                obj_Rpt.Report.DataSource = responses;
                obj_Rpt.Report.DataMember = responses.Tables[0].TableName;

                ASPxWebDocumentViewer1.OpenReport(obj_Rpt);
            }
        }
Example #30
0
        void loadgridview()
        {
            sessions = new SessionManager();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet(); string strquery = String.Empty;

            strquery = String.Format("SELECT FirstName, LastName, Email, CreateDate FROM Login.[User] WHERE MerchantCode='{0}' AND FirstName IS NOT NULL ORDER BY FirstName ASC", sessions.MerchantCode.ToString());

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);
                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 01)
            {
                GridView1.DataSource = responses.Tables[0];
                GridView1.DataBind();
            }
        }
Example #31
0
        public FrmArmsDisplay(System.Data.DataSet dst, bool IsShowDialog)
        {
            SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);

            InitializeComponent();

            dstpass.Clear();

            dstpass = dst;

            //temTable.Columns.Add("PaymentRefNumber", typeof(string));
            //temTable.Columns.Add("EReceipts", typeof(string));
            //temTable.Columns.Add("EReceiptsDate", typeof(DateTime));
            //temTable.Columns.Add("Amount", typeof(decimal));


            if (dstpass.Tables != null || dstpass.Tables[0].Rows.Count > 0)
            {
                gridControl1.DataSource = dstpass.Tables[1];
                gridView1.BestFitColumns();
            }

            if (!this.IsShowDialog)
            {
                Init();
            }

            SplashScreenManager.CloseForm(false);
        }
        public DataSet LoadContacts(string xmlFilePath)
        {
            _xmlFilePath = xmlFilePath;
            _contactsDataSet = new DataSet();
            //_contactsDataView = new DataView();

            _contactsDataSet.Clear();
            if (File.Exists(_xmlFilePath))
            {
                _contactsDataSet.ReadXml(_xmlFilePath, XmlReadMode.ReadSchema);
                //_contactsDataView = _contactsDataSet.Tables[0].DefaultView;
            }
            else
            {
                DataTable dtContacts = new DataTable("Contacts");
                dtContacts.Columns.Add(new DataColumn("ContactNo", typeof(string)));
                dtContacts.Columns.Add(new DataColumn("Identity", typeof(string)));
                dtContacts.Columns.Add(new DataColumn("FriendlyName", typeof(string)));
                dtContacts.Columns.Add(new DataColumn("Status", typeof(string)));
                
                _contactsDataSet.Tables.Add(dtContacts);
                //_contactsDataView = _contactsDataSet.Tables[0].DefaultView;
            }
            return _contactsDataSet;
        }
        void loadRevenueoffice()
        {
            //Revenue office

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            string strquery = String.Format("  SELECT RevenueOfficeID,RTRIM(LTRIM(RevenueOfficeName)) RevenueOfficeName FROM Setting.RevenueOffice ORDER BY RevenueOfficeName asc");

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1)
            {
                ddlRevenue.DataSource     = responses.Tables[0];
                ddlRevenue.DataValueField = "RevenueOfficeID";
                ddlRevenue.DataTextField  = "RevenueOfficeName";
                ddlRevenue.DataBind();
                ddlRevenue.Items.Insert(0, new ListItem("--- Select Revenue Office ---", "0"));
            }
        }
        public static void Copy()
        {
            DataSet DS = new DataSet();
            string ConnectionString = "Data Source=" + CalibrationSettings.Default.ConnectionDir + "Users.db;Version=3;New=False;Compress=True;";
            string LoadCommand = "SELECT * FROM users";
            DS.Clear();
            SQLiteConnection Connection = new SQLiteConnection(ConnectionString);
            //SQLiteCommand Query = new SQLiteCommand(LoadCommand, Connection);
            SQLiteDataAdapter DataAdaptor = new SQLiteDataAdapter(LoadCommand, Connection);
            DataAdaptor.Fill(DS);

            foreach (DataRow dRow in DS.Tables[0].Rows)
            {
                DataClasses.UserProfile CopyUser = new UserProfile();
                CopyUser.Gender = dRow[0].ToString();
                CopyUser.Name = dRow[2].ToString();
                CopyUser.Surname = dRow[3].ToString();
                CopyUser.Weight = Convert.ToInt32(dRow[5]);
                CopyUser.Password = dRow[6].ToString() + "000";
                if (dRow[1].ToString() == "255")
                    CopyUser.Name = "Richard";
                CopyUser.Name = new String(CopyUser.Name.Where(x => x != ' ' && x != '\r' && x != '\n').ToArray());
                CopyUser.EmailAddress = CopyUser.Name + dRow[1].ToString() + "@grucox.com";
                AccessorUsers.RegisterNewUser(CopyUser);
            }
        }
Example #35
0
        /* Выполняем удаление выбранных элементов */
        void removeInTable(String _tableName, String _value)
        {
            if(_tableName == "Фирмы") _deleteMySQL.SqlCommand = "DELETE FROM firms WHERE (firm_name = '" + _value + "' AND firm_delete = 1)";
            if(_tableName == "ТМЦ") _deleteMySQL.SqlCommand = "DELETE FROM tmc WHERE (tmc_name = '" + _value + "' AND tmc_delete = 1)";
            if(_tableName == "Склады") _deleteMySQL.SqlCommand = "DELETE FROM store WHERE (store_name = '" + _value + "' AND store_delete = 1)";
            if(_tableName == "Ед.Изм") _deleteMySQL.SqlCommand = "DELETE FROM units WHERE (units_name = '" + _value + "' AND units_delete = 1)";
            if(_tableName == "Вид налога") _deleteMySQL.SqlCommand = "DELETE FROM typeTax WHERE (typeTax_name = '" + _value + "' AND typeTax_delete = 1)";
            if(_tableName == "Сотрудники") _deleteMySQL.SqlCommand = "DELETE FROM staff WHERE (staff_name = '" + _value + "' AND staff_delete = 1)";
            if(_tableName == "План счетов") _deleteMySQL.SqlCommand = "DELETE FROM planAccounts WHERE (planAccounts_name = '" + _value + "' AND planAccounts_delete = 1)";
            if(_tableName == "Документ") {

                ClassMySQL_Full _removeDocMySQL = new ClassMySQL_Full();
                DataSet _removeDocDataSet = new DataSet();
                _removeDocMySQL.SelectSqlCommand = "SELECT * FROM journal WHERE (journal_number = '" + _value + "' AND journal_delete = 1)";
                _removeDocDataSet.Clear();
                _removeDocDataSet.DataSetName = "journal";
                if(_removeDocMySQL.ExecuteFill(_removeDocDataSet, "journal")){
                    _deleteMySQL.SqlCommand = "DELETE FROM tabularSection WHERE (tabularSection_id_doc = '" + _removeDocDataSet.Tables["journal"].Rows[0]["journal_id_doc"].ToString() + "')";
                    if(_deleteMySQL.ExecuteNonQuery())
                    {
                        _deleteMySQL.SqlCommand = "DELETE FROM journal WHERE (journal_number = '" + _value + "' AND journal_delete = 1)";
                        if(_deleteMySQL.ExecuteNonQuery())
                        {
                            listBox1.Items.Add("[" + _tableName + "]  " + _value + " - - - Запись удалена!");
                        }
                    }
                }

            }else{
                if(_deleteMySQL.ExecuteNonQuery())
                {
                    listBox1.Items.Add("[" + _tableName + "]  " + _value + " - - - Запись удалена!");
                }
            }
        }
        public DataSet dgvselectioncommand()
        {
            DataSet ds = new DataSet();
            try
            {
                ds.Clear();
                OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sql, gl.oleconnection);
                if (teacher != null && teacher != "")
                    dataAdapter.SelectCommand.Parameters.Add("teacher", OleDbType.VarChar, 50).Value = teacher;
                if (infraction != null && infraction != "")
                    dataAdapter.SelectCommand.Parameters.Add("infraction", OleDbType.VarChar, 20).Value = infraction;
                if (firstname != null && firstname != "")
                {
                    dataAdapter.SelectCommand.Parameters.Add("firstname", OleDbType.VarChar, 20).Value = firstname;
                    dataAdapter.SelectCommand.Parameters.Add("lastname", OleDbType.VarChar, 20).Value = lastname;
                    dataAdapter.SelectCommand.Parameters.Add("studentid", OleDbType.VarChar, 20).Value = studentid;
                }
                if (learningcenter != "")
                    dataAdapter.SelectCommand.Parameters.Add("learningcenter", OleDbType.VarChar, 255).Value = learningcenter;
                dataAdapter.SelectCommand.CommandType = CommandType.Text;
                dataAdapter.Fill(ds);

            }
            catch (Exception) { }
            return ds;
        }
Example #37
0
        void calReport()
        {
            XtraRepSummaryLedger obj_Rpt = new XtraRepSummaryLedger();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            string strquery = String.Format("SELECT PayerUtin, PayerName, RevenueOfficeID,RevenueOfficeName,COALESCE(SUM(TaxPayable), 0) Assessment,  COALESCE(SUM(PaymentAmount), 0) Payment, COALESCE(SUM(TaxPayable), 0) - COALESCE(SUM(PaymentAmount), 0) Differences FROM dbo.ViewPayerLedger  GROUP BY PayerUtin, PayerName, RevenueOfficeID,RevenueOfficeName  ORDER BY RevenueOfficeName asc");

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1)
            {
                // obj_Rpt.xrLabel10.Text = string.Format("As At: {0:dddd, d MMMM,yyyy} ", DateTime.Now);
                obj_Rpt.Report.DataSource = responses;
                obj_Rpt.Report.DataMember = responses.Tables[0].TableName;

                ASPxWebDocumentViewer1.OpenReport(obj_Rpt);
            }
        }
Example #38
0
        static public bool IsValidUser(string strquery)
        {
            bool result = false;

            SqlCommand     _command;
            SqlDataAdapter _adp;

            System.Data.DataSet responses = new System.Data.DataSet();

            using (SqlConnection connect = new SqlConnection(ConfigurationManager
                                                             .ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 0)
            {
                result = true;
            }

            return(result);
        }
Example #39
0
        public DataSet extraerDatos(String NombreHoja, String RutaArchivo)
        {
            try
            {
                //Inicialización de las variables
                OleDbConnection conexion = new OleDbConnection();
                OleDbCommand comando = new OleDbCommand();
                OleDbDataAdapter adaptador = new OleDbDataAdapter();
                DataSet dsexcel = new DataSet();
                String ExcelPath = "";
                String data = "";
                dsexcel.Clear();
                data = NombreHoja;
                ExcelPath = RutaArchivo.ToLower();
                conexion.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ExcelPath + "; Extended Properties= \"Excel 8.0;HDR=YES;IMEX=1\"";
                conexion.Open();
                comando.CommandText = "SELECT * FROM [" + data + "$] where valido=1";
                comando.Connection = conexion;
                adaptador.SelectCommand = comando;
                adaptador.Fill(dsexcel);
                conexion.Close();
                return dsexcel;

            }
            catch (Exception)
            {
                return null;
            }
        }
Example #40
0
        private bool admin_checkOut(string loginID, string password)
        {
            bool login = false;
            SqlConnection sqlconnection = new SqlConnection(conStr);

            string comStr = string.Format("select Sys_NAME, Sys_PASSWORD from dboSys where Sys_IID = \'{0}\'" ,loginID);

            dataSet = new DataSet();
            dataSet.Clear();
            dataSet = SqlCommondClass.GetDataSet(comStr, "dboSys", sqlconnection);

            if (dataSet.Tables[0].Rows.Count == 0)
            {
                login = false;
                return login;
            }
            if (dataSet.Tables[0].Rows[0][1].ToString().Trim().Equals(password.Trim()))
            {
                this.sysLogin = true;
                this.loginName = dataSet.Tables[0].Rows[0][0].ToString().Trim();
                login = true;
                return login;
            }

            return login;
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string sqlcheck = "select * from vote where nic=" + Session["voter_nic"].ToString();
            ds = new DataSet();
            SqlDataAdapter ad = new SqlDataAdapter("select * from vote where nic =" + Session["voter_nic"], con);
            SqlCommandBuilder cb = new SqlCommandBuilder(ad);
            ds.Clear();
            ad.Fill(ds);

            if (ds.Tables[0].Rows.Count == 0)
            {

                Response.Redirect("vote_page.aspx");

            }
            else
            {
               // Response.Write(" <script >alert ('congrates') </script>");
                Label8.Text = "You Already Casted Your Vote !";
                // Response.Redirect("voter_home.aspx");
                // Response.Redirect("vote_page.aspx");
                // con.Close();

            }
        }
Example #42
0
        private void SbnDisapprove_Click(object sender, EventArgs e)
        {
            string value = string.Empty;

            if (DialogResults.InputBox(@"Comments for Disapproving ", "Ministry Disapproval", ref value) == DialogResult.OK)
            {
                if (!string.IsNullOrWhiteSpace(value))
                {
                    for (int i = 0; i < selection.SelectedCount; i++)
                    {
                        tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["Period"], (selection.GetSelectedRow(i) as DataRowView)["Narriation"], Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["BankAccountID"]), Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["SummaryID"]), Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["FinancialperiodID"]), (selection.GetSelectedRow(i) as DataRowView)["AgencyCode"], (selection.GetSelectedRow(i) as DataRowView)["RevenueCode"],
                                                           (selection.GetSelectedRow(i) as DataRowView)["Description"], (selection.GetSelectedRow(i) as DataRowView)["AgencyName"], Convert.ToDecimal((selection.GetSelectedRow(i) as DataRowView)["Amount"]) });
                    }

                    using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                    {
                        connect.Open();
                        _command = new SqlCommand("Reconciliation.DisapprovalMinistrySummary", connect)
                        {
                            CommandType = CommandType.StoredProcedure
                        };

                        _command.Parameters.Add(new SqlParameter("@pTransactiondb", SqlDbType.Structured)).Value = tableTrans;
                        _command.Parameters.Add(new SqlParameter("@Userid", SqlDbType.VarChar)).Value            = Program.UserID;
                        _command.Parameters.Add(new SqlParameter("@comment", SqlDbType.VarChar)).Value           = value;
                        _command.CommandTimeout = 0;

                        using (System.Data.DataSet ds = new System.Data.DataSet())
                        {
                            ds.Clear();
                            adp = new SqlDataAdapter(_command);
                            adp.Fill(ds);
                            connect.Close();

                            if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                return;
                            }
                            else
                            {
                                Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                                //FrmReportPosting report = new FrmReportPosting(ds.Tables[1], ds.Tables[2]);
                                //using (FrmReportPosting frmreport = new FrmReportPosting(ds))
                            }
                        }
                    }
                }
                else
                {
                    Common.setMessageBox("Disapproval Comment is Empty", "Ministry Disapproval", 3);

                    return;
                }
                setReload();
            }
        }
Example #43
0
 private void recommend_songlist_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (var sshClient = new SshClient("192.168.199.201", "hadoop", "hadoop"))
         {
             sshClient.Connect();
             string command = "python /home/hadoop/PycharmProjects/untitled/recommend.py " + xmid.Text;
             using (var cmd = sshClient.CreateCommand(command))
             {
                 var res = cmd.Execute();
                 if (res == "107\n")
                 {
                     string rec_sql = "SELECT songname, singer, link FROM `" + xmid.Text + "_rec`";
                     con2 = null;
                     if (con2 == null)
                     {
                         con2 = new MySql.Data.MySqlClient.MySqlConnection(sqlstr);
                         con2.Open();
                     }
                     adapter2 = null;
                     if (adapter2 == null)
                     {
                         adapter2 = new MySql.Data.MySqlClient.MySqlDataAdapter(rec_sql, con2);
                     }
                     ds2 = null;
                     if (ds2 == null)
                     {
                         ds2 = new System.Data.DataSet();
                     }
                     ds2.Clear();
                     adapter2.Fill(ds2, "rec");
                     dt2 = null;
                     if (dt2 == null)
                     {
                         dt2 = ds2.Tables["rec"];
                     }
                     Music_Recommend.ItemsSource = dt2.DefaultView;
                     if (dt2.DefaultView.Count == 0)
                     {
                         MessageBox.Show("无推荐结果哦,试试今日推荐的音乐吧!");
                         todayRecomend();
                     }
                     con2.Close();
                 }
                 else
                 {
                     MessageBox.Show("无推荐结果哦,试试今日推荐的音乐吧!");
                     todayRecomend();
                 }
             }
         }
     }
     catch
     {
         MessageBox.Show("无推荐结果哦,试试今日推荐的音乐吧!");
         todayRecomend();
     }
 }
Example #44
0
 public void read(string query1, string value1)
 {
     da = new SqlDataAdapter(query1 + value1, cn);
     ds = new DataSet();
     ds.Clear();
     ds.Reset();
     da.Fill(ds);
 }
Example #45
0
 public DataSet SqlQueryOnce(string sql, SqlConnection Conn) 
 {
     SqlDataAdapter adpt = new SqlDataAdapter(sql, Conn);
     DataSet ds = new System.Data.DataSet();
     ds.Clear();
     adpt.Fill(ds);
     return ds;
 }
        public FrmReclassifiedResult(System.Data.DataSet ds)
        {
            InitializeComponent();

            dts2.Clear();
            dts2 = ds;
            Init();
        }
Example #47
0
        private void show_oder_details_Click(object sender, EventArgs e)
        {
            String query = "SELECT * FROM [Order Details]";

            dataSet.Clear();
            dataAdapter = new OleDbDataAdapter(query, dbConnection);
            dataAdapter.Fill(dataSet, "Order Details");
        }
Example #48
0
        void GetPayRef()
        {
            string values = string.Empty;

            lblSelect.Text = string.Empty;

            int j = 0;

            temTable.Clear();

            for (int i = 0; i < selection.SelectedCount; i++)
            {
                temTable.Rows.Add(new object[] { String.Format("{0}", (selection.GetSelectedRow(i) as DataRowView)["Payment Ref. Number"]), Program.UserID });
            }

            using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand("ArmsReceiptsMoved", connect)
                {
                    CommandType = CommandType.StoredProcedure
                };

                _command.Parameters.Add(new SqlParameter("@pTransaction", SqlDbType.Structured)).Value = temTable;

                _command.CommandTimeout = 0;

                System.Data.DataSet response = new System.Data.DataSet();

                response.Clear();

                adp = new SqlDataAdapter(_command);
                adp.Fill(response);

                connect.Close();

                if (String.Compare(response.Tables[0].Rows[0]["returnCode"].ToString(), "00", false) == 0)
                {
                    Common.setMessageBox(response.Tables[0].Rows[0]["returnmessage"].ToString(), Program.ApplicationName, 1);

                    if (response.Tables[1] != null || response.Tables[1].Rows.Count > 0)
                    {
                        using (FrmArmsDisplay display = new FrmArmsDisplay(response, true)
                        {
                            FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
                        })
                        {
                            display.ShowDialog();
                        }
                    }
                }
                else
                {
                    Common.setMessageBox(response.Tables[0].Rows[0]["returnmessage"].ToString(), Program.ApplicationName, 1);
                    return;
                }
            }
        }
Example #49
0
 public DataSet fetch(string query)
 {
     da = new SqlDataAdapter(query, con);
     ds = new DataSet();
     ds.Clear();
     ds.Reset();
     da.Fill(ds);
     return ds;
 }
Example #50
0
        void calReport()
        {
            var strrevenue = Session["Revenue"].ToString();

            var startdate = Session["Startdate"].ToString();

            var enddate = Session["Enddate"].ToString();

            //var end= Session["Enddate1"].ToString();
            var end = Convert.ToDateTime(Session["Enddate1"].ToString()).ToString("dd/MM/yyyy");

            //var strat = Session["startdate1"].ToString();
            var strat = Convert.ToDateTime(Session["startdate1"].ToString()).ToString("dd/MM/yyyy");

            //DateTime dt = DateTime.ParseExact(startdate, "dd/mm/yyyy", CultureInfo.InvariantCulture);
            //DateTime dt2 = DateTime.ParseExact(enddate, "dd/mm/yyyy", CultureInfo.InvariantCulture);

            //Console.WriteLine(dt.ToString("yyyy-MM-dd"));

            //var gb = dt.ToString("yyyy-MM-dd");
            //var gb2 = dt2.ToString("yyyy-MM-dd");

            //XtraRepPayment obj_Rpt = new XtraRepPayment();

            XtraRepPayment2 obj_Rpt = new XtraRepPayment2();

            SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet();

            string strquery = String.Format("SELECT * FROM ViewPayment WHERE PaymentDate BETWEEN '{0}' AND '{1}' and RevenueCode ='{2}' ORDER BY PaymentDate ASC", startdate, enddate, strrevenue);

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                connect.Open();
                _command = new SqlCommand(strquery, connect)
                {
                    CommandType = CommandType.Text
                };
                _command.CommandTimeout = 0;
                responses.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(responses);

                connect.Close();
            }

            if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1)
            {
                obj_Rpt.xrLabel10.Text    = string.Format("From {0:dd/MM/yyyy}  To {1:dd/MM/yyyy}", strat, end);
                obj_Rpt.xrLabel8.Text     = Session["RevenueName"].ToString();
                obj_Rpt.Report.DataSource = responses;
                obj_Rpt.Report.DataMember = responses.Tables[0].TableName;

                ASPxWebDocumentViewer1.OpenReport(obj_Rpt);
            }

            //var cachedReportSource = new CachedReportSourceWeb(new XtraRepPayment());
        }
Example #51
0
        void Processwork()
        {
            if (selection.SelectedCount == 0)
            {
                Common.setMessageBox("No Selection made", Program.ApplicationName, 3);
                return;
            }
            else
            {
                for (int i = 0; i < selection.SelectedCount; i++)
                {
                    tableTrans.Rows.Add(new object[] { (selection.GetSelectedRow(i) as DataRowView)["Period"], (selection.GetSelectedRow(i) as DataRowView)["Narriation"], Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["BankAccountID"]), Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["SummaryID"]), Convert.ToInt32((selection.GetSelectedRow(i) as DataRowView)["FinancialperiodID"]), (selection.GetSelectedRow(i) as DataRowView)["AgencyCode"], (selection.GetSelectedRow(i) as DataRowView)["RevenueCode"],
                                                       (selection.GetSelectedRow(i) as DataRowView)["Description"], (selection.GetSelectedRow(i) as DataRowView)["AgencyName"], Convert.ToDecimal((selection.GetSelectedRow(i) as DataRowView)["Amount"]) });
                }

                using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                {
                    connect.Open();
                    _command = new SqlCommand("doSummaryAGPosting", connect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    _command.Parameters.Add(new SqlParameter("@pTransactiondb", SqlDbType.Structured)).Value = tableTrans;
                    _command.Parameters.Add(new SqlParameter("@Userid", SqlDbType.VarChar)).Value            = Program.UserID;
                    _command.CommandTimeout = 0;

                    using (System.Data.DataSet ds = new System.Data.DataSet())
                    {
                        ds.Clear();
                        adp = new SqlDataAdapter(_command);
                        adp.Fill(ds);
                        connect.Close();

                        if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                        {
                            Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                            return;
                        }
                        else
                        {
                            Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                            //FrmReportPosting report = new FrmReportPosting(ds.Tables[1], ds.Tables[2]);
                            using (FrmReportPosting frmreport = new FrmReportPosting(ds))
                            {
                                frmreport.ShowDialog();
                            }
                            //FrmRequest_Load(null, null);

                            setReload();
                        }
                    }
                }
            }
        }
Example #52
0
        void btnSelect_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cboYear.SelectedValue.ToString()))
            {
                Common.setEmptyField("Financial Year", Program.ApplicationName);
                return;
            }
            else if (string.IsNullOrEmpty(cboMonth.SelectedValue.ToString()))
            {
                Common.setEmptyField("Financial Month", Program.ApplicationName);
                return;
            }
            else
            {
                using (SqlConnection connect = new SqlConnection(Logic.ConnectionString))
                {
                    connect.Open();
                    _command = new SqlCommand("dogetCloseFinancialperiod", connect)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    _command.Parameters.Add(new SqlParameter("@period", SqlDbType.VarChar)).Value = cboMonth.SelectedValue;
                    _command.Parameters.Add(new SqlParameter("@years", SqlDbType.VarChar)).Value  = cboYear.SelectedValue;

                    using (System.Data.DataSet ds = new System.Data.DataSet())
                    {
                        ds.Clear();
                        adp = new SqlDataAdapter(_command);
                        adp.Fill(ds);
                        connect.Close();

                        if (ds.Tables[0].Rows[0]["returnCode"].ToString() != "00")
                        {
                            Common.setMessageBox(ds.Tables[0].Rows[0]["returnMessage"].ToString(), Program.ApplicationName, 2);

                            return;
                        }
                        else
                        {
                            gridControl1.DataSource = ds.Tables[1];
                            gridView1.Columns["ClosingBalance"].DisplayFormat.FormatType   = FormatType.Numeric;
                            gridView1.Columns["ClosingBalance"].DisplayFormat.FormatString = "n2";
                            gridView1.Columns["OpeningBalance"].DisplayFormat.FormatType   = FormatType.Numeric;
                            gridView1.Columns["OpeningBalance"].DisplayFormat.FormatString = "n2";
                            gridView1.Columns["FinancialperiodID"].Visible = false;
                            gridView1.Columns["Months"].Visible            = false;
                            gridView1.Columns["ClosingBalance"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;

                            gridView1.Columns["ClosingBalance"].SummaryItem.FieldName     = "ClosingBalance";
                            gridView1.Columns["ClosingBalance"].SummaryItem.DisplayFormat = "Total = {0:n}";

                            //gridView1.BestFitColumns();
                        }
                    }
                }
            }
        }
 public DataSet UpdateDataGridView(string sqlCommand)
 {
     Cs.Open();
     DataSet ds = new DataSet();
     Da.SelectCommand = new SqlCommand(sqlCommand, Cs);
     ds.Clear();
     Da.Fill(ds);
     Cs.Close();
     return ds;
     //dataGridView.DataSource = ds.Tables[0]; // to show
 }
Example #54
0
        public string GetComTreeSource(string content)
        {
            ComBase.Logger("coontent:" + content);
            dynamic data = JValue.Parse(content);
            bool multiple = data.multiple;
            string codeValue = data.codeValue;// UserID
            string codeName = data.codeName;// CnName
            string tableName = data.tableName;// FX_UserInfo
            string whereStr = data.conditions;//
            string sql = "";

            //DataSet dataSet = Utility.Database.ExcuteDataSet(" select DPID as id, DPName as name from FX_Department ");
            //return JsonConvert.SerializeObject( dataSet.Tables[0]);
            DataSet dataSet = new DataSet();
            dataSet.Clear();
            sql = string.Format("select {0} from {1} where 1 = 1", codeValue + " as id," + codeName + " as name ", tableName);
            if (!string.IsNullOrEmpty(whereStr))
            {
                whereStr = whereStr.Replace("$$", " ");
                whereStr = whereStr.Replace("[", "'");
                whereStr = whereStr.Replace("]", "'");
                sql += whereStr;
            }
            dataSet = Utility.Database.ExcuteDataSet(sql);

            //switch (tableName)
            //{
            //    case "FX_UserInfo":
            //        dataSet.Clear();
            //        sb.AppendFormat("select {0} from {1}", codeValue + " as id," + codeName + " as name ", tableName);
            //        //List<FX_UserInfo> ddd1 = Utility.Database.QueryList<FX_UserInfo>(sb.ToString());
            //        dataSet = Utility.Database.ExcuteDataSet(sb.ToString());

            //        //List<FX_UserInfo> ddd1 = Utility.Database.QueryList<FX_UserInfo>(sb.ToString());
            //        return JsonConvert.SerializeObject( dataSet.Tables[0]);
            //    case "FX_Department":
            //        dataSet.Clear();
            //        sb.AppendFormat("select {0} from {1}", codeValue + " as id," + codeName + " as name ", tableName);
            //        dataSet = Utility.Database.ExcuteDataSet(sb.ToString());
            //        //List<GetDataModels> eeee = Utility.Database.QueryList<GetDataModels>(sb.ToString());
            //        return JsonConvert.SerializeObject( dataSet.Tables[0]);

            //    default:
            //        break;
            //}

            //var sql = " UserID, CnName";
            //sb.AppendFormat("select {0} from {1}", codeValue + "," + codeName, tableName);
            //var tablePartField = Utility.Database.GetTableList();
            //var tableAllField = Utility.Database.GetAllFieldInfo(tableName);// 获取表所有字段

            //List<GetDataModels> ddd = Utility.Database.QueryList<GetDataModels>(sb.ToString());
            return JsonConvert.SerializeObject(dataSet.Tables[0]);
        }
Example #55
0
        private void LlenaDetalle(string sAcabado)
        {
            DataViewManager dvmAcabado = new DataViewManager();
            DataSet dsAcabado = new DataSet();
            dsAcabado.Clear();
            dsAcabado = SistEti.lpQueries.ObtenAcabadoBusqueda(sAcabado);
            dvmAcabado = dsAcabado.DefaultViewManager;

            dgvAcabados.DataSource = dvmAcabado.DataSet.Tables[0];
            dgvAcabados.Refresh();
        }
Example #56
0
 /*Возвращает значение выбранной константы */
 public static String constantValue(String constName)
 {
     ClassMySQL_Full _constMySQL = new ClassMySQL_Full();
     DataSet _constDataSet = new DataSet();
     _constDataSet.Clear();
     _constDataSet.DataSetName = "constants";
     _constMySQL.SelectSqlCommand = "SElECT * FROM constants WHERE (const_name = '" + constName + "')";
     if(_constMySQL.ExecuteFill(_constDataSet, "constants")){
         DataTable table = _constDataSet.Tables["constants"];
         return table.Rows[0]["const_value"].ToString();
     }else return "";
 }
Example #57
0
 public int ExecuteQuery(string Query, ref DataSet dataset)
 {
     connection.Open();
     MySqlCommand command = new MySqlCommand(Query);
     command.Connection = this.connection;
     int res = command.ExecuteNonQuery();
     adapter.SelectCommand = command;
     dataset.Clear();
     adapter.Fill(dataset);
     connection.Close();
     return res;
 }
 public void CargarDatos(DataSet data, String str,String consulta)
 {
     try
     {
         Command.CommandText = consulta;
         Adapter.SelectCommand = Command;
         data.Clear();
         Adapter.Fill(data, str);
     }
     catch { }
   
 }
Example #59
0
        public static void Main(string[] args)
        {
            WriteToEventLog("Calling AEPM Service...");

            var dt = new DataTable();
            var dset = new DataSet();
            Guid = args[0];

            //retrieve any records needing updating
            try
            {

                 using(var conn = new OleDbConnection(ConfigurationManager.AppSettings["AS400ConnectionStringDev"]))

                {
                    string sql = GetUnprocessMasterRecsString();
                    var objDataAdapter = new OleDbDataAdapter();
                    var cmd = new OleDbCommand(sql, conn);

                    objDataAdapter.SelectCommand = cmd;
                    objDataAdapter.SelectCommand.CommandTimeout = 0;

                    dt.Clear();
                    dset.Clear();

                    objDataAdapter.Fill(dt);
                    objDataAdapter.Fill(dset, "currentSelections");

                    var cb = new OleDbCommandBuilder(objDataAdapter);
                    AddParameters(cb);

                    //update records to 'S' for submitted
                    for (int i = 0; i < dset.Tables["currentSelections"].Rows.Count; i++)
                    {
                        dset.Tables["currentSelections"].Rows[i]["G_RETRN"] = 'S';
                    }

                    objDataAdapter.Update(dset, "currentSelections");

                    //submit records asynch
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        TestAsync(dt, i);
                    }

                }
            }
            catch (Exception ex)
            {
                WriteToEventLog(ex);
            }
        }
Example #60
0
        public void PrintRegExpsToFile(string keyword, string regexp_substring, int min_rating, int howmanyrows, string filename)
        {
            WebservicesSoapClient wssc = new WebservicesSoapClient();
            System.Console.WriteLine(wssc.State);
            DataSet ds = new DataSet();

            ds = wssc.listRegExp(keyword, regexp_substring, min_rating, howmanyrows);
            ds.WriteXml(filename, System.Data.XmlWriteMode.IgnoreSchema);

            ds.Clear();
            wssc.Abort();
            wssc.Close();
        }