Пример #1
0
        /// <summary>
        /// Constructs a new Entity of Course from a line from the datafiles.
        /// Should only be used when creating objects from files!
        /// </summary>
        /// <param name="line"></param>
        public Course(string[] line)
        {
            DataSearch ds = new DataSearch();

            University u;
            try
            {
                u = ds.GetByID<University>(Guid.Parse(line[2]));
            }
            catch (DuplicateDataException)
            {
                u = new University();
            }
            Lecturer l;
            try
            {
                l = ds.GetByID<Lecturer>(Guid.Parse(line[3]));
            }
            catch (DuplicateDataException)
            {
                l = new Lecturer();
            }
            Major m;
            try
            {
                m = ds.GetByID<Major>(Guid.Parse(line[5]));
            }
            catch (DuplicateDataException)
            {
                m = new Major();
            }
            Init(Guid.Parse(line[0]), line[1], u,
                l, EnumTranslator.stringToSemester[line[4]], m);
        }
Пример #2
0
        /// <summary>
        /// Constructs a new Entity of Rating from a line from the datafiles.
        /// Should only be used when creating objects from files!
        /// </summary>
        /// <param name="line"></param>
        public Rating(string[] r)
        {
            ds = new DataSearch();
            Student s;

            try
            {
                s = ds.GetByID <Student>(Guid.Parse(r[1]));
            }
            catch (DuplicateDataException)
            {
                s = new Student();
            }
            Course c;

            try
            {
                c = ds.GetByID <Course>(Guid.Parse(r[2]));
            }
            catch (DuplicateDataException)
            {
                c = new Course();
            }
            Init(Guid.Parse(r[0]), s, c, EnumTranslator.stringToSemester[r[3]],
                 Int32.Parse(r[4]), Int32.Parse(r[5]), Int32.Parse(r[6]), Int32.Parse(r[7]),
                 Int32.Parse(r[8]), Int32.Parse(r[9]), Int32.Parse(r[10]), r[11], Int32.Parse(r[12]),
                 Boolean.Parse(r[13]), DateTime.Parse(r[14]));
        }
        /// <summary>
        /// Constructs a new Entity of Lecturer from a line from the datafiles.
        /// Should only be used when creating objects from files!
        /// </summary>
        /// <param name="line"></param>
        public Lecturer(string[] line)
        {
            DataSearch ds = new DataSearch();
            University u;

            try
            {
                u = ds.GetByID <University>(Guid.Parse(line[2]));
            }
            catch (DuplicateDataException)
            {
                u = new University();
            }
            Major m;

            try
            {
                m = ds.GetByID <Major>(Guid.Parse(line[3]));
            }
            catch (DuplicateDataException)
            {
                m = new Major();
            }
            Init(Guid.Parse(line[0]), line[1], u, m);
        }
Пример #4
0
        public JsonResult Search(DataSearch item)
        {
            List <ListProduct_JournalPaper>    list      = lpr.getList(item);
            List <ListProduct_ConferencePaper> list2     = lpr.getList2(item);
            List <ListProdcut_Inven>           listInven = lpr.getListInven(item);

            return(Json(new { Journal = list, Conference = list2, Invention = listInven }, JsonRequestBehavior.AllowGet));
        }
 public ProfessorSearchResultWindow(Lecturer lecturer)
 {
     InitializeComponent();
     this.ds          = new DataSearch();
     this.lecturer    = lecturer;
     this.label1.Text = lecturer.TitleAndName;
     this.label2.Text = ds.AverageRatingForLecturer(lecturer).ToString("0.0");
     AddDataToTable();
 }
Пример #6
0
 public UniSearchResultWindow(University uni)
 {
     this.university = uni ?? throw new ArgumentNullException("UniversitySearchResultWindow was called with university null.");
     InitializeComponent();
     ds = new DataSearch();
     this.label1.Text = uni.UniversityName;
     label2.Text      = ds.AverageRatingForUniversity(uni).ToString("0.0");
     AddDataToTable();
 }
Пример #7
0
        //   public HttpResponseMessage Post(string SelectedTests)
        public HttpResponseMessage Get(string SelectedTests, string WorkStudyID)
        {
            AdoHelper ado = new AdoHelper();
            //SqlDataReader reader = null;

            List <RNDTesting>   lstTests        = new List <RNDTesting>();
            List <SqlParameter> lstSqlParameter = new List <SqlParameter>();

            //if (SelectedTests == null)
            //    SelectedTests = "ALL";

            SqlParameter param0 = new SqlParameter("@TestingNos", SelectedTests);
            SqlParameter param1 = new SqlParameter("@WorkStudyID", @WorkStudyID);

            using (SqlDataReader reader = ado.ExecDataReaderProc("RNDPrintTesting", "RND", param0, param1))
            {
                if (reader.HasRows)
                {
                    RNDTesting TM = null;
                    while (reader.Read())
                    {
                        TM               = new RNDTesting();
                        TM.total         = Convert.ToInt32(reader["total"]);
                        TM.TestingNo     = Convert.ToInt32(reader["TestingNo"]);
                        TM.Alloy         = Convert.ToString(reader["Alloy"]);
                        TM.GageThickness = Convert.ToString(reader["GageThickness"]);
                        TM.Hole          = Convert.ToString(reader["Hole"]);
                        TM.Location1     = Convert.ToString(reader["Location1"]);
                        TM.Location2     = Convert.ToString(reader["Location2"]);
                        TM.Location3     = Convert.ToString(reader["Location3"]);
                        TM.LotID         = Convert.ToString(reader["LotID"]);
                        TM.Orientation   = Convert.ToString(reader["Orientation"]);
                        TM.PieceNo       = Convert.ToString(reader["PieceNo"]);
                        TM.SpeciComment  = Convert.ToString(reader["SpeciComment"]);
                        TM.TestType      = Convert.ToString(reader["TestType"]);
                        TM.SubTestType   = Convert.ToString(reader["SubTestType"]);
                        TM.Temper        = Convert.ToString(reader["Temper"]);
                        TM.TestLab       = Convert.ToString(reader["TestLab"]);
                        TM.UACPart       = Convert.ToInt32(reader["UACPart"]);
                        TM.WorkStudyID   = Convert.ToString(reader["WorkStudyID"]);
                        TM.Printed       = Convert.ToChar(reader["Printed"]);
                        lstTests.Add(TM);
                    }
                }
                if (ado._conn != null && ado._conn.State == System.Data.ConnectionState.Open)
                {
                    ado._conn.Close(); ado._conn.Dispose();
                }
            }
            DataSearch <RNDTesting> ds = new DataSearch <RNDTesting>
            {
                items = lstTests,
                total = (lstTests != null && lstTests.Count > 0) ? lstTests[0].total : 0
            };

            return(Serializer.ReturnContent(ds, this.Configuration.Services.GetContentNegotiator(), this.Configuration.Formatters, this.Request));
        }
Пример #8
0
        public CourseViewWindow(Course course)
        {
            this.course = course;
            DataSearch ds = new DataSearch();

            ratings = ds.GetRatingsByCourse(course);
            InitializeComponent();
            detailedCourseStatistics1.InitData(course, ratings, this);
            dataVizualisation1.InitData(course, ratings, this);
        }
 public CourseSearchResultWindow(University university, Major major)
 {
     InitializeComponent();
     this.ds         = new DataSearch();
     this.university = university;
     this.major      = major;
     label1.Text     = university.UniversityName + ": " + major.Name;
     label2.Text     = ds.AverageRatingForMajor(major).ToString("0.0");
     AddDataToTable();
 }
Пример #10
0
        ///// <summary>
        /// Retrieve the Assign Material data and Assign to Grid
        /// </summary>
        /// <param name="option"></param>
        /// <returns></returns>
        private DataSearch <RNDMaterial> GetAssignMaterial(DataGridoption option)
        {
            AdoHelper           ado = new AdoHelper();
            List <RNDMaterial>  lstAssignMaterial = new List <RNDMaterial>();
            List <SqlParameter> lstSqlParameter   = new List <SqlParameter>();

            lstSqlParameter.Add(new SqlParameter("@CurrentPage", option.pageIndex));
            lstSqlParameter.Add(new SqlParameter("@NoOfRecords", option.pageSize));
            AddSearchFilter(option, lstSqlParameter);
            using (SqlDataReader reader = ado.ExecDataReaderProc("RNDAssignMaterial_Read", "RND", lstSqlParameter.Cast <object>().ToArray()))
            {
                if (reader.HasRows)
                {
                    RNDMaterial AM = null;
                    while (reader.Read())
                    {
                        AM               = new RNDMaterial();
                        AM.total         = Convert.ToInt32(reader["total"]);
                        AM.RecID         = Convert.ToInt32(reader["RecID"]);
                        AM.WorkStudyID   = Convert.ToString(reader["WorkStudyID"]);
                        AM.SoNum         = Convert.ToString(reader["SoNum"]);
                        AM.MillLotNo     = Convert.ToInt32(reader["MillLotNo"]);
                        AM.CustPart      = Convert.ToString(reader["CustPart"]);
                        AM.UACPart       = Convert.ToDecimal(reader["UACPart"]);
                        AM.Alloy         = Convert.ToString(reader["Alloy"]);
                        AM.Temper        = Convert.ToString(reader["Temper"]);
                        AM.GageThickness = Convert.ToString(reader["GageThickness"]);
                        AM.Location2     = Convert.ToString(reader["Location2"]);
                        AM.Hole          = Convert.ToString(reader["Hole"]);
                        AM.PieceNo       = Convert.ToString(reader["PieceNo"]);
                        AM.Comment       = Convert.ToString(reader["Comment"]);
                        AM.EntryDate     = (!string.IsNullOrEmpty(reader["EntryDate"].ToString())) ? Convert.ToDateTime(reader["EntryDate"]) : (DateTime?)null;
                        AM.EntryBy       = Convert.ToString(reader["EntryBy"]);
                        AM.DBCntry       = Convert.ToString(reader["DBCntry"]);
                        //  AM.RCS = Convert.ToChar(reader["RCS"]);

                        lstAssignMaterial.Add(AM);
                    }
                }
                if (ado._conn != null && ado._conn.State == System.Data.ConnectionState.Open)
                {
                    ado._conn.Close(); ado._conn.Dispose();
                }
            }
            DataSearch <RNDMaterial> ds = new DataSearch <RNDMaterial>
            {
                items = lstAssignMaterial,
                total = (lstAssignMaterial != null && lstAssignMaterial.Count > 0) ? lstAssignMaterial[0].total : 0
            };

            return(ds);
        }
Пример #11
0
        private void ButtonLogin_Click(object sender, EventArgs e)
        {
            DB db = new DB();

            String username = textBoxUsername.Text;
            String password = textBoxPassword.Text;

            DataTable table = new DataTable();

            MySqlDataAdapter adapter = new MySqlDataAdapter();

            MySqlCommand command = new MySqlCommand("SELECT * FROM `users` WHERE `username`= @usn and `password` = @pass", db.GetConnection());

            command.Parameters.Add("@usn", MySqlDbType.VarChar).Value  = username;
            command.Parameters.Add("@pass", MySqlDbType.VarChar).Value = password;

            adapter.SelectCommand = command;

            adapter.Fill(table);

            //check if the user exists or not.
            if (table.Rows.Count > 0)
            {
                MessageBox.Show("You are logged on!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoginStatus.isLogged = true;
                object[]   values = table.Rows[0].ItemArray;
                DataSearch ds     = new DataSearch();
                University uni    = ds.GetByID <University>(Guid.Parse(values[4].ToString()));

                LoginStatus.CurrentUser = new Student(username, password, uni, values[5].ToString());

                LogenOn?.Invoke(this, new EventArgs());

                this.Close();
            }
            else
            {
                if (username.Trim().Equals(""))
                {
                    MessageBox.Show("Enter Your Username To Login", "Empty Username", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (password.Trim().Equals(""))
                {
                    MessageBox.Show("Enter Your Password To Login", "Empty Password", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Wrong Username Or Password", "Wrong Data", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #12
0
        public DataSearch Serch(Data data, Regex patterns, bool confirmity)
        {
            DataSearch returnSearch = new DataSearch();

            foreach (var item in data)
            {
                if (patterns.IsMatch(item.Index))
                {
                    returnSearch.Add(item);
                }
            }

            return(returnSearch);
        }
Пример #13
0
        /// <summary>
        /// Retrieve the Assign Material data and Assign to Grid
        /// </summary>
        /// <param name="option"></param>
        /// <returns></returns>
        private DataSearch <RNDMaterial> GetUACPartList(DataGridoption option)
        {
            AdoHelper ado = new AdoHelper();
            //SqlDataReader reader = null;
            List <RNDMaterial>  lstAssignMaterial = new List <RNDMaterial>();
            List <SqlParameter> lstSqlParameter   = new List <SqlParameter>();

            lstSqlParameter.Add(new SqlParameter("@CurrentPage", option.pageIndex));
            lstSqlParameter.Add(new SqlParameter("@NoOfRecords", option.pageSize));
            AddSearchFilter(option, lstSqlParameter);
            try
            {
                using (SqlDataReader reader = ado.ExecDataReaderProc("RNDUACPartList_Read", "RND", lstSqlParameter.Cast <object>().ToArray()))
                {
                    if (reader.HasRows)
                    {
                        int         RecID = 0;
                        RNDMaterial AM    = null;
                        while (reader.Read())
                        {
                            AM               = new RNDMaterial();
                            AM.total         = Convert.ToInt32(reader["total"]);
                            AM.RecID         = Convert.ToInt32(reader["RecID"]);
                            AM.UACPart       = Convert.ToDecimal(reader["UACPart"]);
                            AM.GageThickness = Convert.ToString(reader["GageThickness"]);
                            AM.Location2     = Convert.ToString(reader["Location2"]);
                            lstAssignMaterial.Add(AM);
                            RecID++;
                        }
                    }
                    if (ado._conn != null && ado._conn.State == System.Data.ConnectionState.Open)
                    {
                        ado._conn.Close(); ado._conn.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
            }


            DataSearch <RNDMaterial> ds = new DataSearch <RNDMaterial>
            {
                items = lstAssignMaterial,
                total = (lstAssignMaterial != null && lstAssignMaterial.Count > 0) ? lstAssignMaterial[0].total : 0
            };

            return(ds);
        }
        public ActionResult ExportToExcel(string Spec, string Alloy, string Temper, string Plant)
        {
            DataGridoption ExportDataFilter = new DataGridoption();

            string SearchBy = "";

            if (!string.IsNullOrEmpty(Spec))
            {
                SearchBy = SearchBy + ";" + "Spec:" + Spec;
            }
            if (!string.IsNullOrEmpty(Alloy))
            {
                SearchBy = SearchBy + ";" + "Alloy:" + Alloy;
            }
            if (!string.IsNullOrEmpty(Temper))
            {
                SearchBy = SearchBy + ";" + "Temper:" + Temper;
            }
            if (!string.IsNullOrEmpty(Plant))
            {
                SearchBy = SearchBy + ";" + "Plant:" + Plant;
            }

            ExportDataFilter.Screen    = "ExceptionList";
            ExportDataFilter.filterBy  = "all";
            ExportDataFilter.pageIndex = 0;
            ExportDataFilter.pageSize  = 10000;
            ExportDataFilter.searchBy  = SearchBy;

            List <ProdExceptions>       lstException = new List <ProdExceptions>();
            DataSearch <ProdExceptions> ds           = null;

            try
            {
                ds = new ExceptionsData().GetList(ExportDataFilter);

                if (ds != null && ds.items != null && ds.items.Count > 0)
                {
                    lstException = ds.items;
                    string fileName = "ExceptionList" + "_" + DateTime.Now.ToString().Replace(" ", "").Replace("-", "").Replace(":", "");
                    GetExcelFile <ProdExceptions>(lstException, fileName);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(RedirectToAction("ExceptionList"));
        }
Пример #15
0
        /// <summary>
        /// Constructs a new Entity of Student from a line from the datafiles.
        /// Should only be used when creating objects from files!
        /// </summary>
        /// <param name="line"></param>
        public Student(string[] r)
        {
            DataSearch ds = new DataSearch();
            University u;

            try
            {
                u = ds.GetByID <University>(Guid.Parse(r[3]));
            }
            catch (DuplicateDataException)
            {
                u = new University();
            }
            Init(Guid.Parse(r[0]), r[1], r[2], u, r[5]);
        }
Пример #16
0
 void FormInitial()
 {
     //注册窗口空间和事件
     SummaryView = new DevSummary(gridView1);
     DataSearch.UserInit();
     DataSearch.SearchDate     += new EventHandler(DataSearch_SearchDate);
     DataSearch.ADD_Clicked    += new EventHandler(DataSearch_ADD_Clicked);
     DataSearch.Edit_Clicked   += new EventHandler(DataSearch_Edit_Clicked);
     DataSearch.Delete_Clicked += new EventHandler(DataSearch_Delete_Clicked);
     //设置样式
     DevStyle.SetDetailGridViewLayout(gridView1);
     DevStyle.SetGridControlLayout(gridControl1, false);
     DevStyle.DrawRowIndicator(gridView1, 40);
     frmGridCustomize.RegisterGrid(gridView1);
 }
Пример #17
0
        /// <summary>
        /// Constructs a new Entity of Major from a line from the datafiles.
        /// Should only be used when creating objects from files!
        /// </summary>
        /// <param name="line"></param>
        public Major(string[] line)
        {
            DataSearch ds = new DataSearch();
            University u;

            try
            {
                u = ds.GetByID <University>(Guid.Parse(line[2]));
            }
            catch (DuplicateDataException)
            {
                u = new University();
            }
            Init(Guid.Parse(line[0]), line[1], u);;
        }
        public List <ListProduct_ConferencePaper> getList2(DataSearch item)
        {
            string sql = @"select p.name,b.author, p.journal_name,  case when a.quality is null then p.[index] else a.quality end as 'quality', p.vol, p.page, p.link_doi, p.link_scholar
                            from [SM_ScientificProduct].Paper p
	                            join (select p.paper_id, STRING_AGG(c.name, ',') AS 'quality'
			                            from [SM_ScientificProduct].Paper p left join [SM_ScientificProduct].PaperWithCriteria pc on p.paper_id = pc.paper_id
				                            left join [SM_ScientificProduct].PaperCriteria c on pc.criteria_id = c.criteria_id
			                            group by p.paper_id) as a on p.paper_id = a.paper_id
	                            join(select p.paper_id, STRING_AGG(po.name, ',') AS 'author'
			                            from [SM_ScientificProduct].Paper p join [SM_ScientificProduct].AuthorPaper ap on p.paper_id = ap.paper_id
				                            join [General].People po on ap.people_id = po.people_id
			                            group by p.paper_id) as b on p.paper_id = b.paper_id
	                            join [SM_ScientificProduct].RequestPaper rp on p.paper_id = rp.paper_id
                            where p.paper_type_id = 2 and rp.status_id = 2";

            if (item.nameS != null && item.nameS != " ")
            {
                sql += " and p.name like @name";
            }
            else
            {
                item.nameS = " ";
            }
            if (item.monthS != null && item.monthS != " ")
            {
                sql += " and month(p.publish_date) = @month";
            }
            else
            {
                item.monthS = " ";
            }
            if (item.yearS != null && item.yearS != " ")
            {
                sql += " and year(p.publish_date) = @year";
            }
            else
            {
                item.yearS = " ";
            }
            sql += " order by p.publish_date desc";
            List <ListProduct_ConferencePaper> list = new List <ListProduct_ConferencePaper>();

            list = db.Database.SqlQuery <ListProduct_ConferencePaper>(sql
                                                                      , new SqlParameter("name", "%" + item.nameS + "%")
                                                                      , new SqlParameter("month", item.monthS)
                                                                      , new SqlParameter("year", item.yearS)).ToList();
            return(list);
        }
Пример #19
0
        /// <summary>
        /// Constructor for the class Rating without giving a ratingID.
        /// ID will be generated automatically.
        /// Should be used when creating a truly new object that is not yet stored.
        /// </summary>
        /// <param name="student">cannot be null</param>
        /// <param name="course">cannot be null</param>
        /// <param name="semester">cannot be null</param>
        /// <param name="overallRating">Number between 1-10. can be null</param>
        /// <param name="contactHours">Positive number. can be null</param>
        /// <param name="selfStudyHours">Positive number. can be null</param>
        /// <param name="organized">Number bewteesn 1-5. can be null</param>
        /// <param name="learned">Number between 1-5. can be null</param>
        /// <param name="interesting">Number between 1-5. can be null</param>
        /// <param name="presentation">Number bewteen 1-5. can be null</param>
        /// <param name="comment">Number between 1-5. can be null</param>
        /// <param name="grade">Number between 1-10. can be null</param>
        /// <param name="passedFirstTime">True or false. can be null</param>
        /// <param name="date"></param>
        public Rating(Student student, Course course,
                      Semester semester, int overallRating, int contactHours, int selfStudyHours, int organized,
                      int learned, int interesting, int presentation, string comment, int grade,
                      bool passedFirstTime, DateTime date)
        {
            ds = new DataSearch();

            DataSearch.Matches condition = (x) => (x[1].Equals(student.ID.ToString()) &&
                                                   x[2].Equals(course.ID.ToString()));
            if (ds.ObjectExists <Rating>(condition))
            {
                throw new DuplicateDataException("This student has already given a Rating to this course!");
            }
            Init(Guid.NewGuid(), student, course, semester, overallRating, contactHours, selfStudyHours,
                 organized, learned, interesting, presentation, comment, grade, passedFirstTime, date);
        }
Пример #20
0
        public ActionResult GetExceptionList(DataGridoption dataoptions)
        {
            DataSearch <ProdExceptions> ds = new DataSearch <ProdExceptions>();

            try
            {
                ds = new ExceptionsData().GetList(dataoptions);
            }
            catch (Exception ex)
            {
                ds.Message = ex.Message.ToString();
                ds.total   = 0;
            }

            return(Json(new { items = ds.items, total = ds.total }, JsonRequestBehavior.AllowGet));
        }
Пример #21
0
 private void SourceTree_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Down)
     {
         e.SuppressKeyPress = true;
         ScrollTree(1);
     }
     else if (e.KeyCode == Keys.Up)
     {
         e.SuppressKeyPress = true;
         ScrollTree(-1);
     }
     else if (e.KeyCode == Keys.Enter)
     {
         DataSearch.Focus();
     }
 }
        public List <ListProdcut_Inven> getListInven(DataSearch item)
        {
            string sql = @"select i.name, a.author, it.name as 'name_shtt', i.date, i.no
                            from [SM_ScientificProduct].Invention i
	                            join(select	i.invention_id, STRING_AGG(po.name, ',') AS 'author'
			                            from [SM_ScientificProduct].Invention i join [SM_ScientificProduct].AuthorInvention ai on i.invention_id = ai.invention_id
				                            join [General].People po on ai.people_id = po.people_id
			                            group by i.invention_id) as a on i.invention_id = a.invention_id
	                            join [SM_ScientificProduct].InventionType it on i.type_id = it.invention_type_id
	                            join [SM_ScientificProduct].RequestInvention ri on i.invention_id = ri.invention_id
                            where 1=1 and ri.status_id = 2";

            if (item.nameS != null && item.nameS != " ")
            {
                sql += " and i.name like @name";
            }
            else
            {
                item.nameS = " ";
            }
            if (item.monthS != null && item.monthS != " ")
            {
                sql += " and month(i.date) = @month";
            }
            else
            {
                item.monthS = " ";
            }
            if (item.yearS != null && item.yearS != " ")
            {
                sql += " and year(i.date) = @year";
            }
            else
            {
                item.yearS = " ";
            }
            sql += " order by i.date desc";
            List <ListProdcut_Inven> list = new List <ListProdcut_Inven>();

            list = db.Database.SqlQuery <ListProdcut_Inven>(sql
                                                            , new SqlParameter("name", "%" + item.nameS + "%")
                                                            , new SqlParameter("month", item.monthS)
                                                            , new SqlParameter("year", item.yearS)).ToList();
            return(list);
        }
Пример #23
0
        public JsonResult SearchOnePerson(DataSearch item)
        {
            List <ListProduct_OnePerson> list = new List <ListProduct_OnePerson>();

            if (item.monthS == "paper")
            {
                list = lpo.getList(item, "10");
            }
            else
            {
                list = lpo.getListInven(item, "10");
            }
            for (int i = 0; i < list.Count; i++)
            {
                list[i].note = list[i].status_id + "_" + list[i].paper_id + "_" + item.monthS;
            }
            return(Json(new { OnePerson = list }, JsonRequestBehavior.AllowGet));
        }
Пример #24
0
        public ResponseInfo DanhSachTruyenFilter(int index, DataSearch data)
        {
            ResponseInfo response = new ResponseInfo();

            try
            {
                response.Data      = new QuanLyTruyenModel().GetListTruyenSearch(index, data);
                response.IsSuccess = true;
            }
            catch (Exception e)
            {
                response.Code = (int)ConstantsEnum.CodeResponse.ServerError;
                var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.ServerError);
                response.TypeMsgError    = errorMsg.Type;
                response.MsgError        = errorMsg.Msg;
                response.ThongTinBoSung1 = e.Message;
            }
            return(response);
        }
Пример #25
0
        /// <summary>
        /// Retrieve the Registered User Details data and Assign to Grid
        /// </summary>
        /// <param name="option"></param>
        /// <returns></returns>
        private DataSearch <RNDLogin> GetRegisteredUser(DataGridoption option)
        {
            AdoHelper ado = new AdoHelper();
            //SqlDataReader reader = null;
            List <RNDLogin>     lstRNDLogin     = new List <RNDLogin>();
            List <SqlParameter> lstSqlParameter = new List <SqlParameter>();

            lstSqlParameter.Add(new SqlParameter("@CurrentPage", option.pageIndex));
            lstSqlParameter.Add(new SqlParameter("@NoOfRecords", option.pageSize));
            AddSearchFilter(option, lstSqlParameter);
            using (SqlDataReader reader = ado.ExecDataReaderProc("RNDRegisteredUser_Read", "RND", lstSqlParameter.Cast <object>().ToArray()))
            {
                if (reader.HasRows)
                {
                    RNDLogin UD = null;
                    while (reader.Read())
                    {
                        UD                 = new RNDLogin();
                        UD.total           = Convert.ToInt32(reader["total"]);
                        UD.UserId          = Convert.ToInt32(reader["UserId"]);
                        UD.UserName        = Convert.ToString(reader["UserName"]);
                        UD.FirstName       = Convert.ToString(reader["FirstName"]);
                        UD.LastName        = Convert.ToString(reader["LastName"]);
                        UD.PermissionLevel = Convert.ToString(reader["PermissionLevel"]);
                        UD.Created_By      = Convert.ToString(reader["CreatedBy"]);
                        UD.Created_On      = Convert.ToString(reader["CreatedOn"]);
                        UD.StatusCode      = Convert.ToString(reader["StatusCode"]);
                        lstRNDLogin.Add(UD);
                    }
                }
                if (ado._conn != null && ado._conn.State == System.Data.ConnectionState.Open)
                {
                    ado._conn.Close(); ado._conn.Dispose();
                }
            }
            DataSearch <RNDLogin> ds = new DataSearch <RNDLogin>
            {
                items = lstRNDLogin,
                total = (lstRNDLogin != null && lstRNDLogin.Count > 0) ? lstRNDLogin[0].total : 0
            };

            return(ds);
        }
Пример #26
0
        public static List <Download> FetchVisible(DataSearch dataSearch)
        {
            List <Download> items = new List <Download>();

            using (SQLiteCommand command = new SQLiteCommand("select " + Columns + " from episodes, downloads where downloads.epid=episodes.epid", FetchDbConn()))
                using (SQLiteMonDataReader reader = new SQLiteMonDataReader(command.ExecuteReader()))
                {
                    int epidOrdinal = reader.GetOrdinal("epid");

                    while (reader.Read())
                    {
                        if (dataSearch.DownloadIsVisible(reader.GetInt32(epidOrdinal)))
                        {
                            items.Add(new Download(reader));
                        }
                    }
                }

            return(items);
        }
Пример #27
0
        private void ExportOpticalMount(DataGridoption ExportDataFilter)
        {
            var client = GetHttpClient();
            List <OpticalMountViewModel>       lstExportOpticalMount = new List <OpticalMountViewModel>();
            DataSearch <OpticalMountViewModel> objOpticalMount       = null;
            var OpticalMounttask = client.PostAsJsonAsync(Api + "api/Grid", ExportDataFilter).ContinueWith((res) =>
            {
                if (res.Result.IsSuccessStatusCode)
                {
                    objOpticalMount = JsonConvert.DeserializeObject <DataSearch <OpticalMountViewModel> >(res.Result.Content.ReadAsStringAsync().Result);
                }
            });

            OpticalMounttask.Wait();
            if (objOpticalMount != null && objOpticalMount.items != null && objOpticalMount.items.Count > 0)
            {
                lstExportOpticalMount = objOpticalMount.items;
                string fileName = "OpticalMount" + "_" + DateTime.Now.ToString().Replace(" ", "").Replace("-", "").Replace(":", "");
                GetExcelFile <OpticalMountViewModel>(lstExportOpticalMount, fileName);
            }
        }
        //    public ActionResult AddResults(bool isSuccess, string ResultType, string SelectedTests)
        //public ActionResult AddResults(bool isSuccess, string SelectedTests)
        //{
        //    ManualDataViewModel data = new ManualDataViewModel();
        //    isSuccess = false;
        //    List<SelectListItem> ddTestType = null;
        //    try
        //    {
        //        ddTestType = new List<SelectListItem>();
        //        var client = GetHttpClient();
        //        var task = client.GetAsync(Api + "api/ImportData?Active=3").ContinueWith((res) =>
        //        {
        //            if (res.Result.IsSuccessStatusCode)
        //            {
        //                data = JsonConvert.DeserializeObject<ManualDataViewModel>(res.Result.Content.ReadAsStringAsync().Result);
        //                if (data != null)
        //                {
        //                    ddTestType = data.ddTestType;
        //                    //ddWorkStudyId = data.ddWorkStudyID;
        //                }
        //            }
        //        });

        //        task.Wait();

        //        ViewBag.ddTestTypesManual = ddTestType;
        //        //data.WorkStudyID = WorkStudyID;
        //        data.SelectedTests = SelectedTests;

        //    }
        //    catch (Exception ex)
        //    {
        //        _logger.Error(ex);
        //    }

        //    //return Json(new { isSuccess = isSuccess }, JsonRequestBehavior.AllowGet);
        //    return View(data);
        //}
        //[HttpPost]
        public ActionResult PrintSelected(string SelectedTests, string WorkStudyID)
        {
            _logger.Debug("PrintSelected");

            List <TestingViewModel>       lstExportTesting = new List <TestingViewModel>();
            DataSearch <TestingViewModel> objTest          = null;

            bool isSuccess = false;

            try
            {
                var client = GetHttpClient();

                var task = client.GetAsync(Api + "api/Testing?SelectedTests=" + SelectedTests + "&workStudyID=" + WorkStudyID).ContinueWith((res) =>
                {
                    if (res.Result.IsSuccessStatusCode)
                    {
                        objTest = JsonConvert.DeserializeObject <DataSearch <TestingViewModel> >(res.Result.Content.ReadAsStringAsync().Result);
                        if (objTest != null && objTest.items != null && objTest.items.Count > 0)
                        {
                            lstExportTesting = objTest.items;
                            if (lstExportTesting != null)
                            {
                                //set filename
                                string fileName = "PrintNew" + "_" + DateTime.Now.ToString().Replace(" ", "").Replace("-", "").Replace(":", "");
                                GetExcelFile <TestingViewModel>(lstExportTesting, fileName);
                                isSuccess = true;
                            }
                        }
                    }
                });
                task.Wait();
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }
            // return RedirectToAction("TestingMaterialList");
            return(Json(new { isSuccess = isSuccess }, JsonRequestBehavior.AllowGet));
        }
        public List <ListProduct_OnePerson> getListInven(DataSearch item, string id)
        {
            List <ListProduct_OnePerson> list = new List <ListProduct_OnePerson>();
            string sql = @"select i.name, br.created_date, ri.status_id, i.invention_id as 'paper_id'
                            from [SM_ScientificProduct].Invention i join [SM_ScientificProduct].RequestInvention ri on i.invention_id = ri.invention_id
	                            join [SM_Request].BaseRequest br on ri.request_id = br.request_id
                            where br.account_id = @id";

            if (item.nameS != null && item.nameS != " ")
            {
                sql += " and i.name like @name";
            }
            else
            {
                item.nameS = " ";
            }
            sql += " order by status_id desc";
            list = db.Database.SqlQuery <ListProduct_OnePerson>(sql
                                                                , new SqlParameter("id", id)
                                                                , new SqlParameter("name", "%" + item.nameS + "%")).ToList();
            return(list);
        }
 private void AddDataToTable()
 {
     ds           = new DataSearch();
     this.courses = ds.GetCoursesByMajor(major);
     foreach (Course course in courses)
     {
         object[]            row = new object[4];
         Tuple <double, int> t   = ds.AverageRatingAmountRatingsForCourse(course);
         row[0] = course.Name;
         if (!(t.Item1 >= 0 && t.Item1 <= 10))
         {
             row[1] = t.Item1.ToString("0.0");
         }
         else
         {
             row[1] = t.Item1.ToString("0.0") + "/5";
         }
         row[2] = t.Item2;
         row[3] = course.Lecturer.TitleAndName;
         dataGridView1.Rows.Add(row);
     }
 }
Пример #31
0
        public static List<Download> FetchVisible(DataSearch dataSearch)
        {
            List<Download> items = new List<Download>();

            using (SQLiteCommand command = new SQLiteCommand("select " + Columns + " from episodes, downloads where downloads.epid=episodes.epid", FetchDbConn()))
            {
                using (SQLiteMonDataReader reader = new SQLiteMonDataReader(command.ExecuteReader()))
                {
                    int epidOrdinal = reader.GetOrdinal("epid");

                    while (reader.Read())
                    {
                        if (dataSearch.DownloadIsVisible(reader.GetInt32(epidOrdinal)))
                        {
                            items.Add(new Download(reader));
                        }
                    }
                }
            }

            return items;
        }