text:
using System;
using System.Data;
using System.Data.OleDb;
using System.Collections;
using System.Configuration;
using PCSComUtils.DataAccess;
using PCSComUtils.PCSExc;
using PCSComUtils.Common;

namespace PCSComProduction.WorkOrder.DS
{
	public class PRO_IssueStdCostDS
	{
		public PRO_IssueStdCostDS()
		{
		}
		private const string THIS = "PCSComProduction.WorkOrder.DS.PRO_IssueStdCostDS";
		//**************************************************************************
		///    <Description>
		///       This method uses to add data to PRO_IssueStdCost
		///    </Description>
		///    <Inputs>
		///        PRO_IssueStdCostVO
		///    </Inputs>
		///    <Outputs>
		///       newly inserted primarkey value
		///    </Outputs>
		///    <Returns>
		///       void
		///    </Returns>
		///    <Authors>
		///       HungLa
		///    </Authors>
		///    <History>
		///       Tuesday, May 31, 2005
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		public void Add(object pobjObjectVO)
		{
			const string METHOD_NAME = THIS + ".Add()";

			OleDbConnection oconPCS =null;
			OleDbCommand ocmdPCS =null;
			try
			{
				PRO_IssueStdCostVO objObject = (PRO_IssueStdCostVO) pobjObjectVO;
				string strSql = String.Empty;
				Utils utils = new Utils();
				oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
				ocmdPCS = new OleDbCommand("", oconPCS);

				strSql=	"INSERT INTO PRO_IssueStdCost("
				+ PRO_IssueStdCostTable.POSTDATE_FLD + ","
				+ PRO_IssueStdCostTable.TRANSTYPE_FLD + ","
				+ PRO_IssueStdCostTable.COSTMATERIAL01_FLD + ","
				+ PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINERUN06_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUP09_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORRUN12_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORFIXED13_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD + ","
				+ PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD + ","
				+ PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD + ","
				+ PRO_IssueStdCostTable.COSTSHRINK17_FLD + ","
				+ PRO_IssueStdCostTable.COSTFREIGHT18_FLD + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD + ","
				+ PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD + ","
				+ PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD + ")"
				+ "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.POSTDATE_FLD, OleDbType.Date));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.POSTDATE_FLD].Value = objObject.PostDate;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.TRANSTYPE_FLD, OleDbType.VarWChar));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.TRANSTYPE_FLD].Value = objObject.TransType;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMATERIAL01_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMATERIAL01_FLD].Value = objObject.CostMaterial01;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD].Value = objObject.CostMaterialOverHead02;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD].Value = objObject.CostMachineSetup03;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD].Value = objObject.CostMachineSetupFixed04;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD].Value = objObject.CostMachineSetupVar05;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINERUN06_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINERUN06_FLD].Value = objObject.CostMachineRun06;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD].Value = objObject.CostMachineFixed07;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD].Value = objObject.CostMachineVariable08;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORSETUP09_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORSETUP09_FLD].Value = objObject.CostLaborSetup09;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD].Value = objObject.CostLaborSetupFixed10;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD].Value = objObject.CostLaborSetupVariable11;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORRUN12_FLD, OleDbType.VarWChar));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORRUN12_FLD].Value = objObject.CostLaborRun12;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORFIXED13_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORFIXED13_FLD].Value = objObject.CostLaborFixed13;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD].Value = objObject.CostLaborVariable14;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD].Value = objObject.CostOutsideProc15;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD].Value = objObject.CostAssemblyScrap16;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTSHRINK17_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTSHRINK17_FLD].Value = objObject.CostShrink17;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTFREIGHT18_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTFREIGHT18_FLD].Value = objObject.CostFreight18;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD].Value = objObject.CostUserStandard1_19;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD].Value = objObject.CostUserStandard2_20;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD].Value = objObject.CostTotalAmount21;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD, OleDbType.Integer));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD].Value = objObject.IssueMaterialDetailID;

				ocmdPCS.CommandText = strSql;
				ocmdPCS.Connection.Open();
				ocmdPCS.ExecuteNonQuery();

			}
			catch(OleDbException ex)
			{
				if (ex.Errors[1].NativeError == ErrorCode.SQLDUPLICATE_KEYCODE)
				{

					throw new PCSDBException(ErrorCode.DUPLICATE_KEY, METHOD_NAME, ex);
				}
				else
				{
					throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
				}
			}

			catch(InvalidOperationException ex)
			{
				throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
			}
			catch (Exception ex)
			{
				throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
			}

			finally
			{
				if (oconPCS!=null)
				{
					if (oconPCS.State != ConnectionState.Closed)
					{
						oconPCS.Close();
					}
				}
			}
		}

		//**************************************************************************
		///    <Description>
		///       This method uses to delete data from PRO_IssueStdCost
		///    </Description>
		///    <Inputs>
		///        ID
		///    </Inputs>
		///    <Outputs>
		///       void
		///    </Outputs>
		///    <Returns>
		///
		///    </Returns>
		///    <Authors>
		///       HungLa
		///    </Authors>
		///    <History>
		///       09-Dec-2004
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		public void Delete(int pintID)
		{
			const string METHOD_NAME = THIS + ".Delete()";
			string strSql = String.Empty;
			strSql=	"DELETE " + PRO_IssueStdCostTable.TABLE_NAME + " WHERE  " + "IssueStdCostID" + "=" + pintID.ToString();
			OleDbConnection oconPCS=null;
			OleDbCommand ocmdPCS =null;
			try
			{
				Utils utils = new Utils();
				oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
				ocmdPCS = new OleDbCommand(strSql, oconPCS);

				ocmdPCS.Connection.Open();
				ocmdPCS.ExecuteNonQuery();
				ocmdPCS = null;

			}
			catch(OleDbException ex)
			{
				if (ex.Errors[1].NativeError == ErrorCode.SQLCASCADE_PREVENT_KEYCODE)
				{

					throw new PCSDBException(ErrorCode.CASCADE_DELETE_PREVENT, METHOD_NAME, ex);
				}
				else
				{
					throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
				}
			}

			catch (Exception ex)
			{
				throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
			}

			finally
			{
				if (oconPCS!=null)
				{
					if (oconPCS.State != ConnectionState.Closed)
					{
						oconPCS.Close();
					}
				}
			}
		}

		//**************************************************************************
		///    <Description>
		///       This method uses to get data from PRO_IssueStdCost
		///    </Description>
		///    <Inputs>
		///        ID
		///    </Inputs>
		///    <Outputs>
		///       PRO_IssueStdCostVO
		///    </Outputs>
		///    <Returns>
		///       PRO_IssueStdCostVO
		///    </Returns>
		///    <Authors>
		///       HungLa
		///    </Authors>
		///    <History>
		///       Tuesday, May 31, 2005
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		public object GetObjectVO(int pintID)
		{
			const string METHOD_NAME = THIS + ".GetObjectVO()";
			DataSet dstPCS = new DataSet();

			OleDbDataReader odrPCS = null;
			OleDbConnection oconPCS = null;
			OleDbCommand ocmdPCS = null;
			try
			{
				string strSql = String.Empty;
				strSql=	"SELECT "
				+ PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD + ","
				+ PRO_IssueStdCostTable.POSTDATE_FLD + ","
				+ PRO_IssueStdCostTable.TRANSTYPE_FLD + ","
				+ PRO_IssueStdCostTable.COSTMATERIAL01_FLD + ","
				+ PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINERUN06_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUP09_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORRUN12_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORFIXED13_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD + ","
				+ PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD + ","
				+ PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD + ","
				+ PRO_IssueStdCostTable.COSTSHRINK17_FLD + ","
				+ PRO_IssueStdCostTable.COSTFREIGHT18_FLD + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD + ","
				+ PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD + ","
				+ PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD
				+ " FROM " + PRO_IssueStdCostTable.TABLE_NAME
				+" WHERE " + PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD + "=" + pintID;

				Utils utils = new Utils();
				oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
				ocmdPCS = new OleDbCommand(strSql, oconPCS);

				ocmdPCS.Connection.Open();
				odrPCS = ocmdPCS.ExecuteReader();

				PRO_IssueStdCostVO objObject = new PRO_IssueStdCostVO();

				while (odrPCS.Read())
				{
				objObject.IssueStdCostID = int.Parse(odrPCS[PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD].ToString().Trim());
				objObject.PostDate = DateTime.Parse(odrPCS[PRO_IssueStdCostTable.POSTDATE_FLD].ToString().Trim());
				objObject.TransType = odrPCS[PRO_IssueStdCostTable.TRANSTYPE_FLD].ToString().Trim();
				objObject.CostMaterial01 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMATERIAL01_FLD].ToString().Trim());
				objObject.CostMaterialOverHead02 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD].ToString().Trim());
				objObject.CostMachineSetup03 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD].ToString().Trim());
				objObject.CostMachineSetupFixed04 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD].ToString().Trim());
				objObject.CostMachineSetupVar05 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD].ToString().Trim());
				objObject.CostMachineRun06 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINERUN06_FLD].ToString().Trim());
				objObject.CostMachineFixed07 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD].ToString().Trim());
				objObject.CostMachineVariable08 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD].ToString().Trim());
				objObject.CostLaborSetup09 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORSETUP09_FLD].ToString().Trim());
				objObject.CostLaborSetupFixed10 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD].ToString().Trim());
				objObject.CostLaborSetupVariable11 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD].ToString().Trim());
				objObject.CostLaborRun12 = odrPCS[PRO_IssueStdCostTable.COSTLABORRUN12_FLD].ToString().Trim();
				objObject.CostLaborFixed13 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORFIXED13_FLD].ToString().Trim());
				objObject.CostLaborVariable14 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD].ToString().Trim());
				objObject.CostOutsideProc15 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD].ToString().Trim());
				objObject.CostAssemblyScrap16 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD].ToString().Trim());
				objObject.CostShrink17 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTSHRINK17_FLD].ToString().Trim());
				objObject.CostFreight18 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTFREIGHT18_FLD].ToString().Trim());
				objObject.CostUserStandard1_19 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD].ToString().Trim());
				objObject.CostUserStandard2_20 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD].ToString().Trim());
				objObject.CostTotalAmount21 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD].ToString().Trim());
				objObject.IssueMaterialDetailID = int.Parse(odrPCS[PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD].ToString().Trim());

				}
				return objObject;
			}
			catch(OleDbException ex)
			{
				throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
			}

			catch (Exception ex)
			{
				throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
			}

			finally
			{
				if (oconPCS!=null)
				{
					if (oconPCS.State != ConnectionState.Closed)
					{
						oconPCS.Close();
					}
				}
			}
		}
		/// <summary>
		/// GetObjectVOByProduct
		/// </summary>
		/// <param name="pintIssueMaterialDetailID"></param>
		/// <returns></returns>
		/// <author>Trada</author>
		/// <date>Monday, September 5 2005</date>
		public object GetObjectVOByProduct(int pintIssueMaterialDetailID)
		{
			const string METHOD_NAME = THIS + ".GetObjectVOByProduct()";
			DataSet dstPCS = new DataSet();

			OleDbDataReader odrPCS = null;
			OleDbConnection oconPCS = null;
			OleDbCommand ocmdPCS = null;
			try
			{
				string strSql = String.Empty;
				strSql=	"SELECT "
					+ PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD + ","
					+ PRO_IssueStdCostTable.POSTDATE_FLD + ","
					+ PRO_IssueStdCostTable.TRANSTYPE_FLD + ","
					+ PRO_IssueStdCostTable.COSTMATERIAL01_FLD + ","
					+ PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD + ","
					+ PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD + ","
					+ PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD + ","
					+ PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD + ","
					+ PRO_IssueStdCostTable.COSTMACHINERUN06_FLD + ","
					+ PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD + ","
					+ PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD + ","
					+ PRO_IssueStdCostTable.COSTLABORSETUP09_FLD + ","
					+ PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD + ","
					+ PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD + ","
					+ PRO_IssueStdCostTable.COSTLABORRUN12_FLD + ","
					+ PRO_IssueStdCostTable.COSTLABORFIXED13_FLD + ","
					+ PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD + ","
					+ PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD + ","
					+ PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD + ","
					+ PRO_IssueStdCostTable.COSTSHRINK17_FLD + ","
					+ PRO_IssueStdCostTable.COSTFREIGHT18_FLD + ","
					+ PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD + ","
					+ PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD + ","
					+ PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD + ","
					+ PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD
					+ " FROM " + PRO_IssueStdCostTable.TABLE_NAME
					+" WHERE " + PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD + "=" + pintIssueMaterialDetailID;

				Utils utils = new Utils();
				oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
				ocmdPCS = new OleDbCommand(strSql, oconPCS);

				ocmdPCS.Connection.Open();
				odrPCS = ocmdPCS.ExecuteReader();

				PRO_IssueStdCostVO objObject = new PRO_IssueStdCostVO();

				while (odrPCS.Read())
				{
					objObject.IssueStdCostID = int.Parse(odrPCS[PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD].ToString().Trim());
					objObject.PostDate = DateTime.Parse(odrPCS[PRO_IssueStdCostTable.POSTDATE_FLD].ToString().Trim());
					objObject.TransType = odrPCS[PRO_IssueStdCostTable.TRANSTYPE_FLD].ToString().Trim();
					objObject.CostMaterial01 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMATERIAL01_FLD].ToString().Trim());
					objObject.CostMaterialOverHead02 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD].ToString().Trim());
					objObject.CostMachineSetup03 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD].ToString().Trim());
					objObject.CostMachineSetupFixed04 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD].ToString().Trim());
					objObject.CostMachineSetupVar05 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD].ToString().Trim());
					objObject.CostMachineRun06 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINERUN06_FLD].ToString().Trim());
					objObject.CostMachineFixed07 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD].ToString().Trim());
					objObject.CostMachineVariable08 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD].ToString().Trim());
					objObject.CostLaborSetup09 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORSETUP09_FLD].ToString().Trim());
					objObject.CostLaborSetupFixed10 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD].ToString().Trim());
					objObject.CostLaborSetupVariable11 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD].ToString().Trim());
					objObject.CostLaborRun12 = odrPCS[PRO_IssueStdCostTable.COSTLABORRUN12_FLD].ToString().Trim();
					objObject.CostLaborFixed13 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORFIXED13_FLD].ToString().Trim());
					objObject.CostLaborVariable14 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD].ToString().Trim());
					objObject.CostOutsideProc15 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD].ToString().Trim());
					objObject.CostAssemblyScrap16 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD].ToString().Trim());
					objObject.CostShrink17 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTSHRINK17_FLD].ToString().Trim());
					objObject.CostFreight18 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTFREIGHT18_FLD].ToString().Trim());
					objObject.CostUserStandard1_19 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD].ToString().Trim());
					objObject.CostUserStandard2_20 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD].ToString().Trim());
					objObject.CostTotalAmount21 = Decimal.Parse(odrPCS[PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD].ToString().Trim());
					objObject.IssueMaterialDetailID = int.Parse(odrPCS[PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD].ToString().Trim());

				}
				return objObject;
			}
			catch(OleDbException ex)
			{
				throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
			}

			catch (Exception ex)
			{
				throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
			}

			finally
			{
				if (oconPCS!=null)
				{
					if (oconPCS.State != ConnectionState.Closed)
					{
						oconPCS.Close();
					}
				}
			}
		}

		//**************************************************************************
		///    <Description>
		///       This method uses to update data to PRO_IssueStdCost
		///    </Description>
		///    <Inputs>
		///       PRO_IssueStdCostVO
		///    </Inputs>
		///    <Outputs>
		///
		///    </Outputs>
		///    <Returns>
		///
		///    </Returns>
		///    <Authors>
		///       HungLa
		///    </Authors>
		///    <History>
		///       09-Dec-2004
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		public void Update(object pobjObjecVO)
		{
			const string METHOD_NAME = THIS + ".Update()";

			PRO_IssueStdCostVO objObject = (PRO_IssueStdCostVO) pobjObjecVO;

			//prepare value for parameters
			OleDbConnection oconPCS =null;
			OleDbCommand ocmdPCS = null;
			try
			{
				string strSql = String.Empty;
				Utils utils = new Utils();
				oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
				ocmdPCS = new OleDbCommand(strSql, oconPCS);
				strSql=	"UPDATE PRO_IssueStdCost SET "
				+ PRO_IssueStdCostTable.POSTDATE_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.TRANSTYPE_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTMATERIAL01_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTMACHINERUN06_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUP09_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTLABORRUN12_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTLABORFIXED13_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTSHRINK17_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTFREIGHT18_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD + "=   ?" + ","
				+ PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD + "=  ?"
				+" WHERE " + PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD + "= ?";

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.POSTDATE_FLD, OleDbType.Date));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.POSTDATE_FLD].Value = objObject.PostDate;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.TRANSTYPE_FLD, OleDbType.VarWChar));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.TRANSTYPE_FLD].Value = objObject.TransType;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMATERIAL01_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMATERIAL01_FLD].Value = objObject.CostMaterial01;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD].Value = objObject.CostMaterialOverHead02;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD].Value = objObject.CostMachineSetup03;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD].Value = objObject.CostMachineSetupFixed04;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD].Value = objObject.CostMachineSetupVar05;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINERUN06_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINERUN06_FLD].Value = objObject.CostMachineRun06;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD].Value = objObject.CostMachineFixed07;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD].Value = objObject.CostMachineVariable08;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORSETUP09_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORSETUP09_FLD].Value = objObject.CostLaborSetup09;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD].Value = objObject.CostLaborSetupFixed10;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD].Value = objObject.CostLaborSetupVariable11;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORRUN12_FLD, OleDbType.VarWChar));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORRUN12_FLD].Value = objObject.CostLaborRun12;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORFIXED13_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORFIXED13_FLD].Value = objObject.CostLaborFixed13;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD].Value = objObject.CostLaborVariable14;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD].Value = objObject.CostOutsideProc15;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD].Value = objObject.CostAssemblyScrap16;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTSHRINK17_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTSHRINK17_FLD].Value = objObject.CostShrink17;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTFREIGHT18_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTFREIGHT18_FLD].Value = objObject.CostFreight18;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD].Value = objObject.CostUserStandard1_19;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD].Value = objObject.CostUserStandard2_20;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD, OleDbType.Decimal));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD].Value = objObject.CostTotalAmount21;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD, OleDbType.Integer));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD].Value = objObject.IssueMaterialDetailID;

				ocmdPCS.Parameters.Add(new OleDbParameter(PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD, OleDbType.Integer));
				ocmdPCS.Parameters[PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD].Value = objObject.IssueStdCostID;

				ocmdPCS.CommandText = strSql;
				ocmdPCS.Connection.Open();
				ocmdPCS.ExecuteNonQuery();
			}
			catch(OleDbException ex)
			{
				if (ex.Errors[1].NativeError == ErrorCode.SQLDUPLICATE_KEYCODE)
				{

					throw new PCSDBException(ErrorCode.DUPLICATE_KEY, METHOD_NAME, ex);
				}
				else
				{
					throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
				}
			}

			catch(InvalidOperationException ex)
			{
				throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
			}
			catch (Exception ex)
			{
				throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
			}

			finally
			{
				if (oconPCS!=null)
				{
					if (oconPCS.State != ConnectionState.Closed)
					{
						oconPCS.Close();
					}
				}
			}

		}

		//**************************************************************************
		///    <Description>
		///       This method uses to get all data from PRO_IssueStdCost
		///    </Description>
		///    <Inputs>
		///
		///    </Inputs>
		///    <Outputs>
		///       DataSet
		///    </Outputs>
		///    <Returns>
		///       DataSet
		///    </Returns>
		///    <Authors>
		///       HungLa
		///    </Authors>
		///    <History>
		///       Tuesday, May 31, 2005
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		public DataSet List()
		{
			const string METHOD_NAME = THIS + ".List()";
			DataSet dstPCS = new DataSet();

			OleDbConnection oconPCS =null;
			OleDbCommand ocmdPCS = null;
			try
			{
				string strSql = String.Empty;

				strSql=	"SELECT "
				+ PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD + ","
				+ PRO_IssueStdCostTable.POSTDATE_FLD + ","
				+ PRO_IssueStdCostTable.TRANSTYPE_FLD + ","
				+ PRO_IssueStdCostTable.COSTMATERIAL01_FLD + ","
				+ PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINERUN06_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUP09_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORRUN12_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORFIXED13_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD + ","
				+ PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD + ","
				+ PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD + ","
				+ PRO_IssueStdCostTable.COSTSHRINK17_FLD + ","
				+ PRO_IssueStdCostTable.COSTFREIGHT18_FLD + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD + ","
				+ PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD + ","
				+ PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD
					+ " FROM " + PRO_IssueStdCostTable.TABLE_NAME;
				Utils utils = new Utils();
				oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
				ocmdPCS = new OleDbCommand(strSql, oconPCS);
				ocmdPCS.Connection.Open();

				OleDbDataAdapter odadPCS = new OleDbDataAdapter(ocmdPCS);
				odadPCS.Fill(dstPCS,PRO_IssueStdCostTable.TABLE_NAME);

				return dstPCS;
			}
			catch(OleDbException ex)
			{
   				throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
			}
			catch (Exception ex)
			{
				throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
			}

			finally
			{
				if (oconPCS!=null)
				{
					if (oconPCS.State != ConnectionState.Closed)
					{
						oconPCS.Close();
					}
				}
			}

		}

		//**************************************************************************
		///    <Description>
		///       This method uses to update a DataSet
		///    </Description>
		///    <Inputs>
		///        DataSet
		///    </Inputs>
		///    <Outputs>
		///
		///    </Outputs>
		///    <Returns>
		///
		///    </Returns>
		///    <Authors>
		///       HungLa
		///    </Authors>
		///    <History>
		///       Tuesday, May 31, 2005
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		public void UpdateDataSet(DataSet pData)
		{
			const string METHOD_NAME = THIS + ".UpdateDataSet()";
			string strSql;
			OleDbConnection oconPCS =null;
			OleDbCommandBuilder odcbPCS ;
			OleDbDataAdapter odadPCS = new OleDbDataAdapter();

			try
			{
				strSql=	"SELECT "
				+ PRO_IssueStdCostTable.ISSUESTDCOSTID_FLD + ","
				+ PRO_IssueStdCostTable.POSTDATE_FLD + ","
				+ PRO_IssueStdCostTable.TRANSTYPE_FLD + ","
				+ PRO_IssueStdCostTable.COSTMATERIAL01_FLD + ","
				+ PRO_IssueStdCostTable.COSTMATERIALOVERHEAD02_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUP03_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPFIXED04_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINESETUPVAR05_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINERUN06_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINEFIXED07_FLD + ","
				+ PRO_IssueStdCostTable.COSTMACHINEVARIABLE08_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUP09_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPFIXED10_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORSETUPVARIABLE11_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORRUN12_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORFIXED13_FLD + ","
				+ PRO_IssueStdCostTable.COSTLABORVARIABLE14_FLD + ","
				+ PRO_IssueStdCostTable.COSTOUTSIDEPROC15_FLD + ","
				+ PRO_IssueStdCostTable.COSTASSEMBLYSCRAP16_FLD + ","
				+ PRO_IssueStdCostTable.COSTSHRINK17_FLD + ","
				+ PRO_IssueStdCostTable.COSTFREIGHT18_FLD + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD1_19_FLD + ","
				+ PRO_IssueStdCostTable.COSTUSERSTANDARD2_20_FLD + ","
				+ PRO_IssueStdCostTable.COSTTOTALAMOUNT21_FLD + ","
				+ PRO_IssueStdCostTable.ISSUEMATERIALDETAILID_FLD
		+ "  FROM " + PRO_IssueStdCostTable.TABLE_NAME;

				Utils utils = new Utils();
				oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
				odadPCS.SelectCommand = new OleDbCommand(strSql, oconPCS);
				odcbPCS = new OleDbCommandBuilder(odadPCS);
				pData.EnforceConstraints = false;
				odadPCS.Update(pData,PRO_IssueStdCostTable.TABLE_NAME);

			}
			catch(OleDbException ex)
			{
				if (ex.Errors[1].NativeError == ErrorCode.SQLDUPLICATE_KEYCODE)
				{

					throw new PCSDBException(ErrorCode.DUPLICATE_KEY, METHOD_NAME, ex);
				}
				else if (ex.Errors[1].NativeError == ErrorCode.SQLCASCADE_PREVENT_KEYCODE)
				{

					throw new PCSDBException(ErrorCode.CASCADE_DELETE_PREVENT, METHOD_NAME, ex);
				}

				else
				{
					throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
				}
			}

			catch(InvalidOperationException ex)
			{
				throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME,ex);
			}
			catch (Exception ex)
			{
				throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
			}

			finally
			{
				if (oconPCS!=null)
				{
					if (oconPCS.State != ConnectionState.Closed)
					{
						oconPCS.Close();
					}
				}
			}

		}
	}
}


text:
require 'tty-prompt'
require 'terjira/utils/file_cache'

module Terjira
  module Client
    module AuthOptionBuilder
      AUTH_CACHE_KEY = 'auth'.freeze

      def build_auth_options(options = {})
        cache_key = options[:cache_key] || AUTH_CACHE_KEY
        auth_file_cache.fetch cache_key do
          build_auth_options_by_tty(options)
        end
      end

      def build_auth_options_by_cached(options = {})
        cache_key = options[:cache_key] || AUTH_CACHE_KEY
        auth_file_cache.get(cache_key)
      end

      def expire_auth_options
        Terjira::FileCache.clear_all
      end

      def build_auth_options_by_tty(options = {})
        puts 'Login will be required...'
        prompt = TTY::Prompt.new

        result = prompt.collect do
          key(:site).ask('Site (ex: https://myjira.atlassian.net):', required: true)
          key(:context_path).ask('Jira path in your site (just press enter if you don\'t have):', default: '')
          key(:username).ask('Username:', required: true)
          key(:password).mask('Password (Server) / API Token (Cloud):', required: true)

          if options['ssl-config']
            key(:use_ssl).yes?('Use SSL?')
            key(:ssl_verify_mode).select('Verify mode:') do |menu|
              menu.choice 'Verify peer', OpenSSL::SSL::VERIFY_PEER
              menu.choice 'Verify client once', OpenSSL::SSL::VERIFY_CLIENT_ONCE
              menu.choice 'Verify fail if no peer cert', OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
              menu.choice 'Verify none', OpenSSL::SSL::VERIFY_NONE
            end
          end

          if options['proxy-config']
            key(:proxy_address).ask("Proxy address: ", default: nil)
            key(:proxy_port).ask("Proxy port: ", default: nil)
          end
        end

        result[:auth_type] = :basic
        result[:use_ssl] ||= false if result[:site] =~ /http\:\/\//

        result
      end

      def auth_file_cache
        @auth_file_cache ||= Terjira::FileCache.new('profile')
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
class RemoveMarker {
  'use strict';

  findMarker;

  constructor(public that) {

    var findMarker = new FindMarkerById(that);

    this.findMarker = function(marker) {
      return findMarker.find(marker)
    };
  }

  private removeBulk(args) {
    var marker, x;
    for (x in args) {
      if (args.hasOwnProperty(x)) {
        marker = args[x];
        this.remove(this.findMarker(marker));
      }
    }
  }

  public removeMarker(args) {

    if (typeof args === 'undefined') {
      this.removeBulk(this.that.markers.all);
    }

    var type = Object.prototype.toString.call(args);

    if (type === '[object Object]') {
      return this.remove(this.findMarker(args));
    }

    if (type === '[object Array]') {

      this.removeBulk(args);
    }
  }

  private remove(marker) {
    marker.setMap(null);
    delete mapTools.maps[this.that.id].markers.all[marker.data.uid];
  }

}


text:
package mse

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// ExportNacosConfig invokes the mse.ExportNacosConfig API synchronously
func (client *Client) ExportNacosConfig(request *ExportNacosConfigRequest) (response *ExportNacosConfigResponse, err error) {
	response = CreateExportNacosConfigResponse()
	err = client.DoAction(request, response)
	return
}

// ExportNacosConfigWithChan invokes the mse.ExportNacosConfig API asynchronously
func (client *Client) ExportNacosConfigWithChan(request *ExportNacosConfigRequest) (<-chan *ExportNacosConfigResponse, <-chan error) {
	responseChan := make(chan *ExportNacosConfigResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.ExportNacosConfig(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// ExportNacosConfigWithCallback invokes the mse.ExportNacosConfig API asynchronously
func (client *Client) ExportNacosConfigWithCallback(request *ExportNacosConfigRequest, callback func(response *ExportNacosConfigResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *ExportNacosConfigResponse
		var err error
		defer close(result)
		response, err = client.ExportNacosConfig(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// ExportNacosConfigRequest is the request struct for api ExportNacosConfig
type ExportNacosConfigRequest struct {
	*requests.RpcRequest
	InstanceId     string `position:"Query" name:"InstanceId"`
	DataId         string `position:"Query" name:"DataId"`
	AppName        string `position:"Query" name:"AppName"`
	NamespaceId    string `position:"Query" name:"NamespaceId"`
	AcceptLanguage string `position:"Query" name:"AcceptLanguage"`
	Ids            string `position:"Query" name:"Ids"`
	Group          string `position:"Query" name:"Group"`
}

// ExportNacosConfigResponse is the response struct for api ExportNacosConfig
type ExportNacosConfigResponse struct {
	*responses.BaseResponse
	HttpStatusCode int    `json:"HttpStatusCode" xml:"HttpStatusCode"`
	RequestId      string `json:"RequestId" xml:"RequestId"`
	Success        bool   `json:"Success" xml:"Success"`
	ErrorCode      string `json:"ErrorCode" xml:"ErrorCode"`
	Code           int    `json:"Code" xml:"Code"`
	Message        string `json:"Message" xml:"Message"`
	DynamicMessage string `json:"DynamicMessage" xml:"DynamicMessage"`
	Data           Data   `json:"Data" xml:"Data"`
}

// CreateExportNacosConfigRequest creates a request to invoke ExportNacosConfig API
func CreateExportNacosConfigRequest() (request *ExportNacosConfigRequest) {
	request = &ExportNacosConfigRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("mse", "2019-05-31", "ExportNacosConfig", "mse", "openAPI")
	request.Method = requests.POST
	return
}

// CreateExportNacosConfigResponse creates a response to parse from ExportNacosConfig response
func CreateExportNacosConfigResponse() (response *ExportNacosConfigResponse) {
	response = &ExportNacosConfigResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
import factories from "../api"

export default (opts) => {
  const { diffusionLoaderWithoutAuthenticationFactory } = factories(opts)
  const diffusionLoader = diffusionLoaderWithoutAuthenticationFactory

  return {
    auctionLotsLoader: diffusionLoader("lots"),
    auctionLotLoader: diffusionLoader((id) => `lots/${id}`),
    auctionCreatedYearRangeLoader: diffusionLoader("lots/created_dates"),
    auctionResultComparableAuctionResultsLoader: diffusionLoader(
      (id) => `lots/${id}/comparable_lots`
    ),
    comparableAuctionResultsLoader: diffusionLoader("comparable_lots"),
  }
}


text:
using Warcraft.Managers;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Warcraft.Util
{
    class Pathfinding
    {
        List<PathNode> openList = new List<PathNode>();
        List<PathNode> closeList = new List<PathNode>();

        ManagerMap managerMap;

        int[][] neighbourhood = { new int[] { -1, 0 }, new int[] { 1, 0 }, new int[] { 0, -1 }, new int[] { 0, 1 },
                                  new int[] { -1, -1 }, new int[] { -1, 1 }, new int[] { 1, -1 }, new int[] { 1, 1 } };

        int goalX;
        int goalY;

        public Pathfinding(ManagerMap managerMap)
        {
            this.managerMap = managerMap;
        }

        public bool SetGoal(int posX, int posY, int goalX, int goalY)
        {
            posX = posX / 32;
            posY = posY / 32;

            this.goalX = goalX;
            this.goalY = goalY;

            if (posX == goalX && posY == goalY)
                return false;

            if (!CheckWalls(this.goalX, this.goalY))
                return Reset(posX, posY);
            else
            {
                for (int i = 0; i < neighbourhood.Length; i++)
                {
                    this.goalX = this.goalX + neighbourhood[i][0];
                    this.goalY = this.goalY + neighbourhood[i][1];

                    if (posX == this.goalX && posY == this.goalY)
                        return false;

                    if (!CheckWalls(this.goalX, this.goalY))
                        return Reset(posX, posY);
                }
            }

            return false;
        }

        private bool Reset(int posX, int posY)
        {
            PathNode current = new PathNode(posX, posY, 0, 0, null);

            openList.Clear();
            closeList.Clear();

            openList.Add(current);
            closeList.Add(current);

            FindNeighbourhood(0);

            return true;
        }

        public List<PathNode> DiscoverPath()
        {
            while (openList.Count > 0)
            {
                int F = openList[0].F;
                int index = 0;
                for (int i = 1; i < openList.Count; i++)
                {
                    if (openList[i].F < F)
                    {
                        index = i;
                        F = openList[i].F;
                    }
                }

                closeList.Add(openList[index]);
                PathNode current = openList[index];

                if (current.x == goalX && current.y == goalY)
                    break;

                FindNeighbourhood(index);
            }

            return FindPath();
        }

        public void FindNeighbourhood(int index)
        {
            for (int i = 0; i < neighbourhood.Length; i++)
            {
                int x = openList[index].x + neighbourhood[i][0];
                int y = openList[index].y + neighbourhood[i][1];

                if (!CheckWalls(x, y) && !CheckOpen(x, y))
                {
                    int h = Math.Abs(x - goalX) + Math.Abs(y - goalY) + openList[index].H;

                    PathNode c = new PathNode(x, y, i > 3 ? 14 : 10, h, openList[index]);
                    openList.Add(c);
                }
            }

            openList.RemoveAt(index);
        }

        public List<PathNode> FindPath()
        {
            List<PathNode> path = new List<PathNode>();
            PathNode p = closeList.Last();
            while (p.parent != null)
            {
                path.Add(p);
                p = p.parent;
            }

            path.Reverse();

            return path;
        }

        private bool CheckWalls(int pointX, int pointY)
        {
            if (pointX < 0 || pointY < 0 ||
                pointX + 1 > Warcraft.MAP_SIZE ||
                pointY + 1 > Warcraft.MAP_SIZE)
                return true;

            return managerMap.WALLS.Any(i => i.TileX == pointX && i.TileY == pointY) || managerMap.FULL_MAP[pointX][pointY].tileType == Map.TileType.WATER;
        }

        private bool CheckOpen(int pointX, int pointY)
        {
            return openList.Any(i => i.x == pointX && i.y == pointY) || closeList.Any(i => i.x == pointX && i.y == pointY);
        }
    }
}


text:
<?php
namespace Procure\Infrastructure\Doctrine;

use Application\Infrastructure\AggregateRepository\AbstractDoctrineRepository;
use Procure\Application\DTO\Ap\Output\APDocRowInArray;
use Procure\Application\DTO\Ap\Output\APDocRowInExcel;
use Procure\Application\DTO\Ap\Output\APDocRowOutputStrategy;
use Procure\Application\DTO\Ap\Output\ApDocRowInOpenOffice;
use Procure\Domain\APInvoice\APDocQueryRepositoryInterface;
use Procure\Domain\APInvoice\APDocRow;
use Procure\Domain\APInvoice\APDocRowSnapshot;
use Procure\Domain\APInvoice\APDocSnapshot;
use Procure\Domain\APInvoice\Factory\APFactory;

/**
 *
 * @author Nguyen Mau Tri - ngmautri@gmail.com
 *
 */
class DoctrineAPDocQueryRepository extends AbstractDoctrineRepository implements APDocQueryRepositoryInterface
{

    public function getHeaderById($id, $token = null)
    {}

    /**
     *
     * {@inheritdoc}
     * @see \Procure\Domain\APInvoice\APDocQueryRepositoryInterface::getById()
     */
    public function getById($id, $outputStrategy = null)
    {
        if ($id == null)
            return null;

        $criteria = array(
            "id" => $id
        );

        /**
         *
         * @var \Application\Entity\FinVendorInvoice $entity ;
         */
        $entity = $this->doctrineEM->getRepository("\Application\Entity\FinVendorInvoice")->findOneBy($criteria);

        /**
         *
         * @var APDocSnapshot $snapshot ;
         */
        $snapshot = $this->createSnapshot($entity);
        if ($snapshot == null)
            return null;

        $rootEntity = APFactory::createAPDocument($snapshot->docType);
        if ($rootEntity == null)
            return null;

        $rootEntity->makeFromSnapshot($snapshot);

        $criteria = array(
            'invoice' => $entity
        );
        $sort = array();

        $rows = $this->doctrineEM->getRepository('Application\Entity\FinVendorInvoiceRow')->findBy($criteria, $sort);

        if (count($rows) == 0) {
            return $rootEntity;
        }

        switch ($outputStrategy) {
            case APDocRowOutputStrategy::OUTPUT_IN_ARRAY:
                $factory = new APDocRowInArray();
                break;
            case APDocRowOutputStrategy::OUTPUT_IN_EXCEL:
                $factory = new APDocRowInExcel();
                break;
            case APDocRowOutputStrategy::OUTPUT_IN_OPEN_OFFICE:
                $factory = new ApDocRowInOpenOffice();
                break;

            case APDocRowOutputStrategy::OUTPUT_IN_HMTL_TABLE:
                break;

            default:
                $factory = null;
                break;
        }

        foreach ($rows as $r) {

            /** @var \Application\Entity\FinVendorInvoiceRow $r */
            if ($r->getQuantity() == 0) {
                continue;
            }
            $snapshot = $this->createRowSnapshot($r);
            $line = new APDocRow();
            $line->makeFromSnapshot($snapshot);
            $rootEntity->addRow($line);

            /**
             *
             * @var APInvoiceRowOutputStrategy $factory ;
             */
            if (! $factory == null)
                $factory->createOutput($r);
        }

        if (! $factory == null){
            $rootEntity->setRowsOutput($factory->getOutput());
        }

        return $rootEntity;
    }

    public function getByUUID($uuid)
    {}

    public function findAll()
    {}

    /**
     *
     * @param \Application\Entity\FinVendorInvoice $entity
     *            ;
     *
     */
    private function createSnapshot($entity)
    {
        if ($entity == null)
            return null;

        $snapshot = new APDocSnapshot();

        // mapping referrence

        // $snapshot->createdBy= $entity->getCreatedBy();
        if ($entity->getCreatedBy() !== null) {
            $snapshot->createdBy = $entity->getCreatedBy()->getId();
        }

        // $snapshot->lastchangeBy= $entity->getLastchangeBy();
        if ($entity->getLastChangeBy() !== null) {
            $snapshot->lastChangeBy = $entity->getLastChangeBy()->getId();
        }

        // $snapshot->company= $entity->getCompany();
        if ($entity->getCompany() !== null) {
            $snapshot->company = $entity->getCompany()->getId();
        }

        // $snapshot->vendor= $entity->getVendor();
        if ($entity->getVendor() !== null) {
            $snapshot->vendor = $entity->getVendor()->getId();
        }

        // $snapshot->procureGr= $entity->getProcureGr();
        if ($entity->getProcureGr() !== null) {
            $snapshot->procureGr = $entity->getProcureGr()->getId();
        }

        // $snapshot->localCurrency= $entity->getLocalCurrency();
        if ($entity->getLocalCurrency() !== null) {
            $snapshot->localCurrency = $entity->getLocalCurrency()->getId();
        }

        // $snapshot->docCurrency= $entity->getDocCurrency();
        if ($entity->getDocCurrency() !== null) {
            $snapshot->docCurrency = $entity->getDocCurrency()->getId();
        }

        // $snapshot->postingPeriod= $entity->getPostingPeriod();
        if ($entity->getPostingPeriod() !== null) {
            $snapshot->postingPeriod = $entity->getPostingPeriod()->getId();
        }

        // $snapshot->warehouse = $entity->getWarehouse();
        if ($entity->getWarehouse() !== null) {
            $snapshot->warehouse = $entity->getWarehouse()->getId();
        }

        // $snapshot->incoterm2 = $entity->getIncoterm2();
        if ($entity->getIncoterm2() !== null) {
            $snapshot->incoterm2 = $entity->getIncoterm2()->getId();
        }

        // $snapshot->pmtTerm = $entity->getPmtTerm();
        if ($entity->getPmtTerm() !== null) {
            $snapshot->pmtTerm = $entity->getPmtTerm()->getId();
        }

        // $snapshot->currency = $entity->getCurrency();
        if ($entity->getCurrency() !== null) {
            $snapshot->currency = $entity->getCurrency()->getId();
        }

        // $snapshot->po = $entity->getPo();
        if ($entity->getPo() !== null) {
            $snapshot->po = $entity->getPo()->getId();
        }

        // $snapshot->paymentMethod = $entity->getPaymentMethod();
        if ($entity->getPaymentMethod() !== null) {
            $snapshot->paymentMethod = $entity->getPaymentMethod()->getId();
        }

        // $snapshot->inventoryGr = $entity->getInventoryGr();
        if ($entity->getInventoryGr() !== null) {
            $snapshot->inventoryGr = $entity->getInventoryGr()->getId();
        }
        // Mapping Date
        // =====================

        // $snapshot->invoiceDate = $entity->getInvoiceDate();
        if (! $entity->getInvoiceDate() == null) {
            $snapshot->invoiceDate = $entity->getInvoiceDate()->format("Y-m-d");
        }

        // $snapshot->postingDate = $entity->getPostingDate();
        if (! $entity->getPostingDate() == null) {
            $snapshot->postingDate = $entity->getPostingDate()->format("Y-m-d");
        }

        // $snapshot->createdOn = $entity->getCreatedOn();
        if (! $entity->getCreatedOn() == null) {
            $snapshot->createdOn = $entity->getCreatedOn()->format("Y-m-d");
        }

        // $snapshot->lastchangeOn = $entity->getLastchangeOn();
        if (! $entity->getLastchangeOn() == null) {
            $snapshot->lastchangeOn = $entity->getLastchangeOn()->format("Y-m-d");
        }

        // $snapshot->grDate = $entity->getGrDate();
        if (! $entity->getGrDate() == null) {
            $snapshot->grDate = $entity->getGrDate()->format("Y-m-d");
        }

        // $snapshot->reversalDate = $entity->getReversalDate();
        if (! $entity->getReversalDate() == null) {
            $snapshot->reversalDate = $entity->getReversalDate()->format("Y-m-d");
        }

        $reflectionClass = new \ReflectionClass($entity);
        $itemProperites = $reflectionClass->getProperties();

        foreach ($itemProperites as $property) {

            $property->setAccessible(true);
            $propertyName = $property->getName();

            if (! is_object($property->getValue($entity))) {

                if (property_exists($snapshot, $propertyName)) {
                    $snapshot->$propertyName = $property->getValue($entity);
                }
            }
        }

        return $snapshot;
    }

    /**
     *
     * @param object $entity
     * @return NULL|\Procure\Domain\APInvoice\APDocRowSnapshot
     */
    private function createRowSnapshot($entity)
    {
        if ($entity == null)
            return null;

        $snapshot = new APDocRowSnapshot();

        // Mapping Reference
        // =====================

        // $snapshot->invoice= $entity->getInvoice();
        if ($entity->getInvoice() !== null) {
            $snapshot->invoice = $entity->getInvoice()->getId();
        }

        // $snapshot->glAccount= $entity->getGlAccount();
        if ($entity->getGlAccount() !== null) {
            $snapshot->glAccount = $entity->getGlAccount()->getId();
        }

        // $snapshot->costCenter= $entity->getCostCenter();
        if ($entity->getCostCenter() !== null) {
            $snapshot->costCenter = $entity->getCostCenter()->getId();
        }

        // $snapshot->docUom = $entity->getDocUom();
        if ($entity->getDocUom() !== null) {
            $snapshot->docUom = $entity->getDocUom()->getId();
        }

        // $snapshot->prRow = $entity->getPrRow();
        if ($entity->getPrRow() !== null) {
            $snapshot->prRow = $entity->getPrRow()->getId();
        }

        // $snapshot->createdBy = $entity->getCreatedBy();
        if ($entity->getCreatedBy() !== null) {
            $snapshot->createdBy = $entity->getCreatedBy()->getId();
        }

        // $snapshot->warehouse = $entity->getWarehouse();
        if ($entity->getWarehouse() !== null) {
            $snapshot->warehouse = $entity->getWarehouse()->getId();
        }

        // $snapshot->lastchangeBy = $entity->getLastchangeBy();
        if ($entity->getLastchangeBy() !== null) {
            $snapshot->lastchangeBy = $entity->getLastchangeBy()->getId();
        }

        // $snapshot->poRow = $entity->getPoRow();
        if ($entity->getPoRow() !== null) {
            $snapshot->poRow = $entity->getPoRow()->getId();
        }

        // $snapshot->item = $entity->getItem();
        if ($entity->getItem() !== null) {
            $snapshot->item = $entity->getItem()->getId();
        }

        // $snapshot->grRow = $entity->getGrRow();
        if ($entity->getGrRow() !== null) {
            $snapshot->grRow = $entity->getGrRow()->getId();
        }

        // Mapping Date
        // =====================

        $snapshot->createdOn = $entity->getCreatedOn();
        $snapshot->lastchangeOn = $entity->getLastchangeOn();
        $snapshot->reversalDate = $entity->getReversalDate();

        if (! $entity->getReversalDate() == null) {
            $snapshot->reversalDate = $entity->getReversalDate()->format("Y-m-d");
        }

        if (! $entity->getCreatedOn() == null) {
            $snapshot->createdOn = $entity->getCreatedOn()->format("Y-m-d");
        }

        if (! $entity->getLastChangeOn() == null) {
            $snapshot->lastChangeOn = $entity->getLastChangeOn()->format("Y-m-d");
        }

        $reflectionClass = new \ReflectionClass($entity);
        $itemProperites = $reflectionClass->getProperties();

        foreach ($itemProperites as $property) {

            $property->setAccessible(true);
            $propertyName = $property->getName();

            if (! is_object($property->getValue($entity))) {

                if (property_exists($snapshot, $propertyName)) {
                    $snapshot->$propertyName = $property->getValue($entity);
                }
            }
        }

        return $snapshot;
    }
}


text:
module Drivers
  module Db
    class Postgresql < Base
      adapter :postgresql
      allowed_engines :postgres, :postgresql, :'aurora-postgresql'
      packages debian: 'libpq-dev', rhel: 'postgresql96-devel'
    end
  end
end


text: Feel free to ask any questions by	adding a issues. Please don't email me.


text:
<!DOCTYPE html>

    <title data-fhc-i18n="contextMenuItemManageHistory">Manage history</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="lib/jquery.dataTables.min.css"/>
    <link rel="stylesheet" href="/theme/formhistorycontrol-generic.css"/>
    <link rel="stylesheet" href="/theme/navigation.css"/>
    <link rel="stylesheet" href="theme/jquery.mCustomScrollbar.css"/>
    <link rel="stylesheet" href="theme/buttons.dataTables.css"/>
    <link rel="stylesheet" href="theme/table-theme.css"/>
    <link rel="stylesheet" href="theme/loadingstatus.css"/>
    <link rel="stylesheet" href="theme/popup-big.css"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="/theme/formhistorycontrol-generic-dark.css" data-title="Dark"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="/theme/formhistorycontrol-generic-orange.css" data-title="Orange"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="/theme/formhistorycontrol-generic-blue.css" data-title="Blue"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="/theme/navigation-dark.css" data-title="Dark"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="/theme/navigation-orange.css" data-title="Orange"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="/theme/navigation-blue.css" data-title="Blue"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="theme/table-theme-dark.css" data-title="Dark"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="theme/table-theme-orange.css" data-title="Orange"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="theme/table-theme-blue.css" data-title="Blue"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="theme/popup-dark.css" data-title="Dark"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="theme/popup-orange.css" data-title="Orange"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="theme/popup-blue.css" data-title="Blue"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="theme/loadingstatus-dark.css" data-title="Dark"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="theme/loadingstatus-orange.css" data-title="Orange"/>
    <link rel="stylesheet" class="alternate_stylesheet" href="theme/loadingstatus-blue.css" data-title="Blue"/>

Loading...

File

Import

Export

Close

Edit

Add

Modify

Delete

Copy to clipboard

Copy clean text only

Select all

Select none

Invert selection

Display

Refresh

Extra

Cleanup now

Preferences

Help

Help overview

Release Notes

About

        <button id="buttonAdd" data-fhc-i18n="buttonAdd">Add</button>
        <button id="buttonDelete" data-fhc-i18n="buttonDelete">Delete</button>
        <button id="buttonModify" data-fhc-i18n="buttonModify">Modify</button>
        <button id="buttonClose" data-fhc-i18n="buttonClose" class="button-right">Close</button>

Add

Modify

Delete

Copy to clipboard

Select all

Select none

Invert selection


text:
import os
import asyncio

import uvloop
from asyncpg import connect, create_pool

from sanic import Sanic
from sanic.response import json

DB_CONFIG = {
    'host': '<host>',
    'user': '<user>',
    'password': '<password>',
    'port': '<port>',
    'database': '<database>'
}

def jsonify(records):
    """
    Parse asyncpg record response into JSON format
    """
    return [dict(r.items()) for r in records]

app = Sanic(__name__)

@app.listener('before_server_start')
async def register_db(app, loop):
    app.pool = await create_pool(**DB_CONFIG, loop=loop, max_size=100)
    async with app.pool.acquire() as connection:
        await connection.execute('DROP TABLE IF EXISTS sanic_post')
        await connection.execute("""CREATE TABLE sanic_post (
                                id serial primary key,
                                content varchar(50),
                                post_date timestamp
                            );""")
        for i in range(0, 1000):
            await connection.execute(f"""INSERT INTO sanic_post
                (id, content, post_date) VALUES ({i}, {i}, now())""")

@app.get('/')
async def root_get(request):
    async with app.pool.acquire() as connection:
        results = await connection.fetch('SELECT * FROM sanic_post')
        return json({'posts': jsonify(results)})

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8080)


text:
package org.usfirst.frc.team2084.CMonster2015.drive;

/**
 * Represents the constants of a PID controller.
 *
 * @author Ben Wolsieffer
 */
public class PIDConstants {

    public final double p;
    public final double i;
    public final double d;
    public final double f;

    /**
     * Create new {@link PIDConstants} object with the specified constants.
     *
     * @param p the proportional constant
     * @param i the integral constant
     * @param d the differential constant
     * @param f the feed-forward constant
     */
    public PIDConstants(double p, double i, double d, double f) {
        this.p = p;
        this.i = i;
        this.d = d;
        this.f = f;
    }

    /**
     * Create new {@link PIDConstants} object with the specified constants and 0
     * for the feed-forward constant.
     *
     * @param p the proportional constant
     * @param i the integral constant
     * @param d the differential constant
     */
    public PIDConstants(double p, double i, double d) {
        this(p, i, d, 0);
    }
}


text:
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Orleans;
using Orleans.Runtime;
using UnitTests.GrainInterfaces;

namespace UnitTests.Grains
{
    [Serializable]
    [GenerateSerializer]
    public class SimplePersistentGrain_State
    {
        [Id(0)]
        public int A { get; set; }
        [Id(1)]
        public int B { get; set; }
    }

    /// <summary>
    /// A simple grain that allows to set two arguments and then multiply them.
    /// </summary>
    public class SimplePersistentGrain : Grain<SimplePersistentGrain_State>, ISimplePersistentGrain
    {
        private ILogger logger;
        private Guid version;

        public SimplePersistentGrain(ILoggerFactory loggerFactory)
        {
            this.logger = loggerFactory.CreateLogger($"{this.GetType().Name}-{this.IdentityString}");
        }

        public override Task OnActivateAsync(CancellationToken cancellationToken)
        {
            logger.LogInformation("Activate.");
            version = Guid.NewGuid();
            return base.OnActivateAsync(cancellationToken);
        }
        public Task SetA(int a)
        {
            State.A = a;
            return WriteStateAsync();
        }

        public Task SetA(int a, bool deactivate)
        {
            if(deactivate)
                DeactivateOnIdle();
            return SetA(a);
        }

        public Task SetB(int b)
        {
            State.B = b;
            return WriteStateAsync();
        }

        public Task IncrementA()
        {
            State.A++;
            return WriteStateAsync();
        }

        public Task<int> GetAxB()
        {
            return Task.FromResult(State.A*State.B);
        }

        public Task<int> GetAxB(int a, int b)
        {
            return Task.FromResult(a * b);
        }

        public Task<int> GetA()
        {
            return Task.FromResult(State.A);
        }

        public Task<Guid> GetVersion()
        {
            return Task.FromResult(version);
        }

        public Task<object> GetRequestContext()
        {
            var info = RequestContext.Get("GrainInfo");
            return Task.FromResult(info);
        }

        public Task SetRequestContext(int data)
        {
            RequestContext.Set("GrainInfo", data);
            return Task.CompletedTask;
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
University of Wyoming Publ. Sci. , Bot. 7(3): 39 (1940)

#### Original name
Septoria signalensis Solheim

### Remarks
null


text:
<?php

class Edge_Testimonials_IndexController extends Mage_Core_Controller_Front_Action
{
    /*
     * Displays the masonryJS style page
     */
    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

    public function ajaxProductsAction()
    {
        $page = Mage::app()->getRequest()->getParam('page', 0);

        $products = Mage::getModel('testimonials/testimonials')
            ->getCollection();

        $products->getSelect()->order('position', 'ASC');
        $products->getSelect()->limitPage($page, 13);

        $this->getResponse()
             ->clearHeaders()
             ->setHeader('Content-Type', 'application/json')
             ->setBody(json_encode($products->getData()));

        return;
    }
}


text:
<?php

namespace Magento\DesignEditor\Controller\Adminhtml\System\Design\Editor;

class Index extends \Magento\DesignEditor\Controller\Adminhtml\System\Design\Editor
{
    /**
     * Display the design editor launcher page
     *
     * @return void
     */
    public function execute()
    {
        if (!$this->_resolveForwarding()) {
            $this->_renderStoreDesigner();
        }
    }
}


text:
package org.apache.lucene.analysis.ja;

import java.io.IOException;
import java.io.StringReader;
import java.util.Collections;
import java.util.Map;

import org.apache.lucene.analysis.BaseTokenStreamTestCase;
import org.apache.lucene.analysis.TokenStream;

/**
 * Simple tests for {@link JapaneseBaseFormFilterFactory}
 */
public class TestJapaneseBaseFormFilterFactory extends BaseTokenStreamTestCase {
  public void testBasics() throws IOException {
    JapaneseTokenizerFactory tokenizerFactory = new JapaneseTokenizerFactory();
    tokenizerFactory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    Map<String, String> args = Collections.emptyMap();
    tokenizerFactory.init(args);
    tokenizerFactory.inform(new StringMockResourceLoader(""));
    TokenStream ts = tokenizerFactory.create(new StringReader("それはまだ実験段階にあります"));
    JapaneseBaseFormFilterFactory factory = new JapaneseBaseFormFilterFactory();
    ts = factory.create(ts);
    assertTokenStreamContents(ts,
        new String[] { "それ", "は", "まだ", "実験", "段階", "に", "ある", "ます"  }
    );
  }
}


text:
"""Ask tankerkoenig.de for petrol price information."""
from datetime import timedelta
import logging
from math import ceil

import pytankerkoenig
import voluptuous as vol

from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.const import (
    CONF_API_KEY,
    CONF_LATITUDE,
    CONF_LONGITUDE,
    CONF_RADIUS,
    CONF_SCAN_INTERVAL,
    CONF_SHOW_ON_MAP,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import async_load_platform
from homeassistant.helpers.typing import ConfigType

from .const import CONF_FUEL_TYPES, CONF_STATIONS, DOMAIN, FUEL_TYPES

_LOGGER = logging.getLogger(__name__)

DEFAULT_RADIUS = 2
DEFAULT_SCAN_INTERVAL = timedelta(minutes=30)

CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN: vol.Schema(
            {
                vol.Required(CONF_API_KEY): cv.string,
                vol.Optional(
                    CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL
                ): cv.time_period,
                vol.Optional(CONF_FUEL_TYPES, default=FUEL_TYPES): vol.All(
                    cv.ensure_list, [vol.In(FUEL_TYPES)]
                ),
                vol.Inclusive(
                    CONF_LATITUDE,
                    "coordinates",
                    "Latitude and longitude must exist together",
                ): cv.latitude,
                vol.Inclusive(
                    CONF_LONGITUDE,
                    "coordinates",
                    "Latitude and longitude must exist together",
                ): cv.longitude,
                vol.Optional(CONF_RADIUS, default=DEFAULT_RADIUS): vol.All(
                    cv.positive_int, vol.Range(min=1)
                ),
                vol.Optional(CONF_STATIONS, default=[]): vol.All(
                    cv.ensure_list, [cv.string]
                ),
                vol.Optional(CONF_SHOW_ON_MAP, default=True): cv.boolean,
            }
        )
    },
    extra=vol.ALLOW_EXTRA,
)

async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
    """Set the tankerkoenig component up."""
    if DOMAIN not in config:
        return True

    conf = config[DOMAIN]

    _LOGGER.debug("Setting up integration")

    tankerkoenig = TankerkoenigData(hass, conf)

    latitude = conf.get(CONF_LATITUDE, hass.config.latitude)
    longitude = conf.get(CONF_LONGITUDE, hass.config.longitude)
    radius = conf[CONF_RADIUS]
    additional_stations = conf[CONF_STATIONS]

    setup_ok = await hass.async_add_executor_job(
        tankerkoenig.setup, latitude, longitude, radius, additional_stations
    )
    if not setup_ok:
        _LOGGER.error("Could not setup integration")
        return False

    hass.data[DOMAIN] = tankerkoenig

    hass.async_create_task(
        async_load_platform(
            hass,
            SENSOR_DOMAIN,
            DOMAIN,
            discovered=tankerkoenig.stations,
            hass_config=conf,
        )
    )

    return True

class TankerkoenigData:
    """Get the latest data from the API."""

    def __init__(self, hass, conf):
        """Initialize the data object."""
        self._api_key = conf[CONF_API_KEY]
        self.stations = {}
        self.fuel_types = conf[CONF_FUEL_TYPES]
        self.update_interval = conf[CONF_SCAN_INTERVAL]
        self.show_on_map = conf[CONF_SHOW_ON_MAP]
        self._hass = hass

    def setup(self, latitude, longitude, radius, additional_stations):
        """Set up the tankerkoenig API.

        Read the initial data from the server, to initialize the list of fuel stations to monitor.
        """
        _LOGGER.debug("Fetching data for (%s, %s) rad: %s", latitude, longitude, radius)
        try:
            data = pytankerkoenig.getNearbyStations(
                self._api_key, latitude, longitude, radius, "all", "dist"
            )
        except pytankerkoenig.customException as err:
            data = {"ok": False, "message": err, "exception": True}
        _LOGGER.debug("Received data: %s", data)
        if not data["ok"]:
            _LOGGER.error(
                "Setup for sensors was unsuccessful. Error occurred while fetching data from tankerkoenig.de: %s",
                data["message"],
            )
            return False

        # Add stations found via location + radius
        if not (nearby_stations := data["stations"]):
            if not additional_stations:
                _LOGGER.error(
                    "Could not find any station in range."
                    "Try with a bigger radius or manually specify stations in additional_stations"
                )
                return False
            _LOGGER.warning(
                "Could not find any station in range. Will only use manually specified stations"
            )
        else:
            for station in nearby_stations:
                self.add_station(station)

        # Add manually specified additional stations
        for station_id in additional_stations:
            try:
                additional_station_data = pytankerkoenig.getStationData(
                    self._api_key, station_id
                )
            except pytankerkoenig.customException as err:
                additional_station_data = {
                    "ok": False,
                    "message": err,
                    "exception": True,
                }

            if not additional_station_data["ok"]:
                _LOGGER.error(
                    "Error when adding station %s:\n %s",
                    station_id,
                    additional_station_data["message"],
                )
                return False
            self.add_station(additional_station_data["station"])
        if len(self.stations) > 10:
            _LOGGER.warning(
                "Found more than 10 stations to check. "
                "This might invalidate your api-key on the long run. "
                "Try using a smaller radius"
            )
        return True

    async def fetch_data(self):
        """Get the latest data from tankerkoenig.de."""
        _LOGGER.debug("Fetching new data from tankerkoenig.de")
        station_ids = list(self.stations)

        prices = {}

        # The API seems to only return at most 10 results, so split the list in chunks of 10
        # and merge it together.
        for index in range(ceil(len(station_ids) / 10)):
            data = await self._hass.async_add_executor_job(
                pytankerkoenig.getPriceList,
                self._api_key,
                station_ids[index * 10 : (index + 1) * 10],
            )

            _LOGGER.debug("Received data: %s", data)
            if not data["ok"]:
                _LOGGER.error(
                    "Error fetching data from tankerkoenig.de: %s", data["message"]
                )
                raise TankerkoenigError(data["message"])
            if "prices" not in data:
                _LOGGER.error("Did not receive price information from tankerkoenig.de")
                raise TankerkoenigError("No prices in data")
            prices.update(data["prices"])
        return prices

    def add_station(self, station: dict):
        """Add fuel station to the entity list."""
        station_id = station["id"]
        if station_id in self.stations:
            _LOGGER.warning(
                "Sensor for station with id %s was already created", station_id
            )
            return

        self.stations[station_id] = station
        _LOGGER.debug("add_station called for station: %s", station)

class TankerkoenigError(HomeAssistantError):
    """An error occurred while contacting tankerkoenig.de."""


text:
/*
  The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this:
  (you may want to display this pattern in a fixed font for better legibility)

  P   A   H   N
  A P L S I I G
  Y   I   R
  And then read line by line: "PAHNAPLSIIGYIR"

  Write the code that will take a string and make this conversion given a number of rows:

  string convert(string s, int numRows);
  Example 1:

  Input: s = "PAYPALISHIRING", numRows = 3
  Output: "PAHNAPLSIIGYIR"
  Example 2:

  Input: s = "PAYPALISHIRING", numRows = 4
  Output: "PINALSIGYAHRPI"
  Explanation:

  P     I    N
  A   L S  I G
  Y A   H R
  P     I
*/

const convert = (str, rows) => {
  if (rows === 1) {
    return str;
  }

  let mainIndex = 0;
  let isEven = true;
  const ans = [];

  for (let i = 0; i < rows; i += 1) {
    ans[i] = [];
  }

  while (mainIndex < str.length) {
    if (isEven) {
      for (let firstInner = 0; firstInner < rows; firstInner += 1) {
        if (!str[mainIndex]) {
          break;
        }
        ans[firstInner].push(str[mainIndex]);
        mainIndex += 1;
      }

      isEven = false;
      continue;
    }

    if (rows < 3) {
      isEven = true;
      continue;
    }

    for (let secondInner = rows - 2; secondInner >= 1; secondInner -= 1) {
      if (!str[mainIndex]) {
        break;
      }

      ans[secondInner].push(str[mainIndex]);
      mainIndex += 1;
    }

    isEven = true;
  }

  return ans.reduce((accum, next) => accum + next.join(''), '');
};

console.log(convert('A', 1) === 'A');
console.log(convert('ABC', 2) === 'ACB');
console.log(convert('AB', 2) === 'AB');
console.log(convert('AB', 1) === 'AB');
console.log(convert('ABCDEF', 4) === 'ABFCED');
console.log(convert('PAYPALISHIRING', 3) === 'PAHNAPLSIIGYIR');
console.log(convert('PAYPALISHIRING', 4) === 'PINALSIGYAHRPI');


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<resources>
    <style name="Theme.Chromium.TabbedMode" parent="Base.Theme.Chromium.TabbedMode">
        <item name="android:statusBarColor">@android:color/black</item>
        <item name="android:windowLightStatusBar">false</item>
    </style>

    <style name="Theme.Chromium.Settings" parent="Base.Theme.Chromium.Settings">
        <item name="android:statusBarColor">@android:color/black</item>
        <item name="android:windowLightStatusBar">false</item>
    </style>
</resources>