Exemple #1
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            if (this.data_path == null)
            {
                DialogCompanySelect comp = new DialogCompanySelect(this);
                if (comp.ShowDialog() == DialogResult.OK)
                {
                    this.data_path        = comp.selected_comp.RewriteDataPath();
                    this.lblDataPath.Text = DbfTable.GetIsinfo(this.data_path).thinam + " ( " + this.data_path.TrimEnd('\\') + " )";

                    this.LoadStatusComboboxItem();
                    this.cbStatus.SelectedItem = this.cbStatus.Items.Cast <ComboboxItem>().Where(i => ((TransactionStatus.STATUS)i.Value) == TransactionStatus.STATUS.WARRANTY).First();

                    this.iv_list          = new BindingList <ArtrnMin>(DbfTable.InvoiceList(this.data_path, this.status, DbfTable.INVOICE_TYPE.IV));
                    this.dgvIV.DataSource = this.iv_list;
                    this.tabIV.Text       = "  ขายเชื่อ (" + this.iv_list.Count.ToString() + ") <F6>  ";
                }
                else
                {
                    Application.Exit();
                }
            }
            else
            {
                this.lblDataPath.Text = DbfTable.GetIsinfo(this.data_path).thinam + " ( " + this.data_path.TrimEnd('\\') + " )";

                this.LoadStatusComboboxItem();
                this.cbStatus.SelectedItem = this.cbStatus.Items.Cast <ComboboxItem>().Where(i => ((TransactionStatus.STATUS)i.Value) == TransactionStatus.STATUS.WARRANTY).First();

                this.iv_list          = new BindingList <ArtrnMin>(DbfTable.InvoiceList(this.data_path, this.status, DbfTable.INVOICE_TYPE.IV));
                this.dgvIV.DataSource = this.iv_list;
                this.tabIV.Text       = "  ขายเชื่อ (" + this.iv_list.Count.ToString() + ") <F6>  ";
            }
        }
Exemple #2
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();
            }
        }
        private void DialogBojDetail_Load(object sender, EventArgs e)
        {
            this.isinfo = DbfTable.GetIsinfo(this.main_form.selected_comp);

            if (this.boj5_detail == null)
            {
                this.boj5_detail = new boj5_detail
                {
                    asPaidAmount   = 0,
                    boj5_person_id = -1,
                    itemNo         = -1,
                    paidAmount     = 0,
                    shareDocDate   = null,
                    shareDocId     = string.Empty,
                    shareNumber    = 0,
                    shareRegExist  = null,
                    shareRegOmit   = null,
                    shareType      = ((int)SHARE_TYPE.COMMON_SHARE).ToString(),
                    userId         = this.isinfo.taxid
                };
            }

            this.SetDropDownItem();
            this.LoadPersonToDatagrid();
            //using (LocalDbEntities db = DBX.DataSet(this.main_form.selected_comp))
            //{
            //    this.person_list = new BindingList<boj5_person_VM>(db.boj5_person.ToList().ToViewModel());
            //    this.person_list.ToList().ForEach(i =>
            //    {
            //        if(i.boj5_person.id == this.boj5_detail.boj5_person_id)
            //        {
            //            i.selected = true;
            //        }
            //    });
            //    this.dgvPerson.DataSource = this.person_list;
            //}

            this.FillForm();
        }