コード例 #1
0
        public AssessmentLabour(String argConnection, Int32 argAssessmentLabourId)
        {
            mConnection = argConnection;
            string        pstrSql = "SELECT * FROM AssessmentLabour WHERE AssessmentLabourId=" + argAssessmentLabourId;
            SqlDataReader dr      = SqlHelper.ExecuteReader(Connection, CommandType.Text, pstrSql);

            if (dr.Read())
            {
                mAssessmentLabourId = (System.Int32)dr["AssessmentLabourId"];
                mAssessment         = new Assessment(Connection, (int)dr["AssessmentId"]);
                mSrNo         = (System.String)dr["SrNo"];
                mClaimId      = (System.Int32)dr["ClaimId"];
                mDescClaimed  = dr["DescClaimed"].GetType() == typeof(System.DBNull) ? "" : (System.String)dr["DescClaimed"];
                mClaimed      = (System.Double)dr["Claimed"];
                mPart         = new Part(Connection, (int)dr["PartId"]);
                mDescAssessed = dr["DescAssessed"].GetType() == typeof(System.DBNull) ? "" : (System.String)dr["DescAssessed"];
                mAssessedRR   = (System.Double)dr["AssessedRR"];
                mAssessedDB   = (System.Double)dr["AssessedDB"];
                mPaintType    = new PaintType(Connection, (int)dr["PaintTypeId"]);
                mAssessedPT   = (System.Double)dr["AssessedPT"];
                mNetAssessed  = System.Double.Parse(dr["NetAssessed"].ToString());
                mWorkshop     = new Workshop(Connection, dr.GetInt32(dr.GetOrdinal("WorkshopId")));
                mEstimate     = new Estimate(Connection, dr.GetInt32(dr.GetOrdinal("EstimateId")));
            }
            else
            {
                Exception ex = new Exception("Identifier does not exist.");
                ex.Source = "AssessmentLabour.AssessmentLabour()";
                throw ex;
            }
            dr.Close();
        }
コード例 #2
0
        public string Transaction(enumDBTransaction argTransactionType)
        {
            try
            {
                enumDBTransaction pTransactionType = argTransactionType;
                if (pTransactionType == enumDBTransaction.spAdd)
                {
                    mVehicleId = this.Identity.New();
                }

                if (PaintType.PaintTypeId == 0)
                {
                    PaintType = new PaintType(Connection, -1);
                }
                SqlParameter[] parrSP = new SqlParameter[26];

                parrSP[0]  = new SqlParameter("@Action", pTransactionType);
                parrSP[1]  = new SqlParameter("@VehicleId", VehicleId);
                parrSP[2]  = new SqlParameter("@RegistrationNo", RegistrationNo);
                parrSP[3]  = new SqlParameter("@DtRegistration", DtRegistration);
                parrSP[4]  = new SqlParameter("@DtPurchase", DtPurchase);
                parrSP[5]  = new SqlParameter("@RegisteredOwner", RegisteredOwner);
                parrSP[6]  = new SqlParameter("@ModelVersionId", ModelVersion.ModelVersionId);
                parrSP[7]  = new SqlParameter("@TypeOfBody", TypeOfBody);
                parrSP[8]  = new SqlParameter("@ClassOfVehice", ClassOfVehice);
                parrSP[9]  = new SqlParameter("@PreAccidentCondition", PreAccidentCondition);
                parrSP[10] = new SqlParameter("@RegisteredLadenWeight", RegisteredLadenWeight);
                parrSP[11] = new SqlParameter("@UnladenWeight", UnladenWeight);
                parrSP[12] = new SqlParameter("@FitnessCertificateNo", FitnessCertificateNo);
                parrSP[13] = new SqlParameter("@DtValidFitnessCertificate", DtValidFitnessCertificate);
                parrSP[14] = new SqlParameter("@DtTaxPaidUpto", DtTaxPaidUpto);
                parrSP[15] = new SqlParameter("@RoutePermitNo", RoutePermitNo);
                parrSP[16] = new SqlParameter("@DtValidRoutePermit", DtValidRoutePermit);
                parrSP[17] = new SqlParameter("@TypeOfPermit", TypeOfPermit);
                parrSP[18] = new SqlParameter("@RouteArea", RouteArea);
                parrSP[19] = new SqlParameter("@StatusRC", StatusRC);
                parrSP[20] = new SqlParameter("@PaintTypeId", PaintType.PaintTypeId);
                parrSP[21] = new SqlParameter("@ChassisNo", ChassisNo);
                parrSP[22] = new SqlParameter("@EngineNo", EngineNo);
                parrSP[23] = new SqlParameter("@IDV", IDV);
                parrSP[24] = new SqlParameter("@DtRegistrationRemarks", DtRegistrationRemarks);
                parrSP[25] = new SqlParameter("@DoPrintDOP", DoPrintDOP);

                SqlHelper.ExecuteNonQuery(Connection, CommandType.StoredProcedure, "uspVehicle", parrSP);
                return(null);
            }
            catch (Exception ex)
            {
                //OSN.Generic.EventLogHelper appLog = new OSN.Generic.EventLogHelper();
                //appLog.Source = "Communique";
                //StringBuilder sb = new StringBuilder();
                //sb.Append("public bool Transaction(enumDBTransaction argTransactionType)");
                //sb.Append("Exception=" + ex.Message);
                //appLog.WriteEntry(sb.ToString());
                return(ex.ToString());
            }
        }
コード例 #3
0
        public Vehicle(String argConnection, Int32 argVehicleId)
        {
            mConnection = argConnection;
            string        pstrSql = "SELECT * FROM Vehicle WHERE VehicleId=" + argVehicleId;
            SqlDataReader dr      = SqlHelper.ExecuteReader(Connection, CommandType.Text, pstrSql);

            if (dr.Read())
            {
                mVehicleId                 = (System.Int32)dr["VehicleId"];
                mRegistrationNo            = (System.String)dr["RegistrationNo"];
                mDtRegistration            = (System.DateTime)dr["DtRegistration"];
                mDtPurchase                = (System.DateTime)dr["DtPurchase"];
                mRegisteredOwner           = (System.String)dr["RegisteredOwner"];
                mModelVersion              = new ModelVersion(Connection, (int)dr["ModelVersionId"]);
                mTypeOfBody                = (System.String)dr["TypeOfBody"];
                mClassOfVehice             = (System.String)dr["ClassOfVehice"];
                mPreAccidentCondition      = (System.String)dr["PreAccidentCondition"];
                mRegisteredLadenWeight     = (System.Single)dr["RegisteredLadenWeight"];
                mUnladenWeight             = (System.Single)dr["UnladenWeight"];
                mFitnessCertificateNo      = (System.String)dr["FitnessCertificateNo"];
                mDtValidFitnessCertificate = (System.DateTime)dr["DtValidFitnessCertificate"];
                mDtTaxPaidUpto             = (System.DateTime)dr["DtTaxPaidUpto"];
                mRoutePermitNo             = (System.String)dr["RoutePermitNo"];
                mDtValidRoutePermit        = (System.DateTime)dr["DtValidRoutePermit"];
                mTypeOfPermit              = (System.String)dr["TypeOfPermit"];
                mRouteArea                 = (System.String)dr["RouteArea"];
                mStatusRC              = (System.String)dr["StatusRC"];
                mPaintType             = new PaintType(Connection, (System.Int32)dr["PaintTypeId"]);
                mChassisNo             = dr["ChassisNo"].ToString();
                mEngineNo              = dr["EngineNo"].ToString();
                mIDV                   = dr["IDV"].ToString();
                mDtRegistrationRemarks = dr["DtRegistrationRemarks"].ToString();
                mDoPrintDOP            = dr.GetBoolean(dr.GetOrdinal("DoPrintDOP"));
            }
            else
            {
                Exception ex = new Exception("Identifier does not exist.");
                ex.Source = "Vehicle.Vehicle()";
                throw ex;
            }
            dr.Close();
        }
コード例 #4
0
        public LabourSchdPT(String argConnection, Int32 argLabourSchdPTId)
        {
            mConnection = argConnection;
            string        pstrSql = "SELECT * FROM LabourSchdPT WHERE LabourSchdPTId=" + argLabourSchdPTId;
            SqlDataReader dr      = SqlHelper.ExecuteReader(Connection, CommandType.Text, pstrSql);

            if (dr.Read())
            {
                mLabourSchdPTId = (System.Int32)dr["LabourSchdPTId"];
                mPart           = new Part(Connection, (int)dr["PartId"]);
                mPaintType      = new PaintType(Connection, (int)dr["PaintTypeId"]);
                mRate           = (System.Double)dr["Rate"];
            }
            else
            {
                Exception ex = new Exception("Identifier does not exist.");
                ex.Source = "LabourSchdPT.LabourSchdPT()";
                throw ex;
            }
            dr.Close();
        }