private void GetBooking(User user) { _oBooking = PostMethods.GetBooking(user.UserId, "Feedback"); if (_oBooking != null && _oBooking.BookingId != 0) { lblFromCity.Text = _oBooking.FromCityName; lblToCity.Text = _oBooking.ToCityName; lblSchdDate.Text = _oBooking.SchdDate.ToString("dd-MM-yyy HH:MM"); lblTransportName.Text = _oBooking.TransporterVehicle.Transporter.TransportName; lblContactName.Text = _oBooking.TransporterVehicle.Transporter.FullName; lblContactNo.Text = _oBooking.TransporterVehicle.Transporter.Mobile; lblVehicleNo.Text = _oBooking.TransporterVehicle.RegistrationNo; Response.Cookies["transporterId"].Value = ""; Response.Cookies["transporterId"].Value = _oBooking.TransporterVehicle.TransporterId.ToString(); //Response.Cookies["transporterId"].Expires = DateTime.Now.AddMinutes(5); Response.Cookies["bookingId"].Value = ""; Response.Cookies["bookingId"].Value = _oBooking.BookingId.ToString(); //Response.Cookies["bookingId"].Expires = DateTime.Now.AddMinutes(5); GetRating(_oBooking.TransporterVehicle.TransporterId); } else { Response.Redirect("~\\Transporter\\TransporterDashboard.aspx"); } }
protected void btnMyAccount_Click(object sender, EventArgs e) { if (Session["userInfo"] != null) { _user = new TMSLibrary.User(); _user = (TMSLibrary.User)Session["userInfo"]; if (_user.UserId != 0) { if (_user.UserType == (int)TMSLibrary.CONSTANT.ApplicationUserType.Transporter) { Response.Redirect("~\\Transporter\\AllBooking.aspx"); } else { Response.Redirect("~\\Customer\\AllBooking.aspx"); } } } else { Server.Transfer("~\\Account\\Login"); } }
/// <summary> /// Update Status /// </summary> /// <param name="status">status</param> /// <returns>Result</returns> public static int UpdateStatus(int status, int userId) { int result; User _user = new User(); TMSDataLibrary.User _userdata = new TMSDataLibrary.User(); result = _userdata.UpdateStatus(status, userId); return result; }
/// <summary> /// Change Password /// </summary> /// <param name="username">Username</param> /// <param name="userid">User Id</param> /// <returns>Result</returns> public static int ChangePassword(string password, int userid) { int result; User _user = new User(); TMSDataLibrary.User _userdata = new TMSDataLibrary.User(); result = _userdata.ChangePassword(password, userid); return result; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { _user = (TMSLibrary.User)Session["userInfo"]; getUserInfo(); GetNotifications(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["userInfo"] != null) { _user = (TMSLibrary.User)Session["userInfo"]; getUserInfo(); GetDashboardCounters(); } } }
protected void btnLogin_Click1(object sender, EventArgs e) { _user = new TMSLibrary.User(); _user = TMSLibrary.UserMethods.UserLogin(txtUsername.Text.Trim(), txtPassword.Text.Trim()); if (_user.UserId != 0 || txtUsername.Text == "Team") { Session["userInfo"] = _user; if (_user.Status == 0 && txtUsername.Text != "Team") { Response.Redirect("~\\Account\\UserVarification"); } else { //TMSLibrary.Mail.SendEmail("*****@*****.**", "Hello Vaibhav, That's a test mail by Laxyo Solution Soft Pvt. Ltd.", "Test Mail"); //if (chkRemember.Checked) //{ // Response.Cookies["lsspl_1"].Expires = DateTime.Now.AddDays(30); // Response.Cookies["lsspl_2"].Expires = DateTime.Now.AddDays(30); // Response.Cookies["lsspl_1"].Value = txtUsernam.Text.Trim(); // Response.Cookies["lsspl_2"].Value = txtPasseord.Text.Trim(); //} if (_user.UserType == Convert.ToInt32(TMSLibrary.CONSTANT.ApplicationUserType.Customer)) { Response.Redirect("~\\Customer\\Feedback.aspx"); } else if (_user.UserType == Convert.ToInt32(TMSLibrary.CONSTANT.ApplicationUserType.Transporter)) { Response.Redirect("~\\Transporter\\Feedback.aspx"); } else if (txtUsername.Text == "Team" && txtPassword.Text == "Team") { Session["userInfo"] = null; Response.Redirect("~\\Team\\AllBooking.aspx"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Please Enter Correct UserName and Password');", true); } } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Please Enter Correct UserName and Password');", true); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["userInfo"] != null) { _user = (User)Session["userInfo"]; if (!IsPostBack) { GetBooking(_user); } } else { Response.Redirect("~\\Account\\Login"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["userinfo"] != null) { _user = (TMSLibrary.User)Session["userInfo"]; getUserInfo(); GetDashboardCounters(); } else { Response.Redirect("~\\Account\\Login"); } } }
/// <summary> /// Validate User using username for booking on staffhand /// </summary> public static List<User> UserBooking() { List<User> user = new List<User>(); TMSDataLibrary.User _userdata = new TMSDataLibrary.User(); DataTable dt = _userdata.UserBooking(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { User _user = new User(); _user.UserId = Convert.ToInt32(dt.Rows[i][CONSTS.UserColumnIndex.UserId].ToString()); _user.UserName = dt.Rows[i][CONSTS.UserColumnIndex.UserName].ToString(); user.Add(_user); } } return user; }
private void GetBooking(User user) { _oBooking = PostMethods.GetBooking(user.UserId, "Feedback"); if (_oBooking != null && _oBooking.BookingId != 0) { lblFromCity.Text = _oBooking.FromCityName; lblToCity.Text = _oBooking.ToCityName; lblSchdDate.Text = _oBooking.SchdDate.ToString("dd-MM-yyy HH:MM"); lblTransportName.Text = _oBooking.TransporterVehicle.Transporter.TransportName; lblContactName.Text = _oBooking.TransporterVehicle.Transporter.FullName; lblContactNo.Text = _oBooking.TransporterVehicle.Transporter.Mobile; lblVehicleNo.Text = _oBooking.TransporterVehicle.RegistrationNo; Response.Cookies["transporterId"].Value = ""; Response.Cookies["transporterId"].Value = _oBooking.TransporterVehicle.TransporterId.ToString(); //Response.Cookies["transporterId"].Expires = DateTime.Now.AddMinutes(5); Response.Cookies["bookingId"].Value = ""; Response.Cookies["bookingId"].Value = _oBooking.BookingId.ToString(); //Response.Cookies["bookingId"].Expires = DateTime.Now.AddMinutes(5); GetRating(_oBooking.TransporterVehicle.TransporterId); } else { Response.Redirect("~\\Customer\\Dashboard.aspx"); // Response.Redirect("~\\Customer\\AddPost"); } #region Commented Old Code //var con = new SqlConnection("Data Source=192.168.1.127; user id=sa; password=abcd1234; Initial Catalog=TMS"); //var sql = ""; //sql = sql + " select * from vwBooking where BookingId = (select min(BookingId) from Booking where Status='1'"; //sql = sql + " and schdDate<getdate() and userid='" + user.UserId + "') "; //var cmd = new SqlCommand(sql, con); //con.Open(); //var objReader = cmd.ExecuteReader(); //if (objReader != null && objReader.HasRows) //{ // objReader.Read(); // _bookingId = Convert.ToInt32(objReader["BookingId"]); // var from = objReader["FromCityName"].ToString(); // var to = objReader["ToCityName"].ToString(); // var vehicleNo = objReader["RegistrationNo"].ToString(); // var schdDate = Convert.ToDateTime(objReader["SchdDate"]); // var transporterId = Convert.ToInt32(objReader["TransporterId"]); // var transportName = objReader["TransportName"].ToString(); // var transporterName = objReader["FirstName"] + " " + objReader["LastName"]; // var mobileNo = objReader["Mobile"].ToString(); // lblFromCity.Text = from; // lblToCity.Text = to; // lblSchdDate.Text = schdDate.ToString("dd-MM-yyy HH:MM"); // lblTransportName.Text = transportName; // lblContactName.Text = transporterName; // lblContactNo.Text = mobileNo; // lblVehicleNo.Text = vehicleNo; // Response.Cookies["transporterId"].Value = transporterId.ToString(); // Response.Cookies["transporterId"].Expires = DateTime.Now.AddMinutes(5); // Response.Cookies["bookingId"].Value = _bookingId.ToString(); // Response.Cookies["bookingId"].Expires = DateTime.Now.AddMinutes(5); // objReader.Close(); // GetRating(transporterId); //} //else //{ // Response.Redirect("~\\Customer\\AddPost"); //} #endregion }
protected void btnVehicle_Click(object sender, EventArgs e) { TMSLibrary.VehicleDocument obj = new TMSLibrary.VehicleDocument(); if (ddlVehicleNo.SelectedValue != "0") { obj.TransporterVehicleid = Convert.ToInt32(ddlVehicleNo.SelectedItem.Value); } else { ValidatePopup("Please Select Vehicle"); return; } if (ddlVehicleDocumentType.SelectedValue != "0") { obj.DocTypeId = Convert.ToInt32(ddlVehicleDocumentType.SelectedItem.Value); } else { ValidatePopup("Please Select Document Type"); return; } if (fuVehicleDocument.HasFile) { string fileExt = System.IO.Path.GetExtension(fuVehicleDocument.FileName); if (fileExt == ".jpeg" || fileExt == ".jpg" || fileExt == ".bmp" || fileExt == ".gif" || fileExt == ".png") { //string path = "~\\VehicleDocument\\" + fuVehicleDocument.FileName.ToString(); //obj.DocPath = path; //string DocPath = Server.MapPath("~" + "\\VehicleDocument\\" + fuVehicleDocument.FileName).ToString(); //fuVehicleDocument.SaveAs(DocPath); _user = (TMSLibrary.User)Session["userInfo"]; string fileName = _user.UserId + "-" + ddlVehicleNo.SelectedItem.Text + "-" + txtVehicleDocumentNo.Text.Trim() + System.IO.Path.GetExtension(fuVehicleDocument.PostedFile.FileName); fuVehicleDocument.PostedFile.SaveAs(Server.MapPath("~/Document/VehicleDocument/") + fileName); obj.DocPath = "~/Document/VehicleDocument/" + fileName; } else { ValidatePopup("File should be .jpg, .jpeg, .bmp, .gif, .png format"); return; } } else { ValidatePopup("Please Select File"); return; } if (txtVehicleDocumentNo.Text.Trim() != "") { obj.DocumentNo = txtVehicleDocumentNo.Text.Trim(); } else { ValidatePopup("Please Enter Document Number"); return; } if (txtValidFrom.Text.Trim() != "") { obj.ValidFrom = Convert.ToDateTime(txtValidFrom.Text); } else { ValidatePopup("Please valid from date"); return; } if (txtvalidTo.Text.Trim() != "") { obj.ValidTo = Convert.ToDateTime(txtvalidTo.Text); } else { ValidatePopup("Please valid to date"); return; } if (txtVehicleRTO.Text.Trim() != "") { obj.RTO = txtVehicleRTO.Text.Trim(); } else { ValidatePopup("Please neter RTO"); return; } int result = TMSLibrary.VehicleDocumentMethods.AddVehicleDocument(obj); if (result >= 1) { ValidatePopup("Document Added"); ClearInputs(Page.Controls); } else { ValidatePopup("Please Try Again"); return; } FillRptVehicle(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["userInfo"] != null) { UserDocument.Visible = true; _user = (TMSLibrary.User)Session["userInfo"]; _transporter = TMSLibrary.TransporterMethods.GetTransporterInfo(((TMSLibrary.User)Session["userInfo"]).UserId); hdfTransporterId.Value = _transporter.TransporterId.ToString(); fillddlUserDocumentType(); FillRptUserDocument(); } else { Response.Redirect("~\\Account\\Login"); } } else { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "date()", true); } }
protected void lnkAddUserDocument_Click(object sender, EventArgs e) { TMSLibrary.TransporterDocument obj = new TMSLibrary.TransporterDocument(); if (ddlUserDocumentType.SelectedValue != "0") { obj.DocTypeId = Convert.ToInt32(ddlUserDocumentType.SelectedItem.Value); } else { ValidatePopup("Please Select Document Type"); return; } if (fluUserDocument.HasFile) { string fileExt = System.IO.Path.GetExtension(fluUserDocument.FileName); if (fileExt == ".jpeg" || fileExt == ".jpg" || fileExt == ".bmp" || fileExt == ".gif" || fileExt == ".png") { _user = (TMSLibrary.User)Session["userInfo"]; string fileName = _user.UserId + "-" + txtUserDocumentNo.Text.Trim() + System.IO.Path.GetExtension(fluUserDocument.PostedFile.FileName); fluUserDocument.PostedFile.SaveAs(Server.MapPath("~/Document/UserDocument/") + fileName); obj.DocPath = "~/Document/UserDocument/" + fileName; } else { ValidatePopup("File should be .jpg, .jpeg, .bmp, .gif, .png format"); return; } } else { ValidatePopup("Please Select File"); return; } if (txtUserDocumentNo.Text.Trim() != "") { obj.DocumentNo = txtUserDocumentNo.Text.Trim(); } else { ValidatePopup("Please Enter Document Number"); return; } if (txtUserIssueDate.Text != "") { obj.IssueDate = Convert.ToDateTime(txtUserIssueDate.Text); } else { ValidatePopup("Please Enter Issue Date"); return; } if (((TMSLibrary.User)Session["userInfo"]).UserId != 0) { obj.UserId = ((TMSLibrary.User)Session["userInfo"]).UserId; } int result = TMSLibrary.TransporterDocumentMethods.AddUserDocument(obj); if (result >= 1) { ValidatePopup("Document Added"); ClearInputs(Page.Controls); } else { ValidatePopup("Please Try Again"); return; } FillRptUserDocument(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["userInfo"] != null) { _user = (User)Session["userInfo"]; if (Page.PreviousPage != null) { //put previous page into Session to use for Insert Booking. Session["previousPage"] = Page.PreviousPage; string txtFromCity = ((DropDownList)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$ddlfromCity")).SelectedItem.Text; lblFromCity.InnerText = txtFromCity; string txtToCity = ((DropDownList)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$ddlToCity")).SelectedItem.Text; lblToCity.InnerText = txtToCity; if (txtFromCity != "" && txtToCity != "") { lblDistance.InnerText = calculateDistance(txtFromCity, txtToCity); } string txtFromAddress = ((TextBox)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$txtPickupAddress")).Text.Trim(); string txtToAddress = ((TextBox)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$txtDeliveryAddress")).Text.Trim(); lblFromAddress.InnerText = txtFromAddress + ", " + txtFromCity; lblToAddress.InnerText = txtToAddress + ", " + txtToCity; string txtSchdDate = ((TextBox)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$txtScheduleDate")).Text.Trim(); lblSchdDate.InnerText = txtSchdDate; string ddlMaterialType = ((DropDownList)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$ddlMaterialType")).SelectedItem.Text; lblMaterialType.InnerText = ddlMaterialType; string txtTruckType = ((TextBox)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$txtVehicleTypeName")).Text.Trim(); lblTruckType.InnerText = txtTruckType; string ddlNoOfTruck = ((DropDownList)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$ddlNoOfTruck")).SelectedItem.Text; lblNoOftruck.InnerText = ddlNoOfTruck; //chkLoading string AdditionalServices = ""; CheckBox chkLoading = (CheckBox)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$chkLoading"); CheckBox chkUnloading = (CheckBox)PreviousPage.FindControl("ctl00$ContentPlaceHolder2$chkUnloading"); if (chkLoading.Checked || chkUnloading.Checked) { if (chkLoading.Checked) { AdditionalServices = "Load"; } if (chkLoading.Checked && chkUnloading.Checked) AdditionalServices = AdditionalServices + " & "; if (chkUnloading.Checked) { AdditionalServices = AdditionalServices + "Un-Load"; } } lblAdditionalService.InnerText = AdditionalServices; } } }
//public static User GetUserInfo(int userid, int usertype) //{ // DataTable dt = new DataTable(); // TMSDataLibrary.User _userdata = new TMSDataLibrary.User(); // dt = _userdata.GetUserInfo(userid, usertype); // return null; //} /// <summary> /// User Login /// </summary> /// <param name="username">Username</param> /// <param name="password">Password</param> /// <returns></returns> public static User UserLogin(string username, string password) { DataTable dt = new DataTable(); User _user = new User(); TMSDataLibrary.User _userdata = new TMSDataLibrary.User(); dt = _userdata.UserLogin(username, password); if (dt.Rows.Count > 0) { _user.UserId = Convert.ToInt32(dt.Rows[0][CONSTS.UserColumnIndex.UserId].ToString()); _user.UserName = dt.Rows[0][CONSTS.UserColumnIndex.UserName].ToString(); _user.Password = dt.Rows[0][CONSTS.UserColumnIndex.Password].ToString(); _user.UserType = Convert.ToInt16(dt.Rows[0][CONSTS.UserColumnIndex.UserType]); if (dt.Rows[0][CONSTS.UserColumnIndex.LastLogin].ToString() != "") { _user.LastLogin = Convert.ToDateTime(dt.Rows[0][CONSTS.UserColumnIndex.LastLogin].ToString()); } if (dt.Rows[0][CONSTS.UserColumnIndex.Created_At].ToString() != "") { _user.Created_At = Convert.ToDateTime(dt.Rows[0][CONSTS.UserColumnIndex.Created_At].ToString()); } _user.Status = Convert.ToInt16(dt.Rows[0][CONSTS.UserColumnIndex.Status]); } return _user; }
protected void Page_Load(object sender, EventArgs e) { if (Session["userInfo"] != null) { _user = (User)Session["userInfo"]; if (Page.PreviousPage != null) { Session["previousPage"] = Page.PreviousPage; //ddlfromCity = (DropDownList)Page.PreviousPage.FindControl("ctl00$ContentSection$ddlfromCity"); //ddlToCity = (DropDownList)Page.PreviousPage.FindControl("ctl00$ContentSection$ddlToCity"); FromCity = new City() { CityId = Convert.ToInt32((Page.PreviousPage.FindControl("ctl00$ContentSection$txtFromCityId") as TextBox).Text), CityName = (Page.PreviousPage.FindControl("ctl00$ContentSection$txtFromCity") as TextBox).Text }; ToCity = new City() { CityId = Convert.ToInt32((Page.PreviousPage.FindControl("ctl00$ContentSection$txtToCityId") as TextBox).Text), CityName = (Page.PreviousPage.FindControl("ctl00$ContentSection$txtToCity") as TextBox).Text }; //load = (DropDownList)Page.PreviousPage.FindControl("ctl00$ContentSection$ddlload"); startvalue = FromCity.CityName; endvalue = ToCity.CityName; /* if (load.SelectedIndex == 2) { lblfare.Text = TMSLibrary.CONSTANT.Password.Fare; }*/ if (startvalue != "" && endvalue != "") { lblDistance.Text = calculateDistance(startvalue, endvalue); } FillDropDowns(); } } else { Server.Transfer("~\\Account\\Login"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.QueryString["BookingNo"] != null) { _user = (User)Session["userInfo"]; var booking = PostMethods.GetBooking(Request.QueryString["BookingNo"]); FillBookingDetail(booking); FillMessage(); FillNotes(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["userInfo"] != null) { _user = (User)Session["userInfo"]; fillgrdBookings(); } else { Response.Redirect("~\\Account\\Login"); } } else { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "GirdResponsive()", true); } makeGridResponsible(); }