private void pmBlankFormData() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrRefTable, this.mstrRefTable, "select * from " + this.mstrRefTable + " where 0=1", ref strErrorMsg); this.mstrEditRowID = ""; this.txtCode.Text = ""; this.txtName.Text = ""; this.txtName2.Text = ""; this.txtName2.Text = ""; this.cmbType.SelectedIndex = 0; }
public static string GetProdCtrlStock(WS.Data.Agents.cDBMSAgent inSQLHelper, string inProd, string inCorpCtrl) { string strErrorMsg = ""; DataSet dtsDataEnv = new DataSet(); string strCtrlStk = inCorpCtrl; inSQLHelper.SetPara(new object[] { inProd }); if (inSQLHelper.SQLExec(ref dtsDataEnv, "QProd", "PROD", "select * from Prod where fcSkid = ?", ref strErrorMsg)) { string strType = dtsDataEnv.Tables["QProd"].Rows[0]["fcCtrlStoc"].ToString(); strCtrlStk = ("0 ".IndexOf(strType) > -1 ? inCorpCtrl : strType); } return(strCtrlStk); }
private void pmSetBrowView() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside); string strSQLExec = "select BRANCH.FCSKID, BRANCH.FCCODE, BRANCH.FCNAME from BRANCH where FCCORP = ? "; //strSQLExec = string.Format(strSQLExec, new string[] { this.mstrRefTable }); object[] pAPara = new object[] { App.gcCorp }; pobjSQLUtil.SetPara(pAPara); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrBrowViewAlias, this.mstrRefTable, strSQLExec, ref strErrorMsg); }
public void pmSeekVal(string inRowID, string inTabName, ref string ioCode, ref string ioName) { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside); pobjSQLUtil.SetPara(new object[1] { inRowID }); if (pobjSQLUtil.SQLExec(ref this.dtsDataEnv, "QSeekVal", inTabName, "select FCCODE,FCNAME from " + inTabName + " where fcSkid = ?", ref strErrorMsg)) { ioCode = this.dtsDataEnv.Tables["QSeekVal"].Rows[0]["fcCode"].ToString().TrimEnd(); ioName = this.dtsDataEnv.Tables["QSeekVal"].Rows[0]["fcName"].ToString().TrimEnd(); } }
/// <summary> /// Get step «×éÍÅèÒÊØ´¢Í§ serial ¹Õé /// </summary> /// <param name="inSQLHelper"></param> /// <param name="inPdSer"></param> /// <param name="inForRecalChkDelRefPdX3"></param> /// <returns></returns> public static string GetPdSerPStep(WS.Data.Agents.cDBMSAgent inSQLHelper, System.Data.IDbConnection inDbConn, System.Data.IDbTransaction inDbTran, string inPdSer, bool inForRecalChkDelRefPdX3) { string strErrorMsg = ""; string xdRefPInv = DocumentType.BI.ToString() + "," + DocumentType.BQ.ToString() + "," + DocumentType.BR.ToString() + "," + DocumentType.BU.ToString() + "," + DocumentType.BV + "," + DocumentType.BY.ToString() + ","; string xdRefPDrNote = DocumentType.BD.ToString() + "," + DocumentType.BX.ToString() + "," + DocumentType.BB.ToString() + "," + DocumentType.BZ.ToString() + ","; string xdRefPCrNote = DocumentType.BC.ToString() + "," + DocumentType.BA.ToString() + "," + DocumentType.BM.ToString() + "," + DocumentType.BN.ToString() + ","; string strRetPStep = BusinessEnum.gc_PDSER_PSTEP_FREE; DataSet dtsTem = new DataSet(); //inSQLHelper.SetPara(new object[] {inPdSer}); //if (inSQLHelper.SQLExec(ref dtsTem, "QRefPdX3", MapTable.Table.RefPdX3, "select * from "+MapTable.Table.RefPdX3+" where fcPdSer = ? " , ref strErrorMsg)) if (inSQLHelper.BatchSQLExec(ref dtsTem, "QRefPdX3", MapTable.Table.RefPdX3, "select * from " + MapTable.Table.RefPdX3 + " where fcPdSer = ? ", new object[] { inPdSer }, ref strErrorMsg, inDbConn, inDbTran)) { foreach (DataRow dtrRefPdX3 in dtsTem.Tables["QRefPdX3"].Rows) { if (inForRecalChkDelRefPdX3) { } else { int intCmp = -1; string strRefType = dtrRefPdX3["fcRefType"].ToString(); if (DocumentType.PO.ToString().IndexOf(strRefType) > -1) { //strRetPStep = max( strRetPStep , gc_PDSER_PSTEP_ORDER ); //strRetPStep = BusinessEnum.gc_PDSER_PSTEP_ORDER; intCmp = BusinessEnum.gc_PDSER_PSTEP_ORDER.CompareTo(strRetPStep); strRetPStep = (intCmp > -1 ? BusinessEnum.gc_PDSER_PSTEP_ORDER : strRetPStep); } else if ((xdRefPInv + xdRefPDrNote + DocumentType.TR.ToString() + ",").IndexOf(strRefType) > -1) { //strRetPStep = max( strRetPStep , gc_PDSER_PSTEP_INV ); //strRetPStep = BusinessEnum.gc_PDSER_PSTEP_INV; intCmp = BusinessEnum.gc_PDSER_PSTEP_INV.CompareTo(strRetPStep); strRetPStep = (intCmp > -1 ? BusinessEnum.gc_PDSER_PSTEP_INV : strRetPStep); } else if ((xdRefPCrNote).IndexOf(strRefType) > -1) { //strRetPStep = max( strRetPStep , gc_PDSER_PSTEP_RETURN ); //strRetPStep = BusinessEnum.gc_PDSER_PSTEP_RETURN; intCmp = BusinessEnum.gc_PDSER_PSTEP_RETURN.CompareTo(strRetPStep); strRetPStep = (intCmp > -1 ? BusinessEnum.gc_PDSER_PSTEP_RETURN : strRetPStep); } } } } return(strRetPStep); }
private void pmInitGridProp_TemOTHour() { System.Data.DataView dvBrow = this.dtsDataEnv.Tables[this.mstrTemOTHour].DefaultView; this.grdTemOTHour.DataSource = this.dtsDataEnv.Tables[this.mstrTemOTHour]; for (int intCnt = 0; intCnt < this.gridView3.Columns.Count; intCnt++) { this.gridView3.Columns[intCnt].Visible = false; } int i = 0; this.gridView3.Columns["nRecNo"].VisibleIndex = i++; //this.gridView3.Columns["cDay"].VisibleIndex = i++; this.gridView3.Columns["dBegTime"].VisibleIndex = i++; this.gridView3.Columns["dEndTime"].VisibleIndex = i++; this.gridView3.Columns["nTotHour"].VisibleIndex = i++; this.gridView3.Columns["nRecNo"].Caption = "No."; this.gridView3.Columns["dBegTime"].Caption = UIBase.GetAppUIText(new string[] { "ตั้งแต่", "Start" }); this.gridView3.Columns["dEndTime"].Caption = UIBase.GetAppUIText(new string[] { "ถึง", "End" }); this.gridView3.Columns["nTotHour"].Caption = UIBase.GetAppUIText(new string[] { "ชม.", "Hour" }); this.gridView3.Columns["nRecNo"].Width = 30; this.gridView3.Columns["dBegTime"].Width = 80; this.gridView3.Columns["dEndTime"].Width = 80; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); //this.gridView3.Columns["nRecNo"].AppearanceCell.Options. = DevExpress.Utils.HorzAlignment.Far; this.gridView3.Columns["nRecNo"].AppearanceCell.BackColor = System.Drawing.Color.WhiteSmoke; this.gridView3.Columns["nRecNo"].OptionsColumn.AllowFocus = false; this.gridView3.Columns["nRecNo"].OptionsColumn.ReadOnly = true; this.gridView3.Columns["nTotHour"].AppearanceCell.BackColor = System.Drawing.Color.WhiteSmoke; this.gridView3.Columns["nTotHour"].OptionsColumn.AllowFocus = false; this.gridView3.Columns["nTotHour"].OptionsColumn.ReadOnly = true; this.gridView3.Columns["nTotHour"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom; this.gridView3.Columns["nTotHour"].DisplayFormat.FormatString = "{0:#,###,##0.0;-#,###,##0.0; }"; this.gridView3.Columns["dBegTime"].ColumnEdit = this.grcBegTime; this.gridView3.Columns["dEndTime"].ColumnEdit = this.grcEndTime; this.gridView3.Columns["nTotHour"].SummaryItem.DisplayFormat = "{0:#,###,##0.0000;-#,###,##0.0000; }"; this.gridView3.Columns["nTotHour"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; //this.pmCalcColWidth(); }
private void pmBlankFormData() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrRefTable, this.mstrRefTable, "select * from " + this.mstrRefTable + " where 0=1", ref strErrorMsg); this.mstrEditRowID = ""; this.txtCode.Text = ""; this.txtDesc.Text = ""; this.chkIsActive.Checked = false; this.chkIsLock.Checked = false; this.txtYear.Value = DateTime.Now.Year + 543; }
private void pmDefaultBookCode() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside); string strSQLExec_Book = "select top 1 fcSkid, fcCode, fcName from Book where fcCorp = ? and fcBranch = ? and fcRefType = ? order by fcCode"; objSQLHelper.SetPara(new object[] { App.gcCorp, this.mstrBranch, this.mstrRefType }); if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QBook", "BOOK", strSQLExec_Book, ref strErrorMsg)) { this.txtQcBook.Tag = this.dtsDataEnv.Tables["QBook"].Rows[0]["fcSkid"].ToString(); this.txtQcBook.Text = this.dtsDataEnv.Tables["QBook"].Rows[0]["fcCode"].ToString().TrimEnd(); this.txtQnBook.Text = this.dtsDataEnv.Tables["QBook"].Rows[0]["fcName"].ToString().TrimEnd(); } }
private void pmBlankFormData() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrRefTable, this.mstrRefTable, "select * from " + this.mstrRefTable + " where 0=1", ref strErrorMsg); this.mstrEditRowID = ""; this.txtQcAppLogin.Tag = ""; this.txtQcAppLogin.Text = ""; this.txtQnEmpl.Text = ""; this.dtsDataEnv.Tables[this.mstrTemPd].Rows.Clear(); this.gridView2.FocusedColumn = this.gridView2.Columns["cQcSect"]; }
private void pmUpdateProcess_S2() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); string strSQLStr = "select * from Stock02 where cCorp = ? and cProd = ? and dDate = ?"; foreach (DataRow dtrSaleSum in this.dtsDataEnv.Tables[this.mstrTemPd2].Rows) { string strRowID = ""; bool bllIsNewRow = false; DataRow dtrSaveInfo = null; DateTime dttDate = Convert.ToDateTime(dtrSaleSum["dDate"]); objSQLHelper.SetPara(new object[] { App.gcCorp, dtrSaleSum["cProd"].ToString(), dttDate.Date }); if (!objSQLHelper.SQLExec(ref this.dtsDataEnv, this.mstrRefTable2, this.mstrRefTable2, strSQLStr, ref strErrorMsg)) { bllIsNewRow = true; WS.Data.Agents.cConn objConn = WS.Data.Agents.cConn.GetInStance(); strRowID = objConn.RunRowID(this.mstrRefTable2); dtrSaveInfo = this.dtsDataEnv.Tables[this.mstrRefTable2].NewRow(); dtrSaveInfo["cRowID"] = strRowID; } else { dtrSaveInfo = this.dtsDataEnv.Tables[this.mstrRefTable2].Rows[0]; } dtrSaveInfo["cCorp"] = App.gcCorp; dtrSaveInfo["dDate"] = dttDate; dtrSaveInfo["cYear"] = dtrSaleSum["cYear"].ToString(); dtrSaveInfo["cProd"] = dtrSaleSum["cProd"].ToString(); dtrSaveInfo["QcProd"] = dtrSaleSum["cQcProd"].ToString(); dtrSaveInfo["QnProd"] = dtrSaleSum["cQnProd"].ToString(); dtrSaveInfo["StdPrice"] = Convert.ToDecimal(dtrSaleSum["nStdPrice"]); dtrSaveInfo["Qty"] = Convert.ToDecimal(dtrSaleSum["nQty"]); dtrSaveInfo["Sale_Qty"] = Convert.ToDecimal(dtrSaleSum["nSaleQty"]); string strSQLUpdateStr = ""; object[] pAPara = null; cDBMSAgent.GenUpdateSQLString(dtrSaveInfo, "CROWID", bllIsNewRow, ref strSQLUpdateStr, ref pAPara); objSQLHelper.SetPara(pAPara); objSQLHelper.SQLExec(strSQLUpdateStr, ref strErrorMsg); } }
private void pmRetrievePopUpVal(string inPopupForm) { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = null; switch (inPopupForm.TrimEnd().ToUpper()) { case "CRGRP": if (this.pofrmGetCrGrp != null) { DataRow dtrCrGrp = this.pofrmGetCrGrp.RetrieveValue(); if (dtrCrGrp != null) { this.txtQcCrGrp.Tag = dtrCrGrp["fcSkid"].ToString(); this.txtQcCrGrp.Text = dtrCrGrp["fcCode"].ToString().TrimEnd(); this.txtQnCrGrp.Text = dtrCrGrp["fcName"].ToString().TrimEnd(); } else { this.txtQcCrGrp.Tag = ""; this.txtQcCrGrp.Text = ""; this.txtQnCrGrp.Text = ""; } } break; //case "ACCHART": // if (this.pofrmGetAcChart != null) // { // DataRow dtrAcChart = this.pofrmGetAcChart.RetrieveValue(); // if (dtrAcChart != null) // { // this.txtQcAcChart.Tag = dtrAcChart["fcSkid"].ToString(); // this.txtQcAcChart.Text = dtrAcChart["cCode"].ToString().TrimEnd(); // this.txtQnAcChart.Text = dtrAcChart["cName"].ToString().TrimEnd(); // } // else // { // this.txtQcAcChart.Tag = ""; // this.txtQcAcChart.Text = ""; // this.txtQnAcChart.Text = ""; // } // } // break; } }
private void pmSetBrowView() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); string strSQLExec = "select {0}.FCSKID, {0}.FCCODE, {0}.FCNAME from {0} "; strSQLExec += " where {0}.FCCORP = ? "; strSQLExec = string.Format(strSQLExec, new string[] { this.mstrRefTable }); //pobjSQLUtil.SetPara(pAPara); pobjSQLUtil.NotUpperSQLExecString = true; pobjSQLUtil.SetPara(new object[] { App.ActiveCorp.RowID }); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrBrowViewAlias, "PdCateg", strSQLExec, ref strErrorMsg); }
private void pmSetBrowView() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); string strSQLExec = "select EMSECT.FCSKID, EMSECT.FCCODE, EMSECT.FCNAME, EMSECT.FCNAME2, EMSECT.FTLASTUPD as FDCREATE, EMSECT.FTDATETIME as FDLASTUPDBY from {0} EMSECT "; //strSQLExec += " left join {1} EM1 ON EM1.fcSkid = EMSECT.CCREATEBY "; //strSQLExec += " left join {1} EM2 ON EM2.fcSkid = EMSECT.CLASTUPDBY "; strSQLExec += " where EMSECT.FCCORP = ? "; strSQLExec = string.Format(strSQLExec, new string[] { this.mstrRefTable }); pobjSQLUtil.SetPara(new object[] { App.ActiveCorp.RowID }); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrBrowViewAlias, "EMSECT", strSQLExec, ref strErrorMsg); }
private void pmSetMaxLength() { WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); this.txtCode.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QEMAcChartInfo.Field.Code); this.txtName.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QEMAcChartInfo.Field.Name); this.txtName2.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QEMAcChartInfo.Field.Name2); this.cmbGroup.Properties.Items.Clear(); this.cmbGroup.Properties.Items.AddRange(new object[] { "1 = สินทรัพย์ (Asset)", "2 = หนี้สิน (Liability)", "3 = ทุน (Capital)", "4 = รายได้ (Revenue)", "5 = ค่าใช้จ่าย (Expense)", "6 = ค่าใช้จ่ายการผลิต (Menu.Expense)" }); this.cmbGroup.SelectedIndex = 0; this.cmbCateg.Properties.Items.Clear(); this.cmbCateg.Properties.Items.AddRange(new object[] { "D = DETAIL", "G = GROUP" }); this.cmbCateg.SelectedIndex = 0; }
private void pmSetMaxLength() { WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); this.txtCode.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.Code); this.txtName.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.Name); this.txtAddr11.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.Addr1); this.txtAddr12.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.Addr2); this.txtName2.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.Name2); this.txtAddr21.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.Addr12); this.txtAddr22.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.Addr22); this.txtTel.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.TelNo); this.txtFax.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.FaxNo); this.txtHolder.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.HolderName); this.txtTradeNo.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QCorpInfo.Field.TradeNo); }
private void pmInitForm() { UIBase.WaitWind("Loading Form..."); this.pmInitializeComponent(); this.pmSetBrowView(); this.pmInitGridProp(); //this.gridView1.MoveLast(); WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside); this.mint_MAXLENGTH_CODE = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, "FCCODE"); this.mint_MAXLENGTH_NAME = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, "FCNAME"); UIBase.WaitClear(); }
private void pmSetBrowView() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); string strFMDBName = App.ConfigurationManager.ConnectionInfo.ERPDBMSName; string strEmplRTab = strFMDBName + ".dbo.EMPLR"; string strSQLExec = "select MASTER_PROD.CROWID,MASTER_PROD.CCODE, MASTER_PROD.CNAME,MASTER_PROD.CNAME2, MASTER_PROD.CTYPE from MASTER_PROD where CCORP = ? "; //strSQLExec = string.Format(strSQLExec, new string[] {App.gcCorp }); pobjSQLUtil.SetPara(new object[] { App.gcCorp }); //pobjSQLUtil.SetPara(pAPara); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrBrowViewAlias, "Master_Dept", strSQLExec, ref strErrorMsg); }
private void pmSetBrowView() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); string strSQLExec = "select BGBOOK.CROWID, BGBOOK.CCODE, BGBOOK.CNAME, BGBOOK.CNAME2, BGBOOK.DCREATE, BGBOOK.DLASTUPDBY, EM1.CLOGIN as CLOGIN_ADD, EM2.CLOGIN as CLOGIN_UPD from {0} BGBOOK "; strSQLExec += " left join {1} EM1 ON EM1.CROWID = BGBOOK.CCREATEBY "; strSQLExec += " left join {1} EM2 ON EM2.CROWID = BGBOOK.CLASTUPDBY "; strSQLExec += " where BGBOOK.CCORP = ? and CBRANCH = ? and CREFTYPE = ? "; strSQLExec = string.Format(strSQLExec, new string[] { this.mstrRefTable, "APPLOGIN" }); pobjSQLUtil.SetPara(new object[] { App.ActiveCorp.RowID, this.mstrBranch, this.mstrRefType }); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrBrowViewAlias, "BGBOOK", strSQLExec, ref strErrorMsg); }
private bool pmDeleteRow(string inRowID, string inCode, string inName, ref string ioErrorMsg) { bool bllIsCommit = false; bool bllResult = false; this.mSaveDBAgent = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); this.mSaveDBAgent.AppID = App.AppID; this.mdbConn = this.mSaveDBAgent.GetDBConnection(); try { this.mdbConn.Open(); this.mdbTran = this.mdbConn.BeginTransaction(IsolationLevel.ReadUncommitted); string strErrorMsg = ""; string strRefRowID = ""; object[] pAPara = new object[1] { inRowID }; this.mSaveDBAgent.BatchSQLExec("delete from " + this.mstrRefTable + " where fcSkid = ?", pAPara, ref strErrorMsg, this.mdbConn, this.mdbTran); this.mdbTran.Commit(); bllIsCommit = true; WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Delete, TASKNAME, inCode, inName, App.FMAppUserID, App.AppUserName); bllResult = true; } catch (Exception ex) { ioErrorMsg = ex.Message; bllResult = false; if (!bllIsCommit) { this.mdbTran.Rollback(); } App.WriteEventsLog(ex); } finally { this.mdbConn.Close(); } return(bllResult); }
private void pmLoadFormData() { DataRow dtrBrow = this.gridView1.GetDataRow(this.gridView1.FocusedRowHandle); if (dtrBrow != null) { this.mstrEditRowID = dtrBrow["cRowID"].ToString(); string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); pobjSQLUtil.SetPara(new object[] { this.mstrEditRowID }); if (pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrRefTable, this.mstrRefTable, "select * from " + this.mstrRefTable + " where cRowID = ?", ref strErrorMsg)) { DataRow dtrLoadForm = this.dtsDataEnv.Tables[this.mstrRefTable].Rows[0]; this.txtCode.Text = dtrLoadForm[QBGTypeInfo.Field.Code].ToString().TrimEnd(); this.txtName.Text = dtrLoadForm[QBGTypeInfo.Field.Name].ToString().TrimEnd(); this.txtName2.Text = dtrLoadForm[QBGTypeInfo.Field.Name2].ToString().TrimEnd(); string strCateg = dtrLoadForm[QBGTypeInfo.Field.Category].ToString().TrimEnd(); int intSel = -1; switch (strCateg) { case "1": intSel = 0; break; case "2": intSel = 1; break; case "3": intSel = 2; break; case "4": intSel = 3; break; case "5": intSel = 4; break; } this.cmbCateg.SelectedIndex = intSel; } this.pmLoadOldVar(); } }
public static bool ChkDupVatSeq(WS.Data.Agents.cDBMSAgent inSQLHelper, object[] inPara, ref string ioRefNo) { bool bllResult = false; string strErrorMsg = ""; string strSQLStr = ""; DataSet dtsTem = new DataSet(); strSQLStr = "select fcRefNo, fcCode from GLRef where fcCorp = ? and fcBranch = ? and fcVatType = ? and fcVatSeq = ?"; inSQLHelper.SetPara(inPara); if (inSQLHelper.SQLExec(ref dtsTem, "QDupVatSeq", "GLTRAN", strSQLStr, ref strErrorMsg)) { ioRefNo = dtsTem.Tables["QDupVatSeq"].Rows[0]["fcRefNo"].ToString().TrimEnd(); //MessageBox.Show("àÅ¢·ÕèàÍ¡ÊÒëéÓ", "Application Message", MessageBoxButtons.OK, MessageBoxIcon.Error); bllResult = true; } return(bllResult); }
private void pmSetBrowView() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); string strSQLExec = "select DOCTYPE.CROWID, DOCTYPE.CCODE, DOCTYPE.CNAME from DOCTYPE"; if (this.mstrDocTypeList != string.Empty) { strSQLExec += " where DOCTYPE.CCODE in (" + this.mstrDocTypeList + ")"; } //strSQLExec = string.Format(strSQLExec, new string[] { this.mstrRefTable }); //pobjSQLUtil.SetPara(pAPara); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrBrowViewAlias, this.mstrRefTable, strSQLExec, ref strErrorMsg); }
public static bool GetPrice( WS.Data.Agents.cDBMSAgent inSQLHelper , ref decimal ioPrice , ref decimal ioUmQty , ref string ioDiscStr , string inCorp , string inProd , string inCoor , string inPPolicy , string inPContrac , ref decimal inQty , ref decimal inUmQty , ref string ioErrorMsg) { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = inSQLHelper; DataSet dtsDataEnv = new DataSet(); decimal tPrice = 0; decimal tUmQty1 = 0; string tDiscStr = ""; pobjSQLUtil.SetPara(new object[] { inCoor }); if (pobjSQLUtil.SQLExec(ref dtsDataEnv, "GetPrice_Coor", "COOR", "select * from Coor where fcSkid = ? ", ref strErrorMsg)) { DataRow dtrQCoor = dtsDataEnv.Tables["GetPrice_Coor"].Rows[0]; if (dtrQCoor["fcPolicyPr"].ToString().Trim() != string.Empty) { pmChk1Price(inSQLHelper, BusinessEnum.gc_PRICE_POLICY_SALE, "P", ref tPrice, ref tUmQty1, ref tDiscStr, inCorp, inProd, " ", dtrQCoor["fcPolicyPr"].ToString(), "", ref inQty, ref inUmQty, ref ioErrorMsg); } if (dtrQCoor["fcPolicyDi"].ToString().Trim() != string.Empty) { decimal tPriceX = 0; pmChk1Price(inSQLHelper, BusinessEnum.gc_PRICE_POLICY_SALE, "D", ref tPriceX, ref tUmQty1, ref tDiscStr, inCorp, inProd, " ", dtrQCoor["fcPolicyDi"].ToString(), "", ref inQty, ref inUmQty, ref ioErrorMsg); } } ioPrice = tPrice; ioUmQty = tUmQty1; ioDiscStr = tDiscStr; return(true); }
private static decimal pmSumBakOrdAmt(string inType, WS.Data.Agents.cDBMSAgent inSQLHelper, object[] inPara, ref string ioErrorMsg) { decimal decOrdAmt = 0; decimal decInvAmt = 0; string strErrorMsg = ""; string strSQLStr = ""; strSQLStr = "select distinct "; strSQLStr += "ORDERH.FNAMT+ORDERH.FNVATAMT-ORDERH.FNDISCAMTK as OrdAmt "; strSQLStr += ", GLREF.FNAMT+GLREF.FNVATAMT-GLREF.FNDISCAMTK as InvAmt "; strSQLStr += " from ORDERH "; strSQLStr += " left join NOTECUT on ORDERH.FCSKID = NOTECUT.FCCHILDH and NOTECUT.FCCHILDTYP = 'SO' "; strSQLStr += " left join GLREF on GLREF.FCSKID = NOTECUT.FCMASTERH and GLREF.FCSTAT <> 'C' "; strSQLStr += " left join COOR on COOR.FCSKID = ORDERH.FCCOOR "; strSQLStr += " where "; strSQLStr += " ORDERH .FCCORP = ? "; strSQLStr += " and ORDERH .FCBRANCH = ? "; strSQLStr += " and ORDERH .FCREFTYPE = ? "; strSQLStr += " and ORDERH.FCSTEP <> 'P' "; strSQLStr += " and ORDERH.FCSTEP <> 'L' "; strSQLStr += " and ORDERH.FCSTAT <> 'C' "; if (inType == "G") { strSQLStr += " and COOR.FCCONTACTN = ? and COOR.FCCONTACTN <> '' "; } else { strSQLStr += " and COOR.FCSKID = ? "; } DataSet dtsTem = new DataSet(); inSQLHelper.SetPara(inPara); if (inSQLHelper.SQLExec(ref dtsTem, "QSumOrd", "GLTRAN", strSQLStr, ref strErrorMsg)) { foreach (DataRow dtrSum in dtsTem.Tables["QSumOrd"].Rows) { decOrdAmt += (Convert.IsDBNull(dtrSum["OrdAmt"]) ? 0 : Convert.ToDecimal(dtrSum["OrdAmt"])); decInvAmt += (Convert.IsDBNull(dtrSum["InvAmt"]) ? 0 : Convert.ToDecimal(dtrSum["InvAmt"])); } } return(decOrdAmt - decInvAmt); }
public static string RunVatSeq(WS.Data.Agents.cDBMSAgent inSQLHelper, object[] inPara, string inPrefix, ref string ioErrorMsg) { string strRunVal = ""; string strErrorMsg = ""; string strSQLStr = ""; int intMaxLength = 11; string strMax = AppUtil.StringHelper.Replicate("9", intMaxLength - inPrefix.Length); long intRunCode = 0; long lngMaxValue = Convert.ToInt64(strMax); DataSet dtsTem = new DataSet(); string strPrefix = (inPrefix != string.Empty ? " and fcVatSeq like '" + inPrefix + "%' " : ""); strSQLStr = "select fcVatSeq from GLRef where fcCorp = ? and fcBranch = ? and fcVatType = ? " + strPrefix + " and fcVatSeq < ':' order by fcVatSeq desc"; inSQLHelper.SetPara(inPara); if (inSQLHelper.SQLExec(ref dtsTem, "QRunCode", "GLTRAN", strSQLStr, ref strErrorMsg)) { string strLastRunCode = dtsTem.Tables["QRunCode"].Rows[0]["fcVatSeq"].ToString().Trim(); strLastRunCode = strLastRunCode.Substring(inPrefix.Length, intMaxLength - inPrefix.Length); try { intRunCode = Convert.ToInt64(strLastRunCode) + 1; if (intRunCode > lngMaxValue) { ioErrorMsg = "ÅӴѺ·ÕèàµçÁ"; } } catch (Exception ex) { strErrorMsg = ex.Message.ToString(); intRunCode++; } strRunVal = inPrefix + intRunCode.ToString(AppUtil.StringHelper.Replicate("0", strMax.Length)); } else { intRunCode = 1; strRunVal = inPrefix + intRunCode.ToString(AppUtil.StringHelper.Replicate("0", strMax.Length)); } return(strRunVal); }
private void pmSetBrowView() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); //string strCriteria = (this.mFormActiveMode == FormActiveMode.Edit ? "" : " and BGTYPE.CTYPE = 'D' "); string strCriteria = ""; string strSQLExec = "select BGTYPE.CROWID, BGTYPE.CCODE, BGTYPE.CNAME, BGTYPE.CNAME2, BGTYPE.DCREATE, BGTYPE.DLASTUPDBY, EM1.CLOGIN as CLOGIN_ADD, EM2.CLOGIN as CLOGIN_UPD from {0} BGTYPE "; strSQLExec += " left join {1} EM1 ON EM1.CROWID = BGTYPE.CCREATEBY "; strSQLExec += " left join {1} EM2 ON EM2.CROWID = BGTYPE.CLASTUPDBY "; strSQLExec += " where BGTYPE.CCORP = ? " + strCriteria; strSQLExec = string.Format(strSQLExec, new string[] { this.mstrRefTable, "APPLOGIN" }); pobjSQLUtil.SetPara(new object[] { App.ActiveCorp.RowID }); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrBrowViewAlias, "BGTYPE", strSQLExec, ref strErrorMsg); }
private void pmSetBrowView() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); string strSQLExec = ""; strSQLExec = "select "; strSQLExec += " BGUSEHD.CROWID, BGUSEHD.CCODE, BGUSEHD.DDATE,BGUSEHD.CDESC1"; strSQLExec += " from BGUSEHD "; strSQLExec += " where BGUSEHD.CCORP = ? and BGUSEHD.CBRANCH = ? and BGUSEHD.CREFTYPE = ? and BGUSEHD.CBGBOOK = ? and BGUSEHD.CJOB = ? and BGUSEHD.NBGYEAR = ? "; strSQLExec += " and BGUSEHD.CSTAT <> 'C' and BGUSEHD.CISREV <> 'Y' "; object[] pAPara = new object[] { App.ActiveCorp.RowID, this.mstrBranch, this.mstrRefType, this.mstrBGBook, this.mstrJob, this.mintBGYear }; pobjSQLUtil.SetPara(pAPara); pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrBrowViewAlias, this.mstrRefTable, strSQLExec, ref strErrorMsg); }
private void pmSetMaxLength() { WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); this.txtCode.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QBGTypeInfo.Field.Code); this.txtName.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QBGTypeInfo.Field.Name); this.txtName2.Properties.MaxLength = MapTable.GetMaxLength(pobjSQLUtil, this.mstrRefTable, QBGTypeInfo.Field.Name2); this.cmbCateg.Properties.Items.Clear(); this.cmbCateg.Properties.Items.AddRange(new object[] { "1 = §ººØ¤ÅÒ¡Ã" , "2 = §º´Óà¹Ô¹§Ò¹" , "3 = §ºÅ§·Ø¹" , "4 = §ºà§Ô¹Íش˹ع" , "5 = §ºÃÒ¨èÒÂÍ×è¹" }); this.cmbCateg.SelectedIndex = 0; }
private void pmSetBrowView() { string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); string strFMDBName = App.ConfigurationManager.ConnectionInfo.ERPDBMSName; string strEmplRTab = strFMDBName + ".dbo.EMPLR"; string strSQLExec = "select {0}.CROWID, {0}.CCODE, {0}.CNAME, {0}.DCREATE, {0}.DLASTUPD, EM1.FCLOGIN as CLOGIN_ADD, EM2.FCLOGIN as CLOGIN_UPD from {0} "; strSQLExec += " left join {1} EM1 ON EM1.FCSKID = {0}.CCREATEBY "; strSQLExec += " left join {1} EM2 ON EM2.FCSKID = {0}.CLASTUPDBY "; strSQLExec = string.Format(strSQLExec, new string[] { this.mstrRefTable, strEmplRTab }); //pobjSQLUtil.SetPara(pAPara); pobjSQLUtil.NotUpperSQLExecString = true; pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrBrowViewAlias, "Master_Dept", strSQLExec, ref strErrorMsg); }
private void pmLoadFormData() { DataRow dtrBrow = this.gridView1.GetDataRow(this.gridView1.FocusedRowHandle); if (dtrBrow != null) { this.mstrEditRowID = dtrBrow["fcSkid"].ToString(); string strErrorMsg = ""; WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside); pobjSQLUtil.SetPara(new object[] { this.mstrEditRowID }); if (pobjSQLUtil.SQLExec(ref this.dtsDataEnv, this.mstrRefTable, this.mstrRefTable, "select * from " + this.mstrRefTable + " where fcSkid = ?", ref strErrorMsg)) { DataRow dtrLoadForm = this.dtsDataEnv.Tables[this.mstrRefTable].Rows[0]; this.txtCode.Text = dtrLoadForm[QEMSectInfo.Field.Code].ToString().TrimEnd(); this.txtName.Text = dtrLoadForm[QEMSectInfo.Field.Name].ToString().TrimEnd(); this.txtName2.Text = dtrLoadForm[QEMSectInfo.Field.Name2].ToString().TrimEnd(); this.txtQcDept.Tag = dtrLoadForm[QEMSectInfo.Field.DeptID].ToString(); pobjSQLUtil.SetPara(new object[] { this.txtQcDept.Tag }); if (pobjSQLUtil.SQLExec(ref this.dtsDataEnv, "QProj", QEMDeptInfo.TableName, "select * from " + QEMDeptInfo.TableName + " where fcSkid = ?", ref strErrorMsg)) { this.txtQcDept.Text = this.dtsDataEnv.Tables["QProj"].Rows[0][QEMDeptInfo.Field.Code].ToString().TrimEnd(); this.txtQnDept.Text = this.dtsDataEnv.Tables["QProj"].Rows[0][QEMDeptInfo.Field.Name].ToString().TrimEnd(); } //string strLevel = dtrLoadForm[QEMSectInfo.Field.Type].ToString().TrimEnd(); //int intSel = -1; //switch (strLevel) //{ // case "D": // intSel = 0; // break; // case "G": // intSel = 1; // break; //} //this.cmbType.SelectedIndex = intSel; } this.pmLoadOldVar(); } }