コード例 #1
0
ファイル: ReCheck.cs プロジェクト: fuhongliang/oa
        private void btnGetActualmoney_Click(object sender, EventArgs e)
        {
            DAL.AcountCheckTempTableAdapters.T_FB_BUDGETACCOUNTTableAdapter ad = new DAL.AcountCheckTempTableAdapters.T_FB_BUDGETACCOUNTTableAdapter();
            AcountCheckTemp.T_FB_BUDGETACCOUNTDataTable accTable = new AcountCheckTemp.T_FB_BUDGETACCOUNTDataTable();

            ad.Fill(accTable);

            List<AcountCheckTemp.T_FB_BUDGETACCOUNTRow> rowTemps = accTable.Where(t => t.USABLEMONEY > t.ACTUALMONEY).ToList();

            if (rowTemps.Count == 0)
            {
                MessageBox.Show("无记录");
                return;
            }

            foreach (AcountCheckTemp.T_FB_BUDGETACCOUNTRow item in rowTemps)
            {
                AcountCheckTemp.T_FB_BUDGETACCOUNTRow rowTemp = accErrTable.NewT_FB_BUDGETACCOUNTRow();
                rowTemp.BUDGETACCOUNTID = item.BUDGETACCOUNTID;
                rowTemp.BUDGETYEAR = item.BUDGETYEAR;
                rowTemp.BUDGETMONTH = item.BUDGETMONTH;
                rowTemp.ACCOUNTOBJECTTYPE = item.ACCOUNTOBJECTTYPE;

                rowTemp.SUBJECTID = item.SUBJECTID;
                rowTemp.BUDGETMONEY = item.BUDGETMONEY;
                rowTemp.USABLEMONEY = item.USABLEMONEY;
                rowTemp.ACTUALMONEY = item.ACTUALMONEY;
                rowTemp.PAIEDMONEY = item.PAIEDMONEY;
                rowTemp.OWNERCOMPANYID = item.OWNERCOMPANYID;
                rowTemp.OWNERDEPARTMENTID = item.OWNERDEPARTMENTID;
                rowTemp.OWNERPOSTID = item.OWNERPOSTID;
                rowTemp.OWNERID = item.OWNERID;

                rowTemp.CREATEUSERID = item.CREATEUSERID;
                rowTemp.CREATEDATE = item.CREATEDATE;
                rowTemp.UPDATEUSERID = item.UPDATEUSERID;
                rowTemp.UPDATEDATE = item.UPDATEDATE;

                accErrTable.Rows.Add(rowTemp);
            }

            dataGridView3.DataSource = accErrTable;
        }
コード例 #2
0
ファイル: ReCheck.cs プロジェクト: fuhongliang/oa
        private void btnSelectErrData_Click(object sender, EventArgs e)
        {
            AcountCheckTemp.T_FB_BUDGETACCOUNTDataTable dtAcount = new AcountCheckTemp.T_FB_BUDGETACCOUNTDataTable();
            DAL.AcountCheckTempTableAdapters.T_FB_BUDGETACCOUNTTableAdapter Adacount = new DAL.AcountCheckTempTableAdapters.T_FB_BUDGETACCOUNTTableAdapter();
            Adacount.Fill(dtAcount);
            //AcountCheckTemp.ACCOUNTDDataTable dtAcount = new AcountCheckTemp.ACCOUNTDDataTable();
            //if (dtAcount.Rows.Count <= 0)
            //{
            //    DAL.AcountCheckTempTableAdapters.ACCOUNTDTableAdapter AdacountAd = new DAL.AcountCheckTempTableAdapters.ACCOUNTDTableAdapter();
            //    AdacountAd.Fill(dtAcount);
            //}
//         
            
            string strCompanys = string.Empty; 
            for (int i = 0; i < dataGridCompany.Rows.Count; i++)
            {
                if (dataGridCompany.Rows[i].Cells["CheckColumn"].Value != null)
                {
                    if ((bool)dataGridCompany.Rows[i].Cells["CheckColumn"].Value)
                    {
                        strCompanys += "'" + dataGridCompany.Rows[i].Cells[2].Value.ToString() + "'"+ ",";
                    }
                }
            }
            string strFilter = "USABLEMONEY < 0";
            if(!string.IsNullOrEmpty(strCompanys))
            {
                strCompanys=strCompanys.Substring(0, strCompanys.Length - 1);
                strFilter += "and ACCOUNTOBJECTTYPE = "+intAccountType+" and OWNERCOMPANYID in(" + strCompanys + ")";
            }
            //DataRow[] rows= dtAcount.Select(strFilter);
            dataGridErrAcData.DataSource = dtAcount.Select(strFilter);
        }