コード例 #1
0
    protected void SaveData()
    {
        try
        {
            if (Session["CPID"] != null)
            {
                string Vessel_Opening_Date = "";
                string LayCanStartDate     = "";
                string LayCanEndDate       = "";
                string Delivery_Date       = "";
                string ReDelivery_Date     = "";
                string Laycan             = "";
                double HireRate           = 0.00;
                double AddressComm        = 0.00;
                double BrokerageComm      = 0.00;
                double BrokerageComm2     = 0.00;
                double BrokerageComm3     = 0.00;
                string Billing_Cycle_Type = ddlSpreadByInterval.SelectedItem.Text;
                int    msg = 0;
                CPID = Convert.ToInt32(Session["CPID"]);
                if (txtCurrentHireRate.Text != "")
                {
                    HireRate = Convert.ToDouble(txtCurrentHireRate.Text);
                }
                if (txtAddressCommision.Text != "")
                {
                    AddressComm = Convert.ToDouble(txtAddressCommision.Text);
                }
                if (txtBrokCommision.Text != "")
                {
                    BrokerageComm = Convert.ToDouble(txtBrokCommision.Text);
                }
                if (txtBrokCommision2.Text != "")
                {
                    BrokerageComm2 = Convert.ToDouble(txtBrokCommision2.Text);
                }
                if (txtBrokCommision3.Text != "")
                {
                    BrokerageComm3 = Convert.ToDouble(txtBrokCommision3.Text);
                }
                double Redelivery_Notice_Days = Convert.ToDouble(txtRedeliveryDays.Text);
                if (dtOP.Text != "")
                {
                    Vessel_Opening_Date = AddHourMin(dtOP.Text, ddlOpeningHours.SelectedValue, ddlOpeningMins.SelectedValue);
                }
                if (dtdelivery.Text != "")
                {
                    Delivery_Date = AddHourMin(dtdelivery.Text, ddlDeliveryPortHour.SelectedValue, ddlDeliveryPortMin.SelectedValue);
                }
                if (dtRedelivery.Text != "")
                {
                    ReDelivery_Date = AddHourMin(dtRedelivery.Text, ddlRedeliveryHour.SelectedValue, ddlRedeliveryMin.SelectedValue);
                }
                if (dtLayCanStart.Text != "")
                {
                    LayCanStartDate = AddHourMin(dtLayCanStart.Text, ddlLayCanStartHours.SelectedValue, ddlLayCanStartMins.SelectedValue);
                }
                if (dtLayCanEnd.Text != "")
                {
                    LayCanEndDate = AddHourMin(dtLayCanEnd.Text, ddlLayCanEndHours.SelectedValue, ddlLayCanEndMins.SelectedValue);
                }
                if (CPID != 0)
                {
                    msg = oCP.UPD_CharterParty(CPID, UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), ddlCharterer.SelectedValue, ddlOwner.SelectedValue, ddlBroker.SelectedValue,
                                               ddlBroker2.SelectedValue, ddlBroker3.SelectedValue, UDFLib.ConvertDateToNull(Vessel_Opening_Date), UDFLib.ConvertIntegerToNull(ddlPort.SelectedValue), txtDeliveryPort.Text,
                                               txtRedeliveryPort.Text,
                                               ddlDeliveryLTGMT.SelectedValue, ddlReDeliveryLTGMT.SelectedValue, UDFLib.ConvertDateToNull(Delivery_Date), UDFLib.ConvertDateToNull(ReDelivery_Date), UDFLib.ConvertDateToNull(dtCP.Text),
                                               UDFLib.ConvertIntegerToNull(ddlCPType.SelectedValue), UDFLib.ConvertIntegerToNull(ddlStatus.SelectedValue), Laycan, txtGMTTimeZone.Text, UDFLib.ConvertDateToNull(LayCanStartDate),
                                               UDFLib.ConvertDateToNull(LayCanEndDate), txtHireTerms.Text, txtCommisionTerms.Text, HireRate, AddressComm, txtBillingCycle.Text, Billing_Cycle_Type, txtSpreadBy.Text, BrokerageComm,
                                               BrokerageComm2, BrokerageComm3, ddlBrokPayment.SelectedValue, ddlBrokPayment2.SelectedValue, ddlBrokPayment3.SelectedValue,
                                               UDFLib.ConvertIntegerToNull(ddlHireType.SelectedValue), ddlOwnerBank.SelectedValue, Redelivery_Notice_Days, UDFLib.ConvertToInteger(Session["UserID"].ToString()));
                }
                else
                {
                    int RetValue = oCP.Ins_CharterParty(UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), ddlCharterer.SelectedValue, ddlOwner.SelectedValue, ddlBroker.SelectedValue,
                                                        ddlBroker2.SelectedValue, ddlBroker3.SelectedValue, UDFLib.ConvertDateToNull(Vessel_Opening_Date), UDFLib.ConvertIntegerToNull(ddlPort.SelectedValue), txtDeliveryPort.Text, txtRedeliveryPort.Text,
                                                        ddlDeliveryLTGMT.SelectedValue, ddlReDeliveryLTGMT.SelectedValue,
                                                        UDFLib.ConvertDateToNull(Delivery_Date), UDFLib.ConvertDateToNull(ReDelivery_Date), UDFLib.ConvertDateToNull(dtCP.Text),
                                                        UDFLib.ConvertIntegerToNull(ddlCPType.SelectedValue), UDFLib.ConvertIntegerToNull(ddlStatus.SelectedValue), Laycan, txtGMTTimeZone.Text, UDFLib.ConvertDateToNull(LayCanStartDate),
                                                        UDFLib.ConvertDateToNull(LayCanEndDate), txtHireTerms.Text, txtCommisionTerms.Text, HireRate, AddressComm, txtBillingCycle.Text, Billing_Cycle_Type, txtSpreadBy.Text, BrokerageComm,
                                                        BrokerageComm2, BrokerageComm3, ddlBrokPayment.SelectedValue, ddlBrokPayment2.SelectedValue, ddlBrokPayment3.SelectedValue,
                                                        UDFLib.ConvertIntegerToNull(ddlHireType.SelectedValue), ddlOwnerBank.SelectedValue, Redelivery_Notice_Days, UDFLib.ConvertToInteger(Session["UserID"].ToString()));

                    Session["CPID"] = RetValue;
                }
                BindCPDetails();
            }
        }
        catch (Exception ex)
        {
            string msg = ex.ToString();
        }
    }