예제 #1
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            //��ȡ�������
            PW_tb3b obj = FocusedObject;
            if (obj == null)
            {
                return;
            }

            //���������һ������
            PW_tb3b objCopy = new PW_tb3b();
            DataConverter.CopyTo<PW_tb3b>(obj, objCopy);

            //ִ���޸IJ���
            using (FrmPW3bDialog dlg = new FrmPW3bDialog())
            {
                dlg.Object = objCopy;   //�󶨸���
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //�ø������½������
            DataConverter.CopyTo<PW_tb3b>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }
예제 #2
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            PW_tb3b obj = new PW_tb3b();
            obj.UID = Guid.NewGuid().ToString();
            obj.col7 = type;

            //ִ����Ӳ���
            using (FrmPW3bDialog dlg = new FrmPW3bDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //���¶�����뵽������
            ObjectList.Add(obj);

            //ˢ�±�񣬲��������ж�λ���¶����ϡ�
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
예제 #3
0
        /// <summary>
        /// ˢ�±���е�����
        /// </summary>
        /// <returns>ture:�ɹ�  false:ʧ��</returns>
        public bool RefreshData()
        {
            try
            {

                this.gridView.GroupPanelText = "��·���߽��������";
                PW_tb3b p = new PW_tb3b();
                p.col7 = type;
                IList<PW_tb3b> list = Services.BaseService.GetList<PW_tb3b>("SelectPW_tb3bListbyCol7", p);
                this.gridControl.DataSource = list;
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return false;
            }

            return true;
        }
예제 #4
0
        private void InsertInfo()
        {
            string columnname = "";

            try
            {
                DataTable dts = new DataTable();
                OpenFileDialog op = new OpenFileDialog();
                op.Filter = "Excel�ļ�(*.xls)|*.xls";
                if (op.ShowDialog() == DialogResult.OK)
                {
                    dts = GetExcel(op.FileName);
                    IList<PW_tb3b> lii = new List<PW_tb3b>();
                    DateTime s8 = DateTime.Now;
                    for (int i = 0; i < dts.Rows.Count; i++)
                    {

                        PW_tb3b l1 = new PW_tb3b();
                        foreach (DataColumn dc in dts.Columns)
                        {
                            columnname = dc.ColumnName;
                            //if (dts.Rows[i][dc.ColumnName].ToString() == "")
                            //    continue;
                            l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, dts.Rows[i][dc.ColumnName].ToString(), null);

                        }
                        lii.Add(l1);
                    }

                    foreach (PW_tb3b lll in lii)
                    {

                        PW_tb3b l1 = new PW_tb3b();

                        IList<PW_tb3b> list = new List<PW_tb3b>();

                        //{
                        lll.UID = Guid.NewGuid().ToString();
                        lll.col7 = type;
                        Services.BaseService.Create<PW_tb3b>(lll);
                        //}
                    }
                    this.ctrlProject_Sum1.RefreshData();

                }
            }
            catch (Exception ex)
            {
                MsgBox.Show(columnname + ex.Message);
                MsgBox.Show("�����ʽ����ȷ��");

            }
        }