Пример #1
0
        public override int Add()
        {
            if (dataGridView1.CurrentRow == null)
            {
                MessageBox.Show("请选择一条记录,再新增");
                return(0);
            }
            if (dataGridView1.CurrentRow.Cells["companyid"].Value == null)
            {
                return(0);
            }
            int companyid = 0;

            int.TryParse(dataGridView1.CurrentRow.Cells["companyid"].Value.ToString(), out companyid);

            _currentRowCompanyid = companyid;
            _currentcellname     = dataGridView1.CurrentCell.OwningColumn.Name;

            FormCallRecords form = new FormCallRecords(companyid, false);

            form.MenuCode          = "M111";
            form.RefreshDataEvent += form_RefreshDataEvent;
            form.ShowDialog();
            //Query();
            return(base.Add());
        }
Пример #2
0
        void form_RefreshDataEvent(object sender, EventArgs e)
        {
            //Query();

            try
            {
                FormCallRecords formCallRecord           = (FormCallRecords)sender;
                FishEntity.CallRecordsEntity callRecords = formCallRecord.GetCallRecordsEntity;
                if (callRecords == null)
                {
                    return;
                }
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    int companyid = 0;
                    int.TryParse(row.Cells["companyid"].Value.ToString(), out companyid);
                    if (companyid == _currentRowCompanyid)
                    {
                        dataGridView1.CurrentCell = row.Cells[_currentcellname];
                        String temp = "";
                        if (dataGridView1.Rows[row.Index].Cells["linkcontent"].Value != null)
                        {
                            temp = dataGridView1.Rows[row.Index].Cells["linkcontent"].Value.ToString();
                        }
                        String nextlinkdate = callRecords.nextdate.Value.ToString("MM.dd");

                        dataGridView1.Rows[row.Index].Cells["maxnextdate"].Value = nextlinkdate;

                        dataGridView1.Rows[row.Index].Cells["linkcontent"].Value = nextlinkdate + " " + callRecords.communicatecontent + temp;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
                //MessageBox.Show(ex.Message);
            }
        }