Ejemplo n.º 1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            string chkControl = CheckRequireField();

            if (chkControl != "")
            {
                MessageBox.Show("กรุณาใส่ข้อมูล (" + chkControl + ")");
            }
            else
            {
                UpdateValue();
                if (CheckNUMDuplicate())
                {
                    //if (DialogResult.Yes == MessageBox.Show("การดำเนินการนี้จะแทรกชื่อ ["+ personShortDetailData .person.name + " "+personShortDetailData.person.sname+ "] ไปยังลำดับ ["+param.num+"] และส่งผลให้ชื่อที่มีอยู่ก่อนเลื่อนลงไปแทนที่ลำดับถัดไปจนถึงคนสุดท้าย. ยืนยันการแทรกลำดับนี้หรือไม่?", "การแทรกลำดับ", MessageBoxButtons.YesNo))
                    if (DialogResult.Yes == MessageBox.Show("การดำเนินการนี้จะแทรกชื่อ [" + personShortDetailData.person.name + " " + personShortDetailData.person.sname + "] ไปยังลำดับ [" + param.num + "] ยืนยันการแทรกลำดับนี้หรือไม่?", "การแทรกลำดับ", MessageBoxButtons.YesNo))
                    {
                        try
                        {
                            bool isSuccess = dcore.UpdateRequest(personShortDetailData, param);
                            if (isSuccess)
                            {
                                Data.PersonRequestDataSet.PersonRequestDataTable listReq = dcore.GetRequestNUMHigher(param.askby, param.num);
                                isSuccess = dcore.ReOrderNUMRequest(listReq, param);
                                if (isSuccess)
                                {
                                    MessageBox.Show("แก้ไขข้อมูลสำเร็จ");
                                    this.Close();
                                }
                                else
                                {
                                    MessageBox.Show("พบข้อผิดพลาดในการแก้ไขข้อมูล การแทรกลำดับ");
                                }
                            }
                            else
                            {
                                MessageBox.Show("แก้ไขข้อมูลสำเร็จ");
                                this.Close();
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
                else
                {
                    try
                    {
                        bool isSuccess = dcore.UpdateRequest(personShortDetailData, param);
                        if (isSuccess)
                        {
                            MessageBox.Show("แก้ไขข้อมูลสำเร็จ");
                            this.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }