예제 #1
0
        /// <summary>
        /// Habilita / deshabilita los controles del formulario segun el modo de datos
        /// </summary>
        /// <param name="enumMode">Enumerado que indica si esta en modo de edicion o visual</param>
        /// <history>
        /// [jorcanche]  created 11/08/2016
        /// </history>
        private void SetMode(EnumMode enumMode)
        {
            var enable = enumMode != EnumMode.ReadOnly;

            //Controles del detalle
            txtguNoBookD.IsEnabled = cbmgunb.IsEnabled = cbmguPRNoBook.IsEnabled = enable;

            //Si se debe de habilitar
            if (enable)
            {
                //Fecha en que se definio el motivo de no booking
                if (string.IsNullOrEmpty(txtguNoBookD.Text))
                {
                    txtguNoBookD.Text = BRHelpers.GetServerDate().ToShortDateString();
                    _guest.guNoBookD  = BRHelpers.GetServerDate();
                }

                //PR que modifico el motivo de no booking
                cbmguPRNoBook.SelectedValue = _userData.User.peID;
                _guest.guPRNoBook           = _userData.User.peID;


                //No se permite modificar la fecha ni el PR de no Booking
                txtguNoBookD.IsEnabled  = false;
                cbmguPRNoBook.IsEnabled = false;
            }

            //Botones
            btnEdit.IsEnabled   = !enable;
            btnCancel.IsEnabled = btnSave.IsEnabled = enable;
        }
예제 #2
0
        public FmEdit(EnumMode mode) : this()
        {
            Mode = mode;
            switch (Mode)
            {
            case EnumMode.货源一:
                this.Text = DefaultTitle + "货源信息模式一";
                break;

            case EnumMode.货源二:
                this.Text = DefaultTitle + "货源信息模式二";
                break;

            case EnumMode.船源一:
                this.Text = DefaultTitle + "船源信息模式一";
                break;

            case EnumMode.船源二:
                this.Text = DefaultTitle + "船源信息模式二";
                break;

            default:
                this.Text       = "异常模式";
                button1.Enabled = false;
                button1.Visible = false;
                break;
            }
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="guestID">Clave del guest</param>
        /// <history>
        /// [vipacheco] 31/Marzo/2016 Created
        /// [vipacheco] 08/Agosto/2016 Modified -> Se agrega validacion isclosed
        /// </history>
        public frmMealTickets(EnumOpenBy openBy, int guestID = 0)
        {
            _guestID = guestID;
            _openBy  = openBy;

            bool isclosed = false;

            // Si no esta en modo busqueda
            if (guestID != 0)
            {
                lstMealTicket = BRMealTickets.GetMealTickets(guestID);
                SalesRoomCloseDates closeSalesRoom = BRSalesRooms.GetSalesRoom(Context.User.SalesRoom.srID);

                // Verificamos si alguno de sus cupones de comida es de una fecha cerrada, impedimos modificar los datos
                lstMealTicket.ForEach(x =>
                {
                    if (Common.IsClosed(x.meD, closeSalesRoom.srMealTicketsCloseD))
                    {
                        isclosed = true;
                        return;
                    }
                });

                // Si no esta en una fecha cerrada
                if (!isclosed)
                {
                    // Verificamos los permisos del usuario
                    if (Context.User.HasPermission(EnumPermission.MealTicket, EnumPermisionLevel.Standard))
                    {
                        _modeOpen = EnumMode.Edit;
                    }
                    else
                    {
                        _modeOpen = EnumMode.ReadOnly;
                    }
                }
            }
            // Esta en modo busqueda
            else
            {
                // Verificamos los permisos del usuario
                if (Context.User.HasPermission(EnumPermission.MealTicket, EnumPermisionLevel.Standard))
                {
                    _modeOpen = EnumMode.Edit;
                }
                else
                {
                    _modeOpen = EnumMode.ReadOnly;
                }
            }

            // Se verifica si tiene permisos de edición!
            InitializeComponent();

            GridHelper.SetUpGrid(grdMealTicket, new MealTicket());

            dtpFrom.Value = frmHost.dtpServerDate.AddDays(-(frmHost.dtpServerDate.Day) + 1);
            dtpTo.Value   = frmHost.dtpServerDate;
        }
예제 #4
0
 public ColorSelectorInput()
 {
     InitializeComponent();
     Text       = "0";
     colorValue = 0;
     isValid    = true;
     mode       = EnumMode.Dec;
 }
예제 #5
0
 public void New()
 {
     ImageBuffer = null;
     m_iStones   = 0;
     m_Stones    = new StoneCollection();
     m_Mode      = EnumMode.Normal;
     Cursor      = m_RechenCursor;
 }
예제 #6
0
 public ModelConvNetBase(double missingValue,
                         int indexTargetAttribute,
                         int countAttributes) :
     base(missingValue,
          indexTargetAttribute, countAttributes)
 {
     Mode = EnumMode.Regression;
 }
예제 #7
0
 public ModelBackPropagationBase(double missingValue,
                                 int indexTargetAttribute,
                                 int countAttributes) :
     base(missingValue,
          indexTargetAttribute, countAttributes)
 {
     Mode = EnumMode.Regression;
 }
예제 #8
0
        /// <summary>
        /// Habilita / deshabilita los controles del formulario segun el modo de datos
        /// </summary>
        /// <param name="enumMode"></param>
        /// <history>
        /// [aalcocer] 10/08/2016 created
        /// </history>
        private void SetMode(EnumMode enumMode)
        {
            var blnEnable = enumMode != EnumMode.ReadOnly;

            btnCancel.IsEnabled        = btnSave.IsEnabled = blnEnable;
            btnEdit.IsEnabled          = !blnEnable;
            dtgShowSalesman.IsReadOnly = !blnEnable;
        }
예제 #9
0
 public void ResetProcess(EnumMode mode, DividerData dividerData)
 {
     this.curNum      = -1;
     this.curNumTest  = -1;
     this.complete    = EnumCaliState.INITI;
     this.curTotalNum = 0;
     this.curMode     = mode;
     setTotalNumByType(dividerData);
 }
예제 #10
0
 private void Ground_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (m_Mode == EnumMode.Grass)
     {
         m_Grass.plant(e.X, e.Y);
         m_Mode = 0;
         Cursor = m_RechenCursor;
     }
 }
예제 #11
0
        //重置分压器监测数据库实时表数据
        public static void ResetDividerNowTable(bool modeMeasType, EnumMode mode)
        {
            //表名和列名不能作为参数传进去,报错误拼接后有双引号

            /*
             * string sql = @" update ?tablename set input = 0, state = 0, temperature = 0, humidity = 0 ";
             * MySqlParameter[] Params = {
             *                            new MySqlParameter("?tablename", MySqlDbType.String)
             *                        };
             * Params[0].Value = tablename;
             */
            DataBase db        = new DataBase();
            string   tableName = "";
            string   sql       = "";

            switch (mode)
            {
            case EnumMode.Divider_V_DCP:
                tableName = "divider_now_dcp";
                sql       = @" update " + tableName + " set input = 0, state = 0, temperature = 0, humidity = 0 ";
                db.ExecuteQuery(sql);
                if (modeMeasType)
                {
                    goto case EnumMode.Divider_V_DCN;
                }
                break;

            case EnumMode.Divider_V_DCN:
                tableName = "divider_now_dcn";
                sql       = @" update " + tableName + " set input = 0, state = 0, temperature = 0, humidity = 0 ";
                db.ExecuteQuery(sql);
                if (modeMeasType)
                {
                    goto case EnumMode.Divider_V_AC;
                }
                break;

            case EnumMode.Divider_V_AC:
                tableName = "divider_now_ac";
                sql       = @" update " + tableName + " set input = 0, state = 0, temperature = 0, humidity = 0 ";
                db.ExecuteQuery(sql);
                if (modeMeasType)
                {
                    goto case EnumMode.Divider_F;
                }
                break;

            case EnumMode.Divider_F:
                tableName = "divider_now_f";
                sql       = @" update " + tableName + " set input = 0, state = 0, temperature = 0, humidity = 0 ";
                db.ExecuteQuery(sql);
                break;
            }
            //将divider_process表中点序号num置1
            sql = @" update divider_process set num = 1";
            db.ExecuteQuery(sql);
        }
예제 #12
0
 private void Ground_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if ((m_Mode == 0) && (Ground.ModifierKeys == Keys.Alt))
     {
         m_Grass.plan(e.X, e.Y);
         Cursor = m_GrassCursor;
         m_Mode = EnumMode.Grass;
         Refresh();
     }
 }
예제 #13
0
 /// <summary>
 ///   Carga la ventana
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <history>
 ///   [vku] 21/Jun/2016 Created
 /// </history>
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     _blnEdit = Context.User.HasPermission(EnumPermission.TourTimes, EnumPermisionLevel.Special);
     if (!_blnEdit)
     {
         grpCopy.Visibility = Visibility.Collapsed;
     }
     enumMode = ((_blnEdit == true) ? EnumMode.Edit : EnumMode.ReadOnly);
     LoadCatalogs();
 }
예제 #14
0
 public void Redo()
 {
     if (m_Stones[m_iStones] != null)
     {
         (m_Stones[m_iStones] as Stone).unDelete();
         m_iStones++;
         m_Mode = EnumMode.Normal;
         Cursor = m_RechenCursor;
         Refresh();
     }
 }
예제 #15
0
 public frmGuest(UserData user, int guestId, EnumModule module, EnumProgram program, EnumMode mode, bool isInvitation)
 {
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     _user         = user;
     _guestId      = guestId;
     _module       = module;
     _program      = program;
     _mode         = mode;
     _isInvitation = isInvitation;
     InitializeComponent();
 }
예제 #16
0
 public CaliProcess(EnumMode mode, CaliData caliData)
 {
     this.curNum      = 0;
     this.curNumTest  = -1;
     this.curNumStand = -1;
     this.changeMode  = true;
     this.complete    = EnumCaliState.INITI;
     this.curTotalNum = 0;
     this.curMode     = mode;
     this.initiMode   = mode;
     setTotalNumByType(caliData);
 }
예제 #17
0
        public static GUIStyle GetStyle(this EnumMode mode)
        {
            switch (mode)
            {
            case EnumMode.Buttons: return(GUI.skin.button);

            case EnumMode.CheckBox: return(GUI.skin.toggle);

            case EnumMode.Classic: return(GUI.skin.button);

            default: throw new ArgumentException("uknown value");
            }
        }
예제 #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 public FaceDetectionSettings(EnumMode mode = EnumMode.Online)
 {
     if (mode == EnumMode.Online)
     {
         this.scale        = 1.3;
         this.minNeighbors = 5;
         this.minSize      = new Size(10, 10);
     }
     else
     {
         this.scale        = 1.1;
         this.minNeighbors = 5;
         this.minSize      = new Size(5, 5);
     }
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public FaceDetectionSettings(EnumMode mode = EnumMode.Online)
 {
     if (mode == EnumMode.Online)
     {
         this.scale = 1.3;
         this.minNeighbors = 5;
         this.minSize = new Size(10, 10);
     }
     else
     {
         this.scale = 1.1;
         this.minNeighbors = 5;
         this.minSize = new Size(5, 5);
     }
 }
예제 #20
0
        //根据测量模式批量插入分压器数据到divider_data表
        public static bool SaveDividerDataByMode(DividerData dividerData, EnumMode mode)
        {
            DataBase db = new DataBase();
//            string sql = "ALTER TABLE `divider_data` AUTO_INCREMENT = MAX(id) + 1";
//            db.ExecuteQuery(sql);
            DataTable sourceTable = new DataTable();

            sourceTable.TableName = "divider_data";
            sourceTable.Columns.Add("divider_id", typeof(int));
            sourceTable.Columns.Add("source_volt", typeof(float));
            sourceTable.Columns.Add("source_freq", typeof(float));
            sourceTable.Columns.Add("stand_divider_volt", typeof(float));
            sourceTable.Columns.Add("test_divider_volt", typeof(float));
            sourceTable.Columns.Add("temperature", typeof(float));
            sourceTable.Columns.Add("humidity", typeof(float));


            List <DividerItem> list = null;

            switch (mode)
            {
            case EnumMode.Divider_V_DCP:
                list = dividerData.voltageDCPData;
                break;

            case EnumMode.Divider_V_DCN:
                list = dividerData.voltageDCNData;
                break;

            case EnumMode.Divider_V_AC:
                list = dividerData.voltageACData;
                break;

            case EnumMode.Divider_F:
                list = dividerData.frequencyData;
                break;
            }
            AddRow2TableDivider(sourceTable, list, dividerData.dividerId);
            try
            {
                BulkInsert(sourceTable);
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
예제 #21
0
        /// <summary>
        /// 船源信息处理
        /// </summary>
        /// <param name="mode"></param>
        private void EditShips(EnumMode mode)
        {
            if (!IsCanOpenEdit(mode))
            {
                return;
            }

            using (var fm = new FmEdit(mode))
            {
                if (fm.ShowDialog() == DialogResult.OK)
                {
                    var good = fm.DataSource;
                    EditHtmlShipData(good);
                }
            }
        }
예제 #22
0
 public void BuildStone()
 {
     if (m_Mode != EnumMode.Stone)
     {
         m_Mode = EnumMode.Stone;
         Cursor = m_StoneCursor;
         m_Stones.Insert(m_iStones, new Stone(this));
         m_iStones++;
     }
     else if (m_Mode == EnumMode.Stone)
     {
         m_Stones[m_iStones - 1].finish();
         m_Mode = EnumMode.Normal;
         Cursor = m_RechenCursor;
     }
 }
예제 #23
0
        //分压器监测时初始化获取数据到dividerData
        public static List <DividerItem> GetDividerDataFromSql(EnumMode mode)
        {
            string table   = "";
            string strMode = "";

            switch (mode)
            {
            case EnumMode.Divider_V_AC:
                table   = "divider_now_ac";
                strMode = "AC";
                break;

            case EnumMode.Divider_V_DCP:
                table   = "divider_now_dcp";
                strMode = "DCP";
                break;

            case EnumMode.Divider_V_DCN:
                table   = "divider_now_dcn";
                strMode = "DCN";
                break;

            case EnumMode.Divider_F:
                table   = "divider_now_f";
                strMode = "F";
                break;
            }
            string    sql = @"select * from " + table;
            DataBase  db  = new DataBase();
            DataTable dt  = db.ExecuteQuery(sql);

            if (dt == null)
            {
                return(null);
            }
            List <DividerItem> list = new List <DividerItem>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DividerItem item = new DividerItem(strMode);
                item.Source    = float.Parse(dt.Rows[i]["source"].ToString());
                item.Frequency = float.Parse(dt.Rows[i]["frequency"].ToString());
                list.Add(item);
            }
            return(list);
        }
예제 #24
0
 public void Undo()
 {
     if (m_Mode == EnumMode.Grass)
     {
         m_Grass.delete();
         m_Mode = 0;
         Refresh();
     }
     else if (m_iStones > 0)
     // && (JOptionPane.showConfirmDialog(this,"Wollen Sie wirklich den letzten Stein entfernen ?",
     //   "Frage", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION))
     {
         m_iStones--;
         (m_Stones[m_iStones] as Stone).invalidate();
         (m_Stones[m_iStones] as Stone).delete(true);
         m_Mode = 0;
         Cursor = m_RechenCursor;
         Refresh();
     }
 }
예제 #25
0
        //重置分压器监测数据库实时表数据
        public static void ResetDividerNowTable(bool modeMeasType, EnumMode mode)
        {
            DataBase db    = new DataBase();
            string   table = "";
            string   sql   = @"update " + table + " set input = 0, state = 0 ";

            switch (mode)
            {
            case EnumMode.Divider_V_DCP:
                table = "divider_now_dcp";
                db.ExecuteQuery(sql);
                if (modeMeasType)
                {
                    goto case EnumMode.Divider_V_DCN;
                }
                break;

            case EnumMode.Divider_V_DCN:
                table = "divider_now_dcn";
                db.ExecuteQuery(sql);
                if (modeMeasType)
                {
                    goto case EnumMode.Divider_V_AC;
                }
                break;

            case EnumMode.Divider_V_AC:
                table = "divider_now_ac";
                db.ExecuteQuery(sql);
                if (modeMeasType)
                {
                    goto case EnumMode.Divider_F;
                }
                break;

            case EnumMode.Divider_F:
                table = "divider_now_f";
                break;
            }
        }
예제 #26
0
        /// <summary>
        /// Agrega|Actualiza|Elimina registros de la BD
        /// dependiendo del tipo de lista que se le TengaEnviado
        /// El enum agregar unicamente sirve para entidades con id autoincrementales
        /// </summary>
        /// <typeparam name="T">Tipo de lista</typeparam>
        /// <param name="lstEntities">Lista</param>
        /// <param name="state">Modified. Modifica | Added. Agrega | Deleted. Elimina</param>
        /// <returns>0. No se hizo nada | >0. Numero de registros afectados</returns>
        /// <history>
        /// [emoguel] created 27/04/2016
        /// [jorcanche] se agrego asincronia
        /// [edgrodriguez]  28/07/2016 Modified. Ahora se realiza un throw a la excepcion. Para utilizar el metodo de ShowMessage(Exception ex).
        /// </history>
        public async static Task <int> OperationEntities <T>(List <T> lstEntities, EnumMode enumMode) where T : class
        {
            int nRes = 0;

            try
            {
                await Task.Run(() =>
                {
                    using (var dbContext = new IMEntities(ConnectionHelper.ConnectionString()))
                    {
                        using (var transaction = dbContext.Database.BeginTransaction(System.Data.IsolationLevel.Serializable))
                        {
                            #region Transacción
                            try
                            {
                                lstEntities.ForEach(item =>
                                {
                                    dbContext.Entry(item).State = (enumMode == EnumMode.Add) ? EntityState.Added : (enumMode == EnumMode.Edit) ? EntityState.Modified : EntityState.Deleted;
                                });
                                nRes = dbContext.SaveChanges();
                                transaction.Commit();
                            }
                            catch (Exception)
                            {
                                /// nRes = 0;
                                transaction.Rollback();
                                throw;
                            }
                            #endregion
                        }
                    }
                });

                return(nRes);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #27
0
        private bool IsCanOpenEdit(EnumMode mode)
        {
            HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
            var str = Browser.DocumentText;

            document.LoadHtml(str);

            var table   = document.DocumentNode.SelectSingleNode("//table");
            var content = table.InnerText;

            var flag = false;

            switch (mode)
            {
            case EnumMode.货源一:
            case EnumMode.货源二:
                flag = content.Contains("栏目:货源信息");
                if (!flag)
                {
                    FuncMsg.Warn("请先进入[货源信息]编辑页面后再使用本功能");
                }
                break;

            case EnumMode.船源一:
            case EnumMode.船源二:
                flag = content.Contains("栏目:船源信息");
                if (!flag)
                {
                    FuncMsg.Warn("请先进入[船源信息]编辑页面后再使用本功能");
                }
                break;

            default:
                flag = false;
                break;
            }
            return(flag);
        }
예제 #28
0
        /// <summary>
        /// コンストラクタ(複数)
        /// </summary>
        public TagEditDialog()
        {
            InitializeComponent();

            buttonConvertZip.Enabled = false;
            btnRename.Enabled        = false;

            FileInfoList = new List <TagEditFileInfo>();

            this._mode = EnumMode.MULTI;


            SourceGrid.RowInfo[] rows = LinearAudioPlayer.GridController.getSelectRowsInfo();
            foreach (SourceGrid.RowInfo r in rows)
            {
                TagEditFileInfo tefi = new TagEditFileInfo();

                GridItemInfo gi = (GridItemInfo)LinearAudioPlayer.GridController.getRowGridItem(r.Index);

                tefi.Id         = gi.Id;
                tefi.TargetPath = gi.Option;

                if (String.IsNullOrEmpty(tefi.TargetPath))
                {
                    // オーディオファイル
                    tefi.FilePath = gi.FilePath;
                }
                else
                {
                    // 圧縮ファイル
                    tefi.FilePath        = Path.Combine(LinearGlobal.TempDirectory, gi.Option);
                    tefi.ArchiveFilePath = gi.FilePath;
                }

                FileInfoList.Add(tefi);
            }
        }
 public FormFaceDetectionSettings(EnumMode mode = EnumMode.Online)
 {
     InitializeComponent();
     this.faceDetectionSettings = new FaceDetectionSettings(mode);
     propertyGridFacedetectionSettings.SelectedObject = this.faceDetectionSettings;
 }
 public CRC16(EnumMode mode)
 {
     ushort polynomial = (ushort)mode;
     ushort value;
     ushort temp;
     for (ushort i = 0; i < table.Length; ++i)
     {
         value = 0;
         temp = i;
         for (byte j = 0; j < 8; ++j)
         {
             if (((value ^ temp) & 0x0001) != 0)
             {
                 value = (ushort)((value >> 1) ^ polynomial);
             }
             else
             {
                 value >>= 1;
             }
             temp >>= 1;
         }
         table[i] = value;
     }
 }
 public FormFaceDetectionSettings(EnumMode mode = EnumMode.Online)
 {
     InitializeComponent();
     this.faceDetectionSettings = new FaceDetectionSettings(mode);
     propertyGridFacedetectionSettings.SelectedObject = this.faceDetectionSettings;
 }
예제 #32
0
 public EnumFlagsAttribute(EnumMode enumFlagOption = EnumMode.Classic)
 {
     this.EnumFlagOption = enumFlagOption;
 }
예제 #33
0
 public DividerProcess(EnumMode mode, DividerData dividerData)
 {
     ResetProcess(mode, dividerData);
 }