protected void Page_Load(object sender, EventArgs e) { FormsAuthenticationHelper.AuthenticateUserWithReturnUrl(); connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString()); if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER) { Response.Redirect("../unauthorizedaccess.aspx"); } if (Request.QueryString["arn"] != null) { Session["AuctionRefNo"] = Request.QueryString["arn"].ToString().Trim(); } if (Session[Constant.SESSION_AUCTIONREFNO] == null) { Response.Redirect("approvedauctionevents.aspx"); } PageTitle.InnerText = String.Format(Constant.TITLEFORMAT, "Auction Event Details"); if (gvSuppliers.Rows.Count > 0) { CheckBox chkHeader = (CheckBox)gvSuppliers.HeaderRow.FindControl("chkHeader"); chkHeader.Attributes["onclick"] = "ChangeAllCheckBoxStates(this.checked);"; ClientScript.RegisterArrayDeclaration("CheckBoxIDs", String.Concat("'", chkHeader.ClientID, "'")); foreach (GridViewRow gr in gvSuppliers.Rows) { CheckBox chkRow = (CheckBox)gr.FindControl("chkRow"); chkRow.Attributes["onclick"] = "ChangeHeaderAsNeeded();"; ClientScript.RegisterArrayDeclaration("CheckBoxIDs", String.Concat("'", chkRow.ClientID, "'")); } if (DateTime.Now >= Convert.ToDateTime(((Label)((DetailsView)Auctiondetail1.FindControl("dvEventDetails")).Rows[4].Cells[1].FindControl("lblAuctionEndTime")).Text)) { btnSendEmailToVendors.Visible = false; gvSuppliers.Columns[0].Visible = false; } } if (!Page.IsPostBack) { if (Session["Message"] != null) { lblMessage.Text = Session["Message"].ToString(); Session["Message"] = null; } Session[Constant.SESSION_COMMENT_TYPE] = "1"; } }
private bool IsEnabled() { String sDate = ((Label)((DetailsView)Auctiondetail1.FindControl("dvEventDetails")).Rows[0].Cells[0].FindControl("Label3")).Text; DateTime datenow = DateTime.Now; DateTime rdeadline = DateTime.Parse(sDate); SqlParameter[] sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@AuctionRefNo", SqlDbType.Int); sqlParams[0].Value = Int32.Parse(Session[Constant.SESSION_AUCTIONREFNO].ToString()); int status = int.Parse(SqlHelper.ExecuteScalar(connstring, CommandType.StoredProcedure, "sp_GetAuctionStatus", sqlParams).ToString().Trim()); if ((DateTime.Compare(datenow, rdeadline) < 0) & !(status > 4)) { return(true); } else { return(false); } }