Merge() public method

public Merge ( DataTable table ) : void
table DataTable
return void
Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            DataSet ds = new DataSet();

            context.Response.ContentType = "application/json";
            context.Response.ContentEncoding = Encoding.UTF8;

            object[] ob = new object[5];
            ob[0] = context.Request["iMode"];
            ob[1] = Convert.ToDateTime(funDatetime(Convert.ToString(context.Request["StartDate"])));
               // ob[1] = Convert.ToDateTime(context.Request["StartDate"]);
            ob[2] = Convert.ToDateTime(funDatetime(Convert.ToString(context.Request["EndDate"])));
              //  ob[2] = Convert.ToDateTime(context.Request["EndDate"]);
            ob[3] = Convert.ToInt32(context.Request["CompanyID"]);
            ob[4] = Convert.ToInt32(context.Request["BranchID"]);

            ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "[spu_ReportChart]", ob);
            if (ds.Tables.Count > 1)
            {
                DataTable dt = new DataTable();
                dt.Merge(ds.Tables[0]);
                dt.Merge(ds.Tables[1]);
                context.Response.Write(Json.GetJson(dt));
            }
            else
            {
                if (ds.Tables.Count > 0)
                {
                    context.Response.Write(Json.GetJson(ds.Tables[0]));
                }
            }
        }
        public DataTable GetAllDatabaseData()
        {
            Dictionary<string, string> tabs = new Dictionary<string, string>()
            {
                {"Websites Loaded", "webpage_log"},
                {"Websites Actions", "webpage_actions"},
                {"OSIRT Actions", "osirt_actions" },
                {"Attachments", "attachments" },
                {"Videos", "videos" },
            };
            DataTable merged = new DataTable();
            foreach (string table in tabs.Values)
            {
                string columns = DatabaseTableHelper.GetTableColumns(table);
                DataTable data = GetRowsFromColumns(table: table, columns: columns);
                merged.Merge(data, true, MissingSchemaAction.Add);
            }

            DataTable dt = new DatabaseHandler().GetRowsFromColumns("case_notes", "", "date", "time", "note");
            merged.Merge(dt, true, MissingSchemaAction.Add);

            merged.TableName = "merged";
            DataView view = new DataView(merged);
            view.Sort = "date asc, time asc";
            DataTable sortedTable = view.ToTable();
            return sortedTable;
        }
Example #3
0
        public static void Main(string[] args)
        {
            // jsc needs to see args to make Main into main for javac..


            // see also>
            // X:\jsc.svn\examples\javascript\android\AndroidBroadcastLogger\AndroidBroadcastLogger\ApplicationWebService.cs

            System.Console.WriteLine(
               typeof(object).AssemblyQualifiedName
            );

            //            java.lang.Object, rt
            //'JVMCLRDataTableMerge.exe' (CLR v4.0.30319: JVMCLRDataTableMerge.exe): Loaded 'X:\jsc.svn\examples\java\JVMCLRDataTableMerge\JVMCLRDataTableMerge\bin\Release\JVMCLRDataTableMerge.exports'. Module was built without symbols.
            //The program '[12004] JVMCLRDataTableMerge.exe' has exited with code 0 (0x0).
            //System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089   

            Console.WriteLine("ApplicationWebService cctor");

            var o0 = ScriptedNotifications0.GetDataTable();
            var o1 = ScriptedNotifications.GetDataTable();

            var merge = new DataTable();

            merge.Merge(o0);
            merge.Merge(o1);

            Console.WriteLine("ApplicationWebService cctor done");

            CLRProgram.CLRMain();
        }
        public DataTable VerFachada1()
        {
            oTabla = oAgente.ListarAgente();
            oTabla2 = oCliente.ListarCliente();
            oTabla3 = oPunto.ListarPuntoVenta();

            oTabla.Merge(oCliente.ListarCliente());
            oTabla.Merge(oPunto.ListarPuntoVenta());

            return oTabla;
        }
Example #5
0
 /// <summary>
 /// Obtiene todas las reservaciones hechas en el sistema
 /// </summary>
 /// <returns>DataTable Object (start,end,name,id)</returns>
 public DataTable ObtenerReservaciones()
 {
     DataTable toReturn = new DataTable();
     toReturn.Columns.Add("start", typeof(DateTime));
     toReturn.Columns.Add("end", typeof(DateTime));
     toReturn.Columns.Add("name", typeof(string));
     toReturn.Columns.Add("id", typeof(string));
     toReturn.Merge(ObtenerEventos());
     toReturn.Merge(ObtenerCursos());
     toReturn.Merge(ObtenerAprobaciones());
     return toReturn;
 }
Example #6
0
        public void ProcessRequest(HttpContext context)
        {
            DataSet ds = new DataSet();
            string mode = context.Request["handler_mode"];
            if (mode == "print")
            {
                object[] ob = new object[2];
                ob[0] = Convert.ToInt32(context.Request["pid"]);
                ob[1] = context.Request["imode"];
                ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "spu_InvoicePrint", ob);
            }
            context.Response.ContentType = "application/json";
            context.Response.ContentEncoding = Encoding.UTF8;
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables.Count > 1)
                {
                    DataTable dt = new DataTable();
                    for (var i = 0; i < ds.Tables.Count; i++)
                    {
                        dt.Merge(ds.Tables[i]);
                    }
                    context.Response.Write(Json.GetJson(dt));
                }
                else
                {
                    context.Response.Write(Json.GetJson(ds.Tables[0]));
                }

            }
        }
Example #7
0
        /// <summary>
        /// Obtiene todas las reservaciones hechas por la aprobacion de una solicitud
        /// </summary>
        /// <returns>DataTable Object (start,end,name,id)</returns>
        private DataTable ObtenerAprobaciones()
        {
            cUDGDFAPROBACIONNegocios cAprobaciones = new cUDGDFAPROBACIONNegocios(0, "", 0, "");
            DataTable dtAprobaciones = cAprobaciones.Seleccionar_Todo_Detallado();
            DataTable toReturn = new DataTable();
            toReturn.Columns.Add("start", typeof(DateTime));
            toReturn.Columns.Add("end", typeof(DateTime));
            toReturn.Columns.Add("name", typeof(string));
            toReturn.Columns.Add("id", typeof(string));
            String sFechainicio, sFechafin, sHorainicio, sHorafin, sDescripcion;
            String sID;
            Boolean blunes, bmartes, bmiercoles, bjueves, bviernes, bsabado, bdomingo;

            foreach (DataRow drLocalRow in dtAprobaciones.Rows)
            {
                sFechainicio = drLocalRow[1].ToString();
                sFechafin = drLocalRow[2].ToString();
                sHorainicio = drLocalRow[3].ToString();
                sHorafin = drLocalRow[4].ToString();
                sDescripcion = "Reservacion de " + drLocalRow[5].ToString();
                sID = "Reservacion:" + int.Parse(drLocalRow[0].ToString());
                blunes = true;
                bmartes = true;
                bmiercoles = true;
                bjueves = true;
                bviernes = true;
                bsabado = true;
                bdomingo = true;
                toReturn.Merge(ObtenerFechas(sFechainicio, sFechafin, sHorainicio, sHorafin, sDescripcion, sID, blunes, bmartes, bmiercoles, bjueves, bviernes, bsabado, bdomingo));
            }

            return toReturn;
        }
Example #8
0
        protected void ddlCourses_SelectedIndexChanged(object sender, EventArgs e)
        {
            int courseID = int.Parse(ddlCourses.SelectedValue);
            Course course = (Course.GetCourse(courseID)).ElementAt(0);
            IEnumerable<Session> sessions = Classes.Session.GetSessionsByCourseID(courseID);
            //IEnumerable<ClientSession> clientSessions = (ClientSession.GetClientSessionsByClientID(clientID));
            DataTable sessionsTable = new DataTable("SessionsTable");
            foreach (Session sesh in sessions)
            {
                using (DatabaseConnection db = new DatabaseConnection("dbo.GetSession"))
                {
                    // Set Parameters
                    db.comm.Parameters.AddWithValue("SessionID", sesh.SessionID);

                    // Open Connection
                    db.conn.Open();

                    // Execute Command
                    SqlDataAdapter MyAdapter = new SqlDataAdapter();
                    MyAdapter.SelectCommand = db.comm;
                    DataTable table = new DataTable();

                    // Read Response
                    MyAdapter.Fill(table);

                    sessionsTable.Merge(table);
                    db.Dispose();
                }
            }
            modSessionTable(sessionsTable);
            //gvSessions.DataSource = sessionsTable.DefaultView;
            //gvSessions.DataBind();
        }
Example #9
0
        public static string displayNPTMetricsX(List<string> _arr)
        {
            DataTable dummy = new DataTable();
            dummy.Columns.Add("TaskName");
            dummy.Columns.Add("Start");
            dummy.Columns.Add("End");
            dummy.Columns.Add("Elapsed");

            SystemObjects.OPT _opt = new SystemObjects.OPT();
            _opt.WorkdayID = Convert.ToInt32(_arr[0]);
            DataSet ds = new DataSet();
            try
            {
                dummy.Merge(_opt.DisplayNPTMetricsX());
                if (dummy.Rows.Count < 1)
                {
                    dummy.Rows.Add();
                }
                ds.Tables.Add(dummy);
            }
            catch (Exception ex)
            {

            }
            return ds.GetXml();
        }
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            string InstanceName = TextBoxSource.Text;

            //List Catalogs(DBs)
            string strMDX = "select * from $system.DBSCHEMA_CATALOGS";
            string strConnString = "Datasource=" + InstanceName;

            System.Data.DataTable dtDB = GetDataTable(strConnString, strMDX); //returns data table with DB details

            //Enumerate cubes in each database
            ArrayList DBList = ReturnValueFromDataTable(dtDB, 0); //Get DB Name (Catalog_Name) from data table
            dtDB.Dispose();

            System.Data.DataTable dtCubes = new System.Data.DataTable();
            System.Data.DataTable dtPartial = new System.Data.DataTable();

            foreach (string DBName in DBList)
            {
                strMDX = "SELECT * FROM $system.MDSchema_Cubes WHERE CUBE_SOURCE=1";
                strConnString = "Datasource=" + TextBoxSource.Text + ";Catalog=" + DBName;
                dtPartial = GetDataTable(strConnString, strMDX); //get all Cubes for the DB DBName
                DataColumn CubeLink = dtPartial.Columns.Add("Link"); // Add a column "Link" in the data table
                CubeLink.SetOrdinal(0); //make new column as first column in table

                dtCubes.Merge(dtPartial);
                dtPartial.Dispose();
            }

            GridViewResults.AutoGenerateColumns = true;
            GridViewResults.DataSource = dtCubes; //returns data table with DB details
            GridViewResults.DataBind();
            dtCubes.Dispose();
        }
Example #11
0
 //Populate tree node
 public void TreeNodePopulate(TreeNodeCollection nodes, IToken token)
 {
     //Parents nodes
     treeNodes = authorManager.getAllPermission();
     treeNodes.Merge(authorManager.getAuthoritiesByToken(token));
     CreateRootNode(nodes);
 }
        /// <summary>
        /// Processes the result of a data submission to the Server where the result of that operation is
        /// <see cref="TSubmitChangesResult.scrOK" />. (Overload for DataTables.)
        /// </summary>
        /// <param name="ACallingFormOrUserControl"></param>
        /// <param name="ALocalDT"></param>
        /// <param name="ASubmitDT"></param>
        /// <param name="APetraUtilsObject"></param>
        /// <param name="AVerificationResults"></param>
        /// <param name="ASetPrimaryKeyOnlyMethod"></param>
        /// <param name="AMasterDataTableSaveCall"></param>
        /// <param name="ACalledFromUserControl"></param>
        /// <param name="ACallAcceptChangesOnReturnedDataBeforeMerge"></param>
        public static void ProcessSubmitChangesResultOK(IFrmPetra ACallingFormOrUserControl, DataTable ALocalDT,
            DataTable ASubmitDT, TFrmPetraEditUtils APetraUtilsObject, TVerificationResultCollection AVerificationResults,
            Action <bool>ASetPrimaryKeyOnlyMethod, bool AMasterDataTableSaveCall, bool ACalledFromUserControl,
            bool ACallAcceptChangesOnReturnedDataBeforeMerge = false)
        {
            if (AMasterDataTableSaveCall)
            {
                // Call AcceptChanges to get rid now of any deleted columns before we Merge with the result from the Server
                ALocalDT.AcceptChanges();

                // Merge back with data from the Server (eg. for getting Sequence values)
                if (ACallAcceptChangesOnReturnedDataBeforeMerge)
                {
                    ASubmitDT.AcceptChanges();
                }

                ALocalDT.Merge(ASubmitDT, false);

                // Need to accept any new modification ID's
                ALocalDT.AcceptChanges();

                if (ASetPrimaryKeyOnlyMethod != null)
                {
                    // Ensure the Primary-Key(s)-containing Controls are disabled to prevent further modification of Primary Key values
                    ASetPrimaryKeyOnlyMethod(true);
                }
            }

            CommonPostMergeOperations(ACallingFormOrUserControl, APetraUtilsObject,
                AVerificationResults, ACalledFromUserControl);
        }
Example #13
0
        // récupère toutes les valeurs d'une table donnée
        // renvoie un Dataset
        public static DataSet GetAllRecords(string lobSystemInstance, string entityName)
        {
            DataSet ds = new DataSet(entityName);

            NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();
            LobSystemInstance instance = sysInstances[lobSystemInstance];
            Entity entity = instance.GetEntities()[entityName];

            // Get the finder method
            MethodInstance finder = entity.GetFinderMethodInstance();

            //Execute Finder method
            DbEntityInstanceEnumerator records = (DbEntityInstanceEnumerator)entity.Execute(finder, instance);

            //Load matching entities into a DataTable
            DataTable entitiesTable = new DataTable();
            while (records.MoveNext())
            {
                //Load each entity and include the Action URL
                DbEntityInstance record = (DbEntityInstance)records.Current;
                DataTable entityTable = record.EntityAsDataTable;
                entityTable.AcceptChanges();
                entitiesTable.Merge(entityTable);
            }

            //DataTable ordersTable = customerOrders.Tables.Add(“Orders”);
            ds.Tables.Add(entitiesTable);
            return ds;
        }
Example #14
0
        public static string displayNpt(List<string> _arr)
        {
            DataTable dummy = new DataTable();
            dummy.Columns.Add("Task Name");
            dummy.Columns.Add("Status");

            SystemObjects.OPT _opt = new SystemObjects.OPT();

            _opt.TeamID = Convert.ToInt32(_arr[0].ToString());
            DataSet ds = new DataSet();
            try
            {
                dummy.Merge(_opt.DisplayNptTask());
                if (dummy.Rows.Count < 1)
                {
                    dummy.Rows.Add();
                }
                ds.Tables.Add(dummy);
            }
            catch (Exception ex)
            {

            }
            return ds.GetXml();
        }
Example #15
0
        public static string displayReARTickets(List<string> _arr)
        {
            DataTable dummy = new DataTable();
            dummy.Columns.Add("TicketNo", typeof(Int64));
            dummy.Columns.Add("ConcernAction", typeof(String));
            dummy.Columns.Add("TicketDescription", typeof(String));
            dummy.Columns.Add("TicketDate", typeof(DateTime));
            dummy.Columns.Add("TicketStatus", typeof(String));
            dummy.Columns.Add("SummaryOfConcern", typeof(String));

            SystemObjects.ReARObj _rearobj = new SystemObjects.ReARObj();
            _rearobj.WorkdayID = Convert.ToInt32(_arr[0].ToString());

            DataSet ds = new DataSet();
            try
            {
                dummy.Merge(_rearobj.displayReAR(Convert.ToBoolean(_arr[1].ToString())));
                if (dummy.Rows.Count < 1)
                {
                    dummy.Rows.Add();
                }
                ds.Tables.Add(dummy);
            }
            catch (Exception ex)
            {

            }
            return ds.GetXml();
        }
Example #16
0
        static void Main(string[] args)
        {
            DataSet ds = GetDataSet();
            DataTable full = new DataTable();
            foreach (DataTable table in ds.Tables) 
            {
                full.Merge(table);
            }

            var result = from tab in full.AsEnumerable()
                         group tab by tab["time"]
                             into groupDt
                             select new
                             {
                                 Group = groupDt.Key,
                                 Sum = groupDt.Sum(r => decimal.Parse(r["count"].ToString()))
                             };
            var max = result.OrderByDescending(x => x.Sum).First();
            DateTime maxTime = (DateTime)max.Group;
            CultureInfo ci = CultureInfo.InvariantCulture;

            Console.WriteLine("Максимальное количество посетителей "
                + max.Sum + " было в " + maxTime.ToString("HH:mm:ss", ci));

            Console.ReadKey();
        }
Example #17
0
        //lấy ra sinh viên tham gia 1 kỳ thi
        public static DataTable GopKetQua1(IList<int> list)
        {
            var table = new DataTable();
            try
            {
                var tb = new DataTable[list.Count];
                var str = new string[list.Count];

                for (var i = 0; i < list.Count; i++)
                {
                    str[i] =
                        "select bl.MaSV,s.HoSV,s.TenSV,s.NgaySinh,l.MaLop, bl.DiemThi as [Diem" + (i + 1) +
                        "], bl.DiemThi as[TongDiem]" +
                        " from BAILAM bl" +
                        " join SINHVIEN s on bl.MaSV = s.MaSV" +
                        " join LOP l on s.IdLop = l.ID" +
                        " where IdKyThi = " + list[i] + " and DiemThi is not null and not exists( select c.MaSV From (" +
                        Getstr1(list) + " ) c where bl.MaSV = c.MaSV)";
                    tb[i] = Conn.GetTable(str[i]);
                    table.Merge(tb[i]);
                }

            }
            catch (Exception ex)
            {
                Log2File.LogExceptionToFile(ex);
            }
            return table;
        }
Example #18
0
        public void ProcessRequest(HttpContext context)
        {
            DataSet ds = new DataSet();
            context.Response.ContentType = "application/json";
            context.Response.ContentEncoding = Encoding.UTF8;

            object[] ob = new object[14];

            ob[0] = Convert.ToInt32((context.Request["MilestoneID"] == "" ? "0" : context.Request["MilestoneID"]));
            ob[1] = context.Request["MilestoneName"];
            ob[2] = Convert.ToInt32((context.Request["ProjectID"] == "" ? "0" : context.Request["ProjectID"]));
            ob[3] = Convert.ToDateTime(((context.Request["MilestoneDate"] == null || context.Request["MilestoneDate"] == "") ? "1990/1/1" : context.Request["MilestoneDate"]));
            ob[4] = Convert.ToInt32((context.Request["AssignedTo"] == "" ? "0" : context.Request["AssignedTo"]));
            ob[5] = Convert.ToInt32((context.Request["TypeID"] == "" ? "0" : context.Request["TypeID"]));
            ob[6] = context.Request["Description"];
            ob[7] = Convert.ToInt32((context.Request["CreatedBy"] == "" ? "0" : context.Request["CreatedBy"]));
            ob[8] = Convert.ToDateTime(((context.Request["CreatedOn"] == null || context.Request["CreatedOn"] == "") ? "1990/1/1" : context.Request["CreatedOn"]));
            ob[9] = Convert.ToInt32((context.Request["ModifiedBy"] == "" ? "0" : context.Request["ModifiedBy"]));
            ob[10] = Convert.ToDateTime(((context.Request["ModifiedOn"] == null || context.Request["ModifiedOn"] == "") ? "1990/1/1" : context.Request["ModifiedOn"]));
            ob[11] = Convert.ToInt32((context.Request["CompanyID"] == "" ? "0" : context.Request["CompanyID"]));
            ob[12] = Convert.ToInt32((context.Request["BranchID"] == "" ? "0" : context.Request["BranchID"]));
            ob[13] = context.Request["imode"];

            ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "[spu_Milestone]", ob);
            if (ds.Tables.Count > 0)
            {
                DataTable dt = new DataTable();
                for (int i = 0; i < ds.Tables.Count; i++)
                {
                    dt.Merge(ds.Tables[i]);
                }
                context.Response.Write(Json.GetJson(dt));
            }
        }
Example #19
0
        public static string displayemployee(List<string> _arr)
        {
            DataTable dummy = new DataTable();
            dummy.Columns.Add("No");
            dummy.Columns.Add("WorkdayID");
            dummy.Columns.Add("Name");

            SystemObjects.HeadCount _hc = new SystemObjects.HeadCount();
            _hc.TeamID = Convert.ToInt32(_arr[0]);
            _hc.Date =  Convert.ToInt32(_arr[1]);
            _hc.Year = Convert.ToInt32(_arr[2]);
            DataSet ds = new DataSet();
            try
            {
                dummy.Merge(_hc.DisplayEmployee());
                if (dummy.Rows.Count < 1)
                {
                    dummy.Rows.Add();
                }
                ds.Tables.Add(dummy);
            }
            catch (Exception ex)
            {

            }
            return ds.GetXml();
        }
Example #20
0
        /// <summary>
        /// Metode for å søke på brukere.
        /// Lager en query basert på valg og søkeord og binder den nye informasjonen til en datatable.
        /// Om resultatet er tomt vil det ikke skje noen forandring.
        /// </summary>
        public void FilterGridView()
        {
            DataTable filterTable = new DataTable(); //Lager en data table for å lagre data fra spørringen

            //Henter alle fra User-tabellen med korrekt kolonnenavn / vilkår fra databasen
            string filterStatement = String.Format("SELECT userID, surname, firstname, username, password, phone, mail, teamName, groupName FROM User, Team, UserGroup WHERE {0} LIKE '%{1}%' AND User.teamID = Team.teamID AND User.groupID = UserGroup.groupID", FilterSearchDropdown.Text, FilterSearchTerms.Text);

            filterTable = db.AdminGetAllUsers(filterStatement);

            //Henter ut brukere som ikke tilhører et team og merger tabellene
            string queryNull = String.Format("SELECT userID, surname, firstname, username, phone, mail, teamID \"teamName\", groupName FROM User, UserGroup WHERE {0} LIKE '%{1}%' AND User.teamID IS NULL  AND User.groupID = UserGroup.groupID", FilterSearchDropdown.Text, FilterSearchTerms.Text);
            tableNull = db.AdminGetAllUsers(queryNull);

            filterTable.Merge(tableNull, true, MissingSchemaAction.Ignore);

            if (filterTable.Rows.Count > 0) //Hvis søkevilkåret gir resultater
            {
                //Om søket ga resultat
                ViewState["table"] = filterTable;
                GridViewAdmin.DataSource = filterTable; //Setter data source til den filtrerte data table
                GridViewAdmin.DataBind();               //Oppdaterer data i GridView
            }
            else
            {
                //Søket ga ingen resultat, trenger ikke refreshe GridViewAdmin
                FilterSearchTerms.Text = "Søket ga ingen resultat!"; //Gir bruker beskjed
            }
        }
Example #21
0
        // Permet d'éxecuter une méthode select donné avec des paramètres
        // renvoie un Dataset
        public static DataSet GetAllRecordsWithParam(string lobSystemInstance, string entityName, string methodInstance, object[] parameters)
        {
            DataSet ds = new DataSet(entityName);

            NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();
            LobSystemInstance instance = sysInstances[lobSystemInstance];
            Entity entity = instance.GetEntities()[entityName];

            // Get the method
            MethodInstance methInst = entity.GetMethodInstances()[methodInstance];

            //Execute Finder method
            DbEntityInstanceEnumerator records = (DbEntityInstanceEnumerator)entity.Execute(methInst, instance, ref parameters);

            //Load matching entities into a DataTable
            DataTable entitiesTable = new DataTable();
            while (records.MoveNext())
            {
                //Load each entity and include the Action URL
                DbEntityInstance record = (DbEntityInstance)records.Current;
                DataTable entityTable = record.EntityAsDataTable;
                entityTable.AcceptChanges();
                entitiesTable.Merge(entityTable);
            }

            ds.Tables.Add(entitiesTable);
            return ds;
        }
Example #22
0
        public void UpdateChart()
        {
            try
            {
                OleDbConnection connection = new OleDbConnection();
                connection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + reference.Getdb();
                connection.Open();
                OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT print_report.[ID], print_report.[printer_id], print_report.[overall_pagecount], print_report.[color_pagecount], print_report.[mono_pagecount], print_report.[date_time], base_count.[printer_id], base_count.[overall_pagecount] AS baseo, base_count.[color_pagecount] AS basec, base_count.[mono_pagecount] AS basem, print_report.[overall_pagecount] - [baseo] AS totalo, print_report.[color_pagecount] - [basec] AS totalc, print_report.[mono_pagecount] - [basem] AS totalm FROM print_report INNER JOIN base_count ON format(DateAdd('h',1,base_count.[date_time]),'mm/dd/yyyy hh') = format(print_report.[date_time], 'mm/dd/yyyy hh') WHERE print_report.[printer_id] = " + currentchart + " and base_count.[printer_id] = " + currentchart + " and print_report.[overall_pagecount] > 0 and base_count.[overall_pagecount] > 0 and Format(TimeSerial(Hour(print_report.[date_time]),0,0),'Short Time') <= '" + stop_time + "' and INT(print_report.date_time) >= DateValue('" + start + "') and INT(print_report.date_time) <= DateValue('" + stop + "') and Format(TimeSerial(Hour(base_count.[date_time]),0,0),'Short Time') >= '" + start_time + "';", connection);
                DataTable table = new DataTable();
                adapter.Fill(table);
                adapter.Dispose();
                if (live_tracking_checkbox.Checked)
                {
                    adapter = new OleDbDataAdapter("SELECT print_report.[ID], print_report.[printer_id], print_report.[overall_pagecount], print_report.[color_pagecount], print_report.[mono_pagecount], print_report.[date_time], base_count.[printer_id], base_count.[overall_pagecount] AS baseo, base_count.[color_pagecount] AS basec, base_count.[mono_pagecount] AS basem, print_report.[overall_pagecount] - [baseo] AS totalo, print_report.[color_pagecount] - [basec] AS totalc, print_report.[mono_pagecount] - [basem] AS totalm FROM print_report INNER JOIN base_count ON format(DateAdd('h',1,base_count.[date_time]),'mm/dd/yyyy hh') = format(print_report.[date_time], 'mm/dd/yyyy hh') WHERE print_report.[printer_id] = " + currentchart + " and base_count.[printer_id] = " + currentchart + " and print_report.[overall_pagecount] > 0 and Format(TimeSerial(Hour(print_report.[date_time]),0,0),'Short Time') = '" + DateTime.Now.AddHours(-1).ToString("HH:") + "00" + "' and print_report.date_time > DateValue('" + DateTime.Now + "') and Format(TimeSerial(Hour(base_count.[date_time]),0,0),'Short Time') = '" + start_time + "';", connection);
                    DataTable table2 = new DataTable();
                    adapter.Fill(table2);
                    table.Merge(table2);

                    adapter.Dispose();
                }
                connection.Close();

                printed_pages_chart.DataSource = table;
                printed_pages_chart.ChartAreas[0].AxisX.LabelStyle.Format = "M/d/yy htt";
                printed_pages_chart.Series.Clear();
                printed_pages_chart.Series.Add("Total");
                printed_pages_chart.Series["Total"].XValueMember = "date_time";
                printed_pages_chart.Series["Total"].YValueMembers = "totalo";
                printed_pages_chart.Series["Total"].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
                printed_pages_chart.Series["Total"].IsValueShownAsLabel = true;
                printed_pages_chart.Series.Add("Color");
                printed_pages_chart.Series["Color"].XValueMember = "date_time";
                printed_pages_chart.Series["Color"].YValueMembers = "totalc";
                printed_pages_chart.Series["Color"].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
                printed_pages_chart.Series["Color"].IsValueShownAsLabel = true;
                printed_pages_chart.Series.Add("Mono");
                printed_pages_chart.Series["Mono"].XValueMember = "date_time";
                printed_pages_chart.Series["Mono"].YValueMembers = "totalm";
                printed_pages_chart.Series["Mono"].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
                printed_pages_chart.Series["Mono"].IsValueShownAsLabel = true;

                foreach(System.Windows.Forms.DataVisualization.Charting.Series s in printed_pages_chart.Series)
                {
                    foreach (System.Windows.Forms.DataVisualization.Charting.DataPoint dp in s.Points)
                    {
                        if (dp.YValues[0] == 0)
                        {
                            dp.IsValueShownAsLabel = false;
                        }
                    }

                }
                printed_pages_chart.DataBind();
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message);
            }
        }
Example #23
0
        public void ProcessRequest(HttpContext context)
        {
            DataSet ds = new DataSet();
            string mode = context.Request["hmode"];
            context.Response.ContentType = "application/json";
            context.Response.ContentEncoding = Encoding.UTF8;
            if (mode == "get_dropdown" || mode == "get_customerjob" || mode == "get_GridPopup" || mode == "get_prod_details" || mode == "get_prod_update")
            {
                object[] ob = new object[15];
                ob[0] = Convert.ToInt32(context.Request["PurchaseOrderID"]);
                ob[1] = Convert.ToInt32(context.Request["PrurchaseOrderDetailID"]);
                ob[2] = Convert.ToInt32(context.Request["BranchID"]);
                ob[3] = context.Request["PrurchaseOrderNo"];
                ob[4] = Convert.ToInt32(context.Request["Year"]);
                ob[5] = Convert.ToInt32(context.Request["ProductID"]);
                ob[6] = context.Request["ProductCode"];
                ob[7] = Convert.ToInt32(context.Request["PartyID"]);
                ob[8] = Convert.ToInt32(context.Request["JOBID"]);
                ob[9] = Convert.ToInt32(context.Request["IndentID"]);
                ob[10] = context.Request["ScreenName"];

                ob[11] = Convert.ToInt32(context.Request["CompanyID"]);
                ob[12] = context.Request["iMode"];

                ob[13] = Convert.ToInt32(context.Request["CreatedBy"]);
                ob[14] = Convert.ToInt32(context.Request["ModifiedBy"]);

                ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "[spu_PurchaseOrderSearch]", ob);
                if (ds.Tables.Count > 0)
                {
                    if (mode == "get_dropdown" || mode == "get_prod_update")
                    {
                        DataTable dt = new DataTable();
                        for (int i = 0; i < ds.Tables.Count; i++)
                        {
                            dt.Merge(ds.Tables[i]);
                        }
                        context.Response.Write(Json.GetJson(dt));
                    }
                    else
                    {
                        context.Response.Write(Json.GetJson(ds.Tables[0]));

                    }

                }
            }
            else
            {
                object[] ob = new object[2];
                ob[0] = context.Request["ScreenName"];
                ob[1] = Convert.ToInt32(context.Request["CompanyID"]);
                ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "[spu_AutoGenTransaction]", ob);
                if (ds.Tables.Count > 0)
                {
                    context.Response.Write(Json.GetJson(ds.Tables[0]));
                }
            }
        }
Example #24
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                DataSet ds = new DataSet();
                string mode = context.Request["handler_mode"];
                if (mode == "save_Product" || mode == "get_autocode" || mode == "update_Product" || mode == "fetch_Product" || mode == "get_dropdown")
                {
                    object[] ob = new object[19];
                    ob[0] = Convert.ToInt32(context.Request["ProductID"]);
                    ob[1] = Convert.ToInt32(context.Request["CompanyID"]);
                    ob[2] = Convert.ToInt32(context.Request["CategoryID"]);
                    ob[3] = context.Request["Description"];
                    ob[4] = Convert.ToInt32(context.Request["UOMID"]);
                    ob[5] = Convert.ToDecimal(context.Request["BuyPrice"]);
                    ob[6] =  Convert.ToDecimal(context.Request["SalePrice"]);
                    ob[7] = context.Request["ProductCode"];
                    ob[8] = context.Request["ProductStatus"];
                    ob[9] = Convert.ToInt32(context.Request["CreatedBy"]);
                    ob[10] = context.Request["CreatedOn"];
                    ob[11] = Convert.ToInt32(context.Request["ModifiedBy"]);
                    ob[12] = context.Request["ModifiedOn"];
                    ob[13] = context.Request["ProductGroupID"];
                    ob[14] = context.Request["ScreenName"];
                    ob[15] = context.Request["iMode"];
                    ob[16] = context.Request["InventoryType"];
                    ob[17] = context.Request["ARNO"];
                    ob[18] = context.Request["APNo"];
                    ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "[spu_Product]", ob);
                }
                else
                {
                    object[] ob = new object[1];
                    ob[0] = context.Request["ScreenName"];
                    ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "[spu_AutoGenMaster]", ob);
                }
                context.Response.ContentType = "application/json";
                context.Response.ContentEncoding = Encoding.UTF8;
                if (mode == "get_dropdown" || mode == "get_prod_update")
                {
                    DataTable dt = new DataTable();
                    for (int i = 0; i < ds.Tables.Count; i++)
                    {
                        dt.Merge(ds.Tables[i]);
                    }
                    context.Response.Write(Json.GetJson(dt));
                }
                else
                {
                    context.Response.Write(Json.GetJson(ds.Tables[0]));

                }

            }
            catch (Exception e)
            {
            }
        }
Example #25
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                DataSet ds = new DataSet();
                context.Response.ContentType = "application/json";
                context.Response.ContentEncoding = Encoding.UTF8;
                object[] ob = new object[25];
                ob[0] = context.Request["Tittle"];
                ob[1] = context.Request["Type"];
                ob[2] =  Convert.ToDateTime((context.Request["Startdate"] == "" ? "1990/1/1" : context.Request["Startdate"]));
                ob[3] = Convert.ToDateTime((context.Request["Starttime"] == "" ? "1990/1/1" : context.Request["Starttime"]));
                ob[4] =  Convert.ToDateTime((context.Request["Enddate"] == "" ? "1990/1/1" : context.Request["Enddate"]));
                ob[5] = Convert.ToDateTime((context.Request["Endtime"] == "" ? "1990/1/1" : context.Request["Endtime"]));
                ob[6] = Convert.ToInt32((context.Request["StatusID"] == "" ? "0" : context.Request["StatusID"]));
                ob[7] = context.Request["Notification"];
                ob[8] = Convert.ToInt32((context.Request["ActivityID"] == "" ? "0" : context.Request["ActivityID"]));
                ob[9] = context.Request["Location"];
                ob[10] = Convert.ToInt32((context.Request["PriorityID"] == "" ? "0" : context.Request["PriorityID"]));
                ob[11] = Convert.ToInt32((context.Request["VisibilityID"] == "" ? "0" : context.Request["VisibilityID"]));
                ob[12] = Convert.ToInt32((context.Request["RelatedTypeID"] == "" ? "0" : context.Request["RelatedTypeID"]));
                ob[13] = Convert.ToInt32((context.Request["RelateToID"] == "" ? "0" : context.Request["RelateToID"]));
                ob[14] = context.Request["Backgroundcolor"];
                ob[15] = context.Request["URL"];
                ob[16] = Convert.ToInt32((context.Request["CreatedBy"] == "" ? "0" : context.Request["CreatedBy"]));
                ob[17] = Convert.ToDateTime((context.Request["CreatedOn"] == "" ? "1990/1/1" : context.Request["CreatedOn"]));
                ob[18] = Convert.ToInt32((context.Request["ModifiedBy"] == "" ? "0" : context.Request["ModifiedBy"]));
                ob[19] =  Convert.ToDateTime((context.Request["ModifiedOn"] == "" ? "1990/1/1" : context.Request["ModifiedOn"]));
                ob[20] = Convert.ToInt32((context.Request["BranchID"] == "" ? "0" : context.Request["BranchID"]));
                ob[21] = Convert.ToInt32((context.Request["CompanyID"] == "" ? "0" : context.Request["CompanyID"]));
                ob[22] = context.Request["Descriptions"];
                ob[23] = context.Request["iMode"];
                ob[24] = Convert.ToInt32((context.Request["EventsId"] == "" ? "0" : context.Request["EventsId"]));
                ds = MSDataAccess.DataAccess.ExecuteDataset(Json.get_connectionstring(), "[spu_Events]", ob);
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables.Count > 1)
                    {
                        DataTable dt = new DataTable();
                        for (var i = 0; i < ds.Tables.Count; i++)
                        {
                            dt.Merge(ds.Tables[i]);
                        }
                        context.Response.Write(Json.GetJson(dt));
                    }
                    else
                    {
                        context.Response.Write(Json.GetJson(ds.Tables[0]));
                    }

                }
            }
            catch (Exception e)
            {

            }
        }
 public DataTable searchRequisitionTrend(string status, List<string> monthYearList,string department,string category)
 {
     DataTable dt = new DataTable();
     for (int i = 0; i < monthYearList.Count; i++)
     {
         dt.Merge(reqTrendFaca.getRequisitionTrendByCriteria(status, monthYearList[i].ToString(),department,category));
     }
     return dt;
 }
 public static DataTable BuildDataTableFromListOfFilenames(IList<object> listOfInputFiles)
 {
     var retval = new DataTable();
     foreach (var file in listOfInputFiles)
     {
         retval.Merge(GetDataTableFromCsvPath(file.ToString()));
     }
     return retval;
 }
Example #28
0
 /// <summary>
 /// Returns dataTable with S. No. column
 /// </summary>
 /// <returns>DataTable</returns>
 protected DataTable GetTableWithSno(DataTable table)
 {
     DataTable RetVal = new DataTable();
     RetVal.Columns.Add(DILanguage.GetLanguageString("SERIAL_NUMBER"));
     RetVal.Columns[0].AutoIncrement = true;
     RetVal.Columns[0].AutoIncrementSeed = 1;
     RetVal.Merge(table, true, MissingSchemaAction.AddWithKey);
     return RetVal;
 }
 public DataTable searchPurchasOrder(List<string> monthYearList, string supplier, string category)
 {
     DataTable dt = new DataTable();
     for (int i = 0; i < monthYearList.Count; i++)
     {
         dt.Merge(purchaseOrderFaca.getPurchaseOrderByCriteria(monthYearList[i].ToString(), supplier, category));
     }
     return dt;
 }
        public ActionResult ExportExcel(string DepartmentId, string SectionId, string YearId, string MonthId, string MatNameId)
        {
            try
            {
                DataTable templateData = new DataTable();
                // add IEnumerable<AdjustAcceptedViewModels>
                List<AdjustAcceptedViewModels> viewModel = new List<AdjustAcceptedViewModels>();

                //filter department
                var q = from d in objBs.acceptedDelayBs.GetByFilter(DepartmentId, SectionId, Convert.ToInt32(MonthId), Convert.ToInt32(YearId))
                        select d;

                //filter matname
                if (!String.IsNullOrEmpty(MatNameId))
                {
                    q = q.Where(x => x.MATFRIGRP == MatNameId);
                }

                //int c = q.Count();

                foreach (var item in q)
                {
                    AdjustAcceptedViewModels model = new AdjustAcceptedViewModels();
                    model.Shipment = item.SHPMNTNO;
                    model.CarrierId = item.CARRIER_ID;
                    model.RegionId = item.REGION_ID;
                    model.RegionName = item.REGION_NAME_TH;
                    model.Soldto = item.SOLDTO;
                    model.SoldtoName = item.SOLDTO_NAME;
                    model.Shipto = item.SHIPTO;
                    model.Segment = item.SEGMENT;
                    model.SubSegment = item.SUBSEGMENT;
                    model.ShiptoName = item.LAST_SHPG_LOC_NAME;
                    model.ShippingPoint = item.SHPPOINT;
                    model.TruckType = item.TRUCK_TYPE;
                    model.LastTender = item.LTNRDDATE.Value.ToString("dd/MM/yyyy HH:mm", new CultureInfo("th-TH"));
                    model.PlanAccept = item.PLNACPDDATE.Value.ToString("dd/MM/yyyy HH:mm", new CultureInfo("th-TH"));
                    model.LastAccept = item.LACPDDATE.Value.ToString("dd/MM/yyyy HH:mm", new CultureInfo("th-TH"));
                    viewModel.Add(model);
                }
                templateData.Merge(ExcelModels.ToDataTable(viewModel));
                templateData.Columns.Add("Remark", typeof(string));

                ExcelModels ex = new ExcelModels();
                ex.DumpExcel(templateData, "ExportedAdjustAccept_" + DateTime.Now.ToString("yyyyMMddHHmm", new CultureInfo("th-TH")));//dump

                return View();
            }
            catch (Exception e)
            {
                TempData["Msg"] = "Error" + e.ToString();
                return View();
            }
        }