예제 #1
0
        private void gridView1_CellValueChanged(object sender, CellValueChangedEventArgs e)
        {
            if (new GridColumn[] { colProjectCode, colProjectName }.Contains(e.Column))
            {
                DataRow row       = gridView1.GetDataRow(e.RowHandle);
                int     projectId = row.GetValue <int>(e.Column);
                Project project   = Project.GetProject(projectId);

                row.SetValue(colProjectCode, projectId);
                row.SetValue(colProjectName, projectId);
                row.SetValue(colCustomerCode, project?.CustomerCode);
                row.SetValue(colCustomerName, project?.CustomerName);
                row.SetValue(colSiteLocation, project?.SiteLocation);
                row.SetValue(colStartDate, StrEx.GetDateString(project?.StartDate));
                row.SetValue(colEstCompletionDate, StrEx.GetDateString(project?.EstCompletionDate));

                row.SetValue(colLemNum, project.GetNextLemNum());
            }

            if (!gridView1.IsNewItemRow(e.RowHandle))
            {
                if (new GridColumn[] { colProjectCode, colProjectName, colLogDate, colLogStatus, colDescription }.Contains(e.Column))
                {
                    DataRow row = gridView1.GetDataRow(e.RowHandle);
                    row.SetValue(colSubmitStatus, GetEnumName(EnumSubmitStatus.Open));
                    LemHeader.SqlUpdate(row.GetValue <int>(colId), row.GetValue <DateTime>(colLogDate), row.GetValue <int>(colProjectCode),
                                        row.GetCharEnumValue <EnumLogStatus>(colLogStatus), row.GetValueString(colDescription));
                }
            }
        }
예제 #2
0
 private void SetData(List <LemHeader> headerList)
 {
     tableHeader.Clear();
     headerList.Select(x => new { Header = x, project = Project.GetProject(x.ProjectId) }).ToList().ForEach(x =>
     {
         tableHeader.Rows.Add(
             x.Header.Id,
             x.Header.LogDate,
             x.Header.LemNum,
             x.Header.Description,
             (char)x.Header.LogStatus,
             GetEnumName(x.Header.SubmitStatus),
             x.Header.ProjectId,
             x.Header.ProjectId,
             x.Header.ApprovalComments,
             x.Header.EmailData != null,
             x.project?.CustomerCode,
             x.project?.CustomerName,
             x.project?.SiteLocation,
             StrEx.GetDateString(x.project?.StartDate),
             StrEx.GetDateString(x.project?.EstCompletionDate));
     });
     tableHeader.AcceptChanges();
 }