Esempio n. 1
0
 void SaveAssignments()
 {
     if (!_dirty || _currEmployeeId < 1)
     {
         return;
     }
     _dirty = false;
     for (int i = _data.Assignments.Count - 1; i >= 0; i--)
     {
         ViewRow row = _data.Assignments.Rows[i];
         if ((int)row["EmployeeID"] == _currEmployeeId)
         {
             row.Delete();
         }
     }
     foreach (ProductTreeNode productNode in treeViewFeatures.Nodes)
     {
         foreach (FeatureTreeNode featureNode in productNode.Nodes)
         {
             if (featureNode.Checked)
             {
                 ViewRow newRow = _data.Assignments.Rows.CreateRow();
                 newRow["EmployeeID"] = _currEmployeeId;
                 newRow["ProductID"]  = productNode.ProductID;
                 newRow["FeatureID"]  = featureNode.FeatureID;
                 newRow.EndEdit();
             }
         }
     }
 }
Esempio n. 2
0
        private void comboBoxCity_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Display the customers of the selected city.
            ViewRow row = comboBoxCity.SelectedItem as ViewRow;

            if (row != null)
            {
                listBoxCustomers.DisplayMember = "ContactName";
                listBoxCustomers.DataSource    = ((dynamic)row.Value).Customers;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取数据行数据
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="columns"></param>
        /// <param name="firstRow"></param>
        /// <param name="firstColumn"></param>
        /// <param name="fixRowCount"></param>
        /// <returns></returns>
        public List <ViewRow> ReadDataRowFromWorksheet(Worksheet sheet, List <ViewColumn> columns, int firstRow, int firstColumn, int fixRowCount)
        {
            columns = columns ?? new List <ViewColumn>();
            var rows = new List <ViewRow>();

            for (int i = 0; i <= sheet.Cells.MaxDataRow; i++)
            {
                if (i >= firstRow - 1)
                {
                    ViewRow row = new ViewRow();
                    row.cells = new List <ViewCell>();
                    for (int j = 0; j <= sheet.Cells.MaxDataColumn; j++)
                    {
                        if (j >= firstColumn - 1)
                        {
                            var cel = sheet.Cells[i, j];
                            if (cel.IsMerged)
                            {
                                goto BREAKLOOP;
                            }
                            ViewCell cell = new ViewCell();
                            cell.content = cel.StringValue;
                            row.cells.Add(cell);
                        }
                    }
                    if (!row.cells.Any(x => !string.IsNullOrEmpty(x.content)))
                    {
                        goto BREAKLOOP;
                    }
                    rows.Add(row);
                }
                continue;
BREAKLOOP:
                break;
            }
            if (rows.Count < fixRowCount)
            {
                var newRowCount = fixRowCount - rows.Count;
                for (int i = 0; i < newRowCount; i++)
                {
                    ViewRow row = new ViewRow();
                    row.cells = new List <ViewCell>();
                    for (int j = 0; j < columns.Count; j++)
                    {
                        var cell = new ViewCell();
                        cell.content = "";
                        row.cells.Add(cell);
                    }
                    rows.Add(row);
                }
            }
            return(rows);
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ViewRow newRow = _data.Issues.Rows.CreateRow();

            newRow["IssueID"]     = Int32.Parse(txtIssueID.Text);
            newRow["ProductID"]   = (int)comboProduct.SelectedValue;
            newRow["FeatureID"]   = (int)comboFeature.SelectedValue;
            newRow["Description"] = txtDescription.Text;
            newRow["AssignedTo"]  = (int)comboAssignedTo.SelectedValue;
            newRow["Fixed"]       = false;
            newRow.EndEdit();
            Close();
        }
Esempio n. 5
0
        private void buttonReassign_Click(object sender, EventArgs e)
        {
            ViewRow row = issuesBindingSource.Current as ViewRow;

            if (row == null)
            {
                return;
            }
            Issue issue = row.Value as Issue;

            if (issue == null)
            {
                return;
            }
            issue.I.AssignedTo = comboReassign.SelectedIndex;
        }
Esempio n. 6
0
        private void buttonAssign_Click(object sender, EventArgs e)
        {
            string msg = string.Empty;

            foreach (IssueAssignment ia in _issuesToAssign.ToList())
            {
                ViewRow issueRow = _data.FindIssueByID(ia.IssueID);
                issueRow["AssignedTo"] = ia.EmployeeID;
                issueRow.EndEdit();
                msg += "\nto " + ia.EmployeeName + " issue #" + ia.IssueID;
            }
            if (msg.Length == 0)
            {
                msg = "\nNone";
            }
            msg = "Assigned issues:" + msg;
            MessageBox.Show(msg, "Assigned issues");
        }
        private void buttonReassign_Click(object sender, EventArgs e)
        {
            ViewRow row = issuesBindingSource.Current as ViewRow;

            if (row == null)
            {
                return;
            }
            IssueInfo issue = row.Value as IssueInfo;

            if (issue == null)
            {
                return;
            }
            IssueItem xIssue = _data.FindIssueByID(issue.IssueID);

            xIssue.AssignedTo = comboReassign.SelectedIndex;
        }
Esempio n. 8
0
 public ViewRowChangeEvent(ViewRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
        private double GetSecondsLeft(ViewRow <Dictionary <string, object> > viewRow)
        {
            var expiration = (long)viewRow.Value["expiration"];

            return(UnixTimestampToSecondsLeft(expiration));
        }