Example #1
0
        private static DataSet GetChildren(SuperKeyDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.SuperKeyChildrenGet " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, SuperKeyDataModel.DataColumns.SuperKeyId);

            var oDT = new DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Example #2
0
        static public DataSet DeleteChildren(ReleaseLogStatusDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.ReleaseLogStatusChildrenDelete " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, ReleaseLogStatusDataModel.DataColumns.ReleaseLogStatusId);

            var oDT = new DBDataSet("Delete Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Example #3
0
        private static DataSet GetChildren(FunctionalityImageInstanceDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.FunctionalityImageInstanceChildrenGet " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, FunctionalityImageInstanceDataModel.DataColumns.FunctionalityImageInstanceId);

            var oDT = new DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Example #4
0
        public static DataSet DeleteChildren(ActivityDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.ActivityChildrenDelete " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, ActivityDataModel.DataColumns.ActivityId);

            var oDT = new DBDataSet("Activity.DeleteChildren", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Example #5
0
        public static DataSet DeleteChildren(FunctionalityXFunctionalityDevelopmentStepDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.FunctionalityXFunctionalityDevelopmentStepChildrenDelete " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, FunctionalityXFunctionalityDevelopmentStepDataModel.DataColumns.FunctionalityXFunctionalityDevelopmentStepId);

            var oDT = new DBDataSet("FunctionalityXFunctionalityDevelopmentStep.DeleteChildren", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Example #6
0
        private static DataSet GetChildren(ApplicationRoleDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.ApplicationRoleChildrenGet " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, ApplicationRoleDataModel.DataColumns.ApplicationRoleId);

            var oDT = new DBDataSet("ApplicationRole.GetChildren", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Example #7
0
        public static DataSet DeleteChildren(TaskStatusTypeDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.TaskStatusTypeChildrenDelete " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, TaskStatusTypeDataModel.DataColumns.TaskStatusTypeId);

            var oDT = new DBDataSet("TaskStatusType.DeleteChildren", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Example #8
0
        public bool OpenMainDataSet(string sCon)
        {
            bool   bIsOK = false;
            string strX  = "";
            string sSql  = "";
            string sErr  = "";

            bDSIsOpenForMain            = false;
            grdList.AutoGenerateColumns = false;
            grdList.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            DBDataSet.Clear();
            sSql      = "select * from " + strTbNameMain + sCon;        //SQL语句  或 存储过程名 若有参数,另外在参数集里增加
            DBDataSet = SunEast.App.PubDBCommFuns.GetDataBySql(sSql, strTbNameMain, 0, 0, out sErr);
            bIsOK     = DBDataSet != null;
            if (bIsOK)
            {
                bIsOK = DBDataSet.Tables[0].Rows[0][0].ToString().Trim() == "0";
            }
            //if (bIsOK)
            //{
            //    DBDataSet.Clear();
            //    tbX  = new DataTable(strTbNameMain);
            //    tbX = dsX.Tables["data"].Copy();
            //    DBDataSet.Tables.Add(tbX);
            //}
            if (!bIsOK)
            {
                MessageBox.Show(sErr);
            }
            else
            {
                try
                {
                    bDSIsOpenForMain        = true;
                    this.bdsMain.DataSource = DBDataSet.Tables[strTbNameMain];
                    BindDataSetToCtrls();
                    ClearUIValues(pnlEdit);
                    if (bdsMain.Count > 0)
                    {
                        DataRowViewToUI((DataRowView)bdsMain.Current, pnlEdit);
                    }
                    bIsOK              = true;
                    optMain            = OperateType.optNone;
                    btn_SetPwd.Visible = false;
                    btn_SetPwd.Enabled = false;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    bIsOK = false;
                }
            }
            return(bIsOK);
        }
Example #9
0
 private IEnumerable<UnitWrapper> getUnitsFromDataTable(DBDataSet.UnitDataTable tbl)
 {
     DiciplineAccess da = new DiciplineAccess();
     return tbl.Select(unit => new UnitWrapper()
     {
         UnitCode = unit.UnitCode,
         Dicipline = da.GetDicipline(unit.UnitCode),
         Name = unit.Name,
         Description = unit.Description,
         Response = GetResponses(unit.UnitCode).ToList()
     });
 }
Example #10
0
        public static DataSet ReleaseNotesSearch(ReleaseLogDetailDataModel data, RequestProfile requestProfile)
        {
            // formulate SQL
            var sql = "EXEC dbo.ReleaseNotesSearch" +
                      " " + ToSQLParameter(data, ReleaseLogDetailDataModel.DataColumns.ReleaseDateMax) +
                      ", " + ToSQLParameter(data, ReleaseLogDetailDataModel.DataColumns.ReleaseDateMin) +
                      SearchParameter(data, requestProfile);

            var oDs = new DBDataSet("ReleaseLog.ReleaseNotesSearch", sql, DataStoreKey);

            return(oDs.DBDataset);
        }
Example #11
0
        public static DataSet SearchByKey(SearchKeyDataModel data, RequestProfile requestProfile)
        {
            // formulate SQL
            var sql = "EXEC dbo.SearchKeySearchByKey " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId) +
                      ", " + ToSQLParameter(data, SearchKeyDataModel.DataColumns.SearchKeyId);

            var oDT = new DBDataSet("SearchKey.Search", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Example #12
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            DBDataSet ds = new DBDataSet();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
        public void ButtonAddTemplate(object sender, RoutedEventArgs e)
        {
            DBDataSet dataSet = new DBDataSet();

            dataSet.AccessRights = 0;
            dataSet.FingerID     = m_SEN0188SQLite.getFreeFingerId();
            dataSet.FirstName    = "John";
            dataSet.SecondName   = "Doe";
            System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
            dataSet.SensorId = enc.GetBytes(SensorIDValue.Text);
            m_SEN0188SQLite.InsertDataSet(dataSet);
            m_SEN0188SQLite.GetDataSets();
            DataSets.SelectedItem = m_SEN0188SQLite.getDatabyId(dataSet.FingerID);
        }
Example #14
0
 public static void FillDataSet(DBDataSet aDBDataSet)
 {
     try
     {
         Helper.Instance.con.Open();
         SqlDataAdapter da = new SqlDataAdapter("Select * from Customer ", Helper.Instance.con);
         da.Fill(aDBDataSet, "Customer");
         Helper.Instance.con.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("ERROR IN *Customers* MGMT (FillDataSet FUNCTION) EX=" + ex.Message.ToString());
     }
 }
Example #15
0
        public static DataSet SearchView(ScheduleDataModel data, RequestProfile requestProfile)
        {
            // formulate SQL
            var sql = "EXEC dbo.ScheduleViewSearch " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId) +
                      ", " + ToSQLParameter(data, ScheduleDataModel.DataColumns.ScheduleId) +
                      ", " + ToSQLParameter(data, ScheduleDataModel.DataColumns.PersonId) +
                      ", " + ToSQLParameter(data, ScheduleDataModel.DataColumns.ScheduleStateId) +
                      ", " + ToSQLParameter(data, ScheduleDataModel.DataColumns.FromSearchDate) +
                      ", " + ToSQLParameter(data, ScheduleDataModel.DataColumns.ToSearchDate);

            var oDs = new DBDataSet("Schedule.Search", sql, DataStoreKey);

            return(oDs.DBDataset);
        }
        public async void ButtonEditTemplate(object sender, RoutedEventArgs e)
        {
            if (DataSets.SelectedItem == null)
            {
                return;
            }

            DBDataSet dataSet = DataSets.SelectedItem as DBDataSet;

            if (dataSet != null)
            {
                m_SEN0188SQLite.UpdateDataSet(dataSet);
                //    m_SEN0188SQLite.GetDataSets();
                m_Environment.IsAuthorized = m_Environment.IsLoggedIn && await m_Environment.checkAuthorizationAsync(m_Environment.User);
            }
        }
Example #17
0
        /*
         #region 私有变量
         * string strTbNameMain = "TWC_WareHouse";
         * string strKeyFld = "cWHId";
         * bool bDSIsOpenForMain = false;
         * //主表操作
         * OperateType optMain = OperateType.optNone;
         * //记录当前数据列表的 条件
         * StringBuilder sbConndition = new StringBuilder("");
         #endregion
         */
        //public

        private bool BandDataSet(string SqlStrConditon, DataGridView FDataGridView)
        {
            bool Result = true;

            try
            {
                string SqlStr = "";
                string ErrStr = "";
                bDSIsOpenForMain = false;
                FDataGridView.AutoGenerateColumns = false;
                FDataGridView.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
                DBDataSet.Clear();
                SqlStr         = "SELECT * FROM  " + strTbNameMain + " " + SqlStrConditon;
                Cursor.Current = Cursors.WaitCursor;
                DBDataSet      = PubDBCommFuns.GetDataBySql(AppInformation.SvrSocket, false, SqlStr, strTbNameMain, 0, 0, "dDate,dCreateDate,dCheckDate", out ErrStr);

                Result = DBDataSet != null;
                bindingSource_Main.DataSource = DBDataSet.Tables[strTbNameMain];;
                FDataGridView.DataSource      = bindingSource_Main;
                Cursor.Current = Cursors.Default;
                string sId = "";
                if (bindingSource_Main.Count > 0)
                {
                    DataRowView drv = (DataRowView)bindingSource_Main.Current;
                    sId = drv[strKeyFld].ToString().Trim();
                    try
                    {
                        bDSIsOpenForMain = true;
                        DataRowViewToUI(drv, panel_Edit);
                        OptMain = OperateType.optNone;
                    }
                    catch (Exception e)
                    {
                        bDSIsOpenForMain = false;
                        MessageBox.Show(e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Result = false;
                    }
                }
                BandDataSetDetail(" where cBNo='" + sId.Trim() + "'", dataGridView_Detail);
            }
            catch (Exception ei)
            {
                MessageBox.Show(ei.Message);
            }
            return(Result);
        }
Example #18
0
        private void btnguncelle_Click(object sender, EventArgs e)
        {
            int index = 1;

            adapter = new OleDbDataAdapter("SELECT * FROM [LISTE]", baglanti);
            ds      = new DBDataSet();
            baglanti.Open();
            adapter.Fill(ds, "LISTE");
            baglanti.Close();
            cmdb = new OleDbCommandBuilder(adapter);
            foreach (TextBox txt in this.Controls.OfType <TextBox>())
            {
                cmdb = new OleDbCommandBuilder(adapter);
                row  = ds.Tables["LISTE"].Rows[comboBox1.SelectedIndex];
                MessageBox.Show(row[index] + "");
                index++;
            }
        }
 //Wczytywanie pliku XML z operacjami na pozycji magazynowej i sprawdzenie danych
 private void loadDatabase()
 {
     try
     {
         string filePath = "db.xml";
         DBDataSet.ReadXml(filePath);
         dataGridWarehouse.DataSource = DBDataSet;
         dataGridWarehouse.DataMember = "transakcja";
     }
     catch (FileNotFoundException ex)
     {
         MessageBox.Show("Nie można załadować bazy danych." + ex);
     }
     catch (ArgumentException ex)
     {
         MessageBox.Show("Nie można załadować bazy danych." + ex);
     }
 }
        public async void ButtonAddLoggedInUserTemplate(object sender, RoutedEventArgs e)
        {
            if (m_Environment.User == null)
            {
                return;
            }

            DBDataSet dataSet = new DBDataSet();

            dataSet.AccessRights = 0x01; // Master Access
            dataSet.FingerID     = m_SEN0188SQLite.getFreeFingerId();
            dataSet.FirstName    = m_Environment.User.GivenName;
            dataSet.SecondName   = m_Environment.User.Surname;
            System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
            dataSet.SensorId = enc.GetBytes(SensorIDValue.Text);
            m_SEN0188SQLite.InsertDataSet(dataSet);
            m_SEN0188SQLite.GetDataSets();
            DataSets.SelectedItem      = m_SEN0188SQLite.getDatabyId(dataSet.FingerID);
            m_Environment.IsAuthorized = m_Environment.IsLoggedIn && await m_Environment.checkAuthorizationAsync(m_Environment.User);
        }
        public void ButtonDeleteTemplate(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            if (DataSets.SelectedItem == null)
            {
                return;
            }

            DBDataSet dataSet = DataSets.SelectedItem as DBDataSet;

            if (dataSet != null)
            {
                m_SEN0188SQLite.DelDataSetByFingerId(dataSet.FingerID);
                if (m_Environment.SensorInitialized)
                {
                    SensorCMDs.DeleteFingerId(m_Sensorinputconfigoptions, (UInt16)dataSet.FingerID);
                }

                m_SEN0188SQLite.GetDataSets();
            }
        }
Example #22
0
        public List <Dictionary <string, string> > GetODBCData(string connectionString, string queryString)
        {
            var data = new List <Dictionary <string, string> >();

            using (var dbConnection = new ODBConnection(connectionString))
                using (var dataSet = new DBDataSet(dbConnection, queryString))
                {
                    var cols = dataSet.ColumnNames;

                    while (dataSet.MoveNext())
                    {
                        var dic = new Dictionary <string, string>();
                        foreach (var col in cols)
                        {
                            dic[col] = dataSet.GetValue(col);
                        }
                        data.Add(dic);
                    }
                }

            return(data);
        }
        void Update_SEN0188_NotifyChangeState(IPropertySet Outputpropertys)
        {
            ProcessGPIOEvents ev;

            Object Valout;
            Int16  state               = -1;
            String cmdState            = "...";
            bool   doactFilledSensorId = false;

            if (Outputpropertys.TryGetValue("FingerPrint.CMDState", out Valout))
            {
                if (Valout != null)
                {
                    state = (Int16)Valout;
                }
            }

            if (Outputpropertys.TryGetValue("FingerPrint.CMDTextState", out Valout))
            {
                String cmd = Valout as String;
                if (cmd != null)
                {
                    cmdState = cmd;
                }
            }


            if (Outputpropertys.TryGetValue("FingerPrint.CMD", out Valout))
            {
                if (Valout != null)
                {
                    Int32 CMD = (Int32)Valout;

                    if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerSensorInitialize"))
                    {
                        if (state == 0)
                        {
                            m_Environment.SensorInitialized = true;
                            //   m_SensorInitialized = true;
                            doactFilledSensorId = true;
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerAutoVerifiying"))
                    {
                        if (m_EventQueue.Count > 0)
                        {
                            ev = m_EventQueue.Dequeue(); // get Event
                        }
                        else
                        {
                            return;
                        }

                        if (state == 0)
                        {
                            if (Outputpropertys.TryGetValue("FingerPrint.FingerID", out Valout))
                            {
                                if (Valout != null)
                                {
                                    UInt16 fingerId = (UInt16)Valout;
                                    if (Outputpropertys.TryGetValue("FingerPrint.Search_MatchScore", out Valout))
                                    {
                                        UInt16    MatchScore = (UInt16)Valout;
                                        DBDataSet dataset    = m_SEN0188SQLite.getDatabyId(fingerId);
                                        if (dataset != null)
                                        {
                                            FingerEvent eventSet;
                                            if (dataset.AccessRights_Bit0 || (dataset.AccessRights & ev.AccessRights) != 0) // Master Bit
                                            {
                                                ev.UpdateState(0);                                                          // update inativ setzen

                                                ev.ProcessOutput();

                                                cmdState = String.Format("Permission to Access: {0}", ev.Ident);
                                                eventSet = createSensorEvent(dataset.FirstName, dataset.SecondName, MatchScore, fingerId, ev.Ident, state, cmdState);

                                                ProcessGPIOEvents evOk = getProcessGPIOEventsByIdent("State_OK");
                                                if (evOk != null)
                                                {
                                                    evOk.ProcessOutput();
                                                }
                                                ev.UpdateState(1); // update aktiv setzen
                                            }
                                            else
                                            {
                                                cmdState = String.Format("no Permission to Access: {0}", ev.Ident);
                                                state    = -2;
                                                eventSet = createSensorEvent(dataset.FirstName, dataset.SecondName, MatchScore, fingerId, ev.Ident, state, cmdState);

                                                ProcessGPIOEvents evNoPermiss = getProcessGPIOEventsByIdent("State_NoPermiss");
                                                if (evNoPermiss != null)
                                                {
                                                    evNoPermiss.UpdateState(0); // update inativ setzen
                                                    evNoPermiss.ProcessOutput();
                                                    evNoPermiss.UpdateState(1); // update aktiv setzen
                                                }
                                            }

                                            bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet);
                                            NotifyEvent?.Invoke(this, eventSet);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            FingerEvent       eventSet     = createSensorEvent("John", "Doe", -1, -1, ev.Ident, state, cmdState);
                            ProcessGPIOEvents evStateError = getProcessGPIOEventsByIdent("State_Error");
                            if (evStateError != null)
                            {
                                evStateError.UpdateState(0); // update inativ setzen
                                evStateError.ProcessOutput();
                                evStateError.UpdateState(1); // update aktiv setzen
                            }
                            ;

                            bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet);
                            NotifyEvent?.Invoke(this, eventSet);
                        }
                    }
                }
            }

            if (doactFilledSensorId)
            {
                //   m_SensorId.Clear();
                if (Outputpropertys.TryGetValue("FingerPrint.SensorID", out Valout))
                {
                    if (Valout != null)
                    {
                        byte[] array = Valout as byte[];
                        if (array != null)
                        {
                            m_SensorID = System.Text.Encoding.UTF8.GetString(array, 0, array.Length);
                        }
                    }
                }
            }
        }
 private void ReadDB(string _strfilename, int _irobotid)
 {
     this.iRobotID = _irobotid;
     this.strDBPath = _strfilename;
     DSDatabase = new DBDataSet();
     DSDatabase.Disposed += new EventHandler(DSDatabase_Disposed);
     if (this.bDataSetFilled = dbHandler.bFillDataSet(DSDatabase, this.strDBPath))
     {
         SetStatusText("DB succesfully loaded!");
         if (robotSerialPort.IsOpen) connectionButton_Click(null, null);
         refreshPortsButton_Click(null, null);
         refreshBaudRatesButton_Click(null, null);
         Reading();
     }
 }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     DBDataSet ds = new DBDataSet();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
        void Update_SEN0188_NotifyChangeState(IPropertySet Outputpropertys)
        {
            bool   doactFilledFingerLib = false;
            bool   doactFilledSensorId  = false;
            Object Valout;
            Int16  state = -1;

            if (Outputpropertys.TryGetValue("FingerPrint.CMDState", out Valout))
            {
                if (Valout != null)
                {
                    state = (Int16)Valout;
                }
            }

            if (Outputpropertys.TryGetValue("FingerPrint.CMD", out Valout))
            {
                if (Valout != null)
                {
                    Int32 CMD = (Int32)Valout;

                    if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerSensorInitialize"))
                    {
                        if (state == 0)
                        {
                            doactFilledFingerLib            = true;
                            doactFilledSensorId             = true;
                            m_Environment.SensorInitialized = true;
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerRegistration") || CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerAutoRegistration"))
                    {
                        if (Outputpropertys.TryGetValue("FingerPrint.RegististrationState", out Valout))
                        {
                            if (Valout != null)
                            {
                                Int32 regState = (Int32)Valout;
                                if (regState >= 5)
                                {
                                    if (Outputpropertys.TryGetValue("FingerPrint.Registration_FingerID", out Valout))
                                    {
                                        UInt16 PageId = (UInt16)Valout;
                                        if (state == 0)
                                        {
                                            if (Outputpropertys.TryGetValue("FingerPrint.CHARUpLoad", out Valout))
                                            {
                                                if (Valout != null)
                                                {
                                                    byte[] array = Valout as byte[];
                                                    if (array != null)
                                                    {
                                                        DBDataSet dataset = m_SEN0188SQLite.getDatabyId(PageId);
                                                        if (dataset != null)
                                                        {
                                                            dataset.FingerTemplate = array;

                                                            if (SensorIDValue.Text.Length > 0)
                                                            {
                                                                dataset.SensorId = System.Text.Encoding.UTF8.GetBytes(SensorIDValue.Text);
                                                            }


                                                            this.m_SEN0188SQLite.UpdateFingerTemplateDataSet(dataset);
                                                            DataSets.SelectedItem = dataset;
                                                            doactFilledFingerLib  = true;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerDeleteId"))
                    {
                        if (state == 0)
                        {
                            doactFilledFingerLib = true;
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerAutoVerifiying"))
                    {
                        if (state == 0)
                        {
                            if (Outputpropertys.TryGetValue("FingerPrint.FingerID", out Valout))
                            {
                                if (Valout != null)
                                {
                                    UInt16 fingerId = (UInt16)Valout;
                                    if (Outputpropertys.TryGetValue("FingerPrint.Search_MatchScore", out Valout))
                                    {
                                        UInt16    MatchScore = (UInt16)Valout;
                                        DBDataSet dataset    = m_SEN0188SQLite.getDatabyId(fingerId);
                                        if (dataset != null)
                                        {
                                            if (MatchScore > dataset.MatchScore)
                                            {
                                                dataset.MatchScore = MatchScore;
                                                this.m_SEN0188SQLite.UpdateMatchScoreDataSet(dataset);
                                            }
                                            DataSets.SelectedItem = dataset;
                                        }
                                        else
                                        {
                                            DataSets.SelectedItem = null;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerCharDownLoad"))
                    {
                        if (state == 0)
                        { // dowwload succesfull
                            if (Outputpropertys.TryGetValue("FingerPrint.Registration_FingerID", out Valout))
                            {
                                UInt16 FingerId = (UInt16)Valout;
                                if (state == 0)
                                {
                                    DBDataSet dataset = m_SEN0188SQLite.getDatabyId(FingerId);
                                    if (dataset != null)
                                    {
                                        DataSets.SelectedItem = dataset;
                                        doactFilledFingerLib  = true;
                                    }
                                    else
                                    {
                                        DataSets.SelectedItem = null;
                                    }
                                }
                            }
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerWriteSensorID"))// write Sensor-ID
                    {
                        if (state == 0)
                        { // dowwload succesfull
                            doactFilledSensorId = true;
                        }
                    }
                }
            }



            if (doactFilledSensorId)
            {
                //   m_SensorId.Clear();
                if (Outputpropertys.TryGetValue("FingerPrint.SensorID", out Valout))
                {
                    if (Valout != null)
                    {
                        byte[] array = Valout as byte[];
                        if (array != null)
                        {
                            /*
                             * for (uint i = 0; i < array.Length; i++)
                             * {
                             *  m_SensorId.Add(array[i]);
                             * }
                             */
                            SensorIDValue.Text = System.Text.Encoding.UTF8.GetString(array, 0, array.Length);
                        }
                    }
                }
            }

            if (doactFilledFingerLib)
            {
                m_FilledFingerLib.Clear();
                if (Outputpropertys.TryGetValue("FingerPrint.FilledFingerLib", out Valout))
                {
                    if (Valout != null)
                    {
                        UInt32[] array = Valout as UInt32[];
                        if (array != null)
                        {
                            for (uint i = 0; i < array.Length; i++)
                            {
                                m_FilledFingerLib.Add(array[i]);
                            }
                        }
                    }
                }
            }

            if (Outputpropertys.TryGetValue("FingerPrint.CMDTextState", out Valout))
            {
                String cmd = Valout as String;
                if (cmd != null)
                {
                    SensorCmdState.Text = cmd;
                }
            }
        }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     DBDataSet ds = new DBDataSet();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "ProductosDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
 public virtual int Update(DBDataSet.ProductosDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
Example #29
0
        public bool OpenMainDataSet()
        {
            if (UserInformation.UType != UserType.utSupervisor)
            {
                strConnFix = " and cCmptId='" + UserInformation.UnitId + "'";
            }
            bool   bIsOK = false;
            string strX  = "";

            grdList.AutoGenerateColumns = false;
            grdList.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            DBDataSet.Clear();
            DBCommInfo.DBSQLCommandInfo cmdInfo = new DBSQLCommandInfo();                                 //执行命令的对象
            cmdInfo.SqlText = "select * from " + strTbNameMain + " where 1=1 " + sCondition + strConnFix; //SQL语句  或 存储过程名 若有参数,另外在参数集里增加
            //if (UserInformation.UType != UserType.utSupervisor)
            //{
            //    cmdInfo.SqlText = cmdInfo.SqlText + " where "+strKeyFld+"='"+ UserInformation.UnitId +"'"; //仅显示当前用户的单位
            //}
            cmdInfo.SqlType       = SqlCommandType.sctSql;                  //SQL命令类型  SqlCommandType.sctSql  SQL 语句 SqlCommandType.sctProcedure 表存储过程
            cmdInfo.PageIndex     = 0;                                      //需要分页时的页号
            cmdInfo.PageSize      = 0;                                      //需要分页时的每页记录条数
            cmdInfo.FromSysType   = "dotnet";                               //采用处理结果数据的方式:php 表按照<tr><td></td></tr> xml 否则 直接采用ado 的记录集方式
            cmdInfo.DataTableName = strTbNameMain;                          //指定结果数据记录集表名
            SunEast.SeDBClient sdcX = new SeDBClient();                     //获取服务器数据的类型对象
            //sdcX.DBSTServer = DBSocketServerType.dbsstNormal;  //自动根据配置文件读
            string sErr = "";

            //DataSet dsX = null;
            //DataTable tbX= null ;
            DBDataSet = sdcX.GetDataSet(cmdInfo, out sErr);               //通过获取服务器数据对象的GetDataSet方法获取数据
            bIsOK     = DBDataSet != null;
            //if (bIsOK)
            //{
            //    DBDataSet.Clear();
            //    tbX  = new DataTable(strTbNameMain);
            //    tbX = dsX.Tables["data"].Copy();
            //    DBDataSet.Tables.Add(tbX);
            //}
            if (!bIsOK)
            {
                MessageBox.Show(sErr);
            }
            else
            {
                try
                {
                    //DBDataSet.Tables["data"].TableName = strTbNameMain;
                    //DataSetUnBind(pnlEdit);
                    ClearUIValues(pnlEdit);
                    bIsMainOpened           = false;
                    this.bdsMain.DataSource = DBDataSet.Tables[strTbNameMain];
                    bIsMainOpened           = true;
                    grdList.DataSource      = bdsMain;
                    bdsMain_PositionChanged(null, null);
                    //if (bdsMain != null && bdsMain.Count > 0)
                    //{
                    //    DataRowView drv = (DataRowView)bdsMain.Current;
                    //    object objX = drv["cCmptId"];
                    //    //DataRowViewToUI(drv, pnlEdit);
                    //}
                    bIsOK   = true;
                    optMain = OperateType.optNone;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    bIsOK = false;
                }
            }
            return(bIsOK);
        }
        void ButtonComWithSensor(Object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            AppBarButton buttton = sender as AppBarButton;

            if (buttton != null)
            {
                if (buttton.Name == "InitSensor")
                {
                    SensorCMDs.InitSensor(m_Sensorinputconfigoptions);

                    m_Environment.SensorInitialized = false;
                    SensorIDValue.Text = "";
                }
                else if (buttton.Name == "RegisterFingerId")
                {
                    if (DataSets.SelectedItem != null)
                    {
                        DBDataSet dataSet = DataSets.SelectedItem as DBDataSet;
                        if (dataSet != null)
                        {
                            SensorCMDs.RegisterFingerId(m_Sensorinputconfigoptions, (UInt16)dataSet.FingerID);
                            DataSets.SelectedItem = null;
                        }
                    }
                }
                else if (buttton.Name == "VerifyFingerId")
                {
                    SensorCMDs.VerifyFingerId(m_Sensorinputconfigoptions);
                    DataSets.SelectedItem = null;
                }
                else if (buttton.Name == "DeleteallFingerIs")
                {
                    SensorCMDs.DeleteFingerId(m_Sensorinputconfigoptions, (UInt16)10000);
                }
                else if (buttton.Name == "DownloadFingerId")
                {
                    if (DataSets.SelectedItem != null)
                    {
                        DBDataSet dataSet = DataSets.SelectedItem as DBDataSet;
                        if (dataSet != null)
                        {
                            SensorCMDs.DownloadFingerId(m_Sensorinputconfigoptions, (UInt16)dataSet.FingerID, dataSet.FingerTemplate);
                        }
                        DataSets.SelectedItem = null;
                    }
                }
                else if (buttton.Name == "DownloadallFingerIds")
                {
                    SensorCMDs.DeleteFingerId(m_Sensorinputconfigoptions, 10000); // delete complete FingerLib into Sensor
                    for (int i = 0; i < this.m_DataSets.Count; i++)
                    {
                        DBDataSet dataSet = m_DataSets[i];
                        SensorCMDs.DownloadFingerId(m_Sensorinputconfigoptions, (UInt16)dataSet.FingerID, dataSet.FingerTemplate);
                    }
                    DataSets.SelectedItem = null;
                }
                else if (buttton.Name == "SetSensorID")
                {
                    byte[] SensorId = Encoding.ASCII.GetBytes(SensorIDValue.Text);
                    SensorCMDs.SetSensorID(m_Sensorinputconfigoptions, SensorId); // Set Sensor ID

                    SensorIDValue.Text    = "";
                    DataSets.SelectedItem = null;
                }



                SensorCmdState.Text = "...";
            }
        }
 public virtual int Fill(DBDataSet.ProductosDataTable dataTable) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Example #32
0
        void Update_SEN0188_NotifyChangeState(IPropertySet Outputpropertys)
        {
            ProcessFingerEvent ev = m_EventQueue.Dequeue(); // get Event

            Object Valout;
            Int16  state               = -1;
            String cmdState            = "...";
            bool   doactFilledSensorId = false;

            if (Outputpropertys.TryGetValue("FingerPrint.CMDState", out Valout))
            {
                if (Valout != null)
                {
                    state = (Int16)Valout;
                }
            }

            if (Outputpropertys.TryGetValue("FingerPrint.CMDTextState", out Valout))
            {
                String cmd = Valout as String;
                if (cmd != null)
                {
                    cmdState = cmd;
                }
            }


            if (Outputpropertys.TryGetValue("FingerPrint.CMD", out Valout))
            {
                if (Valout != null)
                {
                    Int32 CMD = (Int32)Valout;

                    if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerSensorInitialize"))
                    {
                        if (state == 0)
                        {
                            //        SensorInitialized = true;
                            doactFilledSensorId = true;
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerAutoVerifiying"))
                    {
                        if (state == 0)
                        {
                            if (Outputpropertys.TryGetValue("FingerPrint.FingerID", out Valout))
                            {
                                if (Valout != null)
                                {
                                    UInt16 fingerId = (UInt16)Valout;
                                    if (Outputpropertys.TryGetValue("FingerPrint.Search_MatchScore", out Valout))
                                    {
                                        UInt16    MatchScore = (UInt16)Valout;
                                        DBDataSet dataset    = m_SEN0188SQLite.getDatabyId(fingerId);
                                        if (dataset != null)
                                        {
                                            if (dataset.AccessRights_Bit0 || (dataset.AccessRights & ev.AccessRights) != 0) // Master Bit
                                            {
                                                for (int i = 0; i < ev.GPIOOutputs.Count; i++)
                                                {
                                                    //                         ev.GPIOOutputs[i].GPIOEnvironmentConnector.UpdateState(0);
                                                    ev.GPIOOutputs[i].GPIOObject.SetValue = (ev.GPIOOutputs[i].GPIOObject.InitValue > 0) ? 1:0;
                                                    ev.GPIOOutputs[i].GPIOEnvironmentConnector.UpdateInputPropertySets(ev.GPIOOutputs[i].GPIOObject);
                                                }

                                                FingerEvent eventSet = new FingerEvent();
                                                eventSet.FirstName      = dataset.FirstName;
                                                eventSet.SecondName     = dataset.SecondName;
                                                eventSet.MatchScore     = MatchScore;
                                                eventSet.FingerID       = fingerId;
                                                eventSet.EventType      = 0;
                                                eventSet.SensorState    = state;
                                                eventSet.SensorTxtState = cmdState;
                                                System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
                                                eventSet.SensorId = enc.GetBytes(m_SensorID);

                                                bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet);

                                                ConfigProcessItem outstate = m_ConfigProcessItems.getConfigItemByIdent("State_OK");
                                                if (outstate != null)
                                                {
                                                    for (int i = 0; i < outstate.GPIOOutputProcessItems.Count; i++)
                                                    {
//                                                        outstate.GPIOOutputProcessItems[i].GPIOName
                                                    }
                                                }


                                                //             GetEventData();
                                            }
                                            else
                                            {
                                                ConfigProcessItem outstate = m_ConfigProcessItems.getConfigItemByIdent("State_NoPermiss");
                                                if (outstate != null)
                                                {
                                                    for (int i = 0; i < outstate.GPIOOutputProcessItems.Count; i++)
                                                    {
                                                        //                                                        outstate.GPIOOutputProcessItems[i].GPIOName
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (doactFilledSensorId)
            {
                //   m_SensorId.Clear();
                if (Outputpropertys.TryGetValue("FingerPrint.SensorID", out Valout))
                {
                    if (Valout != null)
                    {
                        byte[] array = Valout as byte[];
                        if (array != null)
                        {
                            m_SensorID = System.Text.Encoding.UTF8.GetString(array, 0, array.Length);
                        }
                    }
                }
            }
        }
Example #33
0
 private UserWrapper getUserWrapper(DBDataSet.UserRow tbl)
 {
     DiciplineAccess da=new DiciplineAccess();
     UserWrapper uw = new UserWrapper
         {
             BirthDate = tbl.BirthDate,
             FirstName = tbl.FirstName,
             LastName = tbl.LastName,
             Role = tbl.Role,
             UserID = tbl.UserID,
             UserName = tbl.Username,
             Salt = tbl.Salt,
             Password = tbl.Password,
             Dicipline = GetDiciplinesByUserId(tbl.UserID).ToList(),
             Subscriptions = GetSubscriptionsByUserId(tbl.UserID).ToList()
         };
     return uw;
 }
Example #34
0
        public bool OpenMainDataSet()
        {
            //if (UserInformation.UType != UserType.utSupervisor)
            //{
            //    strConnFix = " and cCmptId='" + UserInformation.UnitId + "'";
            //}
            bool   bIsOK = false;
            string strX  = "";
            string sErr  = "";

            grdList.AutoGenerateColumns = false;
            grdList.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            DBDataSet.Clear();
            string sSql = "select * from " + strTbNameMain + " where 1=1 and cCSId='" + _CSId.Trim() + "'";

            DBDataSet = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, strTbNameMain, 0, 0, "", out sErr);
            #region
            //DBCommInfo.DBSQLCommandInfo cmdInfo = new DBSQLCommandInfo();//执行命令的对象
            ////cmdInfo.SqlText = "select * from " + strTbNameMain + " where 1=1 " + sCondition + strConnFix;             //SQL语句  或 存储过程名 若有参数,另外在参数集里增加
            //cmdInfo.SqlText = "select * from " + strTbNameMain + " where 1=1 and cCSId='"+ _CSId.Trim() +"'";             //SQL语句  或 存储过程名 若有参数,另外在参数集里增加

            ////if (UserInformation.UType != UserType.utSupervisor)
            ////{
            ////    cmdInfo.SqlText = cmdInfo.SqlText + " where "+strKeyFld+"='"+ UserInformation.UnitId +"'"; //仅显示当前用户的单位
            ////}
            //cmdInfo.SqlType = SqlCommandType.sctSql;                        //SQL命令类型  SqlCommandType.sctSql  SQL 语句 SqlCommandType.sctProcedure 表存储过程
            //cmdInfo.PageIndex = 0;                                          //需要分页时的页号
            //cmdInfo.PageSize = 0;                                           //需要分页时的每页记录条数
            //cmdInfo.FromSysType = "dotnet";                                 //采用处理结果数据的方式:php 表按照<tr><td></td></tr> xml 否则 直接采用ado 的记录集方式
            //cmdInfo.DataTableName = strTbNameMain;                          //指定结果数据记录集表名
            //SunEast.SeDBClient sdcX = new SeDBClient();                     //获取服务器数据的类型对象
            ////sdcX.DBSTServer = DBSocketServerType.dbsstNormal;  //自动根据配置文件读

            ////DataSet dsX = null;
            ////DataTable tbX= null ;
            //DBDataSet = sdcX.GetDataSet(cmdInfo, out sErr);               //通过获取服务器数据对象的GetDataSet方法获取数据
            #endregion

            bIsOK = DBDataSet != null;
            //if (bIsOK)
            //{
            //    DBDataSet.Clear();
            //    tbX  = new DataTable(strTbNameMain);
            //    tbX = dsX.Tables["data"].Copy();
            //    DBDataSet.Tables.Add(tbX);
            //}
            if (!bIsOK)
            {
                MessageBox.Show(sErr);
            }
            else
            {
                try
                {
                    ClearUIValues(pnlEdit);
                    bIsMainOpened           = false;
                    this.bdsMain.DataSource = DBDataSet.Tables[strTbNameMain];
                    bIsMainOpened           = true;
                    BindDataSetToCtrls();
                    grdList.DataSource = bdsMain;
                    bIsOK   = true;
                    optMain = OperateType.optNone;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    bIsOK = false;
                }
            }
            return(bIsOK);
        }
Example #35
0
        public bool OpenMainDataSet(string sCon)
        {
            bool   bIsOK = false;
            string strX  = "";

            bMainlstIsOpened            = false;
            grdList.AutoGenerateColumns = false;
            grdList.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            DBDataSet.Clear();
            DBCommInfo.DBSQLCommandInfo cmdInfo = new DBSQLCommandInfo(); //执行命令的对象
            cmdInfo.SqlText = "select * from " + strTbNameMain + sCon;    //SQL语句  或 存储过程名 若有参数,另外在参数集里增加
            if (UserInformation.UType == UserType.utSupervisor)
            {
                cmdInfo.SqlText = "select * from " + strTbNameMain;   //仅显示当前用户的单位
            }
            cmdInfo.SqlType       = SqlCommandType.sctSql;            //SQL命令类型  SqlCommandType.sctSql  SQL 语句 SqlCommandType.sctProcedure 表存储过程
            cmdInfo.PageIndex     = 0;                                //需要分页时的页号
            cmdInfo.PageSize      = 0;                                //需要分页时的每页记录条数
            cmdInfo.FromSysType   = "dotnet";                         //采用处理结果数据的方式:php 表按照<tr><td></td></tr> xml 否则 直接采用ado 的记录集方式
            cmdInfo.DataTableName = strTbNameMain;                    //指定结果数据记录集表名
            SunEast.SeDBClient sdcX = new SeDBClient();               //获取服务器数据的类型对象
            //sdcX.DBSTServer = DBSocketServerType.dbsstNormal;  //自动根据配置文件读
            string sErr = "";

            //DataSet dsX = null;
            //DataTable tbX= null ;
            DBDataSet = sdcX.GetDataSet(cmdInfo, out sErr);               //通过获取服务器数据对象的GetDataSet方法获取数据
            bIsOK     = DBDataSet != null;
            //if (bIsOK)
            //{
            //    DBDataSet.Clear();
            //    tbX  = new DataTable(strTbNameMain);
            //    tbX = dsX.Tables["data"].Copy();
            //    DBDataSet.Tables.Add(tbX);
            //}
            if (!bIsOK)
            {
                MessageBox.Show(sErr);
            }
            else
            {
                try
                {
                    DataSetUnBind(pnlEdit);
                    this.bdsMain.DataSource = DBDataSet.Tables[strTbNameMain];
                    if (bdsMain != null && bdsMain.Count > 0)
                    {
                        BindDataSetToCtrls();
                    }
                    bIsOK   = true;
                    optMain = OperateType.optNone;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    bIsOK = false;
                }
            }
            bMainlstIsOpened = true;
            return(bIsOK);
        }
 public virtual int Update(DBDataSet dataSet) {
     return this.Adapter.Update(dataSet, "Productos");
 }
Example #37
0
 public bool Read(string _strfilename, int _iid)
 {
     this.ID = _iid;
     this.DBPath = _strfilename;
     if (DSDatabase != null) DSDatabase.Dispose();
     DSDatabase = new DBDataSet();
     if (dbHandler.bFillDataSet(DSDatabase, this.DBPath))
     {
         return Loader();
     }
     else return false;
 }
Example #38
0
 public bool Read(string _strfilename)
 {
     DataTable dtrobot = new DataTable();
     if (dbHandler.bFillDataTable(dtrobot, DBHandler.RobotQuery, _strfilename, true))
     {
         int irobotid = 0;
         if (dtrobot.Rows.Count > 1)
         {
             DialogResult dr = MyMessageBox.Show("Selected database contains data for more than one robot.\r\nPlease choose which robot you want to use:", "Choose Robot", MyMessageBox.MyButtons.ChooseCancel, MyMessageBox.MyIcon.Question, MyMessageBox.RobotChooser.RobotChooser, dtrobot);
             if (dr != DialogResult.Cancel) irobotid = -(Convert.ToInt32(dr));
         }
         else irobotid = Convert.ToInt32(dtrobot.Rows[0]["RobotID"]);
         if (irobotid != 0)
         {
             if (DSDatabase != null) DSDatabase.Dispose();
             this.ID = irobotid;
             this.DBPath = _strfilename;
             DSDatabase = new DBDataSet();
             if (dbHandler.bFillDataSet(DSDatabase, this.DBPath))
             {
                 return Loader();
             }
             else return false;
         }
         else return false;
     }
     else return false;
 }
 private void ReadDB(string _strfilename)
 {
     DataTable dtrobot = new DataTable();
     if (dbHandler.bFillDataTable(dtrobot, DBHandler.RobotQuery, _strfilename, true))
     {
         int irobotid = 0;
         if (dtrobot.Rows.Count > 1)
         {
             DialogResult dr = MyMessageBox.Show("Selected database contains data for more than one robot.\r\nPlease choose which robot you want to use:", "Choose Robot", MyMessageBox.MyButtons.ChooseCancel, MyMessageBox.MyIcon.Question, MyMessageBox.RobotChooser.RobotChooser, dtrobot);
             if (dr != DialogResult.Cancel) irobotid = -(Convert.ToInt32(dr));
         }
         else irobotid = Convert.ToInt32(dtrobot.Rows[0]["RobotID"]);
         if (irobotid != 0)
         {
             if (this.bDataSetFilled) CloseDB();
             this.iRobotID = irobotid;
             this.strDBPath = _strfilename;
             DSDatabase = new DBDataSet();
             DSDatabase.Disposed += new EventHandler(DSDatabase_Disposed);
             if (this.bDataSetFilled = dbHandler.bFillDataSet(DSDatabase, this.strDBPath))
             {
                 SetStatusText("DB succesfully loaded!");
                 if (robotSerialPort.IsOpen) connectionButton_Click(null, null);
                 refreshPortsButton_Click(null, null);
                 refreshBaudRatesButton_Click(null, null);
                 Reading();
             }
         }
     }
 }