Exemple #1
0
        /// <summary>
        /// 导入
        /// </summary>
        private void Import()
        {
            String copyData = Clipboard.GetText();

            String[] strs = copyData.Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            DataCenter.AwardService.m_awards.Clear();
            int strsSize = strs.Length;

            for (int i = 0; i < strsSize; i++)
            {
                String[] strs2 = strs[i].Split(new String[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                if (strs2.Length >= 3)
                {
                    try
                    {
                        AwardInfo awardInfo = new AwardInfo();
                        awardInfo.m_ID         = System.Guid.NewGuid().ToString();
                        awardInfo.m_createDate = strs2[strs2.Length - 1];
                        awardInfo.m_name       = strs2[strs2.Length - 2];
                        awardInfo.m_title      = strs2[0];
                        DataCenter.AwardService.m_awards.Add(awardInfo);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            DataCenter.AwardService.Save();
            Console.WriteLine("1");
        }
Exemple #2
0
        /// <summary>
        /// 添加嘉奖
        /// </summary>
        /// <param name="award">嘉奖</param>
        public void AddAwardToGrid(AwardInfo award)
        {
            StaffService   staffService = DataCenter.StaffService;
            StaffInfo      staff        = staffService.GetStaff(award.m_name);
            List <GridRow> rows         = m_gridAwards.m_rows;
            int            rowsSize     = rows.Count;

            for (int i = 0; i < rowsSize; i++)
            {
                GridRow findRow = rows[i];
                if (findRow.GetCell("colP1").GetString() == award.m_ID)
                {
                    findRow.GetCell("colP2").SetString(award.m_name);
                    findRow.GetCell("colP3").SetString(award.m_title);
                    findRow.GetCell("colP4").SetString(award.m_createDate);
                    return;
                }
            }
            GridRow row = new GridRow();

            m_gridAwards.AddRow(row);
            row.AddCell("colP1", new GridStringCell(award.m_ID));
            row.AddCell("colP2", new GridStringCell(award.m_name));
            row.AddCell("colP3", new GridStringCell(award.m_title));
            row.AddCell("colP4", new GridStringCell(award.m_createDate));
            List <GridCell> cells     = row.GetCells();
            int             cellsSize = cells.Count;

            for (int j = 1; j < cellsSize; j++)
            {
                cells[j].AllowEdit = true;
            }
        }
Exemple #3
0
        /// <summary>
        /// 添加
        /// </summary>
        public void Add()
        {
            AwardService awardService = DataCenter.AwardService;
            AwardInfo    award        = new AwardInfo();

            award.m_ID = awardService.GetNewID();
            awardService.Save(award);
            AddAwardToGrid(award);
            m_gridAwards.Update();
            if (m_gridAwards.VScrollBar != null)
            {
                m_gridAwards.VScrollBar.ScrollToEnd();
            }
            m_gridAwards.Invalidate();
        }
Exemple #4
0
        /// <summary>
        /// 绑定员工
        /// </summary>
        private void BindAwards()
        {
            m_gridAwards.CellEditMode = GridCellEditMode.DoubleClick;
            List <AwardInfo> awards = DataCenter.AwardService.m_awards;
            int awardsSize          = awards.Count;

            m_gridAwards.ClearRows();
            m_gridAwards.BeginUpdate();
            for (int i = 0; i < awardsSize; i++)
            {
                AwardInfo award = awards[i];
                AddAwardToGrid(award);
            }
            m_gridAwards.EndUpdate();
            m_gridAwards.Invalidate();
        }
Exemple #5
0
 /// <summary>
 /// 是否确认关闭
 /// </summary>
 /// <returns>不处理</returns>
 public override int Submit()
 {
     if (m_selectStaffWindow != null)
     {
         AwardService   awardService     = DataCenter.AwardService;
         List <GridRow> selectedRows     = m_gridAwards.SelectedRows;
         int            selectedRowsSize = selectedRows.Count;
         if (selectedRowsSize > 0)
         {
             String    newJobID = m_selectStaffWindow.GetSelectedJobIDs();
             AwardInfo award    = awardService.GetAward(selectedRows[0].GetCell("colP1").GetString());
             award.m_name = newJobID;
             awardService.Save(award);
             AddAwardToGrid(award);
         }
         m_selectStaffWindow = null;
     }
     return(0);
 }
Exemple #6
0
        /// <summary>
        /// 保存信息
        /// </summary>
        /// <param name="award">嘉奖信息</param>
        public void Save(AwardInfo award)
        {
            bool modify     = false;
            int  awardsSize = m_awards.Count;

            for (int i = 0; i < awardsSize; i++)
            {
                if (m_awards[i].m_ID == award.m_ID)
                {
                    m_awards[i] = award;
                    modify      = true;
                    break;
                }
            }
            if (!modify)
            {
                m_awards.Add(award);
            }
            Save();
        }
Exemple #7
0
 /// <summary>
 /// 单元格编辑结束事件
 /// </summary>
 /// <param name="sender">调用者</param>
 /// <param name="cell">单元格</param>
 private void GridCellEditEnd(object sender, GridCell cell)
 {
     if (cell != null)
     {
         AwardInfo award     = DataCenter.AwardService.GetAward(cell.Row.GetCell("colP1").GetString());
         String    colName   = cell.Column.Name;
         String    cellValue = cell.GetString();
         if (colName == "colP2")
         {
             award.m_name = cellValue;
         }
         else if (colName == "colP3")
         {
             award.m_title = cellValue;
         }
         else if (colName == "colP4")
         {
             award.m_createDate = cellValue;
         }
         DataCenter.AwardService.Save(award);
     }
 }