コード例 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Layerlisodwg = new System.Collections.ObjectModel.ObservableCollection <Layerlist>(AcadFunctions.GetLayerlist());



            System.Data.DataTable dt = DatabaseClass.GetTimeRollupCategories();

            List <View.clsTimeRollUp> _col = new List <View.clsTimeRollUp>();

            foreach (DataRow dr in dt.Rows)
            {
                int time = 0;
                if (dr["fldTimeAllocated"] != null)
                {
                    if (!string.IsNullOrEmpty(dr["fldTimeAllocated"].ToString()))
                    {
                        time = Convert.ToInt32(dr["fldTimeAllocated"].ToString());
                    }
                }
                _col.Add(new View.clsTimeRollUp()
                {
                    include = false, Category = dr["fldCategory"].ToString(), Time = time
                });
            }
            System.Collections.ObjectModel.ObservableCollection <View.clsTimeRollUp> myCollection = new System.Collections.ObjectModel.ObservableCollection <View.clsTimeRollUp>(_col as List <View.clsTimeRollUp>);
            timeRollupCol = myCollection;

            textBoxdesc.MaxLength = maxAllowed;
            updateRemainingChars();
            dgvTimeRollup.ItemsSource = timeRollupCol;
            //---------------Added by Sundari on 1-11-2018
            BOM od = new BOM();

            System.Data.DataTable dtnew      = od.Get_Drawingdata(updateDwgAttr: false);
            System.Data.DataTable dtnewExcel = new System.Data.DataTable();
            if (dtnew.Rows.Count > 0)
            {
                dtnewExcel = dtnew.DefaultView.ToTable(false, "Partno", "Description", "Timerollup", "SurfaceArea");
            }
            string tempSum = (dtnewExcel.Rows.Count > 0) ? dtnewExcel.AsEnumerable().Sum(x => Convert.ToDouble(x["Timerollup"])).ToString() : "0";

            totalTimeFromDwg = Convert.ToDouble(tempSum);
            //--------------------------
            calcTotal();

            dgvLayerlist.ItemsSource = Layerlisodwg.Where(x => x.LayerName.StartsWith("PAGE", StringComparison.InvariantCultureIgnoreCase)).ToList();
            dgvLayerlist.Items.Refresh();
        }
コード例 #2
0
        private void timeRollupExcelandXML()
        {
            BOM od = new BOM();

            System.Data.DataTable dtnew = od.Get_Drawingdata(updateDwgAttr: false);

            if (dtnew == null)
            {
                System.Windows.MessageBox.Show("No items found in drawing");
                return;
            }
            else if (dtnew.Rows.Count <= 0)
            {
                System.Windows.MessageBox.Show("No items found in drawing");
                return;
            }
            od.timeRollupCol = timeRollupCol;
            string sumresult = "", drgnumber = "", SurfaceAreaSum = "";
            string projectDesc = textBoxdesc.Text;                                                                                                                                                                                                                    // od.getProjectDesc();//20-Oct-2018
            bool   result      = od.timerollupfunctionality(out sumresult, out drgnumber, out SurfaceAreaSum, out projectDesc, true, readDesc: false, divideBy60: false, updateDWGAttr: false, prevDesc: textBoxdesc.Text, strTotalTime: finalTimeFromUI.ToString()); //02-05-2018

            od.SendXml(false, projectDesc, sumresult, drgnumber, SurfaceAreaSum);
        }