protected void btnRenegotiate_Click(object sender, EventArgs e) { // update bid tender status to "for renegotiation" BidTransaction.UpdateBidTenderStatus(connstring, Convert.ToInt32(Session[Constant.SESSION_BIDTENDERNO].ToString()), Constant.BID_TENDER_STATUS_RE_NEGOTIATE); // save comment BidTransaction.SaveBidTenderComment(connstring, int.Parse(Session[Constant.SESSION_BIDTENDERNO].ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), txtComment.Text.Trim(), Constant.BIDTENDERCOMMENT_BUYER_TO_VENDOR); Response.Redirect("biditemsforrenegotiation.aspx"); }
protected void btnEndorse_Click(object sender, EventArgs e) { // update bid tender status to "endorsed" BidTransaction.UpdateBidTenderStatus(connstring, Convert.ToInt32(Session[Constant.SESSION_BIDTENDERNO].ToString()), Constant.BID_TENDER_STATUS_ENDORSED); // save comment BidTransaction.SaveBidTenderComment(connstring, int.Parse(Session[Constant.SESSION_BIDTENDERNO].ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), txtComment.Text.Trim(), Constant.BIDTENDERCOMMENT_BUYER_TO_PURCHASING); Response.Redirect("endorsedbidtenders.aspx"); }
protected void gvBidItemTenders_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvr = ((Control)e.CommandSource).NamingContainer as GridViewRow; Panel pnlLinks = (Panel)gvr.FindControl("pnlLinks"); Panel pnlComments = (Panel)gvr.FindControl("pnlComments"); switch (e.CommandName) { case "Endorse": { pnlLinks.Visible = false; pnlComments.Visible = true; gvBidItemTenders.Columns[5].ControlStyle.Width = Unit.Pixel(150); Session[Constant.SESSION_BIDTENDERNO] = e.CommandArgument.ToString(); LoadComments(); } break; case "ContinueEndorsement": { TextBox tbComments = (TextBox)pnlComments.FindControl("txtComment"); // update bid tender status to "endorsed" bool updateOk = BidTransaction.UpdateBidTenderStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), Constant.BIDTENDER_STATUS.STATUS.ENDORSED); // save comment bool saveCommentOk = BidTransaction.SaveBidTenderComment(connstring, int.Parse(e.CommandArgument.ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), tbComments.Text.Trim(), Constant.BIDTENDERCOMMENT_BUYER_TO_PURCHASING); if (updateOk && saveCommentOk) { Session["EndorsementMessage"] = "Bid tender was successfully endorsed."; Response.Redirect("biditemdetails.aspx"); } else { Session["EndorsementMessage"] = "Bid tender was not endorsed."; pnlLinks.Visible = true; pnlComments.Visible = false; } Session[Constant.SESSION_BIDTENDERNO] = e.CommandArgument.ToString(); LoadComments(); } break; case "CancelEndorsement": { pnlLinks.Visible = true; pnlComments.Visible = false; gvBidItemTenders.Columns[5].ControlStyle.Width = Unit.Pixel(90); pnlComments.Width = Unit.Percentage(100.00); pnlLinks.Width = Unit.Percentage(100.00); dvTenderDetails.PageIndex = gvBidItemTenders.SelectedIndex; Session[Constant.SESSION_BIDTENDERNO] = gvBidItemTenders.DataKeys[gvBidItemTenders.SelectedIndex].Values[0].ToString(); LoadComments(); } break; case "Select": { string[] args = e.CommandArgument.ToString().Split(new char[] { '|' }); Session[Constant.SESSION_BIDTENDERNO] = args[0]; Session["TVendorId"] = args[1]; Session[Constant.SESSION_BIDREFNO] = args[2]; Session["ViewOption"] = "AsVendor"; LoadComments(); dvTenderDetails.Visible = true; pnlBidTenderAttachments.Visible = true; } break; } }
protected void gvBidItemTenders_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvr = ((Control)e.CommandSource).NamingContainer as GridViewRow; Panel pnlLinks = (Panel)gvr.FindControl("pnlLinks"); Panel pnlComments = (Panel)gvr.FindControl("pnlComments"); TextBox tbComments = (TextBox)pnlComments.FindControl("txtComment"); TextBox tbDutiesTaxes = (TextBox)pnlComments.FindControl("txtDutiesTaxes"); TextBox tbForwarding = (TextBox)pnlComments.FindControl("txtForwarding"); switch (e.CommandName) { case "Endorse": { pnlLinks.Visible = false; pnlComments.Visible = true; gvBidItemTenders.Columns[5].ControlStyle.Width = Unit.Pixel(150); Session[Constant.SESSION_BIDTENDERNO] = e.CommandArgument.ToString(); LoadComments(); } break; case "UpdateCmd": { string sCommand, DutiesTaxes, Forwarding; DutiesTaxes = tbDutiesTaxes.Text.Trim() != "" ? tbDutiesTaxes.Text.Trim() : "0"; Forwarding = tbForwarding.Text.Trim() != "" ? tbForwarding.Text.Trim() : "0"; //Response.Write(tbDutiesTaxes.Text.Trim()+";" + e.CommandArgument.ToString()); //bool updateOk0 = BidTransaction.UpdateBidTenderStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), Constant.BIDTENDER_STATUS.STATUS.SUBMITTED, tbDutiesTaxes.Text.Trim(), tbForwarding.Text.Trim()); sCommand = "UPDATE tblBidTenders SET DutiesTaxes = " + DutiesTaxes + ", Forwarding=" + Forwarding + " WHERE BidTenderNo = " + e.CommandArgument.ToString(); //sCommand = "IF NOT EXISTS (SELECT 1 FROM tblUserTypes t1, tblUsers t2 WHERE t1.UserId = t2.UserId AND t2.UserName = '******') BEGIN INSERT INTO tblUserTypes (UserID, UserType, DateCreated) SELECT UserId, 11, getdate() FROM tblUsers WHERE UserName = '******' END"; SqlHelper.ExecuteNonQuery(connstring, CommandType.Text, sCommand); gvBidItemTenders.DataBind(); } break; case "ContinueEndorsement": { // update bid tender status to "endorsed" bool updateOk = BidTransaction.UpdateBidTenderStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), Constant.BIDTENDER_STATUS.STATUS.ENDORSED, tbDutiesTaxes.Text.Trim(), tbForwarding.Text.Trim()); // save comment bool saveCommentOk = BidTransaction.SaveBidTenderComment(connstring, int.Parse(e.CommandArgument.ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), tbComments.Text.Trim(), Constant.BIDTENDERCOMMENT_BUYER_TO_PURCHASING); if (updateOk && saveCommentOk) { Session["EndorsementMessage"] = "Bid tender was successfully endorsed."; Response.Redirect("biditemdetails.aspx"); } else { Session["EndorsementMessage"] = "Bid tender was not endorsed."; pnlLinks.Visible = true; pnlComments.Visible = false; } Session[Constant.SESSION_BIDTENDERNO] = e.CommandArgument.ToString(); LoadComments(); } break; case "CancelEndorsement": { pnlLinks.Visible = true; pnlComments.Visible = false; gvBidItemTenders.Columns[5].ControlStyle.Width = Unit.Pixel(90); pnlComments.Width = Unit.Percentage(100.00); pnlLinks.Width = Unit.Percentage(100.00); dvTenderDetails.PageIndex = gvBidItemTenders.SelectedIndex; Session[Constant.SESSION_BIDTENDERNO] = gvBidItemTenders.DataKeys[gvBidItemTenders.SelectedIndex].Values[0].ToString(); LoadComments(); } break; case "Select": { string[] args = e.CommandArgument.ToString().Split(new char[] { '|' }); Session[Constant.SESSION_BIDTENDERNO] = args[0]; Session["TVendorId"] = args[1]; Session[Constant.SESSION_BIDREFNO] = args[2]; Session["ViewOption"] = "AsVendor"; LoadComments(); dvTenderDetails.Visible = true; pnlBidTenderAttachments.Visible = true; } break; } }
// submit tender for approval / awarding protected void btnSubmit_Click(object sender, EventArgs e) { if (isAllowSubmit()) { if (Session["AsClarified"] != null) { if (Session["AsClarified"].ToString() == "True") { if (IsValid) { // bool updateOk = BidTransaction.UpdateBidTenderStatus(connstring, Int32.Parse(Session[Constant.SESSION_BIDTENDERNO].ToString()), Constant.BIDTENDER_STATUS.STATUS.SUBMITTED); bool updateOk = BidTransaction.UpdateBidTenderRenegotiationStatus(connstring, Int32.Parse(Session[Constant.SESSION_BIDTENDERNO].ToString()), Constant.BIDTENDER_STATUS.RENEGOTIATION_STATUS.VENDOR_TO_BUYER); if (updateOk) { InsertVendorsComments(); } if (Session["Renegotiated"] != null) { Response.Redirect("bidsforrenegotiation.aspx"); } else { Response.Redirect("submittedtenders.aspx"); } } } else { if (IsValid) { bool updateOk = BidTransaction.UpdateBidTenderRenegotiationStatus(connstring, Int32.Parse(Session[Constant.SESSION_BIDTENDERNO].ToString()), Constant.BIDTENDER_STATUS.RENEGOTIATION_STATUS.VENDOR_TO_BUYER); if (UpdateTender(1) == false) { //unable to save } else { if (Session["Renegotiated"] != null) { UpdateBidTenderAttachments(int.Parse(Session[Constant.SESSION_BIDREFNO].ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), 0); Response.Redirect("bidsforrenegotiation.aspx"); } else { UpdateBidTenderAttachments(int.Parse(Session[Constant.SESSION_BIDREFNO].ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), 0); Response.Redirect("submittedtenders.aspx"); } } } } } else { if (IsValid) { if (UpdateTender(1) == false) { //unable to save } else { if (Session["Renegotiated"] != null) { UpdateBidTenderAttachments(int.Parse(Session[Constant.SESSION_BIDREFNO].ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), 0); Response.Redirect("bidsforrenegotiation.aspx"); } else { UpdateBidTenderAttachments(int.Parse(Session[Constant.SESSION_BIDREFNO].ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), 0); Response.Redirect("submittedtenders.aspx"); } } } } } else { if (Session["Renegotiated"] != null) { if (Session["Renegotiated"].ToString() == "1") { litErrMsg.Text = "<p style='color:red; align:center;'>" + "Renegotiation deadline (" + GetRenegotiationDeadline().ToString() + ") has been reached." + "</p>"; } } else { litErrMsg.Text = "<p style='color:red; align:center;'>" + "Bid submission deadline (" + GetSubmissionDeadline().ToString() + ") has been reached." + "</p>"; } } }
protected void gvBidItemTenders_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvr = ((Control)e.CommandSource).NamingContainer as GridViewRow; Panel pnlLinks = (Panel)gvr.FindControl("pnlLinks"); Panel pnlComments = (Panel)gvr.FindControl("pnlComments"); LinkButton lnkOK = (LinkButton)gvr.FindControl("lnkOK"); LinkButton lnkReendorsed = (LinkButton)gvr.FindControl("lnkEndorse"); LinkButton lnkRenegotiate = (LinkButton)gvr.FindControl("lnkRenegotiate"); HiddenField hdnVendorId = (HiddenField)gvr.FindControl("hdnVendorId"); switch (e.CommandName) { case "Clarify": { pnlLinks.Visible = false; pnlComments.Visible = true; gvBidItemTenders.Columns[5].ControlStyle.Width = Unit.Pixel(150); ViewState["Command"] = "clarify"; lnkOK.Attributes.Add("onclick", "return confirm('Are you sure you want to clarify this item?');"); pnlFileUpload.Visible = true; } break; case "Renegotiate": { pnlLinks.Visible = false; pnlComments.Visible = true; gvBidItemTenders.Columns[5].ControlStyle.Width = Unit.Pixel(150); ViewState["Command"] = "renegotiate"; lnkOK.Attributes.Add("onclick", "return confirm('Are you sure you want to renegotiate this item?');"); pnlFileUpload.Visible = true; } break; case "Re-endorse": { pnlLinks.Visible = false; pnlComments.Visible = true; gvBidItemTenders.Columns[5].ControlStyle.Width = Unit.Pixel(150); ViewState["Command"] = "re-endorse"; lnkOK.Attributes.Add("onclick", "return confirm('Are you sure you want to re-endorse this item?');"); } break; case "ContinueEndorsement": { if (ViewState["Command"] != null) { TextBox tbComments = (TextBox)pnlComments.FindControl("txtComment"); // save comment if (ViewState["Command"].ToString() == "clarify") { // update bid tender status to "renegotiated" bool updateOk = BidTransaction.UpdateBidTenderStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), Constant.BIDTENDER_STATUS.STATUS.RENEGOTIATED); bool updateOk2 = BidTransaction.UpdateBidTenderRenegotiationStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), Constant.BIDTENDER_STATUS.RENEGOTIATION_STATUS.BUYER_TO_VENDOR); bool updateOk3 = BidTransaction.UpdateAsClarifiedStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), 1); bool saveCommentOk = BidTransaction.SaveBidTenderComment(connstring, int.Parse(e.CommandArgument.ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), tbComments.Text.Trim(), Constant.BIDTENDERCOMMENT_BUYER_TO_VENDOR); if (updateOk && updateOk2 && updateOk3 && saveCommentOk) { //save attachments DeleteExistingBidEventAttachments(int.Parse(Session[Constant.SESSION_BIDREFNO].ToString())); SaveBidEventAttachments(int.Parse(Session[Constant.SESSION_BIDREFNO].ToString())); Session["Message"] = "Bid item was successfully clarified."; //send sms try { if (SMSHelper.AreValidMobileNumbers(GetVendorMobileNo(int.Parse(hdnVendorId.Value)))) { SMSHelper.SendSMS(new SMSMessage(CreateSmsBody(e.CommandArgument.ToString().Trim()), GetVendorMobileNo(int.Parse(hdnVendorId.Value)))); } } catch (Exception ex) { LogHelper.EventLogHelper.Log("Bid Event > Send SMS Notification : " + ex.Message, System.Diagnostics.EventLogEntryType.Error); } //end of sms sending Response.Redirect("renegotiatedbiditemdetails.aspx"); } else { Session["Message"] = "Bid item was not clarified."; pnlLinks.Visible = true; } } else if (ViewState["Command"].ToString() == "renegotiate") { // update bid tender status to "renegotiated" bool updateOk = BidTransaction.UpdateBidTenderStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), Constant.BIDTENDER_STATUS.STATUS.RENEGOTIATED); bool updateOk2 = BidTransaction.UpdateBidTenderRenegotiationStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), Constant.BIDTENDER_STATUS.RENEGOTIATION_STATUS.BUYER_TO_VENDOR); bool updateOk3 = BidTransaction.UpdateAsClarifiedStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), 0); bool saveCommentOk = BidTransaction.SaveBidTenderComment(connstring, int.Parse(e.CommandArgument.ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), tbComments.Text.Trim(), Constant.BIDTENDERCOMMENT_BUYER_TO_VENDOR); if (updateOk && updateOk2 && updateOk3 && saveCommentOk) { //save attachments DeleteExistingBidEventAttachments(int.Parse(Session[Constant.SESSION_BIDREFNO].ToString())); SaveBidEventAttachments(int.Parse(Session[Constant.SESSION_BIDREFNO].ToString())); Session["Message"] = "Bid item was successfully clarified."; //send sms try { if (SMSHelper.AreValidMobileNumbers(GetVendorMobileNo(int.Parse(hdnVendorId.Value)))) { SMSHelper.SendSMS(new SMSMessage(CreateSmsBody(e.CommandArgument.ToString().Trim()), GetVendorMobileNo(int.Parse(hdnVendorId.Value)))); } } catch (Exception ex) { LogHelper.EventLogHelper.Log("Bid Event > Send SMS Notification : " + ex.Message, System.Diagnostics.EventLogEntryType.Error); } //end of sms sending Response.Redirect("renegotiatedbiditemdetails.aspx"); } else { Session["Message"] = "Bid item was not clarified."; pnlLinks.Visible = true; } } else if (ViewState["Command"].ToString() == "re-endorse") { // update bid tender status to "endorsed" bool updateOk = BidTransaction.UpdateBidTenderStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), Constant.BIDTENDER_STATUS.STATUS.ENDORSED); bool updateOk2 = BidTransaction.UpdateBidTenderRenegotiationStatus(connstring, Convert.ToInt32(e.CommandArgument.ToString()), Constant.BIDTENDER_STATUS.RENEGOTIATION_STATUS.BUYER_TO_PURCHASING); bool saveCommentOk = BidTransaction.SaveBidTenderComment(connstring, int.Parse(e.CommandArgument.ToString()), int.Parse(Session[Constant.SESSION_USERID].ToString()), tbComments.Text.Trim(), Constant.BIDTENDERCOMMENT_BUYER_TO_PURCHASING); if (updateOk && updateOk2 && saveCommentOk) { Session["Message"] = "Bid item was successfully endorsed."; Response.Redirect("renegotiatedbiditemdetails.aspx"); } else { Session["Message"] = "Bid item was not endorsed."; pnlLinks.Visible = true; pnlComments.Visible = false; } } } } break; case "CancelEndorsement": { pnlLinks.Visible = true; pnlComments.Visible = false; dvTenderDetails.PageIndex = gvBidItemTenders.SelectedIndex; Session[Constant.SESSION_BIDTENDERNO] = gvBidItemTenders.DataKeys[gvBidItemTenders.SelectedIndex].Values[0].ToString(); BindComments(); gvBidItemTenders.Columns[5].ControlStyle.Width = Unit.Pixel(90); pnlFileUpload.Visible = false; } break; case "Select": { string[] args = e.CommandArgument.ToString().Split(new char[] { '|' }); Session[Constant.SESSION_BIDTENDERNO] = args[0]; Session["TVendorId"] = args[1]; Session[Constant.SESSION_BIDREFNO] = args[2]; Session["ViewOption"] = "AsBuyer"; lblCurrentIndex.Text = "0"; BindComments(); gvBidItemTenders.Columns[5].ControlStyle.Width = Unit.Pixel(90); dvTenderDetails.Visible = true; pnlTenderAttachments.Visible = true; } break; } }