Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["email"] == null)
        {
            Response.Redirect("SignIn.aspx");
        }

        consBookEmail = Session["email"].ToString();
        consBookUsr   = Session["usrType"].ToString();
        if (!IsPostBack)
        {
            addConsignmentBAL addConsignmentBALObj = new addConsignmentBAL();
            drpSrType.DataSource     = addConsignmentBALObj.addServicesEmpBALF();
            drpSrType.DataValueField = "serviceType";
            drpSrType.DataTextField  = "serviceType";
            drpSrType.DataBind();

            drpSrcBrId.DataSource     = addConsignmentBALObj.addBranchConsEmpBALF();
            drpSrcBrId.DataValueField = "brBranchId";
            drpSrcBrId.DataTextField  = "brBranchId";
            drpSrcBrId.DataBind();

            drpDestBrId.DataSource     = addConsignmentBALObj.addBranchConsEmpBALF();
            drpDestBrId.DataValueField = "brBranchId";
            drpDestBrId.DataTextField  = "brBranchId";
            drpDestBrId.DataBind();
        }
    }
    protected void btnCalcDist_Click(object sender, EventArgs e)
    {
        addConsignmentBAL addConsignmentBALObj = new addConsignmentBAL();
        string            srcBrLong;
        cityEntity        cityEntityObj = new cityEntity();

        cityEntityObj.cityName_ = txtSrcBrCity.Text.Trim().ToUpper();


        string srcBrLat    = addConsignmentBALObj.consCityBALF(cityEntityObj, out srcBrLong);
        double srLatitude  = Convert.ToDouble(srcBrLat);
        double srLongitude = Convert.ToDouble(srcBrLong);

        string destBrLong;

        cityEntityObj.cityName_ = txtDestBrCity.Text.Trim().ToUpper();

        string destBrLat   = addConsignmentBALObj.consCityBALF1(cityEntityObj, out destBrLong);
        double dsLatitude  = Convert.ToDouble(destBrLat);
        double dsLongitude = Convert.ToDouble(destBrLong);

        double distance = DistanceBetweenPlaces(srLongitude, srLatitude, dsLongitude, dsLatitude);

        txtTotDist.Text = Convert.ToString(distance);

        //txtShpCharge.Text=(txtTotWeight.Text)

        string         costAccDist;
        servicesEntity servicesEntityObj = new servicesEntity();

        servicesEntityObj.serviceType_ = drpSrType.Text.Trim().ToUpper();

        string costAccWeight = addConsignmentBALObj.consServiceCostBALF(servicesEntityObj, out costAccDist);

        //Label1.Text = "hello"+costAccWeight;

        double servCostAccWeight = Convert.ToDouble(costAccWeight);
        double servCostAccDist   = Convert.ToDouble(costAccDist);

        double totWeightC = Convert.ToDouble(txtTotWeight.Text.Trim());

        txtShpCharge.Text = Convert.ToString(costCalculationF(servCostAccWeight, servCostAccDist, distance, totWeightC));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            addConsignmentBAL addConsignmentBALObj = new addConsignmentBAL();
            drpSrType.DataSource     = addConsignmentBALObj.addServicesEmpBALF();
            drpSrType.DataValueField = "serviceType";
            drpSrType.DataTextField  = "serviceType";
            drpSrType.DataBind();

            calculateCostBAL calculateCostBALObj = new calculateCostBAL();
            drpSrcCity.DataSource     = calculateCostBALObj.calculateCostCityBALF();
            drpSrcCity.DataValueField = "cityName";
            drpSrcCity.DataTextField  = "cityName";
            drpSrcCity.DataBind();

            drpDestCity.DataSource     = calculateCostBALObj.calculateCostCityBALF();
            drpDestCity.DataValueField = "cityName";
            drpDestCity.DataTextField  = "cityName";
            drpDestCity.DataBind();
        }
    }
Esempio n. 4
0
    protected void btnConsSubmit_Click(object sender, EventArgs e)
    {
        consignmentEntity consignmentEntityObj = new consignmentEntity();

        consignmentEntityObj.consShipperName_         = txtShrName.Text.Trim().ToUpper();
        consignmentEntityObj.consShipperMobile_       = Convert.ToDecimal(txtShrMobile.Text.Trim());
        consignmentEntityObj.consShipperMail_         = txtShrEmail.Text.Trim().ToUpper();
        consignmentEntityObj.consShipperAddress_      = txtShrAddress.Text.Trim().ToUpper();
        consignmentEntityObj.consMaterialDescription_ = txtMtrDesc.Text.Trim().ToUpper();
        consignmentEntityObj.consTotalItems_          = Convert.ToDecimal(txtTotItems.Text.Trim());
        consignmentEntityObj.consTotalWeight_         = Convert.ToDecimal(txtTotWeight.Text.Trim());
        consignmentEntityObj.consTotalDistance_       = Convert.ToDecimal(txtTotDist.Text.Trim());
        consignmentEntityObj.consServiceType_         = drpSrType.Text.ToUpper();
        consignmentEntityObj.consShippingCharge_      = Convert.ToDecimal(txtShpCharge.Text.Trim());
        consignmentEntityObj.consDateOfBooking_       = Convert.ToDateTime(txtDobook.Text.Trim());
        consignmentEntityObj.consSrcBranchId_         = drpSrcBrId.Text.Trim().ToUpper();
        consignmentEntityObj.consSrcBranchName_       = txtSrcBrName.Text.Trim().ToUpper();
        consignmentEntityObj.consSrcBranchCity_       = txtSrcBrCity.Text.Trim().ToUpper();
        consignmentEntityObj.consDestBranchId_        = drpDestBrId.Text.Trim().ToUpper();
        consignmentEntityObj.consDestBranchName_      = txtDestBrName.Text.Trim().ToUpper();
        consignmentEntityObj.consDestBranchCity_      = txtDestBrCity.Text.Trim().ToUpper();
        consignmentEntityObj.consReceiverName_        = txtRecName.Text.Trim().ToUpper();
        consignmentEntityObj.consReceiverMobile_      = Convert.ToDecimal(txtRecMobile.Text.Trim());
        consignmentEntityObj.consReceiverMail_        = txtRecEmail.Text.Trim().ToUpper();
        consignmentEntityObj.consReceiverAddress_     = txtRecAddress.Text.Trim().ToUpper();
        if (String.Equals(consBookUsr, "Employee"))
        {
            consignmentEntityObj.consBookedBy_ = consBookEmail;
        }
        else
        {
            consignmentEntityObj.consBookedBy_ = "User" + consBookEmail;
        }

        idIncrementCons++;
        idIncrementTrck++;
        consignmentEntityObj.consId_      = "CONSEMPID" + Convert.ToString(idIncrementCons);
        consignmentEntityObj.consTrackId_ = "TRCKEMPID" + Convert.ToString(idIncrementTrck);

        addConsignmentBAL addConsignmentBALObj = new addConsignmentBAL();

        addConsignmentBALObj.addConsignmentBALF(consignmentEntityObj);

        string trckId;
        string shrMailUI = addConsignmentBALObj.consShrMailBALF(consignmentEntityObj, out trckId);
        string message   = "Your Consignment has been booked Successfully.Your tracking id is :" + trckId + "Thankyou for using our service.";


        MailMessage mail   = new MailMessage("*****@*****.**", shrMailUI, "Consignment Booked Successfully", message);
        SmtpClient  client = new SmtpClient();

        client.Port = 587;
        client.Host = "smtp.gmail.com";

        client.Timeout               = 10000;
        client.DeliveryMethod        = SmtpDeliveryMethod.Network;
        client.UseDefaultCredentials = false;
        client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "Parcel@12345");
        client.EnableSsl             = true;

        mail.BodyEncoding = UTF8Encoding.UTF8;
        mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
        client.Send(mail);

        txtDestBrCity.Text = "";
        drpDestBrId.Text   = "";
        txtDestBrName.Text = "";
        txtDobook.Text     = "";
        txtMtrDesc.Text    = "";
        txtRecAddress.Text = "";
        txtRecEmail.Text   = "";
        txtRecMobile.Text  = "";
        txtRecName.Text    = "";
        txtShpCharge.Text  = "";
        txtShrAddress.Text = "";
        txtShrEmail.Text   = "";
        txtShrMobile.Text  = "";
        txtShrName.Text    = "";
        txtSrcBrCity.Text  = "";
        drpSrcBrId.Text    = "";
        txtSrcBrName.Text  = "";
        txtTotDist.Text    = "";
        txtTotItems.Text   = "";
        txtTotWeight.Text  = "";
    }