예제 #1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------//

        private void Admin_Tables_Refresh()
        {
            using (alfaDS DS = new alfaDS())
            {
                // Get Item
                var p_Item = (alfaItem)listAdminTables.SelectedItem;

                // Clear
                grdAdminView.Columns.Clear();

                // Set Datasource
                switch (p_Item.Name)
                {
                case "TableUser": grdAdmin.DataSource = alfaEntity.TableUser_GetList(null, null); break;

                case "TableGroup": grdAdmin.DataSource = alfaEntity.TableGroup_GetList(null, null); break;

                case "TableParams": grdAdmin.DataSource = alfaEntity.TablePrms_GetList(); break;

                case "TableConfig": grdAdmin.DataSource = alfaEntity.TableConfig_GetList(); break;
                }

                // Set GridView
                alfaGrid.SetView(grdAdminView, grdAdmin.DataSource);

                // Set Buttons
                alfaCtrl.SetButton(btnAdminUpdate, (grdAdminView.RowCount > 0));
                alfaCtrl.SetButton(btnAdminDelete, (grdAdminView.RowCount > 0));
                alfaCtrl.EnableControl(btnAdminInsert);
            }
        }
예제 #2
0
        //-----------------------------------------------------------------------------------------------------------------------------------------//

        private void Admin_Tables_Insert()
        {
            using (alfaDS ent = new alfaDS())
            {
                // Create Object
                Object objEntity = null;

                // Get Item
                alfaItem p_Item = (alfaItem)listAdminTables.SelectedItem;

                // Assign Object
                switch (p_Item.Name)
                {
                case "TableUser": objEntity = new SAM_USER(); break;

                case "TableGroup": objEntity = new SAM_GROUP(); break;

                case "TableParams": objEntity = new SAM_PRMS(); break;

                case "TableConfig": objEntity = new SAM_CONFIG(); break;
                }

                // Create Form
                FrmRecord frm = new FrmRecord(p_Item.ToString(), objEntity);

                // Confirmation
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                // Add Record
                switch (p_Item.Name)
                {
                case "TableUser": ent.Context.SAM_USER.Add(objEntity as SAM_USER); break;

                case "TableGroup": ent.Context.SAM_GROUP.Add(objEntity as SAM_GROUP); break;

                case "TableParams": ent.Context.SAM_PRMS.Add(objEntity as SAM_PRMS); break;

                case "TableConfig": ent.Context.SAM_CONFIG.Add(objEntity as SAM_CONFIG); break;
                }

                // SaveChanges
                ent.Context.SaveChanges();
            }

            // DataSource
            this.Admin_Tables_Refresh();

            // Select Row
            alfaGrid.SelectRow(grdAdminView, grdAdminView.RowCount - 1);
        }
예제 #3
0
        //-----------------------------------------------------------------------------------------------------------------------------------------//

        private void Admin_Tables_Update()
        {
            using (alfaDS DS = new alfaDS())
            {
                // Object
                Object objEntity = null;

                // Check
                if (grdAdminView.FocusedRowHandle < 0)
                {
                    return;
                }

                // Get ID
                var p_ID = (decimal)grdAdminView.GetRowCellValue(grdAdminView.FocusedRowHandle, "ID");

                // Get Item
                alfaItem p_Item = (alfaItem)listAdminTables.SelectedItem;

                // Assign Object
                switch (p_Item.Name)
                {
                case "TableUser": objEntity = DS.Context.SAM_USER.First(tt => tt.ID == p_ID); break;

                case "TableGroup": objEntity = DS.Context.SAM_GROUP.First(tt => tt.ID == p_ID); break;

                case "TableParams": objEntity = DS.Context.SAM_PRMS.First(tt => tt.ID == p_ID); break;

                case "TableConfig": objEntity = DS.Context.SAM_CONFIG.First(tt => tt.ID == p_ID); break;
                }

                // Create Form
                FrmRecord frm = new FrmRecord(p_Item.ToString(), objEntity);

                // Confirmation
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    // SaveChanges
                    DS.Context.SaveChanges();

                    // Refresh
                    this.Admin_Tables_Refresh();

                    // Get Row
                    int p_RowHandle = grdAdminView.LocateByValue("ID", p_ID, null);

                    // Select Row
                    alfaGrid.SelectRow(grdAdminView, p_RowHandle);
                }
            }
        }
예제 #4
0
        //-----------------------------------------------------------------------------------------------------------------------------------------//

        public static Task <int> Step07_Calculate_Delta_S()
        {
            // Return Async Result
            return(Task.Run <int>(() =>
            {
                // Break
                if (!alfaSAM.IsRunning)
                {
                    throw new Exception(alfaSAM.BreakMessage);
                }

                using (alfaDS DS = new alfaDS())
                {
                    // Start
                    DateTime p_Start = DateTime.Now;

                    // Log
                    alfaLog.Add("(ORA) Parallel Calculating Delta DATA_S ... [ Start ]");

                    // Count
                    int p_Count = 0;

                    foreach (var p_RowCurrent in DS.Context.SAM_DATA_S.Where(tt => tt.TRF_DELTA == null).OrderByDescending(tt => tt.DT_UNX).ToList())
                    {
                        // Break
                        if (!alfaSAM.IsRunning)
                        {
                            break;
                        }

                        // Set Delta
                        p_RowCurrent.TRF_DELTA = alfaEntity.SAM_Get_Delta_SS(p_RowCurrent);

                        // Save
                        DS.Context.SaveChanges();

                        // Count
                        p_Count++;
                    }

                    // Log
                    alfaLog.Add("(ORA) Parallel Calculating Delta DATA_S ( " + p_Count.ToString() + " Rows ) ...", alfaDate.GetSec(p_Start));

                    // Return
                    return p_Count;
                }
            }));
        }
예제 #5
0
        //-----------------------------------------------------------------------------------------------------------------------------------------//

        private void btnList_Click(object sender, EventArgs e)
        {
            try
            {
                // Cursor
                alfaMsg.CursorWait();

                // GetList
                this.m_List_CC = alfaEntity.SAM_GetList_CC(ListDT01.DateTime, ListDT02.DateTime);
                this.m_List_DD = alfaEntity.SAM_GetList_DD(ListDT01.DateTime, ListDT02.DateTime);
                this.m_List_SS = alfaEntity.SAM_GetList_SS(ListDT01.DateTime, ListDT02.DateTime);

                // SetView Data
                alfaGrid.SetView(grdView_DataCC, this.m_List_CC);
                alfaGrid.SetView(grdView_DataDD, this.m_List_DD);
                alfaGrid.SetView(grdView_DataSS, this.m_List_SS);

                using (alfaDS DS = new alfaDS())
                {
                    // Set List
                    alfaEntity.m_SamConfigList = DS.Context.SAM_CONFIG.ToList();
                }

                // SetView Matrix
                alfaGrid.SetView(grdView_MatrixCC, alfaEntity.SAM_Matrix_CC(this.m_List_CC));
                alfaGrid.SetView(grdView_MatrixDD, alfaEntity.SAM_Matrix_DD(this.m_List_DD));
                alfaGrid.SetView(grdView_MatrixSS, alfaEntity.SAM_Matrix_SS(this.m_List_SS));

                // Cursor
                alfaMsg.CursorDefult();
            }

            catch (Exception ex)
            {
                // Message
                alfaMsg.Error(ex);
            }
        }
예제 #6
0
        //-----------------------------------------------------------------------------------------------------------------------------------------//

        private void Admin_Tables_Delete()
        {
            // Confirmation
            if (alfaMsg.Quest("Are You Sure to Delete the Selected Record ?") == DialogResult.No)
            {
                return;
            }

            using (alfaDS ent = new alfaDS())
            {
                // Get Item
                alfaItem p_Item = (alfaItem)listAdminTables.SelectedItem;

                // Get ID
                int p_ID = Convert.ToInt32(grdAdminView.GetRowCellValue(grdAdminView.FocusedRowHandle, "ID"));

                // Delete Object
                switch (p_Item.Name)
                {
                case "TableUser": ent.Context.SAM_USER.Remove(ent.Context.SAM_USER.First(tt => tt.ID == p_ID)); break;

                case "TableGroup": ent.Context.SAM_GROUP.Remove(ent.Context.SAM_GROUP.First(tt => tt.ID == p_ID)); break;

                case "TableParams": ent.Context.SAM_PRMS.Remove(ent.Context.SAM_PRMS.First(tt => tt.ID == p_ID)); break;

                case "TableConfig": ent.Context.SAM_CONFIG.Remove(ent.Context.SAM_CONFIG.First(tt => tt.ID == p_ID)); break;
                }

                // SaveChanges
                ent.Context.SaveChanges();
            }

            // DataSource
            this.Admin_Tables_Refresh();

            //Focus
            grdAdminView.Focus();
        }
예제 #7
0
        //-----------------------------------------------------------------------------------------------------------------------------------------//

        public static Task <int> Step06_Transfer_Data_S(List <SAM_DATA_C> p_ListData)
        {
            // Return Async Result
            return(Task.Run <int>(() =>
            {
                using (alfaDS DS = new alfaDS())
                {
                    // Break
                    if (!alfaSAM.IsRunning)
                    {
                        throw new Exception(alfaSAM.BreakMessage);
                    }

                    // Start
                    DateTime p_Start = DateTime.Now;

                    // Log
                    alfaLog.Add("(ORA) Parallel Transfering DATA_S ... [ Start ]");

                    // Count
                    int p_Count = 0;

                    foreach (var p_RowCurrent in p_ListData.Where(tt => tt.ADR_SOURCE.EndsWith("s")).ToList())
                    {
                        // Break
                        if (!alfaSAM.IsRunning)
                        {
                            break;
                        }

                        // Check Double Record
                        if (alfaEntity.SAM_Check_SS(p_RowCurrent) != null)
                        {
                            continue;
                        }

                        // Create
                        SAM_DATA_S p_Row = new SAM_DATA_S();

                        // SetDelta
                        alfaSAM.SetDelta(p_ListData, p_RowCurrent, "s");

                        // Assign
                        p_Row.ADR_SOURCE = p_RowCurrent.ADR_SOURCE;
                        p_Row.ADR_TARGET = p_RowCurrent.ADR_TARGET;
                        p_Row.DT_UNX = p_RowCurrent.DT_UNX;
                        p_Row.DT_WIN = p_RowCurrent.DT_WIN;
                        p_Row.TRF_DELTA = p_RowCurrent.TRF_DELTA;
                        p_Row.TRF_TOTAL = p_RowCurrent.TRF_TOTAL;

                        // Add
                        DS.Context.SAM_DATA_S.Add(p_Row);

                        // Save
                        DS.Context.SaveChanges();

                        // Count
                        p_Count++;
                    }

                    // Log
                    alfaLog.Add("(ORA) Parallel Transfering DATA_S ( " + p_Count.ToString() + " Rows ) ...", alfaDate.GetSec(p_Start));

                    // Return
                    return p_Count;
                }
            }));
        }