예제 #1
0
        private void loadQuotaionDetails(string quotationNo)
        {
            QuotationController quotationController = new QuotationController();

            QuotationMain quotationMain = new QuotationMain();

            quotationMain = quotationController.GetQuotationMainDetails(quotationNo);



            hdnJobID.Value = quotationMain.JobId.ToString();

            lblQuotationNo.Text = quotationMain.QuotationNo;
            txtRequestedBy.Text = quotationMain.RequestBy;
            txtClientName.Text  = quotationMain.ClientName;
            txtVehicleNo.Text   = quotationMain.VehicleChasisNo;
            ddlVehicleRiskType.SelectedValue = quotationMain.RiskTypeId;
            loadVoluntary(ddlVehicleRiskType.SelectedItem.ToString());

            string riskType = "0";

            riskType = quotationMain.RiskTypeId;
            if (riskType != "0")
            {
                loadVehicleTypes(riskType);
                ddlVehicleType.SelectedValue = quotationMain.VehicleTypeId;
            }


            string vehicleType = "0";

            vehicleType = quotationMain.VehicleTypeId;


            if (riskType != "0" && vehicleType != "0")
            {
                loadVehicleUsages(riskType, vehicleType);
                ddlUsage.SelectedValue = quotationMain.VehicleClassId;
            }



            txtSumInsured.Text           = quotationMain.SumInsured;
            ddlPeriodTypes.SelectedValue = quotationMain.PeriodTypeCode;


            string periodType = quotationMain.PeriodTypeCode;

            if (periodType != "0")
            {
                loadPeriods(periodType);
                ddlPeriodOfCover.SelectedValue = quotationMain.PeriodCode;
            }



            ddlAgentOrBroker.SelectedValue = quotationMain.AgentBroker;
            ddlLeasingType.SelectedValue   = quotationMain.LeasingType;
            ddlFuelType.SelectedValue      = quotationMain.FuelTypeCode;

            loadProducts();
            ddlProduct.SelectedValue = quotationMain.ProductCode;


            hdnBranch.Value = quotationMain.BranchId;
            txtRemarks.Text = quotationMain.Remark;

            hdnRevisionID.Value = quotationMain.RevisionNo.ToString();

            txtAgentOrBrokerCode.Text = quotationMain.AgentBrokerCode;


            loadSavedQuotationCovers(quotationMain.JobId.ToString(), quotationMain.RevisionNo.ToString());
            getCalculatedTotalPremium(quotationMain.JobId.ToString(), quotationMain.RevisionNo.ToString());
        }
예제 #2
0
        public QuotationMain GetQuotationMainDetails(string quotationNo)
        {
            OracleConnection  con = new OracleConnection(connectionString);
            OracleDataAdapter da  = new OracleDataAdapter();
            string            sql = "";

            if (quotationNo.Substring(5, 1) == "T" || quotationNo.Substring(5, 1) == "t")
            {
                sql = "   SELECT " +
                      "MM.JOB_ID             ," +       //0
                      "MM.QUOTATION_NO      ," +        //1
                      "MM.REQUEST_BY        ," +        //2
                      "MM.CLIENT_NAME       ," +        //3
                      "MM.VEHICLE_CHASIS_NO ," +        //4
                      "MM.RISK_TYPE_ID 		,"+             //5
                      "MM.VEHICLE_TYPE_ID   ," +        //6
                      "MM.VEHICLE_CLASS_ID  ," +        //7
                      "MM.SUM_INSURED       ," +        //8
                      "MM.PERIOD_TYPE_CODE  ," +        //9
                      "MM.PERIOD_CODE		,"+             //10
                      "MM.AGENT_BROKER      ," +        //11
                      "MM.LEASING_TYPE      ," +        //12
                      "MM.FUEL_TYPE_CODE	,"+             //13
                      "MM.PRODUCT_CODE		,"+             //14
                      "MM.BRANCH_ID         ," +        //15
                      "MM.REMARK            ," +        //16
                      "MM.REQUEST_DATE      ," +        //17
                      "MM.STATUS            ," +        //18
                      "MM.USER_ID           ," +        //19
                      "MM.REVISION_NO		,"+             //20
                      "MM.QUOT_YEAR         ," +        //21
                      "MM.AGENT_BROKER_CODE         " + //22
                      " FROM MNBQ_T_MAIN MM  " +
                      " WHERE MM.QUOTATION_NO=:V_QUOTATION_NO";
            }
            else
            {
                sql = "   SELECT " +
                      "MM.JOB_ID             ," +          //0
                      "MM.QUOTATION_NO      ," +           //1
                      "MM.REQUEST_BY        ," +           //2
                      "MM.CLIENT_NAME       ," +           //3
                      "MM.VEHICLE_CHASIS_NO ," +           //4
                      "MM.RISK_TYPE_ID 		,"+                     //5
                      "MM.VEHICLE_TYPE_ID   ," +           //6
                      "MM.VEHICLE_CLASS_ID  ," +           //7
                      "MM.SUM_INSURED       ," +           //8
                      "MM.PERIOD_TYPE_CODE  ," +           //9
                      "MM.PERIOD_CODE		,"+                     //10
                      "MM.AGENT_BROKER      ," +           //11
                      "MM.LEASING_TYPE      ," +           //12
                      "MM.FUEL_TYPE_CODE	,"+             //13
                      "MM.PRODUCT_CODE		,"+                     //14
                      "MM.BRANCH_ID         ," +           //15
                      "MM.REMARK            ," +           //16
                      "MM.REQUEST_DATE      ," +           //17
                      "MM.STATUS            ," +           //18
                      "MM.USER_ID           ," +           //19
                      "MM.REVISION_NO		,"+                     //20
                      "MM.QUOT_YEAR         ," +           //21
                      "MM.AGENT_BROKER_CODE         " +    //22
                      " FROM MNBQ_MAIN MM  " +
                      " WHERE MM.QUOTATION_NO=:V_QUOTATION_NO";
            }
            OracleCommand cmd = new OracleCommand(sql, con);

            cmd.Parameters.Add(new OracleParameter("V_QUOTATION_NO", quotationNo));


            da.SelectCommand = cmd;


            try
            {
                con.Open();
                OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SingleRow);

                // Check if the query returned a record.
                if (!reader.HasRows)
                {
                    return(null);
                }

                // Get the first row.
                reader.Read();


                QuotationMain quotationMain = new QuotationMain(Convert.ToInt32(reader["JOB_ID"].ToString()),
                                                                reader["QUOTATION_NO"].ToString(),
                                                                reader["REQUEST_BY"].ToString(),
                                                                reader["CLIENT_NAME"].ToString(),
                                                                reader["VEHICLE_CHASIS_NO"].ToString(),
                                                                reader["RISK_TYPE_ID"].ToString(),
                                                                reader["VEHICLE_TYPE_ID"].ToString(),
                                                                reader["VEHICLE_CLASS_ID"].ToString(),
                                                                reader["SUM_INSURED"].ToString(),
                                                                reader["PERIOD_TYPE_CODE"].ToString(),
                                                                reader["PERIOD_CODE"].ToString(),
                                                                reader["AGENT_BROKER"].ToString(),
                                                                reader["LEASING_TYPE"].ToString(),
                                                                reader["FUEL_TYPE_CODE"].ToString(),
                                                                reader["PRODUCT_CODE"].ToString(),
                                                                reader["BRANCH_ID"].ToString(),
                                                                reader["REMARK"].ToString(),
                                                                reader["REQUEST_DATE"].ToString(),
                                                                reader["STATUS"].ToString(),
                                                                reader["USER_ID"].ToString(),
                                                                Convert.ToInt32(reader["REVISION_NO"].ToString()),
                                                                reader["QUOT_YEAR"].ToString(),
                                                                reader["AGENT_BROKER_CODE"].ToString());



                reader.Close();
                return(quotationMain);
            }
            catch (Exception err)
            {
                throw new ApplicationException("Data error.");
            }
            finally
            {
                con.Close();
            }
        }