Exemple #1
0
        // 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>";
                }
            }
        }
Exemple #2
0
    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;
        }
    }