public StoreInPlan(SessionInfo _session = null, StoreInPlanHead model = null) { InitializeComponent(); this._repo = new StoreInPlanRepo(); this._repoIn = new StoreInRepo(); this._repoCurr = new CurrenciesRepo(); this._repoSupplier = new SupplierRepo(); this._repoBT = new BussinessTypeRepo(); this._repoMaker = new MakerRepo(); this._repoMill = new MillRepo(); this._repoCmdt = new Commodity(); this._repoSpec = new SpecRepo(); this._repoCoating = new CoatingRepo(); this._repoWhse = new WharehouseRepo(); this._repoPort = new ImportPortRepo(); this._repoCust = new CustomerRepo(); this._repoLookup = new LookupRepo(); this.SourceStr = ""; epiSession = _session; if (model == null || epiSession == null) { this.HeadContent = new StoreInPlanHead(); this.IMEXReviewFlag = false; } else { this.HeadContent = model; this.IMEXReviewFlag = true; } this.ModelClone = new StoreInPlanHead(); this.POTrans = new POLineModel(); }
public StoreInPlanDialog(int Status = 2, string TransType = "") { InitializeComponent(); this._repo = new StoreInPlanRepo(); this.HeadContent = new StoreInPlanDialogModel(); this.status = Status; this.Type = TransType; }
private void tlbSave_Click(object sender, EventArgs e) { bool error = false; //ถ้ายังไม่ทำรายการ Store In if (HeadContent.StoreInFlag == "0") { //ITAKU if (HeadContent.ImportFlag == 2) { if (!ValidateGridCell(ref dataGridView2)) { error = false; } else { error = true; } } //Import & Domestic else { if (!ValidateHeaderError()) { if (HeadContent.ImexConfirm == null) { HeadContent.ImexConfirm = "0"; } //ถ้าเป็นการ Review ของ IMEX if (IMEXReviewFlag) { if (HeadContent.ImexConfirm == "0" || HeadContent.ImexConfirm == "3") { if (chkConfirm.Checked) { if (MessageBox.Show("Are you sure to confirm.", "Question?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { HeadContent.ImexConfirm = "1"; } } else { if (MessageBox.Show("Are you sure to reject.", "Question?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { HeadContent.ImexConfirm = "2"; HeadContent.ImexRemark = txtIMEXRemark.Text; } } } HeadContent.UserGroup = "IMEX"; } //ไม่ใช่การ Review ของ IMEX หมายถึงผู้ทำรายการเป็นแผนกอื่นที่ไม่ใช่ IMEX else { //ถ้าสถานะ IMEX = Reject if (HeadContent.ImexConfirm == "2") { if (MessageBox.Show("Are you sure to reply to IMEX.", "Question?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //Set สถานะเป็น Sale reply to IMEX HeadContent.ImexConfirm = "3"; HeadContent.ImexRemark = txtIMEXRemark.Text + Environment.NewLine + "Sale Reply on Date: " + DateTime.Now.ToLongDateString() + " Time: " + DateTime.Now.ToLongTimeString(); } } HeadContent.UserGroup = "Sale"; } } else { error = true; } } if (!error) { HeadContent.CurrencyCode = cmdCurrencyCode.Text.Trim(); HeadContent = _repo.SaveHead(HeadContent, epiSession); UpdateArticleLine(); SetHeaderContent(HeadContent); } } }
private void StoreInPlan_Load(object sender, EventArgs e) { if (epiSession.SessionID == null) { Login frm = new Login(); frm.ShowDialog(); } else if (epiSession.SessionID == "x") { this.Close(); this.Dispose(); Environment.Exit(1); } else { this.Text = epiSession.PlantName; if (HeadContent.StoreInPlanId == 0) { HeadContent.InvoiceDate = DateTime.Now; HeadContent.ETADate = DateTime.Now; HeadContent.ETDDate = DateTime.Now; } else { txtStoreInPlanNum.Text = HeadContent.StoreInPlanNum; SetHeaderContent(HeadContent); } ModelClone = (StoreInPlanHead)HeadContent.Clone(); LockHeaderControl(); return; } StoreInPlan_Load(sender, e); }
private void GetNew(int ImportFlag) { //tabControl1.TabPages.Remove(tabPage1); //tabControl1.TabPages.Remove(tabPage2); HeadContent = new StoreInPlanHead(); HeadContent.InsertState = true; HeadContent.StoreInPlanId = 0; HeadContent.StoreInPlanNum = ""; HeadContent.InvoiceDate = DateTime.Now; HeadContent.ETADate = DateTime.Now; HeadContent.ETDDate = DateTime.Now; HeadContent.StoreInFlag = "0"; HeadContent.CurrenciesList = _repoCurr.GetAll(); HeadContent.PortList = this._repoPort.GetAll(); HeadContent.ImportFlag = ImportFlag; ModelClone = (StoreInPlanHead)HeadContent.Clone(); SetHeaderContent(HeadContent); }
private void tlbClear_Click(object sender, EventArgs e) { ClearHeaderContent(); ClearPOLineTrans(); dataGridView2.Rows.Clear(); dataGridView2.ReadOnly = true; txtFilePath.Clear(); cmdSheet.DataSource = null; this.HeadContent = new StoreInPlanHead(); this.ModelClone = new StoreInPlanHead(); HeadContent.StoreInFlag = null; HeadContent.InvoiceDate = DateTime.Now; HeadContent.ETADate = DateTime.Now; HeadContent.ETDDate = DateTime.Now; ModelClone = (StoreInPlanHead)HeadContent.Clone(); LockHeaderControl(); }
private void SetHeaderContent(StoreInPlanHead model) { ClearHeaderContent(); txtStoreInPlanNum.DataBindings.Add("Text", model, "StoreInPlanNum", false, DataSourceUpdateMode.OnPropertyChanged); txtInvoiceNum.DataBindings.Add("Text", model, "InvoiceNum", false, DataSourceUpdateMode.OnPropertyChanged); txtSupplierCode.DataBindings.Add("Text", model, "SupplierCode", false, DataSourceUpdateMode.OnPropertyChanged); txtSupplierName.DataBindings.Add("Text", model, "SupplierName", false, DataSourceUpdateMode.OnPropertyChanged); txtCustID.DataBindings.Add("Text", model, "CustID", false, DataSourceUpdateMode.OnPropertyChanged); txtCustomerName.DataBindings.Add("Text", model, "CustomerName", false, DataSourceUpdateMode.OnPropertyChanged); txtMakerCode.DataBindings.Add("Text", model, "MakerCode", false, DataSourceUpdateMode.OnPropertyChanged); txtMakerName.DataBindings.Add("Text", model, "MakerName", false, DataSourceUpdateMode.OnPropertyChanged); txtMillCode.DataBindings.Add("Text", model, "MillCode", false, DataSourceUpdateMode.OnPropertyChanged); txtMillName.DataBindings.Add("Text", model, "MillName", false, DataSourceUpdateMode.OnPropertyChanged); txtBussinessType.DataBindings.Add("Text", model, "BussinessType", false, DataSourceUpdateMode.OnPropertyChanged); txtBussinessTypeName.DataBindings.Add("Text", model, "BussinessTypeName", false, DataSourceUpdateMode.OnPropertyChanged); txtVessel.DataBindings.Add("Text", model, "Vessel", false, DataSourceUpdateMode.OnPropertyChanged); txtExchangeRate.DataBindings.Add("Text", model, "ExchangeRate", true, DataSourceUpdateMode.OnPropertyChanged, 1, "#,##0.000000"); txtIMEXRemark.DataBindings.Add("Text", model, "ImexRemark", false, DataSourceUpdateMode.OnPropertyChanged); dtpETADate.Value = model.ETADate; dtpETDDate.Value = model.ETDDate; dtpInvoiceDate.Value = model.InvoiceDate; cmdCurrencyCode.DataSource = model.CurrenciesList.ToList(); cmdCurrencyCode.DisplayMember = "CurrencyCode"; cmdCurrencyCode.DataBindings.Add("Text", model, "CurrencyCode"); cmbLoadPort.DataSource = model.PortList.ToList(); cmbLoadPort.DisplayMember = "PortCode"; cmbLoadPort.DataBindings.Add("Text", model, "LoadPort", false, DataSourceUpdateMode.OnPropertyChanged); cmbArivePort.DataSource = model.PortList.ToList(); cmbArivePort.DisplayMember = "PortCode"; cmbArivePort.DataBindings.Add("Text", model, "ArivePort", false, DataSourceUpdateMode.OnPropertyChanged); actionToolStripMenuItem.Visible = false; if (model.ImportFlag == 0) { tabControl1.SelectedIndex = 0; tabControl1.TabPages[0].Text = "Import"; dataGridView2.ReadOnly = true; } else if (model.ImportFlag == 1) { tabControl1.SelectedIndex = 0; tabControl1.TabPages[0].Text = "Domestic"; actionToolStripMenuItem.Visible = true; dataGridView2.ReadOnly = true; } else { actionToolStripMenuItem.Visible = true; tabControl1.SelectedIndex = 1; dataGridView2.ReadOnly = false; } dgvList.Rows.Clear(); dataGridView1.Rows.Clear(); if (model.InsertState) { UnLockHeaderControl(); } else { if (HeadContent.StoreInFlag == "1" || HeadContent.ImexConfirm == "1") { LockHeaderControl(); if (HeadContent.StoreInFlag == "1") { butArticleDetail.Enabled = false; toolStripButton1.Visible = false; } } else// if (IMEXReviewFlag == true) { UnLockHeaderControl(); butArticleDetail.Enabled = true; toolStripButton1.Visible = true; butSupplier.Enabled = false; txtSupplierCode.ReadOnly = true; butMaker.Enabled = false; txtMakerCode.ReadOnly = true; butMill.Enabled = false; txtMillCode.ReadOnly = true; if (model.ImportFlag == 0 && HeadContent.ImexConfirm == "2") { panel4.Visible = true; txtIMEXRemark.ReadOnly = true; } } if (model.ImexConfirm == "1") { chkConfirm.Checked = true; } else { chkConfirm.Checked = false; } IEnumerable<StoreInPlanDetail> result = new List<StoreInPlanDetail>(); if (model.ImportFlag == 2) { //if (!string.IsNullOrEmpty(HeadContent.StoreInPlanNum)) //{ result = _repo.GetDetailArticleITAKU(HeadContent.StoreInPlanId); SetItakuDetail(result); //} } else { result = _repo.GetDetail(HeadContent.StoreInPlanId); SetDetail(result); if (dgvList.Rows.Count >= 1) { IEnumerable<StoreInPlanDetail> resultArtcle = this._repo.GetDetailArticle(this.HeadContent.StoreInPlanId, Convert.ToInt32(this.dgvList.Rows[0].Cells[2].Value.ToString())); SetDetailArticle(resultArtcle); } } } if (!HeadContent.InsertState) { butChooseFile.Enabled = false; } else { butChooseFile.Enabled = true; } if (IMEXReviewFlag == true) { toolStripDropDownButton1.Enabled = false; mnuNew.Enabled = false; mnuEditClear.Enabled = false; actionToolStripMenuItem.Enabled = false; toolStripButton1.Enabled = false; tlbClear.Enabled = false; panel4.Visible = true; txtIMEXRemark.ReadOnly = false; butArticleDetail.Enabled = false; } txtNumberOfArticle.DataBindings.Add("Text", model, "NumberOfRcv", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0"); }
private void txtStoreInPlanNum_Leave(object sender, EventArgs e) { string code = txtStoreInPlanNum.Text.Trim(); if (code != ModelClone.StoreInPlanNum && txtStoreInPlanNum.Text != "") { var result = _repo.GetByID(code); if (result == null) { button1_Click(sender, e); } else { HeadContent = result; ModelClone = (StoreInPlanHead)HeadContent.Clone(); } //SetHeaderContent(HeadContent); } }
private void button1_Click(object sender, EventArgs e) { using (StoreInPlanDialog frm = new StoreInPlanDialog()) { frm.ShowDialog(); if (frm.HeadContent.StoreInPlanNum != null) { HeadContent = frm.HeadContent; ModelClone = (StoreInPlanHead)HeadContent.Clone(); } } txtStoreInPlanNum.Text = HeadContent.StoreInPlanNum; SetHeaderContent(HeadContent); }
private void dgvList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { HeadContent = _repo.GetByID(dgvList.Rows[e.RowIndex].Cells[1].Value.ToString()); this.Close(); }
public ImexConfirmCheckList(SessionInfo _session = null, StoreInPlanHead model = null) { InitializeComponent(); this._repo = new StoreInPlanRepo(); epiSession = _session; }