public PayrollItem searchPayrollItemById(string itemId) { string sqlStr = dbUtil.getSqlStatement("SQL_Payroll_PayrollItem_SearchById"); SqlParameter[] sqlParms = { new SqlParameter("@ItemId",SqlDbType.VarChar,20) }; sqlParms[0].Value = itemId; try { DataSet resultSet = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(resultSet)) { PayrollItem item = new PayrollItem(); item.ItemId = resultSet.Tables[0].Rows[0]["ItemId"].ToString(); item.ItemName = resultSet.Tables[0].Rows[0]["ItemName"].ToString(); item.SystemItem = Convert.ToBoolean(resultSet.Tables[0].Rows[0]["SystemItem"]); item.Unit = Convert.ToInt32(resultSet.Tables[0].Rows[0]["Unit"]); item.WageBonus = Convert.ToInt32(resultSet.Tables[0].Rows[0]["WageBonus"]); item.Group = Convert.ToInt32(resultSet.Tables[0].Rows[0]["ItemGroup"]); item.CalcMethod = Convert.ToInt32(resultSet.Tables[0].Rows[0]["CalcMethod"]); item.Minus = Convert.ToBoolean(resultSet.Tables[0].Rows[0]["Minus"]); item.Fomula = resultSet.Tables[0].Rows[0]["Fomula"].ToString(); return item; } return null; } catch (Exception ex) { throw new DAOException("E0001", ex); } }
public Commodity searchComdByComdID(string strComdID) { Commodity comd = new Commodity(); string sqlStr = dbUtil.getSqlStatement("SQL_Comd_SearchByComdID"); SqlParameter[] sqlParms = { new SqlParameter("@ComdID",SqlDbType.VarChar,20) }; sqlParms[0].Value = strComdID; DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(searchResult)) { comd.ComdID = searchResult.Tables[0].Rows[0]["ComdID"].ToString(); comd.ComdName = searchResult.Tables[0].Rows[0]["ComdName"].ToString(); comd.ComdStandard = searchResult.Tables[0].Rows[0]["ComdStandard"].ToString(); comd.Unit = searchResult.Tables[0].Rows[0]["Unit"].ToString(); comd.Description = searchResult.Tables[0].Rows[0]["Description"].ToString(); comd.Manufacturer = searchResult.Tables[0].Rows[0]["Manufacturer"].ToString(); comd.DeleteFLG = (bool)searchResult.Tables[0].Rows[0]["DeleteFLG"]; } } catch (Exception ex) { throw new DAOException("E0001"); } return comd; }
public CommodityPrice SearchComdPriceBySaleEmpID(string strComdID, string strSaleEmpID) { CommodityPrice commodityPrice = new CommodityPrice(); string sqlStr = dbUtil.getSqlStatement("SQL_Comd_Price_SearchBySaleEmpID"); SqlParameter[] sqlParms = { new SqlParameter("@ComdID",SqlDbType.VarChar,20), new SqlParameter("@EmpID",SqlDbType.VarChar,20) }; sqlParms[0].Value = strComdID; sqlParms[1].Value = strSaleEmpID; DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(searchResult)) { commodityPrice.ComdID = searchResult.Tables[0].Rows[0]["ComdID"].ToString(); commodityPrice.PriceTypeID = searchResult.Tables[0].Rows[0]["PriceTypeID"].ToString(); commodityPrice.PriceTypeName = searchResult.Tables[0].Rows[0]["PriceTypeName"].ToString(); commodityPrice.Price = Convert.ToSingle(searchResult.Tables[0].Rows[0]["Price"]); commodityPrice.PriceType_KBN = Convert.ToInt32(searchResult.Tables[0].Rows[0]["PriceTypeKBN"]); } } catch (Exception ex) { throw new DAOException("E0001"); } return commodityPrice; }
public PurchaseParent SearchPurchaseParentByOrderID(string strPurchaseOrderID) { PurchaseParent purchaseParent = new PurchaseParent(); string sqlStr = dbUtil.getSqlStatement("SQL_Comd_PurchaseParent_SearchByOrderID"); SqlParameter[] sqlParms = { new SqlParameter("@PurchaseOrderID",SqlDbType.VarChar,20) }; sqlParms[0].Value = strPurchaseOrderID; DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(searchResult)) { purchaseParent.OrderId = searchResult.Tables[0].Rows[0]["PurchaseOrderID"].ToString(); purchaseParent.Supplier = searchResult.Tables[0].Rows[0]["SupplierID"].ToString(); purchaseParent.PurchaseEmpId = searchResult.Tables[0].Rows[0]["PurchaseEmpID"].ToString(); purchaseParent.PurEmpName = searchResult.Tables[0].Rows[0]["PurchaseEmpName"].ToString(); if (searchResult.Tables[0].Rows[0]["PurchaseDate"].ToString() == string.Empty) { purchaseParent.PurchaseDate = DateTime.MinValue; } else { purchaseParent.PurchaseDate = DateTime.Parse(searchResult.Tables[0].Rows[0]["PurchaseDate"].ToString()); } purchaseParent.StatusKBN = (int)searchResult.Tables[0].Rows[0]["StatusKBN"]; purchaseParent.ReceivingFLG = (bool)searchResult.Tables[0].Rows[0]["ReceivingFLG"]; purchaseParent.PaymentFLG = (bool)searchResult.Tables[0].Rows[0]["PaymentFLG"]; purchaseParent.Remark = searchResult.Tables[0].Rows[0]["Remark"].ToString(); } } catch (Exception ex) { throw new DAOException("E0001"); } return purchaseParent; }
/// <summary> /// ���ҷ���ID�IJ��š� /// ���Ҳ���������null. /// </summary> /// <param name="deptId"></param> /// <returns></returns> public Department searchDeptByDeptID(string deptId) { string sqlStr = dbUtil.getSqlStatement("SQL_Dept_SearchByDeptID"); SqlParameter[] sqlParms = { new SqlParameter("@DeptID",SqlDbType.VarChar,20) }; sqlParms[0].Value = deptId; DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (utilService.isNullDataset(searchResult)) { return null; } Department dept = new Department(); DataRowToDept(searchResult.Tables[0].Rows[0], dept); return dept; } catch (Exception ex) { throw new DAOException("E0001", ex); } }
public Company getCompany() { string sqlStr = dbUtil.getSqlStatement("SQL_COMP_GetCompany"); DataSet resultSet = null; try { Company comp = new Company(); resultSet = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, null); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(resultSet)) { DataRow dr = resultSet.Tables[0].Rows[0]; comp.Name = dr["Name"].ToString(); comp.TelNum = dr["TelNum"].ToString(); comp.Legal = dr["Legal"].ToString(); comp.Address = dr["Addr"].ToString(); comp.ZipCode = dr["ZipCode"].ToString(); comp.IndowRate = Convert.ToDouble(dr["IndowRate"]); comp.Medicalrate = Convert.ToDouble(dr["Medicalrate"]); comp.UnEmpRate = Convert.ToDouble(dr["UnEmpRate"]); comp.EmpInjuryRate = Convert.ToDouble(dr["EmpInjuryRate"]); comp.HouseRate = Convert.ToDouble(dr["HouseRate"]); comp.TaxStart = Convert.ToDouble(dr["TaxStart"]); } return comp; } catch (Exception ex) { throw new DAOException("E0001", ex); } }
public EmpType searchEmpTypeByEmpTypeID(string strEmpTypeID) { string sqlStr = dbUtil.getSqlStatement("SQL_Emp_EmpType_SearchByEmpTypeID"); SqlParameter[] sqlParms = { new SqlParameter("@EmpTypeID",SqlDbType.VarChar,20) }; sqlParms[0].Value = strEmpTypeID; try { EmpType et = new EmpType(); DataSet searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(searchResult)) { et.EmpTypeID = searchResult.Tables[0].Rows[0]["ID"].ToString(); et.Name = searchResult.Tables[0].Rows[0]["Name"].ToString(); et.Description = searchResult.Tables[0].Rows[0]["Description"].ToString(); } return et; } catch (Exception ex) { throw new DAOException("E0001", ex); } }
public Employee searchEmpByEmpId(string strEmpID) { string sqlStr = dbUtil.getSqlStatement("SQL_Emp_SearchByEmpId"); SqlParameter[] sqlParms = { new SqlParameter("@EmpID",SqlDbType.VarChar,20) }; sqlParms[0].Value = strEmpID; try { DataSet resultSet = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(resultSet)) { Employee emp = new Employee(); DataRowToEmployee(resultSet.Tables[0].Rows[0], emp); return emp; } return null; } catch (Exception ex) { throw new DAOException("E0001", ex); } }