Ejemplo n.º 1
0
        private void grdSearch_CellChecked(object sender, RowColEventArgs e)
        {
            if (!grdSearch.Redraw)
            {
                return;
            }
            if (grdSearch.DataSource == null)
            {
                return;
            }
            if (grdSearch.RowSel < grdSearch.Rows.Fixed)
            {
                return;
            }

            bool _ischecked = (grdSearch.GetCellCheck(grdSearch.RowSel, e.Col) == CheckEnum.Checked);

            if (_ischecked)
            {
                grdSearch[grdSearch.RowSel, "Select"] = 1;
            }
            else
            {
                grdSearch[grdSearch.RowSel, "Select"] = 0;
            }
        }
Ejemplo n.º 2
0
        protected override void OnAfterEdit(RowColEventArgs e)
        {
            if (this.Cols[e.Col].UserData != null)
            {
                ColumnInfo info = this.Cols[e.Col].UserData as ColumnInfo;

                if (!info.ViewName.IsNullOrEmpty())
                {
                    if (info.ViewName != info.ColumnName)
                    {
                        G.Controls.Input.DropDown control = this.Cols[e.Col].Editor as G.Controls.Input.DropDown;
                        DbObjectSmartUpdate       obj     = this.GetCurSelect <DbObjectSmartUpdate>();
                        obj.setValue(info.ColumnName, control.GetValue());
                        obj.setValue(info.ViewName, control.Text);
                    }
                    else
                    {
                        G.Controls.Input.DropDown control = this.Cols[e.Col].Editor as G.Controls.Input.DropDown;
                        if (control != null)
                        {
                            DbObjectSmartUpdate obj = this.GetCurSelect <DbObjectSmartUpdate>();
                            obj.setValue(info.ColumnName, control.GetValue());
                        }
                    }
                }
            }
            base.OnAfterEdit(e);
        }
Ejemplo n.º 3
0
        private void FgPro_CellButtonClick(object sender, RowColEventArgs e)
        {
            if (FgPro.Col == 1)
            {
                DataTable dtResult = new DataTable();
                string    c_dato   = "";
                objIte.mysConec = mysConec;
                dtResult        = objIte.BuscarItem("", "n_id", dtPro, 0);
                if (dtResult != null)
                {
                    if (dtResult.Rows.Count != 0)
                    {
                        c_dato = dtResult.Rows[0]["c_despro"].ToString();
                        FgPro.SetData(FgPro.Row, 1, c_dato);

                        c_dato = dtResult.Rows[0]["n_id"].ToString();
                        FgPro.SetData(FgPro.Row, 2, c_dato);

                        if (funFunciones.NulosC(FgPro.GetData(FgPro.Rows.Count - 1, 1)) != "")
                        {
                            FgPro.Rows.Count = FgPro.Rows.Count + 1;
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
 // prevent editing group headers // <<B5>>
 private void _flex_BeforeEdit(object sender, RowColEventArgs e)
 {
     if (_flex.Rows[e.Row].IsNode)
     {
         e.Cancel = true;
     }
 }
        private void fg_MouseEnterCell(object sender, RowColEventArgs e)
        {
            if (e.Row < RowBegin || e.Col < ColBegin)
            {
                return;
            }
            CellRange rg = fg.GetCellRange(e.Row, e.Col);

            if (rg.Data.ToString() != "")
            {
                if (rg.UserData != null)
                {
                    CellData ud         = (CellData)rg.UserData;
                    string   strToolTip = "";
                    if (ud.BuoiHoc != (int)BUOIHOC.ChuaXacDinh)
                    {
                        strToolTip = "Ca học: <color=Blue>" + (ud.BuoiHoc == 0 ? "Sáng" : (ud.BuoiHoc == 1 ? "Chiều" : "Tối"));
                    }
                    if (ud.TenPhongHoc != "")
                    {
                        strToolTip += (strToolTip == "" ? "" : "<color=Black>, Phòng học: <color=Blue>") + ud.TenPhongHoc;
                    }
                    if (ud.TenKeHoachKhac != "" && "" + ud.NgayNghi != "")
                    {
                        strToolTip += (strToolTip == "" ? "" : "<br><color=Black>Kế hoạch khác: <color=Blue>" +
                                       ud.TenKeHoachKhac + "<br><color=Black>Ngày thực hiện: <color=Blue>" + NgayNghiToString(ud.NgayNghi));
                    }
                    toolTipController.ShowHint(strToolTip, "Kế hoạch lớp");
                }
            }
        }
Ejemplo n.º 6
0
 // update the filter after any edits to the filter row
 private void _flex_AfterEdit(object sender, RowColEventArgs e)
 {
     if (e.Row == _row)
     {
         UpdateFilter();
     }
 }
Ejemplo n.º 7
0
 private void fg_MouseEnterCell(object sender, RowColEventArgs e)
 {
     if (e.Row < RowBegin || e.Col < ColBegin)
     {
         return;
     }
     if ("" + fg[e.Row, 0] == "")
     {
         CellRange rg = fg.GetCellRange(e.Row, e.Col);
         if (rg.UserData != null)
         {
             CellData ud         = (CellData)rg.UserData;
             string   strToolTip = "";
             if (ud.BuoiHoc != "")
             {
                 strToolTip = "Ca học: <color=Blue>" + ud.BuoiHoc;
             }
             if (ud.TenPhongHoc != "")
             {
                 strToolTip += (strToolTip == "" ? "" : "<color=Black>, Phòng học: <color=Blue>") + ud.TenPhongHoc;
             }
             if (ud.TenKeHoachKhac != "")
             {
                 strToolTip += (strToolTip == "" ? "" : "<br><color=Black>Kế hoạch khác: <color=Blue>" +
                                ud.TenKeHoachKhac + "<br><color=Black>Ngày thực hiện: <color=Blue>" + ud.NgayNghi);
             }
             toolTipController.ShowHint(strToolTip, "Kế hoạch lớp");
         }
     }
 }
Ejemplo n.º 8
0
 private void vs_BeforeEdit(object sender, RowColEventArgs e)
 {
     if (vs.Rows[e.Row].UserData + "" != "2")
     {
         e.Cancel = true;
     }
 }
Ejemplo n.º 9
0
        public static void Motif_After_Edit(object sender, RowColEventArgs e)
        {
            C1FlexGrid grid = (C1FlexGrid)sender;

            string nom          = grid[e.Row, "nom"].ToString();
            string colname      = grid.Cols[e.Col].Name;
            string userdata     = grid.Cols[e.Col].UserData.ToString();
            string newvalue     = grid[e.Row, e.Col].ToString();
            bool   is_attribute = false;

            XmlNode originnod = (XmlNode)grid.Tag;

            if (userdata == string.Empty)
            {
                return;
            }

            XmlNode node;

            node = originnod.SelectSingleNode(string.Concat("motif[@nom='" + nom + "']"));

            if (userdata == "val")
            {
                is_attribute = false;
            }
            else if (userdata == "att")
            {
                is_attribute = true;
            }

            mod_save.Save_Param_Field(mod_accueil.Motif_Xml, node, newvalue, is_attribute, colname, mod_global.MF.XmlMotifStripLabel.Text);
        }
Ejemplo n.º 10
0
 // sort list items if that was requested
 private void _flex_SetupEditor(object sender, RowColEventArgs e)
 {
     if (_flex.Editor is ComboBox)
     {
         ((ComboBox)_flex.Editor).Sorted = _chkSortLists.Checked;
     }
 }
Ejemplo n.º 11
0
 private void c1FlexGrid1_AfterEdit(object sender, RowColEventArgs e)
 {
     try
     {
         c1FlexGrid1.AutoSizeRow(e.Row);
         c1FlexGrid1.AutoSizeCol(e.Col);
         int hang = c1FlexGrid1.Row;
         int cot  = c1FlexGrid1.Cols.Count - 1;
         if (Convert.ToInt32(c1FlexGrid1[hang, cot]) == 0)
         {
             c1FlexGrid1[c1FlexGrid1.RowSel, c1FlexGrid1.Cols.Count - 1] = 2;
         }
         if (c1FlexGrid1.Cols[c1FlexGrid1.ColSel].Name.ToUpper().Equals("GHICHU") == true && c1FlexGrid1.RowSel == c1FlexGrid1.Rows.Count - 1)
         {
             if (c1FlexGrid1.RowSel == c1FlexGrid1.Rows.Count - 1)
             {
                 Add();
                 c1FlexGrid1.StartEditing(c1FlexGrid1.Rows.Count - 1, 1);
             }
             else
             {
                 c1FlexGrid1.StartEditing(c1FlexGrid1.RowSel + 1, 2);
             }
             //Add(); c1FlexGrid1.StartEditing(c1FlexGrid1.Rows.Count - 1, 1);
         }
     }
     catch { }
 }
Ejemplo n.º 12
0
        /*
         *
         * Editer le fichier XML apres avoir changer la valeur du grid Code Lié */
        public static void Obs_Codelie_After_Edit(object sender, RowColEventArgs e)
        {
            XmlDocument doc = (XmlDocument)mod_global.MF.XmlObsCodesGrid.Tag;

            string position     = mod_global.MF.XmlObsCodeLieGrid[e.Row, "position"].ToString();
            string colname      = mod_global.MF.XmlObsCodeLieGrid.Cols[e.Col].Name;
            string userdata     = mod_global.MF.XmlObsCodeLieGrid.Cols[e.Col].UserData.ToString();
            string newvalue     = mod_global.MF.XmlObsCodeLieGrid[e.Row, e.Col].ToString();
            bool   is_attribute = false;

            if (userdata == string.Empty)
            {
                return;
            }

            XmlNode node;

            node = Selected_Obs_Code.SelectSingleNode(string.Concat("lien/codelie[@position='" + position + "']"));
            if (userdata == "val")
            {
                is_attribute = false;
            }
            else if (userdata == "att")
            {
                is_attribute = true;
            }
            mod_save.Save_Param_Field(doc, node, newvalue, is_attribute, colname, mod_global.MF.XmlObsStripLabel.Text);
        }
Ejemplo n.º 13
0
 private void flxMatHang_AfterEdit(object sender, RowColEventArgs e)
 {
     try
     {
         int hang = flxMatHang.Row;
         if (Convert.ToInt32(flxMatHang[hang, "tt"]) == 0)
         {
             flxMatHang[flxMatHang.RowSel, flxMatHang.Cols.Count - 1] = 2;
         }
         if (flxMatHang.Cols[flxMatHang.ColSel].Name.ToUpper().Equals("GHICHU") == true && flxMatHang.RowSel == flxMatHang.Rows.Count - 1)
         {
             AddMatHang(); flxMatHang.StartEditing(flxMatHang.Rows.Count - 1, 3);
         }
         flxMatHang[flxMatHang.RowSel, "thanhtien"] = (Convert.ToDouble(flxMatHang[flxMatHang.RowSel, "soluong"].ToString().Trim()) * Convert.ToDouble(flxMatHang[flxMatHang.RowSel, "gianhap"].ToString().Trim())).ToString();
         flxMatHang.AutoSizeCols();
         flxMatHang.AutoSizeRows();
         double tongtien = 0;
         for (int i = 1; i < flxMatHang.Rows.Count; i++)
         {
             double thanhtienofrow = 0;
             try { thanhtienofrow = Convert.ToDouble(flxMatHang[i, "thanhtien"].ToString()); }
             catch { }
             tongtien = tongtien + thanhtienofrow;
         }
         txtTongTien.Text = tongtien.ToString("N0", CultureInfo.InvariantCulture);
         TinhToan();
     }
     catch { }
 }
Ejemplo n.º 14
0
        // show menu when user clicks the button
        void _flex_CellButtonClick(object sender, RowColEventArgs e)
        {
            Rectangle rc = _flex.GetCellRect(e.Row, e.Col);

            rc.Offset(0, rc.Height);
            _menu.Show(_flex, rc.Location);
        }
Ejemplo n.º 15
0
 private void FlexGrid_CellChanged(object sender, RowColEventArgs e)
 {
     if (e.Row == _footerRowIndex)
     {
         flexGrid.AutoSizeCol(e.Col);
     }
 }
Ejemplo n.º 16
0
 private void GrfMatr_ComboCloseUp(object sender, RowColEventArgs e)
 {
     //throw new NotImplementedException();
     if (e.Col == colName)
     {
     }
 }
Ejemplo n.º 17
0
        private void GrfExpnD_CellChanged(object sender, RowColEventArgs e)
        {
            //throw new NotImplementedException();
            if (e.Row <= 0)
            {
                return;
            }

            if ((grfExpnD.Col == colDQty))
            {
                //grfExpnD. = colDdesc2;
                calAmt();
                calAmount();
            }
            else if ((grfExpnD.Col == colDUnitNameT))
            {
            }
            else if ((grfExpnD.Col == colDPrice))
            {
                calAmt();
                calAmount();
                //grfExpnD[e.Row, colDedit] = "1";
                //grfExpnD.Rows[e.Row].StyleNew.BackColor = Color.Gray;
            }
            if ((grfExpnD.Col == colDPrice) && (grfExpnD.Rows.Count == (grfExpnD.Row + 1)))
            {
                grfExpnD.Rows.Count++;
            }
        }
Ejemplo n.º 18
0
 private void vs_CellButtonClick(object sender, RowColEventArgs e)
 {
     if (color.ShowDialog() == DialogResult.OK)
     {
         vs.Rows[vs.Row]["COL_NO"] = color.Color.R + "." + color.Color.G + "." + color.Color.B;
     }
 }
Ejemplo n.º 19
0
 private void grdShift_CellChecked(object sender, RowColEventArgs e)
 {
     try
     {
         if (grdShift.GetCellCheck(e.Row, e.Col) == C1.Win.C1FlexGrid.CheckEnum.Checked)
         {
             btnSave.Enabled       = true;
             grdShift.AllowEditing = true;
             for (int rowindex = 1; rowindex < grdShift.Rows.Count; rowindex++)
             {
                 if (rowindex == e.Row)
                 {
                     grdShift.Rows[rowindex].AllowEditing = true;
                     grdShift.Cols[1].AllowEditing        = true;
                     grdShift.Cols[3].AllowEditing        = true;
                 }
                 else
                 {
                     grdShift.Rows[rowindex].AllowEditing = false;
                 }
             }
             grdShift.Cols[2].AllowEditing = false;
         }
         else
         {
             for (int rowindex = 1; rowindex < grdShift.Rows.Count; rowindex++)
             {
                 grdShift.Rows[rowindex].AllowEditing = true;
             }
             ColumnVisibility();
         }
     }
     catch (Exception ex) { }
 }
Ejemplo n.º 20
0
 void _flexRowValidation_RowValidated(object sender, RowColEventArgs e)
 {
     if (_flexRowValidation.ContainsFocus)
     {
         _lstRowValidationEventLog.Items.Add(string.Format("RowValidated: index {0}", e.Row));
     }
 }
Ejemplo n.º 21
0
 private void _grid_AfterAddRow(object sender, RowColEventArgs e)
 {
     if (dsCore1.Orders.Rows.Count > 0)
     {
         _grid.SetData(e.Row, "OrderID", (int)dsCore1.Orders[0].ID);
     }
 }
Ejemplo n.º 22
0
 private void c1FlexGrid1_SetupEditor(object sender, RowColEventArgs e)
 {
     if (e.Col == _largeTextCol)
     {
         //Set size of large text box editor
         c1FlexGrid1.Cols[e.Col].Editor.Size = new Size(250, 100);
     }
 }
Ejemplo n.º 23
0
 private void GrfFooM_CellChanged(object sender, RowColEventArgs e)
 {
     //throw new NotImplementedException();
     if (e.Col == colFmWeight)
     {
         calTotal();
     }
 }
Ejemplo n.º 24
0
 private void GrfExpnD_ComboCloseUp(object sender, RowColEventArgs e)
 {
     //throw new NotImplementedException();
     if (e.Col == colDItemNamet)
     {
         //MessageBox.Show("aaaa", "");
     }
 }
Ejemplo n.º 25
0
 private void GrfRemark_CellChanged(object sender, RowColEventArgs e)
 {
     //throw new NotImplementedException();
     if (grfRemark.Row == grfRemark.Rows.Count - 1)
     {
         grfRemark.Rows.Count = grfRemark.Rows.Count + 1;
     }
 }
Ejemplo n.º 26
0
        //------------------------------------------------------------------------------------------------
        #region ** Spell-check a C1FlexGrid

        // provide as-you-type spelling in the grid editor
        void _flex_StartEdit(object sender, RowColEventArgs e)
        {
            TextBoxBase tb = _flex.Editor as TextBoxBase;

            if (tb != null)
            {
                _spell.SetSpellChecking(tb, true);
            }
        }
Ejemplo n.º 27
0
        private void c1FlexGrid1_SetupEditor(object sender, RowColEventArgs e)
        {
            var tb = this.c1FlexGrid1.Editor as TextBox;

            if (tb != null)
            {
                this.c1SpellChecker1.SetActiveSpellChecking(tb, true);
            }
        }
Ejemplo n.º 28
0
        // provide as-you-type spelling in the grid editor
        void _flex_StartEdit(object sender, RowColEventArgs e)
        {
            TextBoxBase tb = c1FlexGrid1.Editor as TextBoxBase;

            if (tb != null)
            {
                c1SpellChecker1.SetSpellChecking(tb, true);
            }
        }
Ejemplo n.º 29
0
 void c1FlexGrid1_AfterEdit(object sender, RowColEventArgs e)
 {
     if (e.Col == c1FlexGrid1.Cols["AllowRead"].SafeIndex)
     {
         c1FlexGrid1.SetData(e.Row, "AllowCreate", c1FlexGrid1.GetData(e.Row, e.Col));
         c1FlexGrid1.SetData(e.Row, "AllowUpdate", c1FlexGrid1.GetData(e.Row, e.Col));
         c1FlexGrid1.SetData(e.Row, "AllowDelete", c1FlexGrid1.GetData(e.Row, e.Col));
     }
 }
Ejemplo n.º 30
0
 private void c1FlexGrid_Items_CellChecked(object sender, RowColEventArgs e)
 {
     _allPacked = Helper.AllItemsPacked(c1FlexGrid_Items);
     if (_allPacked)
     {
         Helper.ShippingLabelPrint(_orderGrid, _countries, label_Address.Text, _upsDK, _sign);
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
 private void _grid_AfterAddRow(object sender, RowColEventArgs e)
 {
     if (dsCore1.Orders.Rows.Count > 0)
         _grid.SetData(e.Row, "OrderID", (int)dsCore1.Orders[0].ID);
 }
Ejemplo n.º 32
0
 private void m_grv_de_xuat_CellButtonClick(object sender, RowColEventArgs e)
 {
     // Create color picker dialog.
     ColorDialog clrDlg = new ColorDialog();
     // Initialize the dialog.
     if (m_grv_de_xuat[e.Row, e.Col] == typeof(Color))
     {
         clrDlg.Color = (Color)m_grv_de_xuat[e.Row, e.Col];
     }
     // Get new color from dialog and assign it to the cell.
     if (clrDlg.ShowDialog() == DialogResult.OK)
     {
         m_grv_de_xuat[e.Row, e.Col] = clrDlg.Color;
     }
 }
Ejemplo n.º 33
0
 // update the filter after any edits to the filter row
 private void _flex_AfterEdit(object sender, RowColEventArgs e)
 {
     if (e.Row == _row)
         UpdateFilter();
 }
 void _grid_BeforeAddRow(object sender, RowColEventArgs e)
 {
     Cursor = Cursors.AppStarting;
     if (c1Combo1.SelectedValue == null || c1Combo3.SelectedValue == null)
     {
         RibbonMessageBox.Show("Please select customer and set currency type before adding payment details",
             Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         e.Cancel = true;
     }
     Cursor = Cursors.Default;
 }
Ejemplo n.º 35
0
        private void c1FlexGrid_Conditions_BeforeEdit(object sender, RowColEventArgs e)
        {
            C1FlexGrid grid = sender as C1FlexGrid;

               if (ribbonCheckBox_CheckCondition.Checked)
               {
               e.Cancel = true;
               }
               else
               {
               if (e.Row >= 1 && e.Row == grid.RowSel)
               {
                   int nCondition = -1;
                   if (ConditionTable != null)
                   {
                       try
                       {
                            nCondition = Int32.Parse(grid.GetData(e.Row, 1).ToString());
                       }
                       catch
                       {
                           e.Cancel = true;
                           return;
                       }
                   }
                   else
                   {
                       return;
                   }

                   if (nCondition > 0)
                   {
                       if ((nCondition == (int)Definition.RoutingConditions.PRETIME
                           || nCondition == (int)Definition.RoutingConditions.TIME)
                           && (e.Col == 2 || e.Col == 5 || e.Col == 4)) //|| e.Col == 3
                       {
                           e.Cancel = true;
                           return;
                       }

                       if ((nCondition == (int)Definition.RoutingConditions.MACHINESAMPLEFREE)) // machine sample free
                       {

                           if (e.Col == 2)
                           {
                               e.Cancel = true;
                           }
                           if (e.Col == 4)
                           {
                               grid[e.Row, e.Col] = 1;
                               e.Cancel = true;
                           }
                           if (e.Col == 5)
                           {
                               grid[e.Row, e.Col] = "sample free";
                               e.Cancel = true;
                           }
                       }
                       else if ((nCondition == (int)Definition.RoutingConditions.GLOBALTAG)) // global tags
                       {

                           if (e.Col == 2)
                           {
                               e.Cancel = true;
                           }
                       }
                       if ((nCondition == (int)Definition.RoutingConditions.MACHINETAG)) // machine tags
                       {

                           if (e.Col == 2)
                           {
                               e.Cancel = true;
                           }
                       }
                       if ((nCondition == (int)Definition.RoutingConditions.WORKSHEETENTRY)) // WS entry
                       {
                           if (e.Col == 2)
                           {
                               e.Cancel = true;
                           }
                       }

                       if (nCondition == (int)Definition.RoutingConditions.SAMPLEONPOS) // Sample on pos
                       {
                           if (e.Col == 4)
                           {
                               grid[e.Row, e.Col] = 1;
                               e.Cancel = true;
                           }
                           if (e.Col == 2 || e.Col == 3)
                           {
                               e.Cancel = true;
                           }

                       }

                       if ((nCondition == (int)Definition.RoutingConditions.SAMPLETYPE
                           || nCondition == (int)Definition.RoutingConditions.SAMPLEPRIORITY)) // sample on pos ,sample type , sample priority
                       {

                           if (e.Col == 2 || e.Col == 3)
                           {
                               e.Cancel = true;
                           }
                       }

                       if (nCondition == (int)Definition.RoutingConditions.STATUSBITS)
                       { // status bit

                           if (e.Col == 2)
                           {
                               e.Cancel = true;
                           }
                           if (e.Col == 4)
                           {
                               grid[e.Row, e.Col] = 1;
                               e.Cancel = true;
                           }

                       }

                       if ((nCondition == (int)Definition.RoutingConditions.CHECKOWNMAGPOS)) // check own magazine oposition
                       {
                           /*   if (e.Col == 4)
                              {
                                  grid[e.Row, e.Col] = 1;
                                  e.Cancel = true;
                              }
                              if (e.Col == 5)
                              {
                                  grid[e.Row, e.Col] = "free";
                                  e.Cancel = true;
                              }*/
                           if (e.Col == 2 || e.Col == 3 || e.Col == 4 || e.Col == 5)
                           {
                               e.Cancel = true;
                           }
                       }
                   }
               }

               }
        }
Ejemplo n.º 36
0
 private void m_fg_AfterEdit(object sender, RowColEventArgs e)
 {
     try
     {
         hien_thi_tong_tien();
     }
     catch (Exception v_e)
     {
         CSystemLog_301.ExceptionHandle(v_e);
     }
 }
 void _grid_AfterAddRow(object sender, RowColEventArgs e)
 {
     UpdateScrollbar();
 }
Ejemplo n.º 38
0
        private void c1FlexGrid_Commands_MouseEnterCell(object sender, RowColEventArgs e)
        {
            C1FlexGrid grid = sender as C1FlexGrid;

               TextBox tb = grid.Editor as TextBox;
               if (tb != null)
               {
               nCoursorPositionCommands = tb.SelectionStart;
               }
        }
Ejemplo n.º 39
0
 private void c1FlexGrid_Conditions_AfterEdit(object sender, RowColEventArgs e)
 {
     bConditionTableChanged = true;
       // c1FlexGrid_ConditionsUpdate();
        c1FlexGrid_Conditions.AutoSizeRow(e.Row);
        CheckForErrorText("Condition");
 }
Ejemplo n.º 40
0
        private void c1FlexGrid_Commands_CellChanged(object sender, RowColEventArgs e)
        {
            C1FlexGrid grid = sender as C1FlexGrid;

               if (e.Row > 0 && e.Col == 1)
               {
                {
                   grid.SetData(e.Row, 2, "");
                   grid.SetData(e.Row, 3, "");
                   grid.SetData(e.Row, 4, "");
                   grid.SetData(e.Row, 5, "");
                   grid.SetData(e.Row, 6, "");
               }
               }
               grid.Update();
        }
 public void handle_StartEdit(C1FlexGrid i_c1fg, 
     RowColEventArgs e)
 {
     if (m_isRowEditing)
     {
         return;
     }
     if (GridRow2Me_4_IsUpdatableEvent != null)
         GridRow2Me_4_IsUpdatableEvent(i_c1fg, e.Row, m_usObject);
     m_fg = i_c1fg;
     m_current_row = e.Row;
     BeginTran();
     bool v_isUpdatable = default(bool);
     if (CheckIsUpdatableEvent != null)
         CheckIsUpdatableEvent(m_trans, m_usObject, ref v_isUpdatable);
     if (v_isUpdatable)
     {
         m_isRowEditing = true;
         m_oCSaveTrangThai1DongCuaGrid = new CSaveTrangThai1DongCuaGrid(i_c1fg, e.Row);
     }
     else
     {
         BaseMessages.MsgBox_Warning(15);
         Rollback();
         e.Cancel = true;
     }
 }
Ejemplo n.º 42
0
 private void c1FlexGrid_Commands_AfterEdit(object sender, RowColEventArgs e)
 {
     c1FlexGrid_CommandsUpdate();
        CheckForErrorText("Command");
 }
Ejemplo n.º 43
0
        private void c1FlexGrid_Commands_BeforeEdit(object sender, RowColEventArgs e)
        {
            C1FlexGrid grid = sender as C1FlexGrid;
              // grid.ShowButtons = ShowButtonsEnum.Always;

               // "e.Cancel" blocks the direkt input possibility.
               // we want to edit some of the fields by an extra grid
               if (e.Row > 0 && e.Row == grid.RowSel)
               {
               if (ribbonCheckBox_CheckCondition.Checked) { e.Cancel = true; return; }

               int nCommandType = -1;
               try
               {
                   nCommandType = Int32.Parse(grid.GetData(e.Row, 1).ToString());
               }
               catch { }

               if (nCommandType == (int)Definition.RoutingCommands.SHIFTSAMPLE) // shift sample
               {
                   if (e.Col == 2 || e.Col == 3 || e.Col == 4 || e.Col == 5)
                   {

                       e.Cancel = true;
                   }
               }
               if (nCommandType == (int)Definition.RoutingCommands.CREATESAMPLE) // create sample
               {
                   if (e.Col == 2 || e.Col == 3)
                   {
                     e.Cancel = true;
                   }

                   // e.Coll == 4 => SampleID free typing; so no "Cancel"

                   if (e.Col == 5)
                   {
                       CellRange rg = grid.GetCellRange(grid.Row, 5, grid.Row, 5);
                       CellStyle cs = grid.Styles.Add("SamplePriority");
                       cs.Editor = numericUpDown_Commands;
                       rg.Style = grid.Styles["SamplePriority"];
                   }
               }

               if (nCommandType == (int)Definition.RoutingCommands.DELETESAMPLE) // delete sample
               {
                   if (e.Col == 2 || e.Col == 3 || e.Col == 4 || e.Col == 5)
                   {
                       e.Cancel = true;
                   }
               }

               if (nCommandType == (int)Definition.RoutingCommands.CHANGESAMPLETYPE) // change sample type
               {
                   if ( e.Col == 3 || e.Col == 4 || e.Col == 5)
                   {
                       e.Cancel = true;
                   }
                   if (e.Col == 2)
                   {

                   }
               }

               if (nCommandType == (int)Definition.RoutingCommands.CHANGEPRIORITY) // change sample priority
               {
                   if (e.Col == 3 || e.Col == 4 || e.Col == 5 )
                   {
                       e.Cancel = true;
                   }
                   if (e.Col == 2)
                   {
                       CellRange rg = grid.GetCellRange(grid.Row,2, grid.Row, 2);
                       CellStyle cs = grid.Styles.Add("ChangeSamplePriority");
                       cs.Editor = numericUpDown_Commands;
                       rg.Style = grid.Styles["ChangeSamplePriority"];
                   }
               }

               if (nCommandType == (int)Definition.RoutingCommands.WRITEGLOBALTAG ) // write WinCC global tag
               {
                   if (e.Col == 2) // Name select by grid
                   {
                       e.Cancel = true;
                   }
                   if (e.Col == 3 || e.Col == 4)
                   {
                       e.Cancel = true;
                   }

               }
               if ( nCommandType == (int)Definition.RoutingCommands.WRITEMACHINETAG) // write WinCC  machine tag
               {
                   if (e.Col == 2) // Name select by grid
                   {
                       e.Cancel = true;
                   }
                   if (e.Col == 4) // e.Col == 4 => Input field Tagname
                   {
                       e.Cancel = true;
                   }

               }

               if (nCommandType == (int)Definition.RoutingCommands.INSERTWSENTRY) // write WS entry
               {
                  // e.Col == 2 ||
                   if ( e.Col == 3)
                   {
                       e.Cancel = true;
                   }

                   int nSampleLocation = -1;
                   Int32.TryParse(grid.GetData(e.Row, 2).ToString(), out nSampleLocation);
                   if (e.Col == 2)
                   {
                       if (nSampleLocation != (int)Definition.WSInsertLocation.SAMPLEONPOS)
                       {
                           if ((string)grid.GetData(e.Row, 3).ToString() != "")
                           {
                               grid.SetData(e.Row, 3, "");
                           }
                       }
                   }

                  // e.Col == 4 & e.Col == 5  Name and Value must be free for enter
               }
               if (nCommandType == (int)Definition.RoutingCommands.DELETEWSENTRY) // delete WS entry
               {
                   if (e.Col == 2 || e.Col == 3 || e.Col == 5)
                   {
                       e.Cancel = true;
                   }
                   // e.Col == 4  Name and Value must be free for enter
               }

               if (nCommandType == (int)Definition.RoutingCommands.SENDINGCOMMANDTOMACHINE)   //sending command to machine
               {
                   if (e.Col == 2 || e.Col == 3 || e.Col == 5)
                   {
                       e.Cancel = true;
                   }
                   if (e.Col == 4 && grid.GetData(e.Row, 2).ToString().Length>0)    //
                   {
                      int nConnectionType = myHC.GetConnectionTypeFromConnectionListByMachineList_ID(myHC.GetMachineList_IDFromMachinesByMachine_ID(Int32.Parse(grid.GetData(e.Row, 2).ToString())));
                      if (nConnectionType == (int)Definition.ConnectionTypes.MAGAZINE || nConnectionType == (int)Definition.ConnectionTypes.TCPIP)
                      {
                          e.Cancel = false;
                      } else{
                         // grid.SetData(e.Row, 4, "");
                          e.Cancel = true;
                      }

                   }
               }
               if (nCommandType == (int)Definition.RoutingCommands.CREATERESERVATION
                   || nCommandType == (int)Definition.RoutingCommands.DELETERESERVATION) // create/delete reservation point
               {
                   if (e.Col == 2 || e.Col == 3 || e.Col == 4 || e.Col == 5)
                   {
                       e.Cancel = true;
                   }
               }
               }
        }
Ejemplo n.º 44
0
 private void m_fg_CellChanged(object sender, RowColEventArgs e)
 {
     try
     {
         if (flag == true)
         {
             int i_row = e.Row;
             int i_col = e.Col;
             US_V_HT_NGUOI_SU_DUNG v_us = new US_V_HT_NGUOI_SU_DUNG();
             DS_V_HT_NGUOI_SU_DUNG v_ds = new DS_V_HT_NGUOI_SU_DUNG();
             v_us.FillDataset(v_ds, "where TEN_TRUY_CAP=" + "'"+m_fg.Rows[i_row][(int)e_col_Number.TEN_TRUY_CAP].ToString()+"'");
             string message = "Bạn vừa có thay đổi tên mail! Bạn có muốn lưu lại không?";
             MessageBoxButtons buttons = MessageBoxButtons.YesNo;
             DialogResult result;
             result = MessageBox.Show(message, "Thông báo", buttons);
             if (result == DialogResult.Yes)
             {
                 v_us = new US_V_HT_NGUOI_SU_DUNG();
                 decimal v_dc_ID= CIPConvert.ToDecimal(v_ds.V_HT_NGUOI_SU_DUNG.Rows[0]["ID"]);
                 string v_mail = m_fg.Rows[i_row][i_col].ToString();
                 v_us.Update_mail(v_mail, v_dc_ID);
                 MessageBox.Show("Đã lưu thay đổi", "Thông báo", MessageBoxButtons.OK);
             }
             load_data_2_grid();
         }
     }
     catch (Exception v_e)
     {
         CSystemLog_301.ExceptionHandle(v_e);
     }
 }
Ejemplo n.º 45
0
 void c1FlexGrid1_AfterEdit(object sender, RowColEventArgs e)
 {
     if (e.Col == c1FlexGrid1.Cols["AllowRead"].SafeIndex)
     {
         c1FlexGrid1.SetData(e.Row, "AllowCreate", c1FlexGrid1.GetData(e.Row, e.Col));
         c1FlexGrid1.SetData(e.Row, "AllowUpdate", c1FlexGrid1.GetData(e.Row, e.Col));
         c1FlexGrid1.SetData(e.Row, "AllowDelete", c1FlexGrid1.GetData(e.Row, e.Col));
     }
 }
Ejemplo n.º 46
0
        private void GrillaC1FlexGrid_StartEdit(object sender, RowColEventArgs e)
        {
            var estiloFila = grillaC1FlexGrid.Rows[e.Row].Style;

            if (estiloFila == null)
            {
                return;
            }

            var estiloSubtotal0 = grillaC1FlexGrid.Styles[CellStyleEnum.Subtotal0];
            var estiloSubtotal1 = grillaC1FlexGrid.Styles[CellStyleEnum.Subtotal1];

            if (estiloFila.Name == estiloSubtotal0.Name || estiloFila.Name == estiloSubtotal1.Name)
            {
                e.Cancel = true;
            }
        }
        private void _grid_CellButtonClick(object sender, RowColEventArgs e)
        {
            Cursor = Cursors.AppStarting;
            try
            {
                // open item list form
                if (e.Col == _grid.Cols["ItemCode"].SafeIndex)
                {
                    frmItemSearch fx;
                    if (_grid[e.Row, "ItemCode"] == DBNull.Value)
                        fx = new frmItemSearch();
                    else
                        fx = new frmItemSearch((int)_grid[e.Row, "ItemID"]);
                    fx.ShowDialog();

                    if (fx.SelectedOK)
                    {
                        dsCore.ItemsDataTable data = daItems1.GetDataByID(fx.SelectedID);
                        // item info
                        if (data.Rows.Count > 0)
                        {
                            _grid.SetData(e.Row, "ItemID", data[0].ID);
                            _grid.SetData(e.Row, "ItemCode", data[0].Code);
                            _grid.SetData(e.Row, "ItemName", data[0].Name);
                            _grid.SetData(e.Row, "MeasureCode", data[0].IsMeasureCodeNull() ? "" : data[0].MeasureCode);
                            _grid.SetData(e.Row, "UnitPrice", data[0].IsSellingPriceNull() ? 0 : data[0].SellingPrice);
                            _grid.SetData(e.Row, "TaxPct", 0);
                            _grid.SetData(e.Row, "TrxType", 0);
                            _grid.SetData(e.Row, "Quantity", 1);
                            // display default remark
                            _grid.SetData(e.Row, "Remarks", c1TextBox2.Text);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.ErrorRoutine(ex);
                RibbonMessageBox.Show("ERROR Adding Detail Items: " + ex.Message,
                    Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            Cursor = Cursors.Default;
        }
Ejemplo n.º 48
0
        private void c1FlexGrid_TCPIPConfiguration_BeforeEdit(object sender, RowColEventArgs e)
        {
            C1FlexGrid grid = sender as C1FlexGrid;

            if (e.Row >= 1 && e.Row == grid.RowSel)
            {
                int nType = -1;
                try
                {
                    nType = Int32.Parse(grid.GetData(e.Row, "Type").ToString());

                    if (e.Col == 5)
                    {
                        if (nType == 0)
                        {
                            e.Cancel = true;
                        }
                    }
                }
                catch { }
            }
        }
        private void _grid_AfterEdit(object sender, RowColEventArgs e)
        {
            NumberFormatInfo nfi = Application.CurrentCulture.NumberFormat;

            if (e.Col == _grid.Cols["ItemID"].SafeIndex || e.Col == _grid.Cols["ItemCode"].SafeIndex)
            {
                if (_grid.GetData(e.Row, "ItemCode") != DBNull.Value &&
                    _grid.GetData(e.Row, "ItemCode").ToString().Trim() != "")
                {
                    // read data
                    string code = _grid.GetData(e.Row, "ItemCode").ToString().Trim();
                    dsCore.ItemsDataTable data = daItems1.GetDataByCode(code);
                    if (data.Rows.Count > 0)
                    {
                        // display data
                        _grid.SetData(e.Row, "ItemID", data[0].ID);
                        _grid.SetData(e.Row, "ItemCode", data[0].Code);
                        _grid.SetData(e.Row, "ItemName", data[0].Name);
                        _grid.SetData(e.Row, "MeasureCode", data[0].IsMeasureCodeNull() ? "" : data[0].MeasureCode);
                        _grid.SetData(e.Row, "UnitPrice", data[0].IsSellingPriceNull() ? 0 : data[0].SellingPrice);
                        _grid.SetData(e.Row, "TaxPct", 0);
                        _grid.SetData(e.Row, "TrxType", 0);
                        _grid.SetData(e.Row, "Quantity", 1);
                        // display default remark
                        _grid.SetData(e.Row, "Remarks", c1TextBox2.Text);
                    }
                }
            }

            // update converted credit column value
            if (e.Col == _grid.Cols["Quantity"].SafeIndex)
            {
                if (_grid.GetData(e.Row, "Quantity") != DBNull.Value &&
                    _grid.GetData(e.Row, "Quantity").ToString() != "")
                {
                    //_grid.SetData(e.Row, "ExtendedPrice", (double)_grid.GetData(e.Row, "Quantity") * (double)_grid.GetData(e.Row, "UnitPrice"));
                }
            }

        }
Ejemplo n.º 50
0
        private void GrillaC1FlexGrid_AfterEdit(object sender, RowColEventArgs e)
        {
            if (e.Col == _columnaPorcentajeRendimiento.Index)
            {
                var valorTexto = grillaC1FlexGrid.GetData(e.Row, e.Col).ToString();
                decimal valor;
                if (Decimal.TryParse(valorTexto, out valor))
                {
                    var nuevoValor = valor / 100;

                    grillaC1FlexGrid.SetData(e.Row, e.Col, nuevoValor);
                }
            }
        }