HasChanges() public method

Gets a value indicating whether the has changes, including new, deleted, or modified rows.
public HasChanges ( ) : bool
return bool
コード例 #1
0
ファイル: DataSet_HasChanges.cs プロジェクト: nlhepler/mono
	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;
	
		DataSet ds = new DataSet();
		ds.Tables.Add(GHTUtils.DataProvider.CreateParentDataTable());

		try
		{
			BeginCase("HasChanges 1");
			Compare(ds.HasChanges(),false );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
		
		DataRow dr = ds.Tables[0].NewRow();
		dr[0] = 9;
		ds.Tables[0].Rows.Add(dr);
		
		try
		{
			BeginCase("HasChanges 2");
			Compare(ds.HasChanges(),true );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
	}
コード例 #2
0
        public CounterForm()
        {
            InitializeComponent();

            LoginForm form = new LoginForm();

            toolStripStatusLabel_UserName.Text = form.GetUserName();
            toolStripStatusLabel_UserType.Text = form.GetUserType();
            toolStripStatusLabel_Date.Text = DateTime.Today.ToLongDateString();

            ds = new DataSet();
            rentDAL = new Renting_Management_System.DAL.RentDAL();

            ds = rentDAL.GetAll();
            bindingSource = new BindingSource();
            bindingSource.DataSource = ds;
            bindingSource.DataMember = ds.Tables[0].TableName;
            bindingSource.Sort = ds.Tables[0].Columns[0].ColumnName + " ASC";
            dataGridView1.DataSource = bindingSource;
            bindingNavigator1.BindingSource = bindingSource;
            dataGridView1.Columns[0].ReadOnly = true;
            dataGridView1.Columns[1].ReadOnly = true;
            dataGridView1.Columns[2].ReadOnly = true;
            bindingNavigatorAddNewItem.Enabled = false;
            bindingNavigatorDeleteItem.Enabled = false;
            if (ds.HasChanges())
            {
                toolStripButton_Save.Enabled = true;
                changed = true;
            }
        }
コード例 #3
0
        void fatch2()
        {
            DataSet ds = new DataSet();
            ds.ReadXml(s + "\\visible.xml");
            if (ds != null && ds.HasChanges())
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    listBox1.Items.Add(ds.Tables[0].Rows[i][0].ToString());

                }

            }
        }
コード例 #4
0
        void Get_Xml()
        {
            DataSet ds = new DataSet();
            ds.ReadXml(Server.MapPath("~/Quotes.xml"));
            if (ds != null && ds.HasChanges())
            {
                XmlGridView.DataSource = ds;
                XmlGridView.DataBind();
            }
            else
            {
                XmlGridView.DataBind();
            }

        }
コード例 #5
0
 private void UpdateDataSet(DataSet dataSet)
 {
     if (!dataSet.HasChanges(DataRowState.Modified))
     {
         return;
     }
     DataSet tempDataSet = dataSet.GetChanges(DataRowState.Modified);
     if (tempDataSet.HasErrors)
     {
         MessageBox.Show("Data has Errors");
     }
     else
     {
         tableAdapterManager.UpdateAll(tempDataSet);
     }
 }
コード例 #6
0
        public bool lastChanceToSave(bool forceSave)
        {
            bool ret = false;

            if (dictionaryDataSet.HasChanges())
            {
                if (forceSave || Project.YesNoBox(this.ParentForm, "You've changed the dictionary, want to save?"))
                {
                    saveData();
                    ret = true;
                }
                else
                {
                    dictionaryDataSet.AcceptChanges();
                }
            }

            return(ret);
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: spsinghdocument1/some
        void datagrFATCH()
        {
            string b="";
            DataSet ds = new DataSet();
            ds.ReadXml(s + "\\visible.xml");
            if (ds != null && ds.HasChanges())
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                     b = ds.Tables[0].Rows[i][0].ToString();

                   // comboBox1.Items.Add(ds.Tables[0].Rows[i][0].ToString());
                   // dataGridView1.Columns.Add(ds.Tables[0].Rows[i][0].ToString());
                     dataGridView1.Columns.Add("h", b.ToString());
                     dataGridView1.Rows.Add("f");

                }

            }
        }
コード例 #8
0
ファイル: Select.cs プロジェクト: spsinghdocument1/some
        /// </summary>
        void select()
        {
            string b = "";
            string c = "";

            DataSet ds = new DataSet();

            ds.ReadXml(s + "\\RepositionColumns.xml");
            if (ds != null && ds.HasChanges())
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    b = ds.Tables[0].Rows[i][0].ToString();

                       dataGridView1.Rows.Add(b.ToString());

                }

                //////////////////////////////////////////////////////////////////////////////////////////////////////

              //  dataGridView1.Rows.Add(b.ToString());
                //////////////////////////////////////////////////////////////////////////////////////////////////////////

            }
        }
コード例 #9
0
ファイル: Modfy.cs プロジェクト: spsinghdocument1/some
        /// <summary>
        /// /////////////////////////////////////////////////////////////////////////////
        public void select_sho(string PORTFOLIO2)
        {
            string PORTFOLIO = "PARAMETER";
            DataSet ds = new DataSet();
            string s = Application.StartupPath;
            string path = s + "\\InsertToken.xml";
            XmlDocument doc = new XmlDocument();
            doc.Load(path);
            XmlNode node = doc.SelectSingleNode("//TokensDetails/Token[ parameter='" + PORTFOLIO + "']");
            string parameter = (node.SelectSingleNode("parameter").InnerText);
            string portfolio = (node.SelectSingleNode("portfolio").InnerText);
            string AddTokenn = (node.SelectSingleNode("AddTokenn").InnerText);
            dataGridView2.Columns.Add(parameter, parameter);
            dataGridView2.Columns.Add(portfolio, portfolio);
            for (int i = 1; i <= Convert.ToInt64(AddTokenn); i++)
            {
                dataGridView2.Columns.Add("Token_" + i, "Token_" + i);
            }

            ///////////////////////////////////////////////////////////////////////////////////////////

            DataSet ds2 = new DataSet();
            ds2.ReadXml(s + "\\UserInput.xml");
            if (ds2 != null && ds2.HasChanges())
            {
                string datagrd = "";
                for (int i = -1; i < ds2.Tables[0].Rows.Count; i++)
                {

                    if (i == 0 || i == -1)
                    {

                    }
                    else
                    {
                        // datagrd = datagrd + ds2.Tables[0].Rows[i][0].ToString();
                        datagrd = ds2.Tables[0].Rows[i][0].ToString();
                    }

                    dataGridView2.Rows.Add(datagrd.ToString());
                }

            }

            ///////////////////////////////////////////////////////////////////////////////////

            label1.Text = PORTFOLIO2;
            string ab = "";
            dataGridView2.Rows[0].Cells[1].Value = PORTFOLIO2;

            string path2 = s + "\\UserView2.xml";
            XmlDocument doc2 = new XmlDocument();
            doc2.Load(path2);
            XmlNode node2 = doc2.SelectSingleNode("//User_Parameters/Parameters[ portfalio='" + PORTFOLIO2 + "']");

            dataGridView2.Rows[0].Cells[0].Value = (node2.SelectSingleNode("PARAMETER").InnerText);
            dataGridView2.Rows[0].Cells[2].Value = (node2.SelectSingleNode("Token_1").InnerText);
            dataGridView2.Rows[0].Cells[3].Value = (node2.SelectSingleNode("Token_2").InnerText);
            dataGridView2.Rows[2].Cells[1].Value = (node2.SelectSingleNode("MAXQTY").InnerText);
            dataGridView2.Rows[3].Cells[1].Value = (node2.SelectSingleNode("BNSFOIFF").InnerText);
            dataGridView2.Rows[4].Cells[1].Value = (node2.SelectSingleNode("BFNSQTY").InnerText);
        }
コード例 #10
0
ファイル: Modfy.cs プロジェクト: spsinghdocument1/some
        /////////////////////////////////////////////////////////////////////////////////////  Edit  //////////////////////////////
        void inert()
        {
            string parameter = "", portfalioo = "", Token = "", user = "";
            string datagrd = "";
            parameter = (string)dataGridView2.Rows[0].Cells[0].Value;
            portfalioo = (string)dataGridView2.Rows[0].Cells[1].Value;
            if (portfalioo == null)
            {
                MessageBox.Show("Please Insert portfalio");
                return;
            }
            ////////////////////////////////////////////////////////////////////
            XmlDocument MyXmlDocument = new XmlDocument();
            MyXmlDocument.Load(Application.StartupPath + "\\UserView2.xml");
            XmlElement ParentElement = MyXmlDocument.CreateElement("Parameters");
            XmlElement PARAMETER = MyXmlDocument.CreateElement("PARAMETER");
            PARAMETER.InnerText = parameter;
            XmlElement portfalio = MyXmlDocument.CreateElement("portfalio");
            portfalio.InnerText = portfalioo;
            ParentElement.AppendChild(PARAMETER);
            ParentElement.AppendChild(portfalio);

            //////////////////////////////////////////// TOken ADD  ////////////////////////

            string PORTFOLIO = "PARAMETER";
            DataSet ds = new DataSet();
            string s = Application.StartupPath;
            string path = s + "\\InsertToken.xml";
            XmlDocument doc = new XmlDocument();
            doc.Load(path);
            XmlNode node = doc.SelectSingleNode("//TokensDetails/Token[ parameter='" + PORTFOLIO + "']");
            string AddTokenn = (node.SelectSingleNode("AddTokenn").InnerText);
            for (int i = 1; i <= Convert.ToInt64(AddTokenn); i++)
            {
                // dataGridView1.Columns.Add("Token_" + i, "Token_" + i);
                Token = Convert.ToString("Token_" + i);
                XmlElement pToken = MyXmlDocument.CreateElement(Token);

                Token = (string)dataGridView2.Rows[0].Cells[1 + i].Value;
                pToken.InnerText = Token;
                ParentElement.AppendChild(pToken);

            }
            ////////////////////////////////////////////////////////////////////////// User Add  //////////////////
            DataSet ds2 = new DataSet();

            ds2.ReadXml(s + "\\UserInput.xml");
            if (ds2 != null && ds2.HasChanges())
            {

                for (int i = 1; i < ds2.Tables[0].Rows.Count; i++)
                {

                    //if (i == 0 || i == -1)
                    //{

                    //}
                    //  else
                    // {
                    datagrd = Convert.ToString(ds2.Tables[0].Rows[i][0].ToString());

                    XmlElement datagrdd = MyXmlDocument.CreateElement(datagrd.Replace(" ", ""));

                    user = (string)dataGridView2.Rows[1 + i].Cells[1].Value;
                    datagrdd.InnerText = user;
                    ParentElement.AppendChild(datagrdd);
                    //}

                    //dataGridView1.Rows.Add(""+datagrd.ToString());
                }

            }

            ////////////////////////////////////////////////////////////////////////////////////////////////

            MyXmlDocument.DocumentElement.AppendChild(ParentElement);
            MyXmlDocument.Save(Application.StartupPath + "\\UserView2.xml");

            MessageBox.Show("Records Add Successfully");
        }
コード例 #11
0
        public bool updateUserInfo(int userID, Info newInfo)
        {
            SqlConnection loadConnection = new SqlConnection("server=tf-PC\\SQLEXPRESS;database=blogData;uid=admin;pwd=s1y2x3");

            loadConnection.Open();

            string loadString = "SELECT username,headimgID,rgtime,infoID FROM Users WHERE userID=@userID";

            SqlCommand loadCommand1 = new SqlCommand(loadString, loadConnection);
            loadCommand1.Parameters.Add(new SqlParameter("userID", SqlDbType.NVarChar, 10));
            loadCommand1.Parameters["userID"].Value = userID;
            SqlDataAdapter loadAdapter = new SqlDataAdapter(loadCommand1);
            DataSet loadDataSet = new DataSet();
            loadAdapter.Fill(loadDataSet, "Users");

            string loadUserInfoString = "SELECT * FROM Info WHERE ID=@infoID";

            SqlCommand loadCommand3 = new SqlCommand(loadUserInfoString, loadConnection);
            loadCommand3.Parameters.Add(new SqlParameter("infoID", SqlDbType.Int));
            loadCommand3.Parameters["infoID"].Value = loadDataSet.Tables["Users"].Rows[0]["infoID"];
            SqlDataAdapter InfoAdapter = new SqlDataAdapter(loadCommand3);
            InfoAdapter.Fill(loadDataSet, "Info");

            loadDataSet.Tables["Info"].Rows[0]["birthday"] = newInfo.birthday;
            loadDataSet.Tables["Info"].Rows[0]["QQ"] = newInfo.QQ;
            loadDataSet.Tables["Info"].Rows[0]["email"] = newInfo.email;
            loadDataSet.Tables["Info"].Rows[0]["sex"] = newInfo.sex;
            loadDataSet.Tables["Info"].Rows[0]["signtime"] = newInfo.signtime;
            loadDataSet.Tables["Info"].Rows[0]["introduce"] = newInfo.introduce;

            if(loadDataSet.HasChanges())
            {
                try
                {
                    string UpdateCommandString = "SELECT * FROM Info";
                    SqlCommand UpdateCommand = new SqlCommand(UpdateCommandString, loadConnection);
                    SqlDataAdapter UpdateAdapter = new SqlDataAdapter(UpdateCommand);
                    SqlCommandBuilder sb = new SqlCommandBuilder(UpdateAdapter);
                    UpdateAdapter.Update(loadDataSet, "Info");
                }
                catch
                {
                    return false;
                }
            }
            return true;
        }
コード例 #12
0
ファイル: DataConnection.cs プロジェクト: dzikun/WarEmu
        // Sauvegarde tous les changements effectué dans le dataset
        public void SaveDataSet(string tableName, DataSet dataSet)
        {
            if (dataSet.HasChanges() == false)
                return;

            switch (connType)
            {
                case ConnectionType.DATABASE_MSSQL:
                    {
                        try
                        {
                            var conn = new SqlConnection(connString);
                            var adapter = new SqlDataAdapter("SELECT * from " + tableName, conn);
                            var builder = new SqlCommandBuilder(adapter);

                            adapter.DeleteCommand = builder.GetDeleteCommand();
                            adapter.UpdateCommand = builder.GetUpdateCommand();
                            adapter.InsertCommand = builder.GetInsertCommand();

                            lock (dataSet) // lock dataset to prevent changes to it
                            {
                                adapter.ContinueUpdateOnError = true;
                                DataSet changes = dataSet.GetChanges();
                                adapter.Update(changes, tableName);
                                PrintDatasetErrors(changes);
                                dataSet.AcceptChanges();
                            }

                            conn.Close();
                        }
                        catch (Exception ex)
                        {
                            throw new DatabaseException("Can not save table " + tableName, ex);
                        }

                        break;
                    }
                case ConnectionType.DATABASE_ODBC:
                    {
                        try
                        {
                            var conn = new OdbcConnection(connString);
                            var adapter = new OdbcDataAdapter("SELECT * from " + tableName, conn);
                            var builder = new OdbcCommandBuilder(adapter);

                            adapter.DeleteCommand = builder.GetDeleteCommand();
                            adapter.UpdateCommand = builder.GetUpdateCommand();
                            adapter.InsertCommand = builder.GetInsertCommand();

                            DataSet changes;
                            lock (dataSet) // lock dataset to prevent changes to it
                            {
                                adapter.ContinueUpdateOnError = true;
                                changes = dataSet.GetChanges();
                                adapter.Update(changes, tableName);
                                dataSet.AcceptChanges();
                            }

                            PrintDatasetErrors(changes);

                            conn.Close();
                        }
                        catch (Exception ex)
                        {
                            throw new DatabaseException("Can not save table ", ex);
                        }

                        break;
                    }
                case ConnectionType.DATABASE_MYSQL:
                    {
                        return;
                    }
                case ConnectionType.DATABASE_OLEDB:
                    {
                        try
                        {
                            var conn = new OleDbConnection(connString);
                            var adapter = new OleDbDataAdapter("SELECT * from " + tableName, conn);
                            var builder = new OleDbCommandBuilder(adapter);

                            adapter.DeleteCommand = builder.GetDeleteCommand();
                            adapter.UpdateCommand = builder.GetUpdateCommand();
                            adapter.InsertCommand = builder.GetInsertCommand();

                            DataSet changes;
                            lock (dataSet) // lock dataset to prevent changes to it
                            {
                                adapter.ContinueUpdateOnError = true;
                                changes = dataSet.GetChanges();
                                adapter.Update(changes, tableName);
                                dataSet.AcceptChanges();
                            }

                            PrintDatasetErrors(changes);

                            conn.Close();
                        }
                        catch (Exception ex)
                        {
                            throw new DatabaseException("Can not save table", ex);
                        }
                        break;
                    }
            }
        }
コード例 #13
0
ファイル: User_Input2.cs プロジェクト: spsinghdocument1/some
 /// /////////////////////////////////////////////// End  //////////////////////////////////////
 /// /////////////////////////////////////////////// Token add & Update  //////////////////////////////////////
 void Display_lavel()
 {
     DataSet ds = new DataSet();
     ds.ReadXml(Application.StartupPath + "\\InsertToken.xml");
     if (ds != null && ds.HasChanges())
     {
         if (ds.Tables[0].Rows.Count >= 1)
         {
             DataRow dr = ds.Tables[0].Rows[0];
             labelToken.Text = dr[2].ToString();
         }
     }
 }
コード例 #14
0
ファイル: DataSetTest2.cs プロジェクト: carrie901/mono
		[Test] public void HasChanges_ByDataRowState()
		{
			DataSet ds = new DataSet();

			DataRow dr;
			ds.Tables.Add(DataProvider.CreateParentDataTable());

			// HasChanges 1
			Assert.AreEqual(false , ds.HasChanges(), "DS38");

			//make some changes

			dr= ds.Tables[0].Rows[1];
			dr.Delete();

			dr = ds.Tables[0].Rows[2];
			dr[1] = "NewValue";

			dr = ds.Tables[0].Select("","",DataViewRowState.Unchanged)[0];

			dr = ds.Tables[0].NewRow();
			dr[0] = 1;
			ds.Tables[0].Rows.Add(dr);

			// HasChanges Added
			Assert.AreEqual(true , ds.HasChanges(DataRowState.Added), "DS39");

			// HasChanges Deleted
			Assert.AreEqual(true  , ds.HasChanges(DataRowState.Deleted) , "DS40");

			// HasChanges Modified
			Assert.AreEqual(true, ds.HasChanges(DataRowState.Modified), "DS41");

			// HasChanges Unchanged
			Assert.AreEqual(true, ds.HasChanges(DataRowState.Unchanged), "DS42");
		}
コード例 #15
0
ファイル: userview.cs プロジェクト: spsinghdocument1/some
        void show()
        {
            string PORTFOLIO = "PARAMETER";
            DataSet ds = new DataSet();
            string s = Application.StartupPath;
            string path = s + "\\InsertToken.xml";
            XmlDocument doc = new XmlDocument();
            doc.Load(path);
            XmlNode node = doc.SelectSingleNode("//TokensDetails/Token[ parameter='" + PORTFOLIO + "']");
            string parameter = (node.SelectSingleNode("parameter").InnerText);
            string portfolio = (node.SelectSingleNode("portfolio").InnerText);
            string AddTokenn = (node.SelectSingleNode("AddTokenn").InnerText);
            dataGridView1.Columns.Add(parameter, parameter);
            dataGridView1.Columns.Add(portfolio, portfolio);
            for (int i = 1; i <= Convert.ToInt64(AddTokenn); i++)
            {
                dataGridView1.Columns.Add("Token_" + i, "Token_" + i);
            }

            ///////////////////////////////////////////////////////////////////////////////////////////

            DataSet ds2 = new DataSet();
            ds2.ReadXml(s + "\\UserInput.xml");
            if (ds2 != null && ds2.HasChanges())
            {
                string datagrd = "";
                for (int i = -1; i < ds2.Tables[0].Rows.Count; i++)
                {

                    if (i == 0 || i == -1)
                    {

                    }
                    else
                    {
                       // datagrd = datagrd + ds2.Tables[0].Rows[i][0].ToString();
                        datagrd =  ds2.Tables[0].Rows[i][0].ToString();
                    }

                    dataGridView1.Rows.Add(datagrd.ToString());
                }

            }
        }
コード例 #16
0
ファイル: ServerConnection.cs プロジェクト: langpavel/LPS-old
 public int SaveDataSet(DataSet dataset, bool updateUserInfo)
 {
     using(Log.Scope())
     {
         if(dataset == null)
             throw new ArgumentNullException("dataset");
         if(!dataset.HasChanges())
             return 0;
         int affected;
         if(dataset.ExtendedProperties.ContainsKey("TABLE"))
         {
             string tablename = (string)dataset.ExtendedProperties["TABLE"];
             using(DataSet changes = dataset.GetChanges())
             {
                 CheckServerResult(Server.SaveDataSet(sink, security, tablename, changes, true, true, out affected));
             }
             if(affected > 0)
                 dataset.AcceptChanges();
             return affected;
         }
         else
             throw new ArgumentException("Dataset neobsahuje hodnotu TABLE");
     }
 }
コード例 #17
0
ファイル: Utility.cs プロジェクト: sunpander/VSDT
        /// <summary>
        /// ��ѯ�Ƿ��и���
        /// </summary>
        /// <param name="isQuery">
        /// �Ƿ��Dz�ѯ,true .�Dz�ѯʱ,����Ƿ��и���,
        ///            false �����Dz�ѯʱ,�������д���,����ʾ����</param>
        /// <param name="tBindSource"></param>
        public static void CheckUnSavedChange(bool isQuery, System.Windows.Forms.BindingSource tBindSource)
        {
            try
            {
                tBindSource.EndEdit();
                DataSet dsBindSet = new DataSet();
                if (tBindSource.DataSource is DataSet)
                {
                    dsBindSet = (DataSet)tBindSource.DataSource;
                }
                else if (tBindSource.DataSource is DataTable)
                {
                    DataTable dt = (DataTable)tBindSource.DataSource;
                    dsBindSet = dt.DataSet;
                }
                if (dsBindSet.HasChanges())
                {
                    throw new Exception("�����ѱ����ġ�");
                }
            }
            catch (Exception ex)
            {
                if (!isQuery)
                {
                    if (!ex.Message.Equals("�����ѱ����ġ�"))
                        throw new Exception(ex.Message);

                }
                DialogResult dr = EF.EFMessageBox.Show("��������ʧδ����ĸ��ģ��Ƿ������", "epEname", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dr == DialogResult.No)
                {
                    throw new Exception("�������.���������ĸ��ġ�");
                }
            }
        }
コード例 #18
0
ファイル: Xml.cs プロジェクト: spsinghdocument1/some
        void Display_lavel()
        {
            DataSet ds = new DataSet();
            ds.ReadXml(s + "\\MyXmlFile.xml");
            if (ds != null && ds.HasChanges())
            {

                if (ds.Tables[0].Rows.Count >= 1)
                {
                    DataRow dr = ds.Tables[0].Rows[3];

                    label4.Text = dr[0].ToString();
                    label5.Text = dr[2].ToString();

                }

            }
        }
コード例 #19
0
ファイル: Xml.cs プロジェクト: spsinghdocument1/some
        void display()
        {
            DataSet ds = new DataSet();
            ds.ReadXml(s + "\\MyXmlFile.xml");
            if (ds != null && ds.HasChanges())
            {
                dataGridView2.AutoGenerateColumns = false;
                dataGridView2.Columns[0].Name = "ID";
                dataGridView2.Columns[0].HeaderText = "ID";
                dataGridView2.Columns[0].DataPropertyName = "ID";

                dataGridView2.Columns[1].Name = "Name";
                dataGridView2.Columns[1].HeaderText = "Name";
                dataGridView2.Columns[1].DataPropertyName = "Name";

                dataGridView2.Columns[2].Name = "Course";
                dataGridView2.Columns[2].HeaderText = "Course";
                dataGridView2.Columns[2].DataPropertyName = "Course";

                dataGridView2.Columns[3].Name = "College";
                dataGridView2.Columns[3].HeaderText = "College";
                dataGridView2.Columns[3].DataPropertyName = "College";

                dataGridView2.DataSource = ds.Tables[0];

            }
        }
コード例 #20
0
ファイル: Xml.cs プロジェクト: spsinghdocument1/some
        void combo()
        {
            DataSet ds = new DataSet();
            ds.ReadXml(s + "\\MyXmlFile.xml");
            if (ds != null && ds.HasChanges())
            {
                //for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
                //{
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {

                   // comboBox1.Items.Add(ds.Tables[0].Columns[i].ColumnName);
                    comboBox1.Items.Add(ds.Tables[0].Rows[i][0].ToString());

                }

            }
        }
コード例 #21
0
ファイル: InfoDataSet.cs プロジェクト: san90279/UK_OAS
        protected void OnBeforeApplyUpdates(EventArgs value)
        {
            EventHandler handler = (EventHandler)base.Events[EventOnBeforeApplyUpdates];
            if (handler != null)
            {
                handler(this, value);
            }

            DataTable mergeTab = new DataTable();
            DataSet mergedataset = new DataSet();
            DataSet ds = new DataSet();
            if (this.Container != null)
            {
                int i = this.Container.Components.Count;
                for (int j = 0; j < i; j++)
                {
                    if (this.Container.Components[j] is InfoBindingSource)
                    {
                        InfoBindingSource bs = (InfoBindingSource)this.Container.Components[j];
                        int m = bs.Relations.Count;
                        for (int n = 0; n < m; n++)
                        {
                            InfoRelation infoRel = bs.Relations[n];
                            ds = this.fRealDataSet;
                            if (infoRel.RelationDataSet.GetRealDataSet() == ds)
                            {
                                if (ds.HasChanges())
                                {
                                    string strTabName = this.RemoteName.Substring(this.RemoteName.IndexOf('.') + 1);
                                    mergeTab = ds.GetChanges().Tables[strTabName];
                                    mergedataset = ds.GetChanges();
                                    if (((InfoDataSet)bs.GetDataSource()).RealDataSet.Tables[0].Rows.Count == 0)
                                    {
                                        bs.Set_fEmptyViewMerge();
                                    }
                                    //2008/8/4 by ccm, 解决最后一笔无法删除的问题,取消DoDelay事件,避免触发使master重新取资料变为unchanged,导致无法删除。
                                    bs.CancelPositionChanged = true;
                                    ((InfoDataSet)bs.GetDataSource()).RealDataSet.Tables[0].Merge(mergeTab);
                                    bs.CancelPositionChanged = false;

                                    //2008-9-9 Modified by lily 最後一筆master無法删除的問題。View在merge后master的資料會不見,重新merge一次master。
                                    if (mergeTab.Rows.Count > 0 && mergeTab.Rows[0].RowState == DataRowState.Deleted)
                                    {
                                        //2007/01/12 Master-Detail-View因为无法删除最后一笔资料而新增 by Rax
                                        ds.Tables[strTabName].Merge(mergeTab);

                                        foreach (DataTable tb in ds.Tables)
                                        {
                                            if (mergedataset.Tables[tb.TableName] != null)
                                            {
                                                tb.Merge(mergedataset.Tables[tb.TableName]);
                                            }
                                        }
                                        //2007/01/12 end
                                    }
                                    ArrayList keyFields = this.GetKeyFields();
                                    int p = mergeTab.Rows.Count - 1;
                                    if (p >= 0 && (mergeTab.Rows[p].RowState == DataRowState.Added || mergeTab.Rows[p].RowState == DataRowState.Modified))
                                    {
                                        int x = keyFields.Count;
                                        object[] keyValues = new object[x];
                                        for (int y = 0; y < x; y++)
                                        {
                                            keyValues[y] = mergeTab.Rows[p][keyFields[y].ToString()];
                                        }
                                        DataRow locRow = ((InfoDataSet)bs.GetDataSource()).RealDataSet.Tables[0].Rows.Find(keyValues);
                                        if (locRow != null)
                                        {
                                            int a = bs.List.Count;
                                            for (int b = 0; b < a; b++)
                                            {
                                                if (((DataRowView)bs.List[b]).Row == locRow)
                                                {
                                                    // 2006/08/05 將View BindingSource.Relation.Active設  為False,Find()完後, 再設為True
                                                    if (infoRel.Active)
                                                    {
                                                        RelationsActive = true;
                                                        infoRel.Active = false;
                                                    }
                                                    // 2006/08/05

                                                    //2008/9/4 modified by ccm在新增的時候會插入最後一筆,導致取下一批資料
                                                    bs.CancelPositionChanged = true;
                                                    bs.Position = b;
                                                    bs.CancelPositionChanged = false;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
コード例 #22
0
ファイル: DataSetTest2.cs プロジェクト: carrie901/mono
		[Test] public void HasChanges()
		{
			DataSet ds = new DataSet();
			ds.Tables.Add(DataProvider.CreateParentDataTable());

			// HasChanges 1
			Assert.AreEqual(false , ds.HasChanges(), "DS36");

			DataRow dr = ds.Tables[0].NewRow();
			dr[0] = 9;
			ds.Tables[0].Rows.Add(dr);

			// HasChanges 2
			Assert.AreEqual(true , ds.HasChanges(), "DS37");
		}
コード例 #23
0
ファイル: DataSet_HasChanges_D.cs プロジェクト: nlhepler/mono
	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;
	
		DataSet ds = new DataSet();
		
		DataRow dr;
		ds.Tables.Add(GHTUtils.DataProvider.CreateParentDataTable());

		try
		{
			BeginCase("HasChanges 1");
			Compare(ds.HasChanges(),false );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}

		//make some changes

		dr= ds.Tables[0].Rows[1];
		dr.Delete();
        
		dr = ds.Tables[0].Rows[2];
		dr[1] = "NewValue";
		
		dr = ds.Tables[0].Select("","",DataViewRowState.Unchanged)[0];
		
		dr = ds.Tables[0].NewRow();
		dr[0] = 1;
		ds.Tables[0].Rows.Add(dr);
		
		try
		{
			BeginCase("HasChanges Added");
			Compare(ds.HasChanges(DataRowState.Added),true );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
        
		try
		{
			BeginCase("HasChanges Deleted");
			Compare(ds.HasChanges(DataRowState.Deleted) ,true  );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
		
		try
		{
			BeginCase("HasChanges Modified");
			Compare(ds.HasChanges(DataRowState.Modified),true);
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}

		try
		{
			BeginCase("HasChanges Unchanged");
			Compare(ds.HasChanges(DataRowState.Unchanged),true);
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}	
	}
コード例 #24
0
 // trata fallidas hilo ediciones remotas
 private static void Fallidas_bckWrk(DataSet dsRemoto, DataTable tablaActual, DataView viewOriginal)
 {
     string estado = dsRemoto.Tables[0].Rows[0].RowState.ToString();
     if (estado != "Added")  //estoy editando venta
     {
         int PK = Convert.ToInt32(dsRemoto.Tables[0].Rows[0][0].ToString());
         // No falló la inserción anterior y va haber que editarla en el remote server
         if (DAL.FallidasDAL.ExisteVentaFallida(PK, "Added") == false)
         {
             MySqlConnection SqlConnection1 = DALBase.GetConnection();
             DataTable tblVentasDetalleFallidas = new DataTable();
             tblVentasDetalleFallidas.TableName = "VentasDetalleFallidas";
             tblVentasDetalleFallidas.Columns.Add("Id", typeof(int));
             tblVentasDetalleFallidas.Columns.Add("IdVenta", typeof(int));
             tblVentasDetalleFallidas.Columns.Add("Accion", typeof(string));
             foreach (DataRow rowDetalle in tablaActual.Rows)
             {
                 int PkDetalle = Convert.ToInt32(rowDetalle["Id"].ToString());
                 if (rowDetalle["Accion"].ToString() == "Added")
                 {
                     DataRow rowFallidas = tblVentasDetalleFallidas.NewRow();
                     rowFallidas["Id"] = PkDetalle;
                     rowFallidas["IdVenta"] = PK;
                     rowFallidas["Accion"] = "Added";
                     tblVentasDetalleFallidas.Rows.Add(rowFallidas);
                 }
                 else if (rowDetalle["Accion"].ToString() == "Modified")
                 {
                     //si no existe una ventaDetalle 'Modified' o 'Added' con la misma pK la agrego a VentasDetalleFallidas'
                     if (DAL.FallidasDAL.ExisteVentaDetalleFallida(PkDetalle, "Modified") == false)
                     {
                         if (DAL.FallidasDAL.ExisteVentaDetalleFallida(PkDetalle, "Added") == false)
                         {
                             DataRow rowFallidas = tblVentasDetalleFallidas.NewRow();
                             rowFallidas["Id"] = PkDetalle;
                             rowFallidas["IdVenta"] = PK;
                             rowFallidas["Accion"] = "Modified";
                             tblVentasDetalleFallidas.Rows.Add(rowFallidas);
                         }
                     }
                 }
             }
             foreach (DataRowView rowDetalle in viewOriginal)  // busco filas borradas en tblVentasDetalle
             {
                 DataRow[] foundRow = tablaActual.Select("Id = '" + rowDetalle["IdDVEN"].ToString() + "'");
                 if (foundRow.Length == 0)
                 {
                     int PkDetalle = Convert.ToInt32(rowDetalle["IdDVEN"].ToString());
                     //si existe una ventaDetalle 'Added' con la misma PkDetalle la borro y nada mas, si no existe
                     //agrego una 'Deleted' a VentasDetalleFallidas
                     if (DAL.FallidasDAL.ExisteVentaDetalleFallida(PkDetalle, "Added"))
                     {
                         DAL.FallidasDAL.BorrarDetalleFallidas(PkDetalle, "Added");
                     }
                     else if (DAL.FallidasDAL.ExisteVentaDetalleFallida(PkDetalle, "Modified"))
                     {
                         DAL.FallidasDAL.BorrarDetalleFallidas(PkDetalle, "Modified");
                         DataRow rowFallidas = tblVentasDetalleFallidas.NewRow();
                         rowFallidas["Id"] = PkDetalle;
                         rowFallidas["IdVenta"] = PK;
                         rowFallidas["Accion"] = "Deleted";
                         tblVentasDetalleFallidas.Rows.Add(rowFallidas);
                     }
                     else
                     {
                         DataRow rowFallidas = tblVentasDetalleFallidas.NewRow();
                         rowFallidas["Id"] = PkDetalle;
                         rowFallidas["IdVenta"] = PK;
                         rowFallidas["Accion"] = "Deleted";
                         tblVentasDetalleFallidas.Rows.Add(rowFallidas);
                     }
                 }
             }
             DataSet ds = new DataSet();
             ds.Tables.Add(tblVentasDetalleFallidas);
             if (ds.HasChanges())
             {
                 DAL.FallidasDAL.GrabarVentasDetalleFallidas(ds, SqlConnection1);
             }
             SqlConnection1.Close();
         }
     }
 }
コード例 #25
0
ファイル: SqlFunction.cs プロジェクト: DBailey635/C1-CMS
        private string RunOleDbSequel(string connectionString, IDictionary<string, object> parameters)
        {
            string query = _functionInfo.Command;
            IDictionary<string, object> queryParameters = parameters;

            if (ShouldConvert(_functionInfo, parameters))
            {
                ConvertedQuery convertedQuery = ConvertToMSSqlSyntax(_functionInfo, parameters);
                query = convertedQuery.Query;
                queryParameters = convertedQuery.Parameters;
            }

            DataSet dataSet = null;
            string result = string.Empty;
            using (OleDbConnection connection = new OleDbConnection(connectionString))
            {
                using (OleDbCommand command = new OleDbCommand(query, connection))
                {
                    if (_functionInfo.IsStoredProcedure)
                    {
                        command.CommandType = CommandType.StoredProcedure;
                    }
                    else
                    {
                        command.CommandType = CommandType.Text;
                    }
                    foreach (KeyValuePair<string, object> parm in queryParameters)
                    {
                        command.Parameters.Add(new OleDbParameter(parm.Key, parm.Value));
                    }

                    connection.Open();
                    if (_functionInfo.IsQuery)
                    {
                        dataSet = new DataSet();
                        using (OleDbDataAdapter adapter = new OleDbDataAdapter())
                        {
                            adapter.SelectCommand = command;
                            adapter.Fill(dataSet);
                            if (dataSet != null && !dataSet.HasChanges())
                            {
                                StringWriter writer = new StringWriter();
                                dataSet.WriteXml(writer);
                                result = writer.ToString();
                            }
                        }
                    }
                    else
                    {
                        command.ExecuteNonQuery();
                    }
                }
            }
            return result;
        }
コード例 #26
0
        public int Update(System.Data.DataSet dataSet, string srcTable, bool inclHeader)
        {
            if (inclHeader)
            {
                m_hasheader = true;
            }

            if (dataSet.HasChanges())
            {
                DataTable table;

                try
                {
                    table = dataSet.Tables[srcTable];
                }
                catch
                {
                    //could not find the table specified
                    throw new ArgumentException("srcTable does not exist in specified dataSet");
                }
                //open filestream (overwrite previous file)
                m_writer = new StreamWriter(m_filename, false);

                if (m_hasheader)
                {
                    string columnrow = "";

                    //write header row
                    foreach (DataColumn dc in table.Columns)
                    {
                        //write column name
                        columnrow += dc.ColumnName + m_DelimiterString;
                    }

                    //write assembled column names minus the trailing comma
                    m_writer.WriteLine(columnrow.TrimEnd(m_DelimiterString.ToCharArray()));
                }

                //count the number of rows written
                int rowsaffected = 0;

                //write out all the rows (unless they were deleted)
                foreach (DataRow thisrow in table.Rows)
                {
                    //write all except deleted rows
                    if (thisrow.RowState != DataRowState.Deleted)
                    {
                        //write assembled row minus the trailing comma
                        m_writer.WriteLine(BuildRow(thisrow.ItemArray, m_DelimiterString, m_RemoveDelimiterString));
                        rowsaffected++;
                    }
                }

                //close filestream
                m_writer.Close();

                //mark dataset as up-to-date
                try
                {
                    dataSet.AcceptChanges();
                }
                catch
                {
                }
                //return number of rows written
                return(rowsaffected);
            }
            else
            {
                //no changes - ignore
                return(0);
            }
        }
コード例 #27
0
ファイル: SqlFunction.cs プロジェクト: DBailey635/C1-CMS
        private string RunSequel(string connectionString, IDictionary<string, object> parameters)
        {
            XmlReader reader = null;
            DataSet dataSet = null;
            string result = string.Empty;

            var connection = SqlConnectionManager.GetConnection(connectionString);

            using (SqlCommand command = new SqlCommand(_functionInfo.Command, connection))
            {
                if (_functionInfo.IsStoredProcedure)
                {
                    command.CommandType = CommandType.StoredProcedure;
                }
                else
                {
                    command.CommandType = CommandType.Text;
                }

                foreach (KeyValuePair<string, object> parm in parameters)
                {
                    command.Parameters.Add(new SqlParameter(parm.Key, parm.Value));
                }

                if (_functionInfo.IsQuery)
                {
                    if (_functionInfo.ReturnsXml)
                    {
                        reader = command.ExecuteXmlReader();
                        StringBuilder builder = new StringBuilder();
                        reader.Read();
                        while (!reader.EOF)
                        {
                            builder.Append(reader.ReadOuterXml());
                        }

                        result = builder.ToString();
                    }
                    else
                    {
                        dataSet = new DataSet();
                        using (SqlDataAdapter adapter = new SqlDataAdapter())
                        {
                            adapter.SelectCommand = command;
                            adapter.Fill(dataSet);
                            if (dataSet != null && !dataSet.HasChanges())
                            {
                                StringWriter writer = new StringWriter();
                                dataSet.WriteXml(writer);
                                result = writer.ToString();
                            }
                        }
                    }
                }
                else
                {
                    command.ExecuteNonQuery();
                }
            }

            return result;
        }
コード例 #28
0
ファイル: User_Input.cs プロジェクト: spsinghdocument1/some
        ////////////////////////////////////////////////////////////display //////////////
        void display()
        {
            DataSet ds = new DataSet();
            ds.ReadXml(Application.StartupPath + "\\UserInput.xml");
            if (ds != null && ds.HasChanges())
            {
                dataGridView2.AutoGenerateColumns = false;
                dataGridView2.Columns[0].Name = "user_name";
                dataGridView2.Columns[0].HeaderText = "user_name";
                dataGridView2.Columns[0].DataPropertyName = "user_name";

                dataGridView2.Columns[1].Name = "type";
                dataGridView2.Columns[1].HeaderText = "type";
                dataGridView2.Columns[1].DataPropertyName = "type";

                dataGridView2.DataSource = ds.Tables[0];

            }
        }
コード例 #29
0
ファイル: fallidas.cs プロジェクト: BenjaOtero/trend-pos
        public void bckWrk_DoWork(object sender, DoWorkEventArgs e)
        {
            if (BL.Utilitarios.HayInternet()) // si hay conexión a internet
            {
                #region ventas
                //
                //borrar ventas
                //
                DataTable tbl = BL.FallidasBLL.VentasGetByAccion("Deleted");
                if (tbl.Rows.Count > 0)
                {
                    //borro las ventas que no se borraron en el servidor remoto por falta de internet
                    BL.VentasBLL.BorrarByPK(tbl, ref codigoError);
                }
                //
                // agregar ventas
                //
                tbl = BL.FallidasBLL.VentasGetByAccion("Added");
                if (tbl.Rows.Count > 0)
                {
                    ds = BL.VentasBLL.CrearDatasetVentas(0);
                    dsVentas = ds.Clone(); // obtengo la estructura de las tablas ventas y ventasDetalle
                    tblVentas = dsVentas.Tables[0];
                    tblVentasDetalle = dsVentas.Tables[1];
                    tblVentas.TableName = "Ventas";
                    tblVentasDetalle.TableName = "VentasDetalle";
                    foreach (DataRow row in tbl.Rows) // obtengo las ventas que no se insertaron en el remote server para luego insert remoto
                    {
                        idVenta = Convert.ToInt32(row[0].ToString());
                        ds = BL.VentasBLL.CrearDatasetVentas(idVenta);
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            tblVentasFallidas = ds.Tables[0];
                            tblVentasDetalleFallidas = ds.Tables[1];
                            DataRow rwVentasFallidas = tblVentasFallidas.Rows[0];
                            tblVentas.ImportRow(rwVentasFallidas);
                            foreach (DataRow rwVentasDetalleFallidas in tblVentasDetalleFallidas.Rows)
                            {
                                tblVentasDetalle.ImportRow(rwVentasDetalleFallidas);
                            }
                        }
                    }
                    dsVentas.AcceptChanges();
                    foreach (DataRow rowVentas in tblVentas.Rows)
                    {
                        rowVentas.SetAdded();
                    }
                    foreach (DataRow rowDetalle in tblVentasDetalle.Rows)
                    {
                        rowDetalle.SetAdded();
                    }
                    if (tblVentas.GetChanges() != null || tblVentasDetalle.GetChanges() != null)
                    {
                        bool grabarFallidas = true;
                        BL.TransaccionesBLL.GrabarVentas(dsVentas, ref codigoError, grabarFallidas);
                    }
                }

                #endregion

                #region ventasDetalle

                //
                // borrar
                //
                tbl = BL.FallidasBLL.VentasDetalleGetByAccion("Deleted");
                if (tbl.Rows.Count > 0)
                {
                    BL.VentasDetalleBLL.BorrarByPK(tbl, ref codigoError);
                }
                //
                // agregar
                //
                tbl = BL.FallidasBLL.VentasDetalleGetByAccion("Added");
                if (tbl.Rows.Count > 0)
                {
                    ds = BL.VentasDetalleBLL.GetSchema(0);
                    dsVentas = ds.Clone(); // obtengo la estructura de las tablas ventasDetalle
                    tblVentasDetalle = dsVentas.Tables[1];
                    tblVentasDetalle.TableName = "VentasDetalle";
                    foreach (DataRow row in tbl.Rows) // obtengo las ventas que no se insertaron en el remote server para luego insert remoto
                    {
                        idVenta = Convert.ToInt32(row[0].ToString());
                        // obtengo las ventasDetalle que no se insertaron en el remote server para luego insert remoto
                        ds = BL.VentasDetalleBLL.GetFallidas(idVenta);
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            foreach (DataRow rwVentasDetalleFallidas in ds.Tables[0].Rows)
                            {
                                tblVentasDetalle.ImportRow(rwVentasDetalleFallidas);
                            }
                        }
                    }
                    foreach (DataRow rowDetalle in tblVentasDetalle.Rows)
                    {
                        rowDetalle.SetAdded();
                    }
                    if (dsVentas.HasChanges())
                    {
                        BL.VentasDetalleBLL.InsertFallidasRemoteServer(dsVentas, ref codigoError);
                    }
                }
                //
                // editar
                //
                tbl = BL.FallidasBLL.VentasDetalleGetByAccion("Modified");
                if (tbl.Rows.Count > 0)
                {
                    ds = BL.VentasDetalleBLL.GetSchema(0);
                    dsVentas = ds.Clone(); // obtengo la estructura de las tablas ventasDetalle
                    tblVentasDetalle = dsVentas.Tables[1];
                    tblVentasDetalle.TableName = "VentasDetalle";
                    foreach (DataRow row in tbl.Rows) // obtengo las ventas que no se insertaron en el remote server para luego insert remoto
                    {
                        idVenta = Convert.ToInt32(row[0].ToString());
                        // obtengo las ventasDetalle que no se insertaron en el remote server para luego insert remoto
                        ds = BL.VentasDetalleBLL.GetFallidas(idVenta);
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            foreach (DataRow rwVentasDetalleFallidas in ds.Tables[0].Rows)
                            {
                                tblVentasDetalle.ImportRow(rwVentasDetalleFallidas);
                            }
                        }
                    }
                    foreach (DataRow rowDetalle in tblVentasDetalle.Rows)
                    {
                        rowDetalle.SetModified();
                    }
                    if (dsVentas.HasChanges())
                    {
                        BL.VentasDetalleBLL.EditFallidasRemoteServer(dsVentas, ref codigoError);
                    }
                }

                #endregion

                #region TesoreriaMovimientos
                //
                //borrar TesoreriaMovimientos
                //
                tbl = BL.FallidasBLL.TesoreriaGetByAccion("Deleted");
                if (tbl.Rows.Count > 0)
                {
                    //borro las movimientos de tesoreria que no se borraron en el servidor remoto por falta de internet
                    BL.TesoreriaMovimientosBLL.BorrarByPK(tbl, ref codigoError);
                }
                //
                // agregar TesoreriaMovimientos
                //
                tbl = BL.FallidasBLL.TesoreriaGetByAccion("Added");
                if (tbl.Rows.Count > 0)
                {
                    ds = BL.TesoreriaMovimientosBLL.CrearDataset();
                    DataSet dsTesoreria = ds.Clone(); // obtengo la estructura de la tabla TesoreriaMovimientos
                    DataTable tblTesoreria = dsTesoreria.Tables[0];
                    tblTesoreria.TableName = "TesoreriaMovimientos";
                    foreach (DataRow row in tbl.Rows) // obtengo las ventas que no se insertaron en el remote server para luego insert remoto
                    {
                        int idMov = Convert.ToInt32(row[0].ToString());
                        ds = BL.TesoreriaMovimientosBLL.CrearDatasetMovimiento(idMov);
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            tblTesoreriaFallidas = ds.Tables[0];
                            DataRow rwTesoreriaFallidas = tblTesoreriaFallidas.Rows[0];
                            tblTesoreria.ImportRow(rwTesoreriaFallidas);
                        }
                    }
                    dsTesoreria.AcceptChanges();
                    foreach (DataRow rowTesoreria in tblTesoreria.Rows)
                    {
                        rowTesoreria.SetAdded();
                    }
                    if (tblTesoreria.GetChanges() != null)
                    {
                        bool grabarFallidas = true;
                        BL.TesoreriaMovimientosBLL.InsertFallidasRemoteServer(dsTesoreria, ref codigoError, grabarFallidas);
                    }
                }
                //
                // editar TesoreriaMovimientos
                //
                tbl = BL.FallidasBLL.TesoreriaGetByAccion("Modified");
                if (tbl.Rows.Count > 0)
                {
                    ds = BL.TesoreriaMovimientosBLL.CrearDataset();
                    DataSet dsTesoreria = ds.Clone(); // obtengo la estructura de la tabla TesoreriaMovimientos
                    DataTable tblTesoreria = dsTesoreria.Tables[0];
                    tblTesoreria.TableName = "TesoreriaMovimientos";
                    foreach (DataRow row in tbl.Rows) // obtengo las ventas que no se insertaron en el remote server para luego insert remoto
                    {
                        int idMov = Convert.ToInt32(row[0].ToString());
                        ds = BL.TesoreriaMovimientosBLL.CrearDatasetMovimiento(idMov);
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            tblTesoreriaFallidas = ds.Tables[0];
                            DataRow rwTesoreriaFallidas = tblTesoreriaFallidas.Rows[0];
                            tblTesoreria.ImportRow(rwTesoreriaFallidas);
                        }
                    }
                    dsTesoreria.AcceptChanges();
                    foreach (DataRow rowTesoreria in tblTesoreria.Rows)
                    {
                        rowTesoreria.SetModified();
                    }
                    if (tblTesoreria.GetChanges() != null)
                    {
                        bool grabarFallidas = true;
                        BL.TesoreriaMovimientosBLL.EditFallidasRemoteServer(dsTesoreria, ref codigoError, grabarFallidas);
                    }
                }
                #endregion

                #region FondoCaja
                //
                // agregar FondoCaja
                //
                tbl = BL.FallidasBLL.FondoCajaGetByAccion("Added");
                if (tbl.Rows.Count > 0)
                {
                    ds = BL.FondoCajaBLL.CrearDataset();
                    DataSet dsFondoCaja = ds.Clone(); // obtengo la estructura de la tabla
                    DataTable tblFondoCaja = dsFondoCaja.Tables[0];
                    tblFondoCaja.TableName = "FondoCaja";
                    foreach (DataRow row in tbl.Rows) // obtengo las ventas que no se insertaron en el remote server para luego insert remoto
                    {
                        int idMov = Convert.ToInt32(row[0].ToString());
                        ds = BL.FondoCajaBLL.GetByPk(idMov);
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            tblFondoFallidas = ds.Tables[0];
                            DataRow rwFondoFallidas = tblFondoFallidas.Rows[0];
                            tblFondoCaja.ImportRow(rwFondoFallidas);
                        }
                    }
                    dsFondoCaja.AcceptChanges();
                    foreach (DataRow rowFondo in tblFondoCaja.Rows)
                    {
                        rowFondo.SetAdded();
                    }
                    if (tblFondoCaja.GetChanges() != null)
                    {
                        bool grabarFallidas = true;
                        BL.FondoCajaBLL.InsertFallidasRemoteServer(dsFondoCaja, ref codigoError, grabarFallidas);
                    }
                }
                //
                // editar FondoCaja
                //
                tbl = BL.FallidasBLL.FondoCajaGetByAccion("Modified");
                if (tbl.Rows.Count > 0)
                {
                    ds = BL.FondoCajaBLL.CrearDataset();
                    DataSet dsFondoCaja = ds.Clone(); // obtengo la estructura de la tabla TesoreriaMovimientos
                    DataTable tblFondoCaja = dsFondoCaja.Tables[0];
                    tblFondoCaja.TableName = "FondoCaja";
                    foreach (DataRow row in tbl.Rows) // obtengo las ventas que no se insertaron en el remote server para luego insert remoto
                    {
                        int idMov = Convert.ToInt32(row[0].ToString());
                        ds = BL.FondoCajaBLL.GetByPk(idMov);
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            tblFondoFallidas = ds.Tables[0];
                            DataRow rwFondoFallidas = tblFondoFallidas.Rows[0];
                            tblFondoCaja.ImportRow(rwFondoFallidas);
                        }
                    }
                    dsFondoCaja.AcceptChanges();
                    foreach (DataRow rowFondo in tblFondoCaja.Rows)
                    {
                        rowFondo.SetModified();
                    }
                    if (tblFondoCaja.GetChanges() != null)
                    {
                        bool grabarFallidas = true;
                        BL.FondoCajaBLL.EditFallidasRemoteServer(dsFondoCaja, ref codigoError, grabarFallidas);
                    }
                }
                #endregion

                #region Clientes
                // la inserción de registros fallidos en el remote server y el borrado de registros de la tabla local "clientesfallidas",
                // se hace toda através de ClientesBLL y ClientesDAL no se usa
                // como en ventas, ventasDetalle, TesoreriaMovimientos y FondoCaja las clases FallidasBLL y FallidasDAL
                //
                //borrar Clientes
                //
                tbl = BL.ClientesBLL.ClienteGetByAccion("Delete"); // OJO !!! que las otras tablas locales fallidas guardan 'Modified', 'Deleted', 'Added'
                if (tbl.Rows.Count > 0)
                {
                    //borro los clientes que no se borraron en el servidor remoto por falta de internet
                    BL.ClientesBLL.BorrarByPK(tbl, ref codigoError);
                }
                //
                // agregar Clientes
                //
                tbl = BL.ClientesBLL.ClienteGetByAccion("Add");// OJO !!! que las otras tablas locales fallidas guardan 'Modified', 'Deleted', 'Added'
                if (tbl.Rows.Count > 0)
                {
                    ds = BL.ClientesBLL.GetClientes(0);
                    DataSet dsCliente = ds.Clone(); // obtengo la estructura de la tabla Clientes
                    DataTable tblCliente = dsCliente.Tables[0];
                    tblCliente.TableName = "Clientes";
                    foreach (DataRow row in tbl.Rows) // obtengo los clientes que no se insertaron en el remote server para luego insert remoto
                    {
                        int idCliente = Convert.ToInt32(row[0].ToString());
                        ds = BL.ClientesBLL.GetRegistroFallido(idCliente);
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            tblClienteFallidas = ds.Tables[0];
                            DataRow rwClienteFallidas = tblClienteFallidas.Rows[0];
                            tblCliente.ImportRow(rwClienteFallidas);
                        }
                    }
                    dsCliente.AcceptChanges();
                    foreach (DataRow rowCliente in tblCliente.Rows)
                    {
                        rowCliente.SetAdded();
                    }
                    if (tblCliente.GetChanges() != null)
                    {
                        bool grabarFallidas = true;
                        BL.ClientesBLL.GrabarFallidasRemoteServer(dsCliente, ref codigoError, grabarFallidas, "Add");
                    }
                }
                //
                // editar Clientes
                //
                tbl = BL.ClientesBLL.ClienteGetByAccion("Change");// OJO !!! que las otras tablas locales fallidas guardan 'Modified', 'Deleted', 'Added'
                if (tbl.Rows.Count > 0)
                {
                    ds = BL.ClientesBLL.GetClientes(0);
                    DataSet dsCliente = ds.Clone(); // obtengo la estructura de la tabla Clientes
                    DataTable tblCliente = dsCliente.Tables[0];
                    tblCliente.TableName = "Clientes";
                    foreach (DataRow row in tbl.Rows) // obtengo los clientes que no se insertaron en el remote server para luego insert remoto
                    {
                        int idCliente = Convert.ToInt32(row[0].ToString());
                        ds = BL.ClientesBLL.GetRegistroFallido(idCliente);
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            tblClienteFallidas = ds.Tables[0];
                            DataRow rwClienteFallidas = tblClienteFallidas.Rows[0];
                            tblCliente.ImportRow(rwClienteFallidas);
                        }
                    }
                    dsCliente.AcceptChanges();
                    foreach (DataRow rowCliente in tblCliente.Rows)
                    {
                        rowCliente.SetModified();
                    }
                    if (tblCliente.GetChanges() != null)
                    {
                        bool grabarFallidas = true;
                        BL.ClientesBLL.GrabarFallidasRemoteServer(dsCliente, ref codigoError, grabarFallidas, "Change");
                    }
                }
                #endregion
            }
        }