Beispiel #1
0
        private void GetBojData()
        {
            this.isinfo = DbfTable.GetIsinfo(this.main_form.selected_comp);
            using (LocalDbEntities db = DBX.DataSet(this.main_form.selected_comp))
            {
                this.boj5_header = db.boj5_header.FirstOrDefault();
                if (this.boj5_header == null)
                {
                    db.boj5_header.Add(new boj5_header
                    {
                        accSource          = ACC_SOURCE.B.ToString(),
                        foreignShareholder = 0,
                        headerStatus       = "A",
                        meetingNo          = "",
                        meetingType        = MEETING_TYPE.B.ToString(),
                        parValue           = 0,
                        sourceDate         = null,
                        thaiShareholder    = 0,
                        totalCapital       = 0,
                        totalForeignShare  = 0,
                        totalShare         = 0,
                        totalThaiShare     = 0,
                        userId             = "",
                        yearEnd            = null
                    });
                    db.SaveChanges();

                    this.boj5_header = db.boj5_header.First();
                }

                this.boj5_detail = db.boj5_detail.Include("boj5_person").OrderBy(d => d.itemNo).ToList();
            }
        }
Beispiel #2
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     if (XMessageBox.Show("ยกเลิกการแก้ไขข้อมูล, ทำต่อหรือไม่?", "", MessageBoxButtons.OKCancel, XMessageBoxIcon.Question) == DialogResult.OK)
     {
         this.tmp_boj5_header = null;
         this.GetBojData();
         this.FillForm(this.boj5_header, this.boj5_detail);
         this.ResetFormState(FORM_MODE.READ);
     }
 }
Beispiel #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.tmp_boj5_header == null)
            {
                return;
            }
            try
            {
                using (LocalDbEntities db = DBX.DataSet(this.main_form.selected_comp))
                {
                    var header_to_update = db.boj5_header.Find(1);
                    header_to_update.accSource          = this.tmp_boj5_header.accSource;
                    header_to_update.foreignShareholder = this.tmp_boj5_header.foreignShareholder;
                    header_to_update.headerStatus       = this.tmp_boj5_header.headerStatus;
                    header_to_update.meetingNo          = this.tmp_boj5_header.meetingNo;
                    header_to_update.meetingType        = this.tmp_boj5_header.meetingType;
                    header_to_update.parValue           = this.tmp_boj5_header.parValue;
                    header_to_update.sourceDate         = this.tmp_boj5_header.sourceDate;
                    header_to_update.thaiShareholder    = this.tmp_boj5_header.thaiShareholder;
                    header_to_update.totalCapital       = this.tmp_boj5_header.totalCapital;
                    header_to_update.totalForeignShare  = this.tmp_boj5_header.totalForeignShare;
                    header_to_update.totalShare         = this.tmp_boj5_header.totalShare;
                    header_to_update.totalThaiShare     = this.tmp_boj5_header.totalThaiShare;
                    header_to_update.userId             = this.tmp_boj5_header.userId;
                    header_to_update.yearEnd            = this.tmp_boj5_header.yearEnd;

                    db.SaveChanges();
                }

                this.tmp_boj5_header = null;
                this.ResetFormState(FORM_MODE.READ);
                this.GetBojData();
                this.FillForm(this.boj5_header, this.boj5_detail);
            }
            catch (Exception ex)
            {
                XMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, XMessageBoxIcon.Error);
            }
        }
Beispiel #4
0
        private void FillForm(boj5_header boj5_header_to_fill, List <boj5_detail> boj5_detail_to_fill)
        {
            if (this.isinfo != null)
            {
                this.cCompNam._Text = this.isinfo.thinam;
                this.cTaxId._Text   = this.isinfo.taxid;
            }

            if (boj5_header_to_fill != null)
            {
                var selected_accsource = this.cAccSource._Items.Cast <XDropdownListItem>().Where(i => (string)i.Value == boj5_header_to_fill.accSource).FirstOrDefault();
                if (selected_accsource != null)
                {
                    this.cAccSource._SelectedItem = selected_accsource;
                }

                this.cSourceDate._SelectedDate  = boj5_header_to_fill.sourceDate;
                this.cYearEnd._SelectedDate     = boj5_header_to_fill.yearEnd;
                this.cTotalCapital._Value       = Convert.ToDecimal(boj5_header_to_fill.totalCapital);
                this.cTotalShare._Value         = Convert.ToDecimal(boj5_header_to_fill.totalShare);
                this.cParValue._Value           = Convert.ToDecimal(boj5_header_to_fill.parValue);
                this.cThaiShareHolder._Value    = Convert.ToDecimal(boj5_header_to_fill.thaiShareholder);
                this.cTotalThaiShare._Value     = Convert.ToDecimal(boj5_header_to_fill.totalThaiShare);
                this.cForeignShareHolder._Value = Convert.ToDecimal(boj5_header_to_fill.foreignShareholder);
                this.cTotalForeignShare._Value  = Convert.ToDecimal(boj5_header_to_fill.totalForeignShare);
                this.cMeetingTypeE.Checked      = boj5_header_to_fill.meetingType == MEETING_TYPE.E.ToString() ? true : false;
                this.cMeetingTypeC.Checked      = boj5_header_to_fill.meetingType == MEETING_TYPE.C.ToString() ? true : false;
                this.cMeetingTypeS.Checked      = boj5_header_to_fill.meetingType == MEETING_TYPE.S.ToString() ? true : false;
                this.cMeetingNo._Text           = boj5_header_to_fill.meetingNo;
            }

            if (boj5_detail_to_fill != null)
            {
                this.boj5_detail_bindinglist = new BindingList <boj5_detail_VM>(this.boj5_detail.ToViewModel());
                this.dgv.DataSource          = this.boj5_detail_bindinglist;
            }
        }
Beispiel #5
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            using (LocalDbEntities db = DBX.DataSet(this.main_form.selected_comp))
            {
                this.tmp_boj5_header = db.boj5_header.First();
                this.FillForm(this.tmp_boj5_header, this.boj5_detail);
            }

            this.ResetFormState(FORM_MODE.EDIT);
            this.cAccSource.Focus();

            //using (LocalDbEntities db = DBX.DataSet(this.main_form.selected_comp))
            //{
            //    db.glacc_match.Add(new glacc_match { accnum = "1234-56", depcod = "ขาย 2", taxodesc = "TAXO 1", taxodesc2 = "TAXO 2" });
            //    db.boj5_person.Add(new boj5_person { holderName = "วีรวัฒน์ ตรุเจตนารมย์", addrFull = "kanasiri" });
            //    db.boj5_person.Add(new boj5_person { holderName = "รฐา ตรุเจตนารมย์", addrFull = "kanasiri" });
            //    db.SaveChanges();
            //    var a = db.glacc_match.ToList();
            //    var b = db.boj5_detail.ToList();
            //    var c = db.boj5_header.ToList();
            //    var d = db.boj5_person.ToList();
            //    Console.WriteLine(" ==> ok");
            //}
        }