protected void btnOk_Click(object sender, EventArgs e) { GridViewRow gvr = selfReceiptGV.SelectedRow; int index = gvr.DataItemIndex; DataTable dt = Session["dtSources"] as DataTable; string strReceiptId = dt.Rows[index]["receiptId"].ToString(); int usrId = int.Parse(dt.Rows[index]["usrId"].ToString()); string projetTag = dt.Rows[index]["projectTag"].ToString(); //string receiptNum = dt.Rows[index]["receiptPercent"].ToString(); string strReceiptPercent = dt.Rows[index]["receiptPercent"].ToString(); string strMainContractId = dt.Rows[index]["mainContractId"].ToString(); string strProjetTagId = dt.Rows[index]["projectTagId"].ToString(); //string strFilter = // " receiptId = " + "'" + strReceiptId + "'"; //dt.DefaultView.RowFilter = strFilter; //DataTable doneTable = dt.DefaultView.ToTable("addTable"); //dt.Clear(); //ReceiptApplyProcess rap = Session["ReceiptApplyProcess"] as ReceiptApplyProcess; //rap.MyDst.Tables.Add(doneTable); //rap.SelfReceiptDone(); Xm_db xmDataCont = Xm_db.GetInstance(); int receiptId = int.Parse(strReceiptId); float receiptPercent = float.Parse(strReceiptPercent); int mainContractId = int.Parse(strMainContractId); int projectTagId = int.Parse(strProjetTagId); string receiptNum = receiptPercent.ToString("p"); xmDataCont.SelfReceipt_done(receiptId, receiptPercent, mainContractId, projectTagId); //var usr_autority = // from usr in xmDataCont.Tbl_usr // join auth in xmDataCont.View_usr_autority on usr.UsrId equals auth.UsrId // where (auth.UsrId == usrId || // auth.AuthorityId == 25) && // auth.UsrAuEnd > DateTime.Now // select usr; //int flag = 0x2000; var usr_autority = from usr in xmDataCont.Tbl_usr //join auth in xmDataCont.View_usr_autority on usr.UsrId equals auth.UsrId where (usr.UsrId == usrId || ((usr.TotleAuthority & (UInt32)AuthAttributes.pay_receiptExamine) != 0)) && usr.EndTime > DateTime.Now select usr; //where (usr.UsrId == usrId || // usr.TotleAuthority.ToAuthAttr().HasOneFlag(AuthAttributes.pay_receiptExamine)) && // usr.EndTime > DateTime.Now //select usr; foreach (var usr in usr_autority) { BeckSendMail.getMM().NewMail(usr.UsrEmail, "mis系统票务通知", projetTag + "的开票申请已完成" + receiptNum + ",请尽快完成后续工作"); } var viewMainReceipt = from mainReceipt in xmDataCont.View_mainReceipt where mainReceipt.EndTime > DateTime.Now && mainReceipt.IsAccept.Equals(bool.TrueString) && mainReceipt.DoneTime > DateTime.Now select mainReceipt; DataTable taskTable = viewMainReceipt.ToDataTable(); //rap.RealSelfReceiptView(); //DataTable taskTable = rap.MyDst.Tables["view_mainReceipt"].DefaultView.ToTable(); //string end = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"); //strFilter = // " isAccept = " + "'" + bool.TrueString + "'" + // " and doneTime > " + "'" + end + "'"; string strFilter = string.Empty; dt_modify(taskTable, strFilter); Session["dtSources"] = taskTable.DefaultView.ToTable(); selfReceiptGV.SelectedIndex = -1; selfReceiptGV.Enabled = true; selfReceiptGV.Columns[12].Visible = true; selfReceiptGV.DataSource = Session["dtSources"]; selfReceiptGV.DataBind(); btnOk.Visible = false; btnNo.Visible = false; }