Exemple #1
0
        private void grid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;
            var      row  = (GridRow)e.GridPanel.Rows[cell.RowIndex];

            if (cell.GridColumn == gcWorkshop)
            {
                if (Convert.ToString(row.Cells[gcWorkshop].Value) != "")
                {
                    row[gcProcess].EditorType = typeof(ProcessComboBoxSelect);
                    string n    = row.Cells[gcWorkshop].Value.ToString();
                    var    db   = EntitiesFactory.CreateSpareInstance();
                    var    list =
                        new  List <TA_PROCESS>(db.TA_PROCESS.Where(p => p.OwnedWorkshopCode == n).ToList());
                    row[gcProcess].EditorParams = new object[] { list };
                    if (row.Cells[gcProcess].Value != null)
                    {
                        string pro = row.Cells[gcProcess].Value.ToString();
                        if (list.All(p => p.OwendProcessCode != pro))
                        {
                            row.Cells[gcProcess].Value = "";
                        }
                    }
                }
            }
        }
        private void SGrid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            var row = e.GridCell.GridRow;

            if (row?.Tag == null)
            {
                return;
            }

            var item = (RolePrivilege)row.Tag;

            item.Enable = (bool)e.GridCell.Value;

            if (item.Id != 0)
            {
                item.RowStatus = AiTech.LiteOrm.RecordStatus.ModifiedRecord;
            }

            var writer = new RoleDataWriter(App.CurrentUser.User.Username, (Role)cboRole.SelectedItem);

            writer.SaveChanges();
            item.StartTrackingChanges();
        }
        private void dgvDisco_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            int    i = dgvDisco.PrimaryGrid.ActiveRow.Index;
            int    aux;
            int    cantidadDisco;
            string myStr;

            if (!(i == -1))
            {
                myStr = ((GridCell)(((GridRow)dgvDisco.PrimaryGrid.ActiveRow)[2])).Value.ToString();
                myStr = myStr.TrimStart('0');

                if (myStr.Length > 0)
                {
                    aux = int.Parse(myStr);
                    if (aux < 0)
                    {
                        myStr = "1";
                    }
                }
                else
                {
                    myStr = "1";
                }
                cantidadDisco = myStr.Length > 0 ? int.Parse(myStr) : 1;
                ((GridCell)(((GridRow)dgvDisco.PrimaryGrid.ActiveRow)[2])).Value = cantidadDisco;
            }
        }
        private void TranslationsSupergridCellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            var row       = (ApplicationTranslation)e.GridCell.GridRow.GetCell(OBJECT).Value;
            var gridTitle = (string)e.GridCell.GridColumn.DataPropertyName;
            var langId    = int.Parse(gridTitle.Split('_')[1]);

            var translation = new ApplicationTranslations().GetByKeyAndLanguageId(row.Key, langId).Find(x => x.SubKey.Equals(row.SubKey))
                              ?? new ApplicationTranslation(-1, row.Key, row.SubKey, langId, e.NewValue as string);

            if (langId != (int)Enums.Languages.en_GB && string.IsNullOrEmpty(e.NewValue as string))
            {
                new ApplicationTranslations().Delete(translation);
            }
            else if (translation.Id == -1)
            {
                new ApplicationTranslations().Add(translation);
            }
            else
            {
                translation.Value = e.NewValue as string;
                new ApplicationTranslations().Modify(translation);
            }
            //AddHistoryAction(TranslationKey.History_TranslationsForm_Modified, "Translation '{0}' '{1}' for '{2}' modified from {3} to {4} by user {5}.", row.Key, row.SubKey, Translations.Enums.TranslatedEnumDictionary[(Enums.Languages)langId], e.OldValue, row.Value, CurrentUser.User.Username);
            AddHistoryAction(TranslationKey.History_TranslationsForm_Modified, "Translation '{0}' '{1}' for '{2}' modified from {3} to {4} by user {5}.", row.Key, row.SubKey, (Enums.Languages)langId, e.OldValue, row.Value, CurrentUser.User.Username);
        }
Exemple #5
0
        private void SGC_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            #region 判斷僅能輸入正整數
            try
            {
                int    n;
                string temp = e.GridCell.GridRow.Cells["自定泡泡號"].Value.ToString();
                if (!int.TryParse(temp, out n) && temp != "")
                {
                    MessageBox.Show("請輸入正整數");
                    e.GridCell.GridRow.Cells["自定泡泡號"].Value = "";
                    return;
                }

                #region 判斷是否重複數字,可能要移到按OK才判斷
                //foreach (GridRow i in SGC.PrimaryGrid.GridPanel.Rows)
                //{
                //    if (temp == "")
                //    {
                //        break;
                //    }
                //    if (temp == i.Cells["自定泡泡號"].Value)
                //    {
                //        MessageBox.Show("數字重複,請重心指定");
                //        break;
                //    }
                //}
                #endregion
            }
            catch (System.Exception ex)
            {
            }
            #endregion
        }
Exemple #6
0
        private void grid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;
            var      row  = (GridRow)e.GridPanel.Rows[cell.RowIndex];

            //根据选择的物料,获取库存表中的批次,出库库位
//            if (cell.GridColumn == gcPartCode)
//            {
//                if (row[gcPartCode].Value!= null)
//                {
//                    var partcode = row[gcPartCode].Value.ToString();
//                    var stockDetail =
//                        StockDetailController.GetListByPartCode(_db, partcode)
//                            .OrderBy(p => p.Batch)
//                            .FirstOrDefault();
//                    if (stockDetail != null)
//                    {
//                        row.Cells[gcUnitPrice].Value = stockDetail.UnitPrice;
//                        row.Cells[gcBatch].Value = stockDetail.Batch;
//                        row.Cells[gcFromLocCode].Value = stockDetail.LocCode;
//                    }
//                }
//            }
            //根据如库数量,自动计算金额
            if (cell.GridColumn == gcQty)
            {
                if (row.Cells[gcUnitPrice].Value != null && Convert.ToString(row.Cells[gcQty].Value) != "")
                {
                    row.Cells[gcAmount].Value = (decimal)row.Cells[gcUnitPrice].Value * (decimal)row.Cells[gcQty].Value;
                }
            }
        }
Exemple #7
0
        void SuperGridControl1CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            GridPanel panel = e.GridPanel;

            // If a cell value in the "Order Details" panel has changed
            // then update its footer to reflect the change

            if (panel.Name.Equals("Table1") == true)
            {
                UpdateFooter(panel);
            }
        }
Exemple #8
0
        private void grid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;
            var      row  = (GridRow)e.GridPanel.Rows[cell.RowIndex];

            //根据选择的零件号,获取库存批次,单价
            if (cell.GridColumn == gcPartCode)
            {
                var stockDetail = StockDetailController.GetListByPartCode(_db, cell.Value.ToString()).OrderBy(p => p.Batch).FirstOrDefault();
                row.Cells[gcBatch].Value       = stockDetail.Batch;
                row.Cells[gcFromLocCode].Value = stockDetail.LocCode;
            }
        }
Exemple #9
0
        private void grid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;
            var      row  = (GridRow)e.GridPanel.Rows[cell.RowIndex];

            //根据出库数量,自动计算金额
            if (cell.GridColumn == gcInQty)
            {
                if (Convert.ToString(row.Cells[gcUnitPrice].Value) != "" && Convert.ToString(row.Cells[gcInQty].Value) != "")
                {
                    row.Cells[gcAmount].Value = (decimal)row.Cells[gcUnitPrice].Value * (decimal)row.Cells[gcInQty].Value;
                }
            }
        }
        private void superGridPanel_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;

            if (cell.GridColumn.Name.Equals("製程序") == true && !IS_PROGRAM)
            {
                IS_PROGRAM = true;

                GridRow row = cell.GridRow;

                for (int i = 0; i < panel.Rows.Count; i++)
                {
                    if (i == row.Index)
                    {
                        continue;
                    }
                    bool check = (bool)panel.GridPanel.GetCell(i, 0).Value;
                    if (check)
                    {
                        panel.GridPanel.GetCell(i, 0).Value = (bool)false;
                    }
                }

                bool cur_check = (bool)panel.GridPanel.GetCell(row.Index, 0).Value;
                if (!cur_check)
                {
                    panel.GridPanel.GetCell(row.Index, 0).Value = (bool)false;
                }
                else
                {
                    panel.GridPanel.GetCell(row.Index, 0).Value = (bool)true;
                }
                //CaxLog.ShowListingWindow(row.Index.ToString());

                IS_PROGRAM = false;
            }

            //清空所有checkBox&labelBox
            //ClearAllCheck();

            //判斷選取到的製程序對應開啟的groupBox
            bool check_sel = (bool)panel.GridPanel.GetCell(cell.GridRow.Index, 0).Value;

            if (check_sel)
            {
                SelePartName = panel.GridPanel.GetCell(cell.GridRow.Index, 1).Value.ToString();
            }
        }
        /// <summary>
        /// Handles cell value changes in order to reflect MicroChart
        /// borders that are based upon the MicroChart values
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SuperGridControl1CellValueChanged(
            object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;

            if (cell.ColumnIndex <= 1)
            {
                bool needsBorder = NeedsChartBorder(e.NewValue);
                bool hasBorder   = NeedsChartBorder(e.OldValue);

                if (needsBorder != hasBorder)
                {
                    UpdateMicroChartBorder(cell, needsBorder);
                }
            }
        }
Exemple #12
0
 private void superGrid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
 {
     if (e.GridCell.ColumnIndex == 4)
     {
         if (e.GridCell.GridRow["price"].Value != null)
         {
             e.GridCell.GridRow["totalprice"].Value = Math.Round(double.Parse(e.NewValue.ToString()) * double.Parse(e.GridCell.GridRow["price"].Value.ToString()), 5);
         }
     }
     else if (e.GridCell.ColumnIndex == 5)
     {
         if (e.GridCell.GridRow["weight"].Value != null)
         {
             e.GridCell.GridRow["totalprice"].Value = Math.Round(double.Parse(e.NewValue.ToString()) * double.Parse(e.GridCell.GridRow["weight"].Value.ToString()), 5);
         }
     }
 }
        /// <summary>
        /// This routine is called whenever a grid cell value changes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SuperGridControl1CellValueChanged(
            object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;

            // If the cell changing value is in the "Power State" column
            // then adjust the row "Start/Stop" cell appropriately

            if (cell.GridColumn.Name.Equals("Power State") == true)
            {
                GridRow row = cell.GridRow;

                // Hide the cell if the switch button is off
                // and reset the cell's value back to the "Start" state

                row.Cells["Start/Stop"].Visible = (bool)e.NewValue;
                row.Cells["Start/Stop"].Value   = (bool)e.NewValue ? "Start" : "Hidden";
            }
        }
Exemple #14
0
 private void ProjectGrid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
 {
     if (e.GridCell.GridColumn.EditControl is ArchiveDropDownEditControl)
     {
         //ArchiveDropDownEditControl gbc = e.GridCell.EditControl as ArchiveDropDownEditControl;
         if (e.OldValue.Equals("激活") && e.NewValue.Equals("冻结"))
         {
             DialogResult dr = MessageBox.Show("确实要冻结该项目吗? 冻结项目以后,该项目的所有资料将无法借出/归还,也不能进行任何维护操作。", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
             if (dr.Equals(DialogResult.No))
             {
                 e.GridCell.Value = "激活";
                 return;
             }
             ProjectInfo pi = (ProjectInfo)e.GridCell.GridRow[1].Tag;
             pi.IsFreeze = 1;
             EditList.Add(e.GridCell.GridRow);
         }
     }
 }
Exemple #15
0
        private void grid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;
            var      row  = (GridRow)e.GridPanel.Rows[cell.RowIndex];

            //相同批次的物料,看库存中是否有单价
            if (cell.GridColumn == gcPartCode || cell.GridColumn == gcBatch)
            {
                if (row[gcPartCode].Value != null)
                {
                    var partcode = row[gcPartCode].Value.ToString();
                    if (row[gcBatch].Value != null)
                    {
                        var batch       = row[gcBatch].Value.ToString();
                        var stockDetail =
                            StockDetailController.GetListByPartCode(_db, partcode)
                            .Where(p => p.Batch == batch)
                            .OrderBy(p => p.Batch)
                            .FirstOrDefault();
                        if (stockDetail != null)
                        {
                            row.Cells[gcUnitPrice].Value = stockDetail.UnitPrice;
                        }
                    }
                }
                if (row[gcProduceDate].Value == null)
                {
                    row[gcProduceDate].Value = DateTime.Now;
                }
            }
            //根据出库数量,自动计算金额
            if (cell.GridColumn == gcUnitPrice || cell.GridColumn == gcQty)
            {
                if (Convert.ToString(row.Cells[gcUnitPrice].Value) != "" && Convert.ToString(row.Cells[gcQty].Value) != "")
                {
                    row.Cells[gcAmount].Value = (decimal)row.Cells[gcUnitPrice].Value * (decimal)row.Cells[gcQty].Value;
                }
            }
        }
        private void ApplicationSettingsSupergridCellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            if (_lastChange > DateTime.Now.AddSeconds(-1))
            {
                return;
            }

            _lastChange = DateTime.Now;
            var row = (ApplicationSetting)e.GridCell.GridRow.GetCell(OBJECT).Value;

            if (!CurrentUser.HasPermission(
                    ACICategories.APPLICATIONSETTINGSMANAGEMENT,
                    $"{ACIOptions.MODIFY}_Category_{((ApplicationSettingsCategories)row.ApplicationSettingsCategoryId).ToString()}"))
            {
                DisplayError(TranslationKey.Error_ApplicationSettings_InsufficientRights, "Insufficient Rights", "You don't have the right to edit a value of a setting of category {0}", Translations.ApplicationSettings.TranslatedApplicationSettingsCategoryDictionary[row.ApplicationSettingsCategoryId]);
                RefreshGrid();
                return;
            }
            row.Value = e.NewValue.ToString();
            ApplicationSettings.Business.ApplicationSettings.Instance.Modify(row);
            AddHistoryAction(TranslationKey.History_ApplicationSettingsAdministrationForm_Modified, "User {0} changed application setting {1} from {2} to {3}", CurrentUser.User.Username, Translations.ApplicationSettings.TranslatedApplicationSettingsNameDictionary[row.ApplicationSettingId], e.OldValue, row.Value);
        }
Exemple #17
0
        private void grid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;
            var      row  = (GridRow)e.GridPanel.Rows[cell.RowIndex];

            //根据选择的零件号,获取库存批次,单价
//            if (cell.GridColumn == gcPartCode)
//            {
//                var stockDetail = StockDetailController.GetListByPartCode(_db, cell.Value.ToString()).OrderBy(p=>p.Batch).FirstOrDefault();
//                row.Cells[gcBatch].Value = stockDetail.Batch;
//                row.Cells[gcUnitPrice].Value = stockDetail.UnitPrice;
//                row.Cells[gcFromLocCode].Value = stockDetail.LocCode;
//            }
            //根据出库数量,自动计算金额
            if (cell.GridColumn == gcOutQty)
            {
                if (Convert.ToString(row.Cells[gcUnitPrice].Value) != "" && Convert.ToString(row.Cells[gcOutQty].Value) != "")
                {
                    row.Cells[gcAmount].Value = (decimal)row.Cells[gcUnitPrice].Value * (decimal)row.Cells[gcOutQty].Value;
                }
            }
        }
        private void HistoryKeysSupergridCellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            if (_lastChange > DateTime.Now.AddSeconds(-1))
            {
                return;
            }

            _lastChange = DateTime.Now;
            var row = (HistoryKey)e.GridCell.GridRow.GetCell(OBJECT).Value;

            if (!CurrentUser.HasPermission(
                    ACICategories.HISTORYKEYMANAGEMENT,
                    ACIOptions.MODIFY))
            {
                DisplayError(TranslationKey.Error_HistoryKeyManagement_InsufficientRights, "Insufficient Rights", "You don't have the right to edit a history key");
                RefreshGrid();
                return;
            }

            if (e.GridCell.GridColumn.Name.Equals("TraceLevel"))
            {
                row.TraceLevelValue = (System.Diagnostics.SourceLevels)e.NewValue;
                HistoryKeys.Instance.Modify(row);
                AddHistoryAction(TranslationKey.History_HistoryKeyAdministrationForm_ModifiedTraceLevel, "User {0} changed option Trace Level on {1} from {2} to {3}", CurrentUser.User.Username, row.HistoryKey, (System.Diagnostics.SourceLevels)e.OldValue, row.TraceLevel);
            }
            else if (e.GridCell.GridColumn.Name.Equals("ShowInClient"))
            {
                row.ShowInClient = (bool)e.NewValue;
                HistoryKeys.Instance.Modify(row);
                AddHistoryAction(TranslationKey.History_HistoryKeyAdministrationForm_ModifiedShowInClient, "User {0} changed option Show in Client on {1} from {2} to {3}", CurrentUser.User.Username, row.HistoryKey, e.OldValue, row.ShowInClient);
            }
            else if (e.GridCell.GridColumn.Name.Equals("SaveInDatabase"))
            {
                row.SaveInDatabase = (bool)e.NewValue;
                HistoryKeys.Instance.Modify(row);
                AddHistoryAction(TranslationKey.History_HistoryKeyAdministrationForm_ModifiedSaveInDatabase, "User {0} changed option Save in Database on {1} from {2} to {3}", CurrentUser.User.Username, row.HistoryKey, e.OldValue, row.SaveInDatabase);
            }
        }
Exemple #19
0
        private void QL_sgQuanLyNguoiNhan_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            if (e.GridCell.GridRow["PheDuyet"].Value != null | e.GridCell.GridRow["NgayLuuTru"].Value != null)
            {
                if (!e.GridCell.GridColumn.AllowEdit)
                {
                    return;
                }
            }

            var maBN = e.GridCell.GridRow["MaMau"].Value;

            if (maBN == null)
            {
                MessageBox.Show("Bạn cần nhập mã bệnh nhân hiến trước khi làm tiếp", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                foreach (var bn in listNHTs)
                {
                    if ((string)maBN == bn.MaBN)
                    {
                        e.GridCell.GridRow["PheDuyet"].Value   = bn.FlagApprove;
                        e.GridCell.GridRow["NgayLuuTru"].Value = bn.NgayTao;
                    }
                }

                var id = e.GridCell.GridRow["Id"].Value;
                if (id == null | Convert.ToInt32(id) == 0)
                {
                    QuanLyNguoiNhanMau bn = new QuanLyNguoiNhanMau();
                    bn.MaMau = Convert.ToString(maBN);

                    var pheduyet = e.GridCell.GridRow["PheDuyet"].Value;
                    bn.PheDuyet = Convert.ToBoolean(pheduyet);

                    var ngayluutru = e.GridCell.GridRow["NgayLuuTru"].Value;
                    bn.NgayLuuTru = Convert.ToDateTime(ngayluutru);

                    var ngaysudung = e.GridCell.GridRow["NgaySuDung"].Value;
                    bn.NgaySuDung = Convert.ToDateTime(ngaysudung);

                    var manguoinhan = e.GridCell.GridRow["MaNguoiNhan"].Value;
                    bn.MaNguoiNhan = Convert.ToString(manguoinhan);

                    var ketqua = e.GridCell.GridRow["KetQuaSuDung"].Value;
                    bn.KetQuaSuDung = Convert.ToString(ketqua);

                    var huymau = e.GridCell.GridRow["HuyMau"].Value;
                    bn.HuyMau = Convert.ToBoolean(huymau);

                    var ngayhuymau = e.GridCell.GridRow["NgayHuyMau"].Value;
                    bn.NgayHuyMau = Convert.ToDateTime(ngayhuymau);

                    var ghichu = e.GridCell.GridRow["GhiChu"].Value;
                    bn.GhiChu = Convert.ToString(ghichu);

                    dbQL.AddNguoiNhanMau(bn);
                    FillData();
                }
                else
                {
                    QuanLyNguoiNhanMau bn = dbQL.GetNguoiNhanById(Convert.ToInt32(id));
                    bn.MaMau = Convert.ToString(maBN);

                    var pheduyet = e.GridCell.GridRow["PheDuyet"].Value;
                    bn.PheDuyet = Convert.ToBoolean(pheduyet);

                    var ngayluutru = e.GridCell.GridRow["NgayLuuTru"].Value;
                    bn.NgayLuuTru = Convert.ToDateTime(ngayluutru);

                    var ngaysudung = e.GridCell.GridRow["NgaySuDung"].Value;
                    bn.NgaySuDung = Convert.ToDateTime(ngaysudung);

                    var manguoinhan = e.GridCell.GridRow["MaNguoiNhan"].Value;
                    bn.MaNguoiNhan = Convert.ToString(manguoinhan);

                    var ketqua = e.GridCell.GridRow["KetQuaSuDung"].Value;
                    bn.KetQuaSuDung = Convert.ToString(ketqua);

                    var huymau = e.GridCell.GridRow["HuyMau"].Value;
                    bn.HuyMau = Convert.ToBoolean(huymau);

                    var ngayhuymau = e.GridCell.GridRow["NgayHuyMau"].Value;
                    bn.NgayHuyMau = Convert.ToDateTime(ngayhuymau);

                    var ghichu = e.GridCell.GridRow["GhiChu"].Value;
                    bn.GhiChu = Convert.ToString(ghichu);

                    dbQL.EditNguoiNhanMau(Convert.ToInt32(id), bn);
                    FillData();
                }
            }
        }
Exemple #20
0
 private void grid_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
 {
 }
Exemple #21
0
        private void MembershipSupergridCellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            try
            {
                if (!CurrentUser.HasPermission(ACICategory, ACIOptions.MODIFY))
                {
                    return;
                }

                if (_user != null && (_user.AccountType == AccountTypes.ADUser || _user.AccountType == AccountTypes.ADSuperUser))
                {
                    DisplayWarning(TranslationKey.Message_UserGroup_ModifyNotAllowed, "Action not allowed", "It is not allowed to modify group assignments for domain users.");
                    return;
                }

                if (_user != null)
                {
                    var row = (UMMembershipHelper.GroupHelper)e.GridCell.GridRow.GetCell(OBJECT).Value;
                    row.Member = (bool)e.NewValue;
                    if (!row.Member)
                    {
                        var userGroupList = new UserGroupList(_user.Id, row.Id);
                        new UserGroupLists().Delete(userGroupList);
                        AddHistoryAction(TranslationKey.History_MembershipPopupForm_Deleted, "User {0} deleted user {1} from group {2}", CurrentUser.User.Username, _user.Username, row.Name);
                    }
                    else
                    {
                        var userGroupList = new UserGroupList(_user.Id, row.Id);
                        new UserGroupLists().Add(userGroupList);
                        AddHistoryAction(TranslationKey.History_MembershipPopupForm_Added, "User {0} added user {1} to group {2}", CurrentUser.User.Username, _user.Username, row.Name);
                    }
                }
                else if (_group != null)
                {
                    var row = (UMMembershipHelper.UserHelper)e.GridCell.GridRow.GetCell(OBJECT).Value;
                    row.Member = (bool)e.NewValue;

                    if (row.AccountType == AccountTypes.ADUser || row.AccountType == AccountTypes.ADSuperUser)
                    {
                        DisplayWarning(TranslationKey.Message_UserGroup_ModifyNotAllowed, "Action not allowed", "It is not allowed to modify group assignments for domain users.");
                        return;
                    }

                    if (!row.Member)
                    {
                        var userGroupList = new UserGroupList(row.Id, _group.Id);
                        new UserGroupLists().Delete(userGroupList);
                        AddHistoryAction(TranslationKey.History_MembershipPopupForm_Deleted, "User {0} deleted user {1} from group {2}", CurrentUser.User.Username, row.Username, _group.Name);
                    }
                    else
                    {
                        var userGroupList = new UserGroupList(row.Id, _group.Id);
                        new UserGroupLists().Add(userGroupList);
                        AddHistoryAction(TranslationKey.History_MembershipPopupForm_Added, "User {0} added user {1} to group {2}", CurrentUser.User.Username, row.Username, _group.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteError("()", Trace.GetMethodName(), CLASSNAME, ex);
                DisplayError(Trace.GetMethodName(), TranslationKey.CommonMessage_InternalError, ex);
            }
            finally
            {
                Refresh();
            }
        }
 private void PropertiesSupergridCellValueChanged(object sender, GridCellValueChangedEventArgs e)
 {
     try
     {
         if (_user != null)
         {
             var row = (ViewUserPropertyValue)e.GridCell.GridRow.GetCell(OBJECT).Value;
             row.Value = (string)e.NewValue;
             if (string.IsNullOrEmpty(row.Value) || row.Value.Equals(row.DefaultValue))
             {
                 var property = new UserPropertyValues().GetById(row.PropertyId, _user.Id);
                 if (property != null)
                 {
                     new UserPropertyValues().Delete(property);
                 }
             }
             else
             {
                 new UserPropertyValues().AddOrUpdate(new UserPropertyValue(row.PropertyId, _user.Id, row.Value));
             }
             AddHistoryAction(TranslationKey.History_PropertiesPopupForm_User_Modified, "User {0} changed user property {1} from {2} to {3} for user {4}", CurrentUser.User.Username, Translations.Enums.TranslatedEnumDictionary[(UserManagementProperties)row.PropertyId], e.OldValue, row.Value, _user.Username);
         }
         else if (_group != null)
         {
             var row = (ViewGroupPropertyValue)e.GridCell.GridRow.GetCell(OBJECT).Value;
             row.Value = (string)e.NewValue;
             if (string.IsNullOrEmpty(row.Value) || row.Value.Equals(row.DefaultValue))
             {
                 var property = new GroupPropertyValues().GetById(row.PropertyId, _group.Id);
                 if (property != null)
                 {
                     new GroupPropertyValues().Delete(property);
                 }
             }
             else
             {
                 new GroupPropertyValues().AddOrUpdate(new GroupPropertyValue(row.PropertyId, _group.Id, row.Value));
             }
             AddHistoryAction(TranslationKey.History_PropertiesPopupForm_Group_Modified, "User {0} changed group property {1} from {2} to {3} for group {4}", CurrentUser.User.Username, Translations.Enums.TranslatedEnumDictionary[(UserManagementProperties)row.PropertyId], e.OldValue, row.Value, _group.Name);
         }
         else if (_computer != null)
         {
             var row = (ViewComputerPropertyValue)e.GridCell.GridRow.GetCell(OBJECT).Value;
             row.Value = (string)e.NewValue;
             if (string.IsNullOrEmpty(row.Value) || row.Value.Equals(row.DefaultValue))
             {
                 var property = new ComputerPropertyValues().GetById(row.PropertyId, _computer.Id);
                 if (property != null)
                 {
                     new ComputerPropertyValues().Delete(property);
                 }
             }
             else
             {
                 new ComputerPropertyValues().AddOrUpdate(new ComputerPropertyValue(row.PropertyId, _computer.Id, row.Value));
             }
             AddHistoryAction(TranslationKey.History_PropertiesPopupForm_Computer_Modified, "User {0} changed computer property {1} from {2} to {3} for computer {4}", CurrentUser.User.Username, Translations.Enums.TranslatedEnumDictionary[(UserManagementProperties)row.PropertyId], e.OldValue, row.Value, _computer.HostName);
         }
     }
     catch (Exception ex)
     {
         Trace.WriteError("()", Trace.GetMethodName(), CLASSNAME, ex);
         DisplayError(Trace.GetMethodName(), TranslationKey.CommonMessage_InternalError, ex);
     }
     finally
     {
         Refresh();
     }
 }
Exemple #23
0
        private void superGridPanel_CellValueChanged(object sender, GridCellValueChangedEventArgs e)
        {
            GridCell cell = e.GridCell;

            if (cell.GridColumn.Name.Equals("製程序") == true && !IS_PROGRAM)
            {
                IS_PROGRAM = true;

                GridRow row = cell.GridRow;

                for (int i = 0; i < panel.Rows.Count; i++)
                {
                    if (i == row.Index)
                    {
                        continue;
                    }
                    bool check = (bool)panel.GridPanel.GetCell(i, 0).Value;
                    if (check)
                    {
                        panel.GridPanel.GetCell(i, 0).Value = (bool)false;
                    }
                }

                bool cur_check = (bool)panel.GridPanel.GetCell(row.Index, 0).Value;
                if (!cur_check)
                {
                    panel.GridPanel.GetCell(row.Index, 0).Value = (bool)false;
                }
                else
                {
                    panel.GridPanel.GetCell(row.Index, 0).Value = (bool)true;
                }
                //CaxLog.ShowListingWindow(row.Index.ToString());

                IS_PROGRAM = false;
            }

            //清空所有checkBox&labelBox
            ClearAllCheck();

            //判斷選取到的製程序對應開啟的groupBox
            bool check_sel = (bool)panel.GridPanel.GetCell(cell.GridRow.Index, 0).Value;

            if (check_sel)
            {
                SelePartName = panel.GridPanel.GetCell(cell.GridRow.Index, 1).Value.ToString();
                string[] SplitSelePartName       = SelePartName.Split(new string[] { "OP" }, StringSplitOptions.RemoveEmptyEntries);
                string   DoubleSplitSelePartName = (SplitSelePartName[1].Split(new string[] { "_CAM" }, StringSplitOptions.RemoveEmptyEntries))[0];
                if (DoubleSplitSelePartName == "001")
                {
                    groupBox001.Enabled = true;
                    groupBox900.Enabled = false;
                    groupBoxW.Enabled   = false;
                }
                else if (DoubleSplitSelePartName == "900")
                {
                    groupBox900.Enabled = true;
                    groupBox001.Enabled = false;
                    groupBoxW.Enabled   = false;
                }
                else
                {
                    groupBoxW.Enabled   = true;
                    groupBox001.Enabled = false;
                    groupBox900.Enabled = false;
                }
                SeleOperValue = DoubleSplitSelePartName;
            }
        }