private void Populate(string tripId) { lnkbtnPrint.Visible = true; lnkbtnSubmit.Text = "Update"; Int64 tripIdno = Convert.ToInt64(tripId); ManualTripSheetDAL obj = new ManualTripSheetDAL(); tblManualTripHead mt = obj.GetTripSheet(tripIdno); txtTripNo.Text = mt.Trip_No.ToString(); txtTripDate.Text = ((mt.Trip_Date == null || mt.Trip_Date.ToString() == "") ? "" : Convert.ToDateTime(mt.Trip_Date.ToString()).ToString("dd-MM-yyyy")); ddlCompFromCity.SelectedValue = mt.BaseCity_Idno.ToString(); ddlTruckNo.SelectedValue = mt.Truck_Idno.ToString(); ddlSender.SelectedValue = mt.Party_Idno.ToString(); ddlFromCity.SelectedValue = mt.FromCity_idno.ToString(); ddlToCity.SelectedValue = mt.ToCity_idno.ToString(); txtDriverName.Text = mt.Driver_Name.ToString(); txkStartKms.Text = mt.StartKms.ToString(); txkEndKms.Text = mt.EndKms.ToString(); ddlDateRange.SelectedValue = mt.Year_Idno.ToString(); txtItemName.Text = mt.Item_Name.ToString(); txtItemSize.Text = mt.Item_Size.ToString(); ddlRateType.SelectedValue = mt.Rate_Type.ToString(); txtQuantity.Text = mt.Quantity.ToString(); txtGweight.Text = mt.Gross_Weight.ToString(); txtAweight.Text = mt.Actual_Weight.ToString(); txtrate.Text = mt.Item_Rate.ToString(); txtAdvance.Text = mt.Party_Adv.ToString(); txtCommission.Text = mt.Party_Comm.ToString(); txtTotalPartyAdv.Text = mt.TotalParty_Adv.ToString(); txtRTOChallan.Text = mt.RTO_Chln.ToString(); txtDetention.Text = mt.Detention.ToString(); txtTotalAmount.Text = mt.Freight_Amnt.ToString(); txtTotalFreight.Text = mt.GrossFreight_Amnt.ToString(); txtReceived.Text = mt.Received_Amnt.ToString(); ddlRecType.SelectedValue = mt.Rec_Type.ToString(); txtTotalPartyBalance.Text = mt.TotalParty_Bal.ToString(); txtDriver.Text = mt.DriverCash_Amnt.ToString(); txtDiesel.Text = mt.Diesel_Amnt.ToString(); txtDriverAc.Text = mt.DriverAC_Amnt.ToString(); txtTotalVehAdv.Text = mt.TotalVeh_Amnt.ToString(); txtNetTripProfit.Text = mt.NetTrip_Profit.ToString(); if (mt.FixRate == true) { chkFixRate.Checked = mt.FixRate == null ? false : Convert.ToBoolean(mt.FixRate); txtItemName.Text = ""; txtItemSize.Text = ""; txtQuantity.Text = ""; txtrate.Text = ""; txtGweight.Text = ""; txtAweight.Text = ""; ddlRateType.SelectedValue = "0"; txtItemName.Enabled = false; txtItemSize.Enabled = false; txtQuantity.Enabled = false; txtrate.Enabled = false; txtGweight.Enabled = false; txtAweight.Enabled = false; ddlRateType.Enabled = false; } }
public void txtTripNo_TextChanged(object sender, EventArgs e) { ManualTripSheetDAL obj = new ManualTripSheetDAL(); txtTripNo.Text = obj.GetMaxTripNo(Convert.ToInt32(ddlDateRange.SelectedValue), ApplicationFunction.ConnectionString()).ToString(); ddlCompFromCity.Focus(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["DBName"] != null) { if (Session["DBName"].ToString() == "TrHariCargoCarrierDdUK") { Response.Redirect("CustomTripSheet.aspx"); } } if (Request.UrlReferrer == null) { base.AutoRedirect(); } if (base.CheckUserRights(intFormId) == false) { Response.Redirect("PermissionDenied.aspx"); } if (!IsPostBack) { this.BindDateRange(); BindDropdown(); ManualTripSheetDAL obj = new ManualTripSheetDAL(); txtTripNo.Text = obj.GetMaxTripNo(Convert.ToInt32(ddlDateRange.SelectedValue), ApplicationFunction.ConnectionString()).ToString(); if (Request.QueryString["TripId"] != null) { this.Populate(Request.QueryString["TripId"]); } } }
protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e) { string strMsg = string.Empty; if (e.CommandName == "cmdedit") { Response.Redirect("ManualTripSheet.aspx?TripId=" + e.CommandArgument, true); } if (e.CommandName == "cmddelete") { ManualTripSheetDAL obj = new ManualTripSheetDAL(); Int32 intValue = obj.DeleteTrip(Convert.ToInt64(e.CommandArgument)); obj = null; if (intValue > 0) { this.BindGrid(); strMsg = "Record deleted successfully."; txtTripNo.Focus(); } else { if (intValue == -1) { strMsg = "Record can not be deleted. It is in use."; } else { strMsg = "Record not deleted."; } } ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true); } }
private void BindGrid() { ManualTripSheetDAL obj = new ManualTripSheetDAL(); DateTime? dtfrom = null; DateTime? dtto = null; Int64 yearIDNO = Convert.ToInt32(ddlDateRange.SelectedValue); Int64 lorry_Idno = Convert.ToInt64(ddlLorry_No.SelectedValue); int TripNo = string.IsNullOrEmpty(Convert.ToString(txtTripNo.Text)) ? 0 : Convert.ToInt32(txtTripNo.Text); if (string.IsNullOrEmpty(Convert.ToString(Datefrom.Text)) == false) { dtfrom = Convert.ToDateTime(ApplicationFunction.mmddyyyy(Datefrom.Text)); } if (string.IsNullOrEmpty(Convert.ToString(Datefrom.Text)) == false) { dtto = Convert.ToDateTime(ApplicationFunction.mmddyyyy(Dateto.Text)); } int cityfrom = Convert.ToInt32(drpCityFrom.SelectedValue); int sender = Convert.ToInt32(ddlSender.SelectedValue == "" ? 0 : Convert.ToInt32(ddlSender.SelectedValue)); Int32 yearidno = Convert.ToInt32(ddlDateRange.SelectedValue == "" ? 0 : Convert.ToInt32(ddlDateRange.SelectedValue)); Int64 UserIdno = 0; if (Convert.ToString(Session["Userclass"]) != "Admin") { UserIdno = Convert.ToInt64(Session["UserIdno"]); } var lstGridData = obj.SelectTrip(TripNo, dtfrom, dtto, cityfrom, sender, yearidno, lorry_Idno); obj = null; if (lstGridData != null && lstGridData.Count > 0) { grdMain.DataSource = lstGridData; grdMain.DataBind(); prints.Visible = false; } else { grdMain.DataSource = null; grdMain.DataBind(); prints.Visible = false; } }
public void lnkbtnSubmit_OnClick(object sender, EventArgs e) { if (CheckEmptyFields()) { CalculateAll(); Int64 return_status = 0; ManualTripSheetDAL obj = new ManualTripSheetDAL(); if (Request.QueryString["TripId"] == null) { return_status = obj.InsertTripSheet(Convert.ToInt64(txtTripNo.Text), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtTripDate.Text.Trim().ToString())), Convert.ToInt32(ddlCompFromCity.SelectedValue), Convert.ToInt32(ddlTruckNo.SelectedValue), Convert.ToInt32(ddlSender.SelectedValue), Convert.ToInt32(ddlFromCity.SelectedValue), Convert.ToInt32(ddlToCity.SelectedValue), Convert.ToString(txtDriverName.Text), Convert.ToString(txkStartKms.Text), Convert.ToString(txkEndKms.Text), Convert.ToInt32(ddlDateRange.SelectedValue), Convert.ToString(txtItemName.Text), Convert.ToString(txtItemSize.Text), Convert.ToInt32(ddlRateType.SelectedValue), Convert.ToDouble(txtQuantity.Text == "" ? "0" : txtQuantity.Text), Convert.ToDouble(txtGweight.Text == "" ? "0" : txtGweight.Text), Convert.ToDouble(txtAweight.Text == "" ? "0" : txtAweight.Text), Convert.ToDouble(txtrate.Text == "" ? "0" : txtrate.Text), Convert.ToDouble(txtAdvance.Text == "" ? "0" : txtAdvance.Text), Convert.ToDouble(txtCommission.Text == "" ? "0" : txtCommission.Text), Convert.ToDouble(txtTotalPartyAdv.Text == "" ? "0" : txtTotalPartyAdv.Text), Convert.ToDouble(txtRTOChallan.Text == "" ? "0" : txtRTOChallan.Text), Convert.ToDouble(txtDetention.Text == "" ? "0" : txtDetention.Text), Convert.ToDouble(txtTotalAmount.Text == "" ? "0" : txtTotalAmount.Text), Convert.ToDouble(txtTotalFreight.Text == "" ? "0" : txtTotalFreight.Text), Convert.ToDouble(txtReceived.Text == "" ? "0" : txtReceived.Text), Convert.ToInt32(ddlRecType.SelectedValue), Convert.ToDouble(txtTotalPartyBalance.Text == "" ? "0" : txtTotalPartyBalance.Text), Convert.ToDouble(txtDriver.Text == "" ? "0" : txtDriver.Text), Convert.ToDouble(txtDiesel.Text == "" ? "0" : txtDiesel.Text), Convert.ToDouble(txtDriverAc.Text == "" ? "0" : txtDriverAc.Text), Convert.ToDouble(txtTotalVehAdv.Text == "" ? "0" : txtTotalVehAdv.Text), Convert.ToDouble(txtNetTripProfit.Text == "" ? "0" : txtNetTripProfit.Text), chkFixRate.Checked); } else { Int64 intTripIdno = Convert.ToInt64(Request.QueryString["TripId"]); return_status = obj.UpdateTripSheet(intTripIdno, Convert.ToInt64(txtTripNo.Text == "" ? "0" : txtTripNo.Text), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtTripDate.Text.Trim().ToString())), Convert.ToInt32(ddlCompFromCity.SelectedValue), Convert.ToInt32(ddlTruckNo.SelectedValue), Convert.ToInt32(ddlSender.SelectedValue), Convert.ToInt32(ddlFromCity.SelectedValue), Convert.ToInt32(ddlToCity.SelectedValue), Convert.ToString(txtDriverName.Text), Convert.ToString(txkStartKms.Text), Convert.ToString(txkEndKms.Text), Convert.ToInt32(ddlDateRange.SelectedValue), Convert.ToString(txtItemName.Text), Convert.ToString(txtItemSize.Text), Convert.ToInt32(ddlRateType.SelectedValue), Convert.ToDouble(txtQuantity.Text == "" ? "0" : txtQuantity.Text), Convert.ToDouble(txtGweight.Text == "" ? "0" : txtGweight.Text), Convert.ToDouble(txtAweight.Text == "" ? "0" : txtAweight.Text), Convert.ToDouble(txtrate.Text), Convert.ToDouble(txtAdvance.Text == "" ? "0" : txtAdvance.Text), Convert.ToDouble(txtCommission.Text == "" ? "0" : txtCommission.Text), Convert.ToDouble(txtTotalPartyAdv.Text == "" ? "0" : txtTotalPartyAdv.Text), Convert.ToDouble(txtRTOChallan.Text == "" ? "0" : txtRTOChallan.Text), Convert.ToDouble(txtDetention.Text == "" ? "0" : txtDetention.Text), Convert.ToDouble(txtTotalAmount.Text == "" ? "0" : txtTotalAmount.Text), Convert.ToDouble(txtTotalFreight.Text == "" ? "0" : txtTotalFreight.Text), Convert.ToDouble(txtReceived.Text == "" ? "0" : txtReceived.Text), Convert.ToInt32(ddlRecType.SelectedValue), Convert.ToDouble(txtTotalPartyBalance.Text), Convert.ToDouble(txtDriver.Text == "" ? "0" : txtDriver.Text), Convert.ToDouble(txtDiesel.Text == "" ? "0" : txtDiesel.Text), Convert.ToDouble(txtDriverAc.Text == "" ? "0" : txtDriverAc.Text), Convert.ToDouble(txtTotalVehAdv.Text == "" ? "0" : txtTotalVehAdv.Text), Convert.ToDouble(txtNetTripProfit.Text == "" ? "0" : txtNetTripProfit.Text), chkFixRate.Checked); } if (return_status > 0) { ShowMessage("Trip sheet is saved successfully."); Response.Redirect("ManualTripSheet.aspx"); } else if (return_status == -1) { ShowMessageErr("Trip sheet already exists."); } else { ShowMessageErr("Trip sheet SAVED FAILURE."); } } else { ShowMessageErr("Please fill all the fields."); } }
public void PrintTrip(int PrintType) { //PrintType = 1 Then With Vehicle detail Else 2 Without Int64 tripIdno = Convert.ToInt64(Request.QueryString["TripId"] == null ? "0" : Request.QueryString["TripId"]); ManualTripSheetDAL obj = new ManualTripSheetDAL(); tblManualTripHead mt = obj.GetTripSheet(tripIdno); #region Variable declaration string TripNo = mt.Trip_No.ToString(); string TripDate = mt.Trip_Date.ToString(); string CompFromCity = mt.BaseCity_Idno.ToString(); string TruckNo = mt.Truck_Idno.ToString(); string Sender = mt.Party_Idno.ToString(); string FromCity = mt.FromCity_idno.ToString(); string ToCity = mt.ToCity_idno.ToString(); string DriverName = mt.Driver_Name.ToString(); string StartKms = mt.StartKms.ToString(); string EndKms = mt.EndKms.ToString(); string DateRange = mt.Year_Idno.ToString(); string ItemName = mt.Item_Name.ToString(); string ItemSize = mt.Item_Size.ToString(); string RateType = mt.Rate_Type.ToString(); string Quantity = mt.Quantity.ToString(); string Gweight = mt.Gross_Weight.ToString(); string Aweight = mt.Actual_Weight.ToString(); string rate = mt.Item_Rate.ToString(); string Advance = mt.Party_Adv.ToString(); string Commission = mt.Party_Comm.ToString(); string TotalPartyAdv = mt.TotalParty_Adv.ToString(); string RTOChallan = mt.RTO_Chln.ToString(); string Detention = mt.Detention.ToString(); string TotalAmount = mt.Freight_Amnt.ToString(); string TotalFreight = mt.GrossFreight_Amnt.ToString(); string Received = mt.Received_Amnt.ToString(); string RecType = mt.Rec_Type.ToString(); string TotalPartyBalance = mt.TotalParty_Bal.ToString(); string Driver = mt.DriverCash_Amnt.ToString(); string Diesel = mt.Diesel_Amnt.ToString(); string DriverAc = mt.DriverAC_Amnt.ToString(); string TotalVehAdv = mt.TotalVeh_Amnt.ToString(); string NetTripProfit = mt.NetTrip_Profit.ToString(); #endregion string str = "PrintManualTrip.aspx?PrintType=" + PrintType + "&TripNo=" + TripNo + "&TripDate=" + TripDate + "&CompFromCity=" + CompFromCity + "&TruckNo=" + TruckNo + "&Sender=" + Sender + "&FromCity=" + FromCity + "&ToCity=" + ToCity + "&DriverName=" + DriverName + "&StartKms=" + StartKms + "&EndKms=" + EndKms + "&DateRange=" + DateRange + "&ItemName=" + ItemName + "&ItemSize=" + ItemSize + "&RateType=" + RateType + "&Quantity=" + Quantity + "&Gweight=" + Gweight + "&Aweight=" + Aweight + "&rate=" + rate + "&Advance=" + Advance + "&Commission=" + Commission + "&TotalPartyAdv=" + TotalPartyAdv + "&RTOChallan=" + RTOChallan + "&Detention=" + Detention + "&TotalAmount=" + TotalAmount + "&TotalFreight=" + TotalFreight + "&Received=" + Received + "&RecType=" + RecType + "&TotalPartyBalance=" + TotalPartyBalance + "&Driver=" + Driver + "&Diesel=" + Diesel + "&DriverAc=" + DriverAc + "&TotalVehAdv=" + TotalVehAdv + "&NetTripProfit=" + NetTripProfit; Response.Redirect(str); }