示例#1
0
        private void DeleteProject()
        {
            DataGridViewSelectedRowCollection dvrc = dgv_projects.SelectedRows;

            foreach (DataGridViewRow dvr in dvrc)
            {
                int     id  = (int)dvr.Cells[0].Value;
                Project pro = ProjectManager.Load(id);
                if (pro == null)
                {
                    GlobalTool.LogError("ProjectManageForm.mi_delete_Click", "删除工程出现错误,请检查您的网络连接,或者向管理员寻求帮助!", true);
                    continue;
                }
                else
                {
                    if (pro.OwnerId != User.CurrentUser.Id)
                    {
                        MessageBox.Show("该工程不为您所有,您无法删除", "警告", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else
                    {
                        bool res = ProjectManager.Delete(id);
                        if (!res)
                        {
                            GlobalTool.LogError("ProjectManageForm.ProjectManager.Delete", "删除工程出现错误,请检查您的网络连接,或者向管理员寻求帮助!", true);
                        }
                    }
                }
            }
            RefreshData();
        }
示例#2
0
 public void RefreshData()
 {
     dt = ProjectManager.Search(tb_keyword.Text);
     if (dt == null)
     {
         GlobalTool.LogError("ProjectLoadForm.RefreshData", "检索工程数据出现错误,请检查您的网络连接,或者向管理员寻求帮助!", true);
         return;
     }
     dt.Columns["id"].ColumnName     = "编号";
     dt.Columns["name"].ColumnName   = "名称";
     dt.Columns["owner"].ColumnName  = "所有者";
     dt.Columns["mode_"].ColumnName  = "计算类型";
     dt.Columns["type_"].ColumnName  = "几何类型";
     dt.Columns["share"].ColumnName  = "共享";
     dt.Columns["remark"].ColumnName = "备注";
     dt.Columns["time_"].ColumnName  = "时间";
     RefreshDataView();
 }
示例#3
0
 private void LoadProject()
 {
     if (LoadEvent != null)
     {
         DataGridViewSelectedRowCollection dvrc = dgv_projects.SelectedRows;
         DataGridViewRow dvr = dvrc[0];
         int             id  = (int)dvr.Cells[0].Value;
         Project         pro = ProjectManager.Load(id);
         if (pro == null)
         {
             GlobalTool.LogError("ProjectManageForm.mi_load_Click", "读取工程出现错误,请检查您的网络连接,或者向管理员寻求帮助!", true);
             return;
         }
         else
         {
             LoadEvent(pro);
         }
     }
 }