Пример #1
0
        internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type, DataColumn[] extra)
        {
            try
            {
                DataTable dt = new DataTable();

                foreach (PropertyInfo pi in type.GetProperties())
                {
                    if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                    {
                        dt.Columns.Add(pi.Name, pi.PropertyType);
                    }
                }

                if (extra != null)
                {
                    foreach (DataColumn c in extra)
                    {
                        if (dt.Columns.Contains(c.ColumnName))
                        {
                            dt.Columns.Remove(c.ColumnName);
                        }
                        dt.Columns.Add(c);
                    }
                }

                foreach (object k in obj)
                {
                    DataRow dr = dt.NewRow();
                    foreach (PropertyInfo pi in type.GetProperties())
                    {
                        if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                        {
                            dr[pi.Name] = pi.GetValue(k, null);
                        }
                    }
                    dt.Rows.Add(dr);
                }

                return(dt);
            }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "ObjectArrayToDataTable()--:--CtlQuestionAns.xaml.cs--:--" + exp.Message + " :--:--");
                //ClsException.LogError(ex);
                //ClsException.WriteToErrorLogFile(ex);
                System.Text.StringBuilder sb = new StringBuilder();
                sb.AppendLine(exp.Message);
                sb.AppendLine();
                sb.AppendLine("StackTrace : " + exp.StackTrace);
                sb.AppendLine();
                sb.AppendLine("Location : " + exp.Data["My Key"].ToString());
                sb.AppendLine();
                sb1 = CreateTressInfo();
                sb.Append(sb1.ToString());
                VMuktiAPI.ClsLogging.WriteToTresslog(sb);
                return(null);
            }
        }
Пример #2
0
 internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type)
 {
     try
     {
         return(ObjectArrayToDataTable(obj, type, null));
     }
     catch (Exception exp)
     {
         VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "ObjectArrayToDataTable()", "CtlQuestionAns.xaml.cs");
         return(null);
     }
 }
Пример #3
0
        internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type, DataColumn[] extra)
        {
            try
            {
                DataTable dt = new DataTable();

                foreach (PropertyInfo pi in type.GetProperties())
                {
                    if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                    {
                        dt.Columns.Add(pi.Name, pi.PropertyType);
                    }
                }

                if (extra != null)
                {
                    foreach (DataColumn c in extra)
                    {
                        if (dt.Columns.Contains(c.ColumnName))
                        {
                            dt.Columns.Remove(c.ColumnName);
                        }
                        dt.Columns.Add(c);
                    }
                }

                foreach (object k in obj)
                {
                    DataRow dr = dt.NewRow();
                    foreach (PropertyInfo pi in type.GetProperties())
                    {
                        if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                        {
                            dr[pi.Name] = pi.GetValue(k, null);
                        }
                    }
                    dt.Rows.Add(dr);
                }

                return(dt);
            }
            catch (Exception exp)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "ObjectArrayToDataTable()", "CtlQuestionAns.xaml.cs");
                return(null);
            }
        }
Пример #4
0
 internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type)
 {
     try
     {
         return(ObjectArrayToDataTable(obj, type, null));
     }
     catch (Exception exp)
     {
         exp.Data.Add("My Key", "ObjectArrayToDataTable()--:--CtlQuestionAns.xaml.cs--:--" + exp.Message + " :--:--");
         //ClsException.LogError(ex);
         //ClsException.WriteToErrorLogFile(ex);
         System.Text.StringBuilder sb = new StringBuilder();
         sb.AppendLine(exp.Message);
         sb.AppendLine();
         sb.AppendLine("StackTrace : " + exp.StackTrace);
         sb.AppendLine();
         sb.AppendLine("Location : " + exp.Data["My Key"].ToString());
         sb.AppendLine();
         sb1 = CreateTressInfo();
         sb.Append(sb1.ToString());
         VMuktiAPI.ClsLogging.WriteToTresslog(sb);
         return(null);
     }
 }
Пример #5
0
        public void FncFillGrid()
        {
            try
            {
                objQColl = ClsQuestionCollection.GetAll(int.Parse(((ListBoxItem)(cmbScript.SelectedItem)).Tag.ToString()));
                DataTable dt = ObjectArrayToDataTable(objQColl, typeof(ClsQuestion));
                //MessageBox.Show(objQColl.Count.ToString());

                ctlGrid c = new ctlGrid(dt, true, true);
                c.Height = 200;
                c.Width  = 700;
                c.SetValue(Canvas.LeftProperty, 20.0);
                c.SetValue(Canvas.TopProperty, 70.0);

                c.btnEditClicked   += new ctlGrid.ButtonClicked(c_btnEditClicked);
                c.btnDeleteClicked += new ctlGrid.ButtonClicked(c_btnDeleteClicked);

                cnvMain.Children.Add(c);
            }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "FncFillGrid()--:--CtlQuestionAns.xaml.cs--:--" + exp.Message + " :--:--");
                //ClsException.LogError(ex);
                //ClsException.WriteToErrorLogFile(ex);
                System.Text.StringBuilder sb = new StringBuilder();
                sb.AppendLine(exp.Message);
                sb.AppendLine();
                sb.AppendLine("StackTrace : " + exp.StackTrace);
                sb.AppendLine();
                sb.AppendLine("Location : " + exp.Data["My Key"].ToString());
                sb.AppendLine();
                sb1 = CreateTressInfo();
                sb.Append(sb1.ToString());
                VMuktiAPI.ClsLogging.WriteToTresslog(sb);
            }
        }
Пример #6
0
        public void FncFillGrid()
        {
            try
            {
                objQColl = ClsQuestionCollection.GetAll(int.Parse(((ListBoxItem)(cmbScript.SelectedItem)).Tag.ToString()));
                DataTable dt = ObjectArrayToDataTable(objQColl, typeof(ClsQuestion));
                //MessageBox.Show(objQColl.Count.ToString());

                ctlGrid c = new ctlGrid(dt, true, true);
                c.Height = 200;
                c.Width  = 700;
                c.SetValue(Canvas.LeftProperty, 20.0);
                c.SetValue(Canvas.TopProperty, 70.0);

                c.btnEditClicked   += new ctlGrid.ButtonClicked(c_btnEditClicked);
                c.btnDeleteClicked += new ctlGrid.ButtonClicked(c_btnDeleteClicked);

                cnvMain.Children.Add(c);
            }
            catch (Exception exp)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "FncFillGrid()", "CtlQuestionAns.xaml.cs");
            }
        }
 internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type)
 {
     try
     {
     return ObjectArrayToDataTable(obj, type, null);
     }
     catch (Exception exp)
     {
         VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "ObjectArrayToDataTable()", "CtlQuestionAns.xaml.cs");
         return null;
     }
 }
 internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type)
 {
     try
     {
     return ObjectArrayToDataTable(obj, type, null);
 }
     catch (Exception exp)
     {
         exp.Data.Add("My Key", "ObjectArrayToDataTable()--:--CtlQuestionAns.xaml.cs--:--" + exp.Message + " :--:--");
         //ClsException.LogError(ex);
         //ClsException.WriteToErrorLogFile(ex);
         System.Text.StringBuilder sb = new StringBuilder();
         sb.AppendLine(exp.Message);
         sb.AppendLine();
         sb.AppendLine("StackTrace : " + exp.StackTrace);
         sb.AppendLine();
         sb.AppendLine("Location : " + exp.Data["My Key"].ToString());
         sb.AppendLine();
         sb1 = CreateTressInfo();
         sb.Append(sb1.ToString());
         VMuktiAPI.ClsLogging.WriteToTresslog(sb);
         return null;
     }
 }
        internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type, DataColumn[] extra)
        {
            DataTable dt = new DataTable();

            foreach (PropertyInfo pi in type.GetProperties())
            {
                if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                {
                    dt.Columns.Add(pi.Name, pi.PropertyType);
                }
            }

            if (extra != null)
            {
                foreach (DataColumn c in extra)
                {
                    if (dt.Columns.Contains(c.ColumnName))
                        dt.Columns.Remove(c.ColumnName);
                    dt.Columns.Add(c);
                }
            }

            foreach (object k in obj)
            {
                DataRow dr = dt.NewRow();
                foreach (PropertyInfo pi in type.GetProperties())
                {
                    if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                    {
                        dr[pi.Name] = pi.GetValue(k, null);
                    }
                }
                dt.Rows.Add(dr);
            }

            return dt;
        }
        public void FncFillGrid()
        {
            try
            {
            objQColl = ClsQuestionCollection.GetAll(int.Parse(((ListBoxItem)(cmbScript.SelectedItem)).Tag.ToString()));
            DataTable dt = ObjectArrayToDataTable(objQColl, typeof(ClsQuestion));
            //MessageBox.Show(objQColl.Count.ToString());

            ctlGrid c = new ctlGrid(dt, true, true);
            c.Height = 200;
            c.Width = 700;
            c.SetValue(Canvas.LeftProperty, 20.0);
            c.SetValue(Canvas.TopProperty, 70.0);

            c.btnEditClicked += new ctlGrid.ButtonClicked(c_btnEditClicked);
            c.btnDeleteClicked += new ctlGrid.ButtonClicked(c_btnDeleteClicked);

            cnvMain.Children.Add(c);

            }
            catch (Exception exp)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "FncFillGrid()", "CtlQuestionAns.xaml.cs");
            }
        }
 internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type)
 {
     return ObjectArrayToDataTable(obj, type, null);
 }
 public void FncFillGrid()
 {
     //edited
     objQColl = ClsQuestionCollection.GetAll(int.Parse(((ListBoxItem)(cmbScript.SelectedItem)).Tag.ToString()));
     c.Bind(objQColl);
 }
        internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type, DataColumn[] extra)
        {
            try
            {
            DataTable dt = new DataTable();

            foreach (PropertyInfo pi in type.GetProperties())
            {
                if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                {
                    dt.Columns.Add(pi.Name, pi.PropertyType);
                }
            }

            if (extra != null)
            {
                foreach (DataColumn c in extra)
                {
                    if (dt.Columns.Contains(c.ColumnName))
                        dt.Columns.Remove(c.ColumnName);
                    dt.Columns.Add(c);
                }
            }

            foreach (object k in obj)
            {
                DataRow dr = dt.NewRow();
                foreach (PropertyInfo pi in type.GetProperties())
                {
                    if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                    {
                        dr[pi.Name] = pi.GetValue(k, null);
                    }
                }
                dt.Rows.Add(dr);
            }

            return dt;
        }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "ObjectArrayToDataTable()--:--CtlQuestionAns.xaml.cs--:--" + exp.Message + " :--:--");
                //ClsException.LogError(ex);
                //ClsException.WriteToErrorLogFile(ex);
                System.Text.StringBuilder sb = new StringBuilder();
                sb.AppendLine(exp.Message);
                sb.AppendLine();
                sb.AppendLine("StackTrace : " + exp.StackTrace);
                sb.AppendLine();
                sb.AppendLine("Location : " + exp.Data["My Key"].ToString());
                sb.AppendLine();
                sb1 = CreateTressInfo();
                sb.Append(sb1.ToString());
                VMuktiAPI.ClsLogging.WriteToTresslog(sb);
                return null;
            }
        }
Пример #14
0
 public void FncFillGrid()
 {
     //edited
     objQColl = ClsQuestionCollection.GetAll(int.Parse(((ListBoxItem)(cmbScript.SelectedItem)).Tag.ToString()));
     c.Bind(objQColl);
 }
        internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type, DataColumn[] extra)
        {
            try
            {
            DataTable dt = new DataTable();

            foreach (PropertyInfo pi in type.GetProperties())
            {
                if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                {
                    dt.Columns.Add(pi.Name, pi.PropertyType);
                }
            }

            if (extra != null)
            {
                foreach (DataColumn c in extra)
                {
                    if (dt.Columns.Contains(c.ColumnName))
                        dt.Columns.Remove(c.ColumnName);
                    dt.Columns.Add(c);
                }
            }

            foreach (object k in obj)
            {
                DataRow dr = dt.NewRow();
                foreach (PropertyInfo pi in type.GetProperties())
                {
                    if (pi.PropertyType.IsPrimitive || pi.PropertyType == typeof(string) || pi.PropertyType == typeof(DateTime))
                    {
                        dr[pi.Name] = pi.GetValue(k, null);
                    }
                }
                dt.Rows.Add(dr);
            }

            return dt;
        }
            catch (Exception exp)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "ObjectArrayToDataTable()", "CtlQuestionAns.xaml.cs");
                return null;
            }
        }
Пример #16
0
 internal static DataTable ObjectArrayToDataTable(ClsQuestionCollection obj, Type type)
 {
     return(ObjectArrayToDataTable(obj, type, null));
 }
        public void FncFillGrid()
        {
            try
            {
            objQColl = ClsQuestionCollection.GetAll(int.Parse(((ListBoxItem)(cmbScript.SelectedItem)).Tag.ToString()));
            DataTable dt = ObjectArrayToDataTable(objQColl, typeof(ClsQuestion));
            //MessageBox.Show(objQColl.Count.ToString());

            ctlGrid c = new ctlGrid(dt, true, true);
            c.Height = 200;
            c.Width = 700;
            c.SetValue(Canvas.LeftProperty, 20.0);
            c.SetValue(Canvas.TopProperty, 70.0);

            c.btnEditClicked += new ctlGrid.ButtonClicked(c_btnEditClicked);
            c.btnDeleteClicked += new ctlGrid.ButtonClicked(c_btnDeleteClicked);

            cnvMain.Children.Add(c);

        }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "FncFillGrid()--:--CtlQuestionAns.xaml.cs--:--" + exp.Message + " :--:--");
                //ClsException.LogError(ex);
                //ClsException.WriteToErrorLogFile(ex);
                System.Text.StringBuilder sb = new StringBuilder();
                sb.AppendLine(exp.Message);
                sb.AppendLine();
                sb.AppendLine("StackTrace : " + exp.StackTrace);
                sb.AppendLine();
                sb.AppendLine("Location : " + exp.Data["My Key"].ToString());
                sb.AppendLine();
                sb1 = CreateTressInfo();
                sb.Append(sb1.ToString());
                VMuktiAPI.ClsLogging.WriteToTresslog(sb);
            }
        }