protected void ProcessManualPost()
 {
     switch (verifyAction)
     {
         case VerifyExchangeAction.Approve:
             AddError(ExchangeVoucherHeaderDataSource.ChangeExchangeVoucherStatus(sEditItem, ExchangeVoucherStatus.Approved));
             verifyAction = VerifyExchangeAction.None;
             //if (errorCode.Count == 0)
             Response.Redirect(BuildMiniPostBackUrl("-1", "", "")); // remove if needed
             break;
         case VerifyExchangeAction.Reject:
             AddError(ExchangeVoucherHeaderDataSource.ChangeExchangeVoucherStatus(sEditItem, ExchangeVoucherStatus.Reject));
             verifyAction = VerifyExchangeAction.None;
             //if (errorCode.Count == 0)
             Response.Redirect(BuildMiniPostBackUrl("-1", "", "")); // remove if needed
             break;
         case VerifyExchangeAction.Update: EmptyGridViewEx1_RowUpdating(EmptyGridViewEx1, null); break;
         case VerifyExchangeAction.CancelEdit: EmptyGridViewEx1_RowCancelingEdit(EmptyGridViewEx1, null); break;
         case VerifyExchangeAction.SelectSpare:
             if (!((ViewState[SELECTING_SPARE_KEY] != null) && Convert.ToBoolean(ViewState[SELECTING_SPARE_KEY].ToString())))
                 btnFindSpare_Click(null, null);
             break;
         default: break;
     }
     EmptyGridViewEx1.EditIndex = editIndex;
     if (editIndex >= 0) EmptyGridViewEx1_RowEditing(EmptyGridViewEx1, null);
 }
    protected void Page_Init(object sender, EventArgs e)
    {
        isManualPost = Convert.ToBoolean(Request.QueryString["pb"]);
        string sEditIndex = Request.QueryString["ei"];
        string sPage = Request.QueryString["pg"];
        sEditItem = Request.QueryString["epcv"];
        string sEditAct = Request.QueryString["eact"];
        string sPcvn = Request.QueryString["pcvn"];
        string sPcvf = Request.QueryString["pcvf"];
        string sPcvt = Request.QueryString["pcvt"];
        string sEngine = Request.QueryString["en"];
        string sStatus = Request.QueryString["pcvn"];
        string sReparef = Request.QueryString["rpf"];
        string sReparet = Request.QueryString["rpt"];

        int tsT, tsF, iact;
        DateTimeFormatInfo dti = Thread.CurrentThread.CurrentCulture.DateTimeFormat;

        if ((!string.IsNullOrEmpty(sReparef)) && (int.TryParse(sReparef, out tsF))) this.RepairDateFrom = DateTime.Now.Add(new TimeSpan(tsF, 0, 0, 0));
        if ((!string.IsNullOrEmpty(sReparet)) && (int.TryParse(sReparet, out tsT))) this.RepairDateTo = DateTime.Now.Add(new TimeSpan(tsT, 0, 0, 0));
        if (!string.IsNullOrEmpty(sStatus)) int.TryParse(sStatus, out this.Status);
        if (!string.IsNullOrEmpty(sEngine)) this.EngineNumber = sEngine;
        if (!string.IsNullOrEmpty(sPcvn)) this.ProposalNumber = sPcvn;
        if (!string.IsNullOrEmpty(sPcvf)) this.VoucherNumberFrom = sPcvf;
        if (!string.IsNullOrEmpty(sPcvt)) this.VoucherNumberTo = sPcvt;
        if (!string.IsNullOrEmpty(sPage)) pageIndex = Convert.ToInt32(sPage);
        if (!string.IsNullOrEmpty(sEditIndex)) editIndex = Convert.ToInt32(sEditIndex); if (editIndex < 0) editIndex = -1;

        // process request
        if (int.TryParse(sEditAct, out iact)) { verifyAction = (VerifyExchangeAction)iact; }
    }