protected void BindData()
 {
     var report = new List<OrderAverageReportLineSummary>();
     report.Add(this.OrderService.OrderAverageReport(OrderStatusEnum.Pending));
     report.Add(this.OrderService.OrderAverageReport(OrderStatusEnum.Processing));
     report.Add(this.OrderService.OrderAverageReport(OrderStatusEnum.Complete));
     report.Add(this.OrderService.OrderAverageReport(OrderStatusEnum.Cancelled));
     gvOrders.DataSource = report;
     gvOrders.DataBind();
 }
예제 #2
0
 public static string ConvertPascalCaseToFriendlyString(this string stringToConvert)
 {
     List<char> cFriendlyName = new List<char>();
     char[] cName = stringToConvert.ToCharArray();
     for (int cIdx = 0; cIdx < cName.Length; cIdx++)
     {
         char c = cName[cIdx];
         if (cIdx > 0 && char.IsUpper(c))
         {
             cFriendlyName.Add(' ');
         }
         cFriendlyName.Add(c);
     }
     return new string(cFriendlyName.ToArray());
 }
예제 #3
0
 /// <summary>
 /// 绑定专业
 /// </summary>
 protected void BindProfession()
 {
     IList<CY.GFive.Core.Business.Profess> proList = CY.GFive.Core.Business.Profess.GetAllProfess();
     IList<CY.GFive.Core.Business.Profess> proListMid = new List<CY.GFive.Core.Business.Profess>();
     for (int i = 0; i < proList.Count; i++)
     {
         if (proList[i].IsHighLevel == 0)
         {
             proListMid.Add(proList[i]);
         }
     }
     DDLProfession.DataTextField = "ProName";
     DDLProfession.DataValueField = "ProCode";
     DDLProfession.DataSource = proListMid;
     DDLProfession.DataBind();
 }
예제 #4
0
        void BindGrid()
        {
            Language language = LanguageManager.GetLanguageById(int.Parse(this.ddlLanguage.SelectedItem.Value));
            if (language != null)
            {
                var resourceDictionary = language.LocaleStringResources;
                List<LocaleStringResource> resources = new List<LocaleStringResource>();
                foreach (KeyValuePair<string, LocaleStringResource> kvp in resourceDictionary)
                {
                    if (kvp.Value != null)
                        resources.Add(kvp.Value);
                }
                gvLocaleStringResources.DataSource = resources;
                gvLocaleStringResources.DataBind();
            }

            btnAddNew.Visible = this.ddlLanguage.SelectedIndex > 0;
        }
예제 #5
0
        public static List<BookingFile> GetListBookingFileByDate(string date, string hanhtrinh)
        {
            List<BookingFile> BFList = new List<BookingFile>();
            BookingFile BF;
            DataTable dt = ShipBookingData.FillDataTable("spBookingFile_SelectByDate", "@NgayDi", "@HanhTrinh", date, hanhtrinh);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                BF = new BookingFile();
                BF.LoaiChuyen = dt.Rows[i]["LoaiChuyen"].ToString();
                BF.NoiDi = dt.Rows[i]["NoiDi"].ToString();
                BF.NoiDen = dt.Rows[i]["NoiDen"].ToString();
                BF.NgayDi = DateTime.Parse(dt.Rows[i]["NgayDi"].ToString());
                BF.NgayVe = DateTime.Parse(dt.Rows[i]["NgayVe"].ToString());
                BF.ThoiGian = dt.Rows[i]["ThoiGian"].ToString();
                BF.OpenChecking = Convert.ToBoolean(dt.Rows[0]["OpenChecking"].ToString());
                BF.LoaiVe = dt.Rows[i]["LoaiVe"].ToString();
                BF.SoGhe = dt.Rows[i]["SoGhe"].ToString();
                BF.GiaTien = dt.Rows[i]["GiaTien"].ToString();
                BF.ThanhToan = dt.Rows[i]["ThanhToan"].ToString();
                BF.MaNguoiNhan = dt.Rows[i]["MaNguoiNhan"].ToString();
                BF.MaHanhTrinh = dt.Rows[i]["HanhTrinh"].ToString();
                BF.GioKhoiHanh = DateTime.Parse(dt.Rows[i]["GioKhoiHanh"].ToString());
                BF.GioDen = DateTime.Parse(dt.Rows[i]["GioDen"].ToString());
                BF.SoVe = dt.Rows[i]["SoVe"].ToString();

                BFList.Add(BF);
                BF = null;
            }

            return BFList;
        }
예제 #6
0
파일: Form1.cs 프로젝트: Dio-Angus/FD
 public List<string> ReadData(string name)
 {
     //C#读取TXT文件之建立  FileStream 的对象,说白了告诉程序,
     //文件在那里,对文件如何 处理,对文件内容采取的处理方式
     FileStream fs = new FileStream(@name, FileMode.Open, FileAccess.Read);
     //仅 对文本 执行  读写操作
     StreamReader sr = new StreamReader(fs);
     //定位操作点,begin 是一个参考点
     sr.BaseStream.Seek(0, SeekOrigin.Begin);
     //读一下,看看文件内有没有内容,为下一步循环 提供判断依据
     //sr.ReadLine() 这里是 StreamReader的要领  可不是 console 中的~
     string str = sr.ReadLine();//假如  文件有内容
     List<string> line = new List<string>();
     while (str != null)
     {
         //输出字符串,str 在上面已经定义了 读入一行字符
         line.Add(str);
         //这里我的理会是 当输出一行后,指针移动到下一行~
         //下面这句话就是 判断 指针所指这行能无法 有内容~
         str = sr.ReadLine();
     }
     //C#读取TXT文件之关上文件,留心顺序,先对文件内部执行 关上,然后才是文件~
     sr.Close();
     fs.Close();
     return line;
 }
예제 #7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            #region 生成包裹

            var product = new List<ExpressProduct>();
            product.Add(new ExpressProduct
            {
                CustomsTitleCN = "怀表",
                CustomsTitleEN = "POCKET WATCH",
                Quantity = 1,
                SKU = "WP083",
                StorageNo = "test",
                Weight = 100,
                DeclareValue = Convert.ToDecimal(5.67),
            });

            var packageList = new List<ExpressPackage>();
            packageList.Add(new ExpressPackage
            {
                Custom = "OR201112230076",
                ShipToAddress = new ShipToAddress
                {
                    Contact= "nicolas courtais",
                    Street1= "37 rue general ferrié",
                    City= "grenoble",
                    Province= "Rhône-Alpes",
                    Country = "France",
                    PostCode = "38100",
                },
                Packing = new Packing
                {
                    Height = 1,
                    Length = 1,
                    Width = 1,
                },
                Remark = "备注信息",
                Status = OrderExpressState.Initial,
                TrackCode = "",
                Weight = 500,
                ProductList = product.ToArray(),
            });

            var orderDetail = new ExpressOrder
            {
                IsTracking = false,
                Location = "GZ",
                Remark = "测试订单",
                PackageList = packageList.ToArray(),
                PickUpAddress = new PickUpAddress
                {
                    Country = "United States",
                    Street1 = "1712 Jones Street",
                    Contact = "Curtis Wilson",
                    Province = "United States",
                    District = "United States",
                    PostCode = "77511",
                    City = "Alvin",
                    Company = "ABC",
                },

            };

            #endregion

            var clint = new CK1SoapClient();
            UserKeyAndToken ukt = new UserKeyAndToken();
            var request = new ExpressAddOrderNewRequest
            {
                UserKey = ukt.getUserKey(),
                Token = ukt.getToken(),
                Submit = false,
                OrderDetail = orderDetail,
                ExpressTypeNew = "HTM",
                MessageID = "SampleCallId"
            };

            ExpressAddOrderResponse response = clint.ExpressAddOrderNew(request);

            lblAck.Text = response.Ack.ToString();
            lblInvocationID.Text = response.InvocationID;
            lblMessage.Text = response.Message;
            lblOrderSign.Text = response.OrderSign;

            pnlResponse.Visible = true;
            pnlRequest.Visible = false;
        }
예제 #8
0
        //Collections
        public static List<Topic> Latest(int amount = 10)
        {
            var topics = new List<Topic>();

            // 1057 is the profile node.  This is a hack way of hiding the forums from the latest list on the homepage added by PG
            var reader = Data.SqlHelper.ExecuteReader(
                "SELECT TOP " + amount + " forumTopics.* FROM forumTopics INNER JOIN ForumForums on forumTopics.ParentId = ForumForums.Id Where (forumTopics.isSpam IS NULL OR forumTopics.isSpam != 1) AND forumforums.parentId != 1057 ORDER BY updated DESC");

            while (reader.Read())
            {
                topics.Add(GetFromReader(reader));
            }

            reader.Close();
            reader.Dispose();

            return topics;
        }
예제 #9
0
        /// <summary>
        /// 按比例获取一定数量学生
        /// </summary>
        /// <param name="scoList"></param>
        /// <param name="dec"></param>
        /// <returns></returns>
        private IList<CY.GFive.Core.Business.Score> GetValidScore(IList<CY.GFive.Core.Business.Score> scoList, string year, int term, string grade)
        {
            CY.GFive.Core.Business.ScholarshipStep ScoStep = CY.GFive.Core.Business.ScholarshipStep.Load(int.Parse(DDLLevel.SelectedValue));//获取所占学生比例
            int count = Decimal.ToInt32(scoList.Count * ScoStep.StdProportional) / 100;
            IList<CY.GFive.Core.Business.ScholarInfo> schInfoList = CY.GFive.Core.Business.ScholarInfo.GetListByGradeTermYear(year, term, grade, int.Parse(DDLScholarship.SelectedValue));
            List<CY.GFive.Core.Business.Score> newScoList = new List<CY.GFive.Core.Business.Score>();
            int index = 0;
            foreach (CY.GFive.Core.Business.Score sco in scoList)
            {

                if (index < count)
                {
                    //筛选出未获奖和已获得本级别奖的学生
                    bool check = false;
                    int isIndex = -1;
                    for (int j = 0; j < schInfoList.Count; j++)
                    {
                        if (scoList[index].StdCode == schInfoList[j].StdCode && schInfoList[j].Degree != DDLLevel.Text)
                        {
                            check = true;
                            break;
                        }
                        else if (schInfoList[j].Degree == DDLLevel.Text)
                        {
                            isIndex = schInfoList[j].Id;
                        }
                    }
                    if (isIndex != -1)
                    {
                        scoList[index].IsCheck = isIndex.ToString();//标记已被选中
                    }
                    if (!check)
                    {
                        newScoList.Add(scoList[index]);
                        index++;
                    }
                }
                else
                {
                    if (scoList[index - 1] == scoList[index])
                    {
                        newScoList.Add(scoList[index]);
                        index++;
                    }
                    else
                        break;
                }
            }
            return newScoList;
        }
예제 #10
0
        private void DataBind_Repeater(string year, int term, string proCode, string grade)
        {
            IList<CY.GFive.Core.Business.Student> strList = CY.GFive.Core.Business.Student.GetStuListByYearTermAndPro(year, term, proCode, grade);//学生
            //IList<CY.GFive.Core.Business.ConductInfo> conList = CY.GFive.Core.Business.ConductInfo.GetAvgCndtScore(year, term,grade);//操行
            IList<CY.GFive.Core.Business.Score> scoList = CY.GFive.Core.Business.Score.GetAvgScoreList(year, term, proCode, grade);//平均成绩和操行
            int ID = 0;
            if (int.TryParse(DDLScholarship.SelectedValue, out ID))
            {
                CY.GFive.Core.Business.Scholarship Sco = CY.GFive.Core.Business.Scholarship.Load(ID);//成绩和操行分比例
                try
                {
                    scoList = GetAvgTotalScore(scoList, Sco.ScoreProportional, Sco.ConductProportional);
                    scoList = ScoreSort(scoList) as IList<CY.GFive.Core.Business.Score>;
                    scoList = GetValidScore(scoList, year, term, grade) as IList<CY.GFive.Core.Business.Score>;
                    strList = HandList(scoList, strList) as IList<CY.GFive.Core.Business.Student>;
                }
                catch
                {
                    ERRLbl.Text = "系统异常错误!";
                    return;
                }
                List<CY.GFive.Core.Business.Student> unStuList = new List<CY.GFive.Core.Business.Student>();//构造未被选中列表
                List<CY.GFive.Core.Business.Student> stuList = new List<CY.GFive.Core.Business.Student>();//构造已被评选获奖学生列表
                foreach (CY.GFive.Core.Business.Student stu in strList)
                {
                    if (stu.IsCheck.Length == 0)
                    {
                        unStuList.Add(stu);
                    }
                    else
                    {
                        stuList.Add(stu);
                    }
                }
                RepStudents.DataSource = unStuList;
                RepStudents.DataBind();

                RepStudents2.DataSource = stuList;
                RepStudents2.DataBind();
            }
            else
            {
                ERRLbl.Text = "参数不合法!";
                return;
            }
        }
 //chi duoc anh xa co so du lieu len thoi
 public List<RequestModel> ListRQ()
 {
     List<RequestModel> Listr = new List<RequestModel>();
     var requests = from r in dc.Requests
                    join ca in dc.CatalogeRQs on r.CatalogRQId equals ca.CatalogRQId
                    join el in dc.Employees on r.EmployeeNumber equals el.EmployeeNumber
                   select new
                   {
                       CatalogRQId=ca.CatalogRQId,
                       RequestId=r.RequestId,
                       EmployeeNumber=r.EmployeeNumber,
                       FullName=el.FullName,
                       RequestName = r.RequestName,
                       CatalogRQName = ca.CatalogRQName,
                       DateDispatch = r.DateDispatch,
                       DateApprove = r.DateApprove,
                       RequestContent=r.RequestContent,
                       Description=r.Description,
                       State=r.State,
                       Accept=r.Accept
                   };
     foreach (var rr in requests)
     {
         RequestModel obrq = new RequestModel();
         obrq.CRQId1 = rr.CatalogRQId;
         obrq.RId = rr.RequestId;
         obrq.ENumber = rr.EmployeeNumber;
         obrq.FName = rr.FullName;
         obrq.RName = rr.RequestName;
         obrq.CRQName = rr.CatalogRQName;
         obrq.DDispatch = Convert.ToDateTime(rr.DateDispatch);
         obrq.DApprove = Convert.ToDateTime(rr.DateApprove);
         obrq.RContent = rr.RequestContent;
         obrq.Dtion = rr.Description;
         obrq.Stte = rr.State;
         obrq.Acc = Convert.ToBoolean(rr.Accept);
         Listr.Add(obrq);
     }
     return Listr;
 }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = "Danh Sách Album";

            service.setUserCredentials("*****@*****.**", "doantruong");
            feed = service.Query(query);
            foreach (PicasaEntry entry in feed.Entries)
            {
                AlbumAccessor ac = new AlbumAccessor(entry);
                listAlbum.Add(ac);
            }
            if (!IsPostBack)
            {
                int soDong = LoadAlbum();
                FilterSTT(soDong, 0, 10);
            }
            this.GridViewPicasa.HeaderStyle.CssClass = "headerstyle";

            //photos

            string maAlbum = null;
            List<SPHOTO> listPhotos = new List<SPHOTO>();
            if(Request.QueryString["id"] != null)
            {
                maAlbum = Request.QueryString["id"].ToString();
            }
            if(maAlbum != null)
            {
                PhotoQuery Pquery = new PhotoQuery(PicasaQuery.CreatePicasaUri("*****@*****.**",maAlbum));
                feed = service.Query(Pquery);
                foreach (PicasaEntry entry in feed.Entries)
                {
                    SPHOTO temp = new SPHOTO();

                    temp.title = entry.Title.Text;
                    temp.thumbURL = entry.Media.Thumbnails[1].Attributes["url"] as string;
                    listPhotos.Add(temp);

                }
                ListViewPhotos.DataSource = listPhotos;
                ListViewPhotos.DataBind();
            }
            if (maAlbum != null)
            {
                //lay ma

                //lay thong tin va load len cac textbox
                for (int i = 0; i < listAlbum.Count; i++)
                {
                    if (listAlbum[i].Id == maAlbum)
                    {
                        currentAlbum = listAlbum[i];
                        break;
                    }
                }
                switch (currentAlbum.Access)
                {
                    case "public":
                        DropDownListAccess.SelectedIndex = 0;
                        break;

                    case "private":
                        DropDownListAccess.SelectedIndex = 1;
                        break;
                    case "protected":
                        DropDownListAccess.SelectedIndex = 2;
                        break;

                }
                txtalbumtitle.Text = currentAlbum.AlbumTitle;
                txtmieuta.Text = currentAlbum.AlbumSummary;
            }
        }
예제 #13
0
파일: Form1.cs 프로젝트: Dio-Angus/FD
        public List<string> GetMatchs(string pattern,string text)
        {
            // Define a regular expression for repeated words.
            Regex rx = new Regex(pattern,
              RegexOptions.Compiled | RegexOptions.IgnoreCase);

            // Define a test string.
            //string text = "The the quick brown fox  fox jumped over the lazy dog dog.";

            // Find matches.
            MatchCollection matches = rx.Matches(text);

            // Report the number of matches found.
            //Console.WriteLine("{0} matches found in:\n   {1}",
                             // matches.Count,
                             // text);

            // Report on each match.
            List<string> matchs = new List<string>();
            foreach (Match match in matches)
            {
                matchs.Add(match.ToString());

            }
            return matchs;
        }
예제 #14
0
파일: Form1.cs 프로젝트: Dio-Angus/FD
        private List<string> GetSegmentWords(List<string> content)
        {
            Segment segment = new Segment();

            List<string> segmentWords = new List<string>();
            foreach (string s in content)
            {
                ICollection<WordInfo> words = segment.DoSegment(s);
                List<string> sWords = new List<string>();
                foreach (WordInfo wordInfo in words)
                {
                    if (wordInfo == null)
                    {
                        continue;
                    }
                    sWords.Add(wordInfo.Word);
                }
                segmentWords.AddRange(sWords);
            }
            return segmentWords;
        }
예제 #15
0
파일: Form1.cs 프로젝트: Dio-Angus/FD
        private void bt_clustering_Click(object sender, EventArgs e)
        {
            List<string> initialContent = ReadData("C:\\Users\\LENOVO\\Desktop\\回复提取3.0.txt");
            List<string> content = new List<string>();
            for (int i = 0; i < initialContent.Count; i++)
            {
                List<string> matchs=GetMatchs(@"(?<=\b.+?\b\s\b\w{4}\d\b\s).*", initialContent[i]);
                if (matchs.Count != 0)
                    content.Add(matchs[0]);

            }
            List<string> segmentWords = GetSegmentWords(content);
            string[] stopWords = File.ReadAllLines(@"中文停用词表(专用).txt", System.Text.Encoding.Default);
            List<theWord> theWords = new List<theWord>();
            foreach (string s in segmentWords.Distinct().ToList())
            {
                int i = 0;
                foreach (string word in stopWords)
                {
                    if (word == s)
                    {
                        i = 1;
                        break;
                    }
                }
                if (!Regex.IsMatch(s, @"[\u4e00-\u9fbb]+$"))//去除非汉字
                    i = 1;
                if (i == 1)
                    continue;
                int times = 0;
                foreach (string word in segmentWords)
                {
                    if (s == word)
                        times++;
                }
                theWord theword;
                theword.text = s;
                theword.times = times;
                theWords.Add(theword);
            }
            theWords.Sort((left, right) =>
            {
                if (left.times > right.times)
                    return -1;
                else if (left.times == right.times)
                    return 0;
                else
                    return 1;
            });
            for (int i = 0; i < theWords.Count; i++)
            {
                tb_content.Text += theWords[i].text + "(" + theWords[i].times + ")" + "\r\n";
            }

            StreamWriter sw = new StreamWriter("C:\\Users\\LENOVO\\Desktop\\流行词排行3.0.txt");
            sw.Write(tb_content.Text);
            sw.Close();
        }
        private void BindGrid()
        {
            if (this.ddlLanguage.SelectedItem == null)
                return;

            Language language = this.LanguageService.GetLanguageById(int.Parse(this.ddlLanguage.SelectedItem.Value));
            if (language != null)
            {
                var allResources = this.LocalizationManager.GetAllResourcesByLanguageId(language.LanguageId);
                var filteredResources = new List<LocaleStringResource>();

                string filterByResourceName = txtResourceName.Text.Trim();
                string filterByResourceValue = txtResourceValue.Text.Trim();
                foreach (KeyValuePair<string, LocaleStringResource> kvp in allResources)
                {
                    if (kvp.Value != null)
                    {
                        //filter by resource name
                        bool resourceNameOK = false;

                        if (String.IsNullOrWhiteSpace(filterByResourceName) ||
                            kvp.Value.ResourceName.IndexOf(filterByResourceName, StringComparison.InvariantCultureIgnoreCase) >= 0)
                        {
                            resourceNameOK = true;
                        }
                        //filter by resource value
                        bool resourceValueOK = false;
                        if (String.IsNullOrWhiteSpace(filterByResourceValue) ||
                            kvp.Value.ResourceValue.IndexOf(filterByResourceValue, StringComparison.InvariantCultureIgnoreCase) >= 0)
                        {
                            resourceValueOK = true;
                        }

                        if (resourceNameOK && resourceValueOK)
                        {
                            filteredResources.Add(kvp.Value);
                        }
                    }
                }
                gvLocaleStringResources.DataSource = filteredResources;
                gvLocaleStringResources.DataBind();
            }

            //btnAddNew.Visible = this.ddlLanguage.SelectedIndex > 0;
        }
예제 #17
0
        public static List<Topic> GetAll()
        {
            var topics = new List<Topic>();
            var reader = Data.SqlHelper.ExecuteReader("SELECT * FROM forumTopics WHERE (forumTopics.isSpam IS NULL OR forumTopics.isSpam != 1) ");

            while (reader.Read())
                topics.Add(GetFromReader(reader));

            reader.Close();
            reader.Dispose();

            return topics;
        }
예제 #18
0
        /// <summary>
        /// 处理列表
        /// </summary>
        /// <param name="scoList"></param>
        /// <param name="strList"></param>
        /// <returns></returns>
        private List<CY.GFive.Core.Business.Student> HandList(IList<CY.GFive.Core.Business.Score> scoList, IList<CY.GFive.Core.Business.Student> strList)
        {
            List<CY.GFive.Core.Business.Student> stuList = new List<CY.GFive.Core.Business.Student>();
            for (int i = 0; i < scoList.Count; i++)
            {
                for (int j = 0; j < strList.Count; j++)
                {

                    if (strList[i].Code == scoList[i].StdCode)
                    {
                        strList[i].AvgScore = decimal.Round(scoList[i].AvgScore, 2);
                        strList[i].AvgCndtScore = decimal.Round(scoList[i].AvgCndtScore, 2);
                        strList[i].AvgTotalscore = decimal.Round(scoList[i].AvgTotalscore, 2);
                        strList[i].IsCheck = scoList[i].IsCheck;
                        stuList.Add(strList[i]);
                        strList.RemoveAt(i);
                        break;
                    }
                }
            }
            return stuList;
        }
예제 #19
0
        //Collections
        public static List<Topic> TopicsInForum(int forumId)
        {
            var topics = new List<Topic>();
            var reader = Data.SqlHelper.ExecuteReader("SELECT * FROM forumTopics WHERE (forumTopics.isSpam IS NULL OR forumTopics.isSpam != 1) AND parentId = @parentId ORDER BY updated DESC", Data.SqlHelper.CreateParameter("@parentId", forumId.ToString(CultureInfo.InvariantCulture)));

            while (reader.Read())
                topics.Add(GetFromReader(reader));

            reader.Close();
            reader.Dispose();

            return topics;
        }
예제 #20
0
        /// <summary>
        /// 按分数排序 从高到低
        /// </summary>
        /// <param name="scoList"></param>
        /// <returns></returns>
        private List<CY.GFive.Core.Business.Score> ScoreSort(IList<CY.GFive.Core.Business.Score> scoList)
        {
            List<CY.GFive.Core.Business.Score> newScoList = new List<CY.GFive.Core.Business.Score>();
            //List<CY.GFive.Core.Business.Score> scoList2 = scoList as List<CY.GFive.Core.Business.Score>;
            int[] iArray = new int[scoList.Count];
            decimal[] decArray = new decimal[scoList.Count];
            int index = 0;

            for (int i = 0; i < scoList.Count; i++)
            {
                decArray[i] = scoList[i].AvgTotalscore;
            }

            for (int j = 0; j < decArray.Length; j++)
            {
                int max = 0;
                decimal dec = decArray[j];
                for (int i = j + 1; i < decArray.Length; i++)
                {
                    if (decArray[j] < decArray[i])
                    {
                        decArray[j] = decArray[i];
                        max = i;
                    }
                }
                decArray[max] = dec;
                iArray[index] = max;
                index++;
            }

            for (int i = 0; i < iArray.Length; i++)
            {
                int j = iArray[i];
                newScoList.Add(scoList[j]);
            }

            return newScoList;
        }
        private void InitializeControl()
        {
            string QuoteId = GetQuoteId();

            QuoteListWrapper wrapper = new QuoteListWrapper();
            IQuote quote = wrapper.GetQuoteById(QuoteId);

            List<CategoryWrapper> catList = new List<CategoryWrapper>();
            foreach (string category in quote.Categories)
            {
                CategoryWrapper wrap = new CategoryWrapper();
                wrap.Text = category;
                catList.Add(wrap);
            }

            ListView1.DataSource = catList;
            ListView1.DataBind();
        }
예제 #22
0
 /// <summary>
 /// 绑定奖项
 /// </summary>
 protected void BindScholarship()
 {
     IList<CY.GFive.Core.Business.Scholarship> schList = CY.GFive.Core.Business.Scholarship.GetAllScholarship();
     IList<CY.GFive.Core.Business.Scholarship> schmidlist = new List<CY.GFive.Core.Business.Scholarship>();
     for (int i = 0; i < schList.Count; i++)
     {
         if (schList[i].IsHighLevel == 0)
         {
             schmidlist.Add(schList[i]);
         }
     }
     DDLScholarship.DataTextField = "Name";
     DDLScholarship.DataValueField = "Id";
     DDLScholarship.DataSource = schmidlist;
     DDLScholarship.DataBind();
 }
예제 #23
0
 public void GetAllSpecialUser(int forumid)
 {
     ForumInfo[] forumInfoArray = AdminForums.GetForumSpecialUser(forumid);
     foruminfolist = new List<ForumInfo>();
     if (forumInfoArray != null)
     {
         foreach (ForumInfo fi in forumInfoArray)
         {
             foruminfolist.Add(fi);
         }
     }
 }
        private static List<Technology> SelectedTechnologies(FormCollection form)
        {
            var technologies = new List<Technology>();
            foreach (var key in form.Keys)
            {
                if (key.ToString().StartsWith("Technology."))
                {
                    var value = form[key.ToString()];
                    bool selected = false;

                    if (value.ToLowerInvariant() == "true")
                        selected = true;
                    if (HasChanged(value) && GetNewBooleanValue(value))
                        selected = true;

                    if (selected)
                    {
                        var id = ExtractId(key.ToString());
                        var repo = new LookupRepository();
                        technologies.Add(repo.GetTechnology(id));
                    }
                }
            }
            return technologies;
        }
예제 #25
0
        public void UpdateGrid(string ContextKey, object[] ChangesArray)
        {
            //List<string> fieldName = new List<string>();
            MetaGridContextKey gridContextKey = UtilHelper.JsonDeserialize<MetaGridContextKey>(ContextKey);
            List<MetaObject> changed = new List<MetaObject>();
            CHelper.AddToContext("GridUpdated", 1);

            LoadMetaViewPreference(gridContextKey.ViewName);
            MetaView CurrentView = GetViewByName(gridContextKey.ViewName);
            MetaObject[] list = CurrentView.List(mvPref);

            if (CurrentView.PrimaryGroupBy != null || CurrentView.SecondaryGroupBy == null)
            {
                if (CurrentView.SecondaryGroupBy != null)
                    list = MetaViewGroupUtil.ExcludeCollapsed(MetaViewGroupByType.Secondary, CurrentView.SecondaryGroupBy, CurrentView.PrimaryGroupBy, mvPref, list);

                list = MetaViewGroupUtil.ExcludeCollapsed(MetaViewGroupByType.Primary, CurrentView.PrimaryGroupBy, null, mvPref, list);
            }

            foreach (Dictionary<string, object> obj in ChangesArray)
            {
                int primaryKeyId = Convert.ToInt32(obj["primaryKeyId"]);
                int columnId = Convert.ToInt32(obj["column"]);
                string value = Convert.ToString(obj["value"]);

                MetaObject tmp = GetMetaObjectById(list, primaryKeyId);
                MetaObject curObject = null;
                if (tmp != null)
                    curObject = MetaObjectActivator.CreateInstance(tmp.GetMetaType(), primaryKeyId);
                else
                    continue;

                curObject.Properties[GetFieldNameByIndex(columnId)].Value = GetMinutesFromString(value);

                changed.Add(curObject);
            }

            using (TransactionScope tran = DataContext.Current.BeginTransaction())
            {
                foreach (MetaObject changeObj in changed)
                {
                    changeObj.Save();
                }

                tran.Commit();
            }
        }
예제 #26
0
파일: WebPage.cs 프로젝트: Dio-Angus/FD
 /// <summary>
 /// 此公有方法从本网页的链接中提取一定数量的链接,该链接的URL满足某正则式
 /// </summary>
 /// <param name="pattern">正则式</param>
 /// <param name="count">返回的链接的个数</param>
 /// <returns>List<Link></returns>
 public List<Link> getSpecialLinksByUrl(string pattern, int count)
 {
     if (m_links.Count == 0) getLinks();
     List<Link> SpecialLinks = new List<Link>();
     List<Link>.Enumerator i;
     i = m_links.GetEnumerator();
     int cnt = 0;
     while (i.MoveNext() && cnt < count)
     {
         if (new Regex(pattern, RegexOptions.Multiline | RegexOptions.IgnoreCase).Match(i.Current.NavigateUrl).Success)
         {
             SpecialLinks.Add(i.Current);
             cnt++;
         }
     }
     return SpecialLinks;
 }