示例#1
0
        private void B_ok_Click(object sender, EventArgs e)
        {
            if (!SaveCheck())
            {
                return;                //数据合法性校验!!!
            }
            if (action.Equals("add"))
            {
                ac01.ac001 = Tools.GetEntityPK("AC01");
                ac01.ac100 = Envior.cur_userId;                 //经办人
                ac01.ac200 = DateTime.Now;                      //经办日期
            }


            ac01.ac002 = rg_ac002.EditValue.ToString();     //性别
            ac01.ac003 = txtEdit_ac003.Text;                //逝者姓名
            ac01.ac004 = int.Parse(txtEdit_ac004.Text);     //年龄
            ac01.ac005 = lookUp_ac005.EditValue.ToString(); //死亡原因
            ac01.ac014 = txtedit_ac014.Text;                //身份证号
            ac01.ac007 = lookUp_ac007.EditValue.ToString(); //籍贯-所属区县
            ac01.ac008 = txtEdit_ac008.Text;                //籍贯-详细地址
            ac01.ac006 = lookup_ash.EditValue.ToString();   //骨灰处理方式
            ac01.ac070 = lookup_ac070.EditValue.ToString();

            if (dateEdit_ac010.EditValue != null)
            {
                ac01.ac010 = DateTime.Parse(dateEdit_ac010.EditValue.ToString()); //死亡时间
            }
            ac01.ac009 = txtEdit_ac009.Text;                                      //接灵地址

            ac01.ac020 = DateTime.Parse(dateEdit_ac020.EditValue.ToString());     //到达中心时间

            ac01.ac050 = txtEdit_ac050.Text;                                      //联系人
            ac01.ac051 = txtEdit_ac051.Text;                                      //联系电话

            if (!(lookUp_ac052.EditValue == null || lookUp_ac052.EditValue is System.DBNull))
            {
                ac01.ac052 = lookUp_ac052.EditValue.ToString(); //与逝者关系
            }

            ac01.ac055 = txtEdit_ac055.Text;                //联系地址

            if (lookUp_ac060.EditValue != null)
            {
                ac01.ac060 = lookUp_ac060.EditValue.ToString(); //灵车司机
            }
            ac01.ac110  = Envior.cur_userId;                    //最后经办人
            ac01.ac220  = DateTime.Now;                         //最后经办日期
            ac01.ac099  = mem_ac099.Text;                       //备注
            ac01.status = "1";                                  //当前状态

            if (action.Equals("add"))
            {
                if (lookup_ash.EditValue.ToString() != "2" /*骨灰寄存:放弃*/)
                {
                    ac01.ac080        = FireAction.GenFireOrder(lookup_ac070.EditValue.ToString());
                    label_forder.Text = ac01.ac080.ToString();
                }
            }


            try
            {
                string s_tip = "保存成功!";
                if (action.Equals("add"))
                {
                    ac01_dao.Insert(ac01);
                    if (ac01.ac080 != null)
                    {
                        s_tip = s_tip + "\r\n" + "火化序号:" + ac01.ac080.ToString();
                    }
                }
                else
                {
                    ac01_dao.Update(ac01);
                }

                MessageBox.Show(s_tip, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (action.Equals("add"))
                {
                    if (MessageBox.Show("现在打印【火化登记单】吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        PrtServAction.Print_CheckinNotice(ac01.ac001, this.Handle.ToInt32());
                    }
                }

                if (businessObject != null)
                {
                    businessObject.swapdata["AC001"] = ac01.ac001;
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ee)
            {
                MessageBox.Show("保存数据失败!\n" + ee.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }