예제 #1
0
파일: UcAjgl.cs 프로젝트: mydre/qz2
        private void button3_Click(object sender, EventArgs e)
        {
            AppConfig app = AppConfig.getAppConfig();


            if (app.caseId_selected_row == -1)
            {
                MessageBox.Show("请选择需要编辑的案件", "提示");
                return;
            }
            else if (app.already_working == false)
            {
                DialogResult dr = MessageBox.Show("是否要编辑编号为" + app.caseId_selected_row + "的案件", "提示", MessageBoxButtons.OKCancel);

                if (dr == DialogResult.OK)
                {
                    app.caseId_selected_working = app.caseId_selected_row;
                    app.already_working         = true;
                }
                else if (dr == DialogResult.Cancel)
                {
                    app.caseId_selected_row = -1;
                    return;
                }
            }
            else
            {
                if (app.caseId_selected_row != app.caseId_selected_working)
                {
                    DialogResult dr = MessageBox.Show("你之前对编号为" + app.caseId_selected_working + "的案件编辑(未保存),是否确定要为编号为" + app.caseId_selected_row + "的案件进行编辑!", "提示", MessageBoxButtons.OKCancel);
                    if (dr == DialogResult.OK)
                    {
                        app.caseId_selected_working = app.caseId_selected_row;
                        AppContext.setInstanceNull();
                    }
                    else if (dr == DialogResult.Cancel)
                    {
                        app.caseId_selected_row = -1;
                        return;
                    }
                }
                app.caseId_selected_row = -1;

                FormGjglNewAj form = new FormGjglNewAj();
                form.ShowDialog();
            }
        }
예제 #2
0
        private void Button2_Click(object sender, EventArgs e)
        {
            //新建案件
            FormGjglNewAj form = new FormGjglNewAj();
            string        s    = form.ShowDialog().ToString();

            if (s == "Cancel")
            {
                return;
            }

            Case @case = form.Case;

            using (var context = new CaseContext())
            {
                context.Cases.Add(@case);
                context.SaveChanges();
                AppContext.CaseID = @case.CaseId;
            }
            Program.m_mainform.AddNewGjalAj();
            // MessageBox.Show("案件添加成功!");
        }