예제 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("ต้องการลบ การร้องขอนี้ ใช่หรือไม่", "ลบรายการ", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                try
                {
                    bool isSuccess = dcore.DeletePersonRequest(personShortDetailData.request.navyid, personShortDetailData.request.askby, personShortDetailData.request.unit);
                    if (isSuccess == true)
                    {
                        MessageBox.Show("ลบข้อมูลเรียบร้อย");

                        personShortDetailData = dcore.GetPersonRequestDetail(navyid);
                        InitialzeForm();
                        //cbbUnit.SelectedIndex = -1;
                        //cbbRequester1.SelectedIndex = -1;
                    }
                    else
                    {
                        //MessageBox.Show("พบข้อผิดพลาด ในการลบข้อมูล");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (dialogResult == DialogResult.No)
            {
                //do something else
            }
        }
예제 #2
0
        public void InitialValue(Navy.Core.PersonRequest personShortDetailData)
        {
            labelname.Text  = personShortDetailData.person.name;
            labelsname.Text = personShortDetailData.person.sname;
            labelid8.Text   = personShortDetailData.person.id8;

            labelstatuscode.Text = String.IsNullOrWhiteSpace(Function.GetTextOrNull(personShortDetailData.person.statuscode, "")) ? "" : "(" + personShortDetailData.person.statuscode + ") " + personShortDetailData.person.stitle;
            labelpostname.Text   = Function.GetTextOrNull(personShortDetailData.person.postname, "-");
            labelunit4.Text      = Function.GetTextOrNull(personShortDetailData.person.unit4, "-");
            labelitem.Text       = Function.GetTextOrNull(personShortDetailData.person.item, "-");

            labelpercent.Text = Function.GetTextOrNull(personShortDetailData.person.percent, "-");
            labeleducode.Text = Function.GetTextOrNull(personShortDetailData.person.educname, "-");

            labelskillcode.Text = Function.GetTextOrNull(personShortDetailData.person.skill, "-");
            labelcompany.Text   = Function.GetTextOrNull(personShortDetailData.person.company, "-");;
            labelbatt.Text      = Function.GetTextOrNull(personShortDetailData.person.batt, "-");;
            labelplatoon.Text   = Function.GetTextOrNull(personShortDetailData.person.platoon, "-");;
            labelpseq.Text      = Function.GetTextOrNull(personShortDetailData.person.pseq, "-");;
            labelyearin.Text    = Function.GetTextOrNull(personShortDetailData.person.yearin, "-");;
            labeloldyearin.Text = Function.GetTextOrNull(personShortDetailData.person.oldyearin, "-");
            labelunit3.Text     = Function.GetTextOrNull(personShortDetailData.person.unitname, "-");;
            labelunit1.Text     = Function.GetTextOrNull(personShortDetailData.person.unit1, "-");
            labelunit2.Text     = Function.GetTextOrNull(personShortDetailData.person.unit2, "-");
        }
예제 #3
0
        private void EditNUM(string num)
        {
            PersonRequestEditNUMForm f = new PersonRequestEditNUMForm(num);

            f.ShowDialog();

            if (f.submitValue)
            {
                Navy.Core.PersonRequest pr = new Navy.Core.PersonRequest();
                pr.person.navyid  = gvResult.SelectedRows[0].Cells["navyid"].Value.ToString();
                pr.person.yearin  = gvResult.SelectedRows[0].Cells["yearin"].Value.ToString();
                pr.person.name    = gvResult.SelectedRows[0].Cells["name"].Value.ToString();
                pr.person.sname   = gvResult.SelectedRows[0].Cells["sname"].Value.ToString();
                pr.person.id8     = gvResult.SelectedRows[0].Cells["id8"].Value.ToString();
                pr.request.navyid = gvResult.SelectedRows[0].Cells["navyid"].Value.ToString(); //for edit mode

                ParamPersonRequest param = new ParamPersonRequest();
                param.navyid      = gvResult.SelectedRows[0].Cells["navyid"].Value.ToString();
                param.unit        = gvResult.SelectedRows[0].Cells["unit"].Value.ToString();
                param.askby       = gvResult.SelectedRows[0].Cells["askby"].Value.ToString();
                param.num         = num;
                param.remark      = gvResult.SelectedRows[0].Cells["remark"].Value.ToString();
                param.remark2     = gvResult.SelectedRows[0].Cells["remark2"].Value.ToString();
                param.flag        = "F";
                param.piority     = "0";
                param.username    = Environment.MachineName;
                param.updatecount = (Convert.ToInt16(gvResult.SelectedRows[0].Cells["updatecount"].Value) + 1);

                try
                {
                    bool isSuccess = dcore.UpdateRequest(pr, param);
                    if (isSuccess)
                    {
                        //Data.PersonRequestDataSet.PersonRequestDataTable listReq = dcore.GetRequestNUMHigher(param.askby, param.num);
                        //listReq = listReq.Select("").CopyToDataTable;

                        //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);
                }
            }
        }
예제 #4
0
        public PersonRequestForm(string navyid, string askby, string unit)
        {
            InitializeComponent();

            this.navyid           = navyid;
            personShortDetailData = dcore.GetPersonRequestDetail(navyid, askby, unit);
            InitialzeForm();
        }
예제 #5
0
 private void btnSubmit2_Click(object sender, EventArgs e)
 {
     try
     {
         bool isSuccess = dcore.UpdatePersonUnit3(personShortDetailData.person.navyid, DataControls.GetSelectedValueComboBoxToString(cbbUnit2));
         if (isSuccess == true)
         {
             MessageBox.Show("แก้ไขข้อมูลสำเร็จ");
             personShortDetailData = dcore.GetPersonRequestDetail(navyid);
             InitialzeForm();
             //this.Close();
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #6
0
 public PersonShortDetailView(Navy.Core.PersonRequest personShortDetailData)
 {
     InitializeComponent();
     InitialValue(personShortDetailData);
 }