Beispiel #1
0
        private void btView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridView1.FocusedRowHandle != -1)
            {
                frmExportYearSelect frm = new frmExportYearSelect();
                DataTable dt = new DataTable();
                dt.Columns.Add("A", typeof(string));
                dt.Columns.Add("B", typeof(bool));
                if (frm.ShowDialog()==DialogResult.OK)
                {
                  
                   // dt = frm.DT1;
                    DataRow[] dtc = frm.DT1.Select("B=1");
                    foreach (DataRow dr1 in dtc)
                    {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[0].ToString();
                        dr[1] = Convert.ToInt32(dr1[1]);
                        dt.Rows.Add(dr);
                    }
                    dtc = frm.DT1.Select("D=1");
                    foreach (DataRow dr1 in dtc)
                    {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[2].ToString();
                        dr[1] = Convert.ToInt32(dr1[3]);
                        dt.Rows.Add(dr);
                    }
                    dtc = frm.DT1.Select("F=1");
                    foreach (DataRow dr1 in dtc)
                    {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[4].ToString();
                        dr[1] = Convert.ToInt32(dr1[5]);
                        dt.Rows.Add(dr);
                    }
                    if (dt.Rows.Count == 0)
                    {
                        Export05.ExportExcel(gridView1.GetFocusedRow() as PJ_05jcky);
                    }
                    else
                    {
                        string sely = "(";
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (i < dt.Rows.Count - 1)
                            {
                                sely += "'" + dt.Rows[i][0].ToString() + "',";
                            }
                            else
                                sely += "'" + dt.Rows[i][0].ToString() + "')";

                        }
                        Export05.ExportExcel(gridView1.GetFocusedRow() as PJ_05jcky, sely);

                    }
                }
               
            }
        }
Beispiel #2
0
        private void btView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (PSObj!=null&&gridView1.RowCount>0)
            {
                frmExportYearSelect frm = new frmExportYearSelect();
                DataTable dt = new DataTable();
                dt.Columns.Add("A", typeof(string));
                dt.Columns.Add("B", typeof(bool));
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    //dt = frm.DT1;
                    DataRow[] dtc = frm.DT1.Select("B=1");
                    foreach (DataRow dr1 in dtc)
                    {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[0].ToString();
                        dr[1] = Convert.ToInt32(dr1[1]);
                        dt.Rows.Add(dr);
                    }
                    dtc = frm.DT1.Select("D=1");
                    foreach (DataRow dr1 in dtc)
                    {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[2].ToString();
                        dr[1] = Convert.ToInt32(dr1[3]);
                        dt.Rows.Add(dr);
                    }
                    dtc = frm.DT1.Select("F=1");
                    foreach (DataRow dr1 in dtc)
                    {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[4].ToString();
                        dr[1] = Convert.ToInt32(dr1[5]);
                        dt.Rows.Add(dr);
                    }
                    IList<PJ_14aqgjsy> pjlist = new List<PJ_14aqgjsy>();
                    if (dt.Rows.Count == 0)
                    {
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            pjlist.Add(gridView1.GetRow(i) as PJ_14aqgjsy);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            PJ_14aqgjsy obj = gridView1.GetRow(i) as PJ_14aqgjsy;
                            for (int j = 0; j < dt.Rows.Count; j++)
                            {
                                if (Convert.ToInt32(dt.Rows[j][0]) == obj.rq.Year)
                                {
                                    pjlist.Add(gridView1.GetRow(i) as PJ_14aqgjsy);
                                }
                            }

                        }
                    }

                    Export14.ExportExcel(PSObj, pjlist);
                }
              
            }
           
           
        }
Beispiel #3
0
        private void btView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
            if (gridView1.RowCount > 0) {
                frmExportYearSelect frm = new frmExportYearSelect();
                DataTable dt = new DataTable();
                dt.Columns.Add("A", typeof(string));
                dt.Columns.Add("B", typeof(bool));
                if (frm.ShowDialog() == DialogResult.OK) {
                    //dt = frm.DT1;
                    IList<PJ_08sbtdjx> pjlist = new List<PJ_08sbtdjx>();
                    DataRow[] dtc = frm.DT1.Select("B=1");
                    foreach (DataRow dr1 in dtc) {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[0].ToString();
                        dr[1] = Convert.ToInt32(dr1[1]);
                        dt.Rows.Add(dr);
                    }
                    dtc = frm.DT1.Select("D=1");
                    foreach (DataRow dr1 in dtc) {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[2].ToString();
                        dr[1] = Convert.ToInt32(dr1[3]);
                        dt.Rows.Add(dr);
                    }
                    dtc = frm.DT1.Select("F=1");
                    foreach (DataRow dr1 in dtc) {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[4].ToString();
                        dr[1] = Convert.ToInt32(dr1[5]);
                        dt.Rows.Add(dr);
                    };

                    if (dt.Rows.Count == 0) {

                        for (int i = 0; i < gridView1.RowCount; i++) {
                            PJ_08sbtdjx _pj = gridView1.GetRow(i) as PJ_08sbtdjx;
                            pjlist.Add(_pj);

                        }
                    } else {
                        for (int i = 0; i < gridView1.RowCount; i++) {
                            PJ_08sbtdjx _pj = gridView1.GetRow(i) as PJ_08sbtdjx;

                            for (int j = 0; j < dt.Rows.Count; j++) {
                                if (_pj.tdsj.Year == Convert.ToInt32(dt.Rows[j][0])) {
                                    pjlist.Add(_pj);
                                }
                            }


                        }
                    }

                    Export08.ExportExcel(pjlist);
                }

            } else {
                return;
            }
        }
Beispiel #4
0
        private void btView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
            //frm06sbxsLine frm = new frm06sbxsLine();
            //frm.orgcode = btGdsList.EditValue.ToString();
            //if (frm.ShowDialog()==DialogResult.OK)
            //{

            //    IList<PJ_06sbxs> pj06list = new List<PJ_06sbxs>();
            //    pj06list = Client.ClientHelper.PlatformSqlMap.GetList<PJ_06sbxs>(" where LineName='" + frm.linename + "'");
            //    if (pj06list.Count>0)
            //    {
            //        Export06.ExportExcel(pj06list);
            //    }
            //   else
            //    {
            //        MsgBox.ShowTipMessageBox("此线路没有添加巡视情况。");
            //        return;
            //    }
            //}
            if (gridView1.FocusedRowHandle >= 0) {
                bool xsmxflag = false; //是否有巡视的子表
                frmExportYearSelect frm = new frmExportYearSelect();
                DataTable dt = new DataTable();
                dt.Columns.Add("A", typeof(string));
                dt.Columns.Add("B", typeof(bool));
                if (frm.ShowDialog() == DialogResult.OK) {
                    DataRow[] dtc = frm.DT1.Select("B=1");
                    foreach (DataRow dr1 in dtc) {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[0].ToString();
                        dr[1] = Convert.ToInt32(dr1[1]);
                        dt.Rows.Add(dr);
                    }
                    dtc = frm.DT1.Select("D=1");
                    foreach (DataRow dr1 in dtc) {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[2].ToString();
                        dr[1] = Convert.ToInt32(dr1[3]);
                        dt.Rows.Add(dr);
                    }
                    dtc = frm.DT1.Select("F=1");
                    foreach (DataRow dr1 in dtc) {
                        DataRow dr = dt.NewRow();
                        dr[0] = dr1[4].ToString();
                        dr[1] = Convert.ToInt32(dr1[5]);
                        dt.Rows.Add(dr);
                    }


                    Dictionary<string, List<PJ_06sbxs>> diclist = new Dictionary<string, List<PJ_06sbxs>>();
                    PJ_06sbxs _pj = gridView1.GetRow(gridView1.FocusedRowHandle) as PJ_06sbxs;
                    //添加明细表的信息
                    IList<PJ_06sbxsmx> ilist = null;
                    if (dt.Rows.Count == 0) {
                        ilist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_06sbxsmx>(" where ParentID='" + _pj.ID + "' order by CreateDate desc");
                    } else {
                        string sely = "(";
                        for (int i = 0; i < dt.Rows.Count; i++) {
                            if (i < dt.Rows.Count - 1) {
                                sely += "'" + dt.Rows[i][0].ToString() + "',";
                            } else
                                sely += "'" + dt.Rows[i][0].ToString() + "')";

                        }
                        ilist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_06sbxsmx>(" where ParentID='" + _pj.ID + "'and year(xssj) in" + sely + "order by CreateDate desc");
                    }
                    if (ilist.Count == 0) {
                        xsmxflag = false;
                        List<PJ_06sbxs> lispj = new List<PJ_06sbxs>();
                        lispj.Add(_pj);
                        diclist[_pj.LineID] = lispj;
                    } else {
                        xsmxflag = true;
                        List<PJ_06sbxs> lispj = new List<PJ_06sbxs>();
                        diclist[_pj.LineID] = lispj;
                        foreach (PJ_06sbxsmx pmx in ilist) {
                            PJ_06sbxs newpj = new PJ_06sbxs();
                            Type obj = newpj.GetType();
                            foreach (PropertyInfo p in obj.GetProperties()) {
                                try {
                                    p.SetValue(newpj, pmx.GetType().GetProperty(p.Name).GetValue(pmx, null), null);
                                } catch (Exception ex) { }
                            }
                            diclist[_pj.LineID].Add(newpj);
                        }
                        // lispj.Add(_pj);

                    }
                    foreach (KeyValuePair<string, List<PJ_06sbxs>> pp in diclist) {
                        List<PJ_06sbxs> objlist = pp.Value;
                        if (objlist.Count > 0) {
                            Export06.ExportExcel(objlist, xsmxflag);
                        }

                    }
                }

            }


            //for (int i = 0; i < gridView1.RowCount;i++ )
            //{
            //    PJ_06sbxs _pj = gridView1.GetRow(i) as PJ_06sbxs;

            //    if (diclist.ContainsKey(_pj.LineID))
            //    {
            //        diclist[_pj.LineID].Add(_pj);
            //    }
            //    else
            //    {
            //        List<PJ_06sbxs> lispj = new List<PJ_06sbxs>();
            //        lispj.Add(_pj);
            //        diclist[_pj.LineID] = lispj;
            //    }
            //    //添加明细表的信息
            //    IList<PJ_06sbxsmx> ilist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_06sbxsmx>(" where ParentID='" + _pj.ID + "' order by CreateDate desc");
            //    foreach (PJ_06sbxsmx pmx in ilist)
            //    {
            //        PJ_06sbxs newpj = new PJ_06sbxs();
            //        Type obj = newpj.GetType();
            //        foreach (PropertyInfo p in obj.GetProperties())
            //        {
            //            try
            //            {
            //                p.SetValue(newpj, p.GetValue(pmx, null), null);
            //            }
            //            catch { }
            //        }
            //        diclist[_pj.LineID].Add(newpj);
            //    }
            //}
            //foreach (KeyValuePair<string, List<PJ_06sbxs>> pp in diclist)
            //{
            //    List<PJ_06sbxs> objlist = pp.Value;
            //    if (objlist.Count > 0)
            //    {
            //        Export06.ExportExcel(objlist);
            //    }

            //}

        }
Beispiel #5
0
        private void btView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridView1.FocusedRowHandle != -1)
            {
                frmExportYearSelect frm = new frmExportYearSelect();
                DataTable dt = new DataTable();
                dt.Columns.Add("A", typeof(string));
                dt.Columns.Add("B", typeof(bool));
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    //dt = frm.DT1;
                    try
                    {
                        DataRow[] dtc = frm.DT1.Select("B=1");
                        foreach (DataRow dr1 in dtc)
                        {
                            DataRow dr = dt.NewRow();
                            dr[0] = dr1[0].ToString();
                            dr[1] = Convert.ToInt32(dr1[1]);
                            dt.Rows.Add(dr);
                        }
                        dtc = frm.DT1.Select("D=1");
                        foreach (DataRow dr1 in dtc)
                        {
                            DataRow dr = dt.NewRow();
                            dr[0] = dr1[2].ToString();
                            dr[1] = Convert.ToInt32(dr1[3]);
                            dt.Rows.Add(dr);
                        }
                        dtc = frm.DT1.Select("F=1");
                        foreach (DataRow dr1 in dtc)
                        {
                            DataRow dr = dt.NewRow();
                            dr[0] = dr1[4].ToString();
                            dr[1] = Convert.ToInt32(dr1[5]);
                            dt.Rows.Add(dr);
                        }
                        //Export13.ExportExcel(gridView1.GetFocusedRow() as PS_tqdlbh);
                        mOrg org = MainHelper.PlatformSqlMap.GetOneByKey<mOrg>(btGdsList.EditValue.ToString());
                        if (dt.Rows.Count == 0)
                        {
                            Export13.ExportExcel2(gridControl1.DataSource as IList<PS_tqdlbh>, org.OrgName);
                        }
                        else
                        {
                            IList<PS_tqdlbh> pjlist = new List<PS_tqdlbh>();
                            for (int i = 0; i < gridView1.RowCount; i++)
                            {
                                PS_tqdlbh _pj = gridView1.GetRow(i) as PS_tqdlbh;

                                for (int j = 0; j < dt.Rows.Count; j++)
                                {
                                    if (_pj.InDate.Year == Convert.ToInt32(dt.Rows[j][0]))
                                    {
                                        pjlist.Add(_pj);
                                    }
                                }


                            }
                            Export13.ExportExcel2(pjlist, org.OrgName);
                        }

                    }
                    catch (System.Exception ex)
                    {

                    }
                }
               
               
               
            }
        }