protected void btnOk_Click(object sender, EventArgs e)
        {
            int index = int.Parse(btnOk.CommandArgument);

            int       dataIndex = mainContractGV.Rows[index].DataItemIndex;
            DataTable dt        = (DataTable)Session["dtSources"];

            GridViewRow  row    = mainContractGV.Rows[index];
            DropDownList ddlPay = row.FindControl("ddlPay") as DropDownList;

            System.Nullable <float> payPercent = float.Parse(ddlPay.SelectedValue);

            System.Nullable <int> mainContractId = int.Parse(dt.DefaultView[dataIndex].Row["mainContractId"].ToString());

            //MainContractProcess mcp = Session["MainContractProcess"] as MainContractProcess;

            //mcp.MainContractPayPercentUpdate(mainContractId, payPercent);

            //mcp.RealmainContractProjectView();

            //DataTable taskTable = mcp.MyDst.Tables["view_mainContract_project_usr"];

            //string strUsrId = Session["usrId"] as string;

            //int usrId = int.Parse(strUsrId);
            Xm_db xmDataCont = Xm_db.GetInstance();

            try
            {
                xmDataCont.MainContract_payPercent_update(mainContractId, payPercent);

                xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);

                var mailVar = reflash(xmDataCont);

                sendMail(mainContractId, mailVar);
            }
            catch (System.Data.Linq.ChangeConflictException cce)
            {
                string strEx = cce.Message;
                foreach (System.Data.Linq.ObjectChangeConflict occ in xmDataCont.ChangeConflicts)
                {
                    occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
                }

                xmDataCont.MainContract_payPercent_update(mainContractId, payPercent);

                xmDataCont.SubmitChanges();

                var mailVar = reflash(xmDataCont);

                sendMail(mainContractId, mailVar);
            }

            mainContractGV.DataSource = Session["dtSources"];
            mainContractGV.DataBind();

            Button btn = null;

            btn         = sender as Button;
            btn.Visible = false;
            btn         = btnNo;
            btn.Visible = false;
            mainContractGV.Columns[7].Visible  = true;
            mainContractGV.Columns[9].Visible  = true;
            mainContractGV.Columns[10].Visible = true;
        }