public static string Export(Replay replay) { Game game = new Game(replay); GameState oldState = null; List<GameAction> actions = new List<GameAction>(); for (int i = 0; i < replay.Actions.Count; i++) { if (replay.Actions[i] is ReplayTimeAction) actions.Add(replay.Actions[i]); game.Seek(i); List<GameAction> newActions = StateDelta.Delta(oldState, game.State); actions.AddRange(newActions); if (game.State != null) oldState = game.State.Clone(); } List<JObject> jActions = new List<JObject>(); TimeSpan time = TimeSpan.Zero; foreach (var action in actions) { if (action is ReplayTimeAction) time = ((ReplayTimeAction)action).Time; else jActions.Add(SerializeAction(action, time)); } JObject json = new JObject(new JProperty("changes", new JArray(jActions))); return json.ToString(Newtonsoft.Json.Formatting.None); }
public void SortTest() { var episodes = new List<TvdbEpisode>(); episodes.Add(new TvdbEpisode { SeasonNumber = 2, EpisodeNumber = 1 }); episodes.Add(new TvdbEpisode { SeasonNumber = 1, EpisodeNumber = 1 }); episodes.Add(new TvdbEpisode { SeasonNumber = 1, EpisodeNumber = 5 }); episodes.Add(new TvdbEpisode { SeasonNumber = 3, EpisodeNumber = 12 }); episodes.Add(new TvdbEpisode { SeasonNumber = 2, EpisodeNumber = 12 }); episodes.Sort(new TvEpisodeComparer()); Assert.Equal(1, episodes[0].SeasonNumber); Assert.Equal(1, episodes[0].EpisodeNumber); Assert.Equal(1, episodes[1].SeasonNumber); Assert.Equal(5, episodes[1].EpisodeNumber); Assert.Equal(2, episodes[2].SeasonNumber); Assert.Equal(1, episodes[2].EpisodeNumber); Assert.Equal(2, episodes[3].SeasonNumber); Assert.Equal(12, episodes[3].EpisodeNumber); Assert.Equal(3, episodes[4].SeasonNumber); Assert.Equal(12, episodes[4].EpisodeNumber); }
void UCSalePlanView_SaveEvent(object sender, EventArgs e) { try { gvPurchasePlanList.EndEdit(); List<SysSQLString> listSql = new List<SysSQLString>(); SysSQLString sysStringSql = new SysSQLString(); sysStringSql.cmdType = CommandType.Text; Dictionary<string, string> dic = new Dictionary<string, string>();//参数 string sql1 = string.Format(@" Update tb_parts_sale_plan Set is_suspend=@is_suspend,suspend_reason=@suspend_reason,update_by=@update_by, update_name=@update_name,update_time=@update_time,operators=@operators,operator_name=@operator_name where sale_plan_id=@sale_plan_id;"); dic.Add("is_suspend", chkis_suspend.Checked ? "0" : "1");//选中(中止):0,未选中(不中止):1 dic.Add("suspend_reason", txtsuspend_reason.Caption.Trim()); dic.Add("update_by", GlobalStaticObj.UserID); dic.Add("update_name", GlobalStaticObj.UserName); dic.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString()); dic.Add("operators", GlobalStaticObj.UserID); dic.Add("operator_name", GlobalStaticObj.UserName); dic.Add("sale_plan_id", planId); sysStringSql.sqlString = sql1; sysStringSql.Param = dic; listSql.Add(sysStringSql); foreach (DataGridViewRow dr in gvPurchasePlanList.Rows) { string is_suspend = "1"; if (dr.Cells["is_suspend"].Value == null) { is_suspend = "1"; } if ((bool)dr.Cells["is_suspend"].EditedFormattedValue) { is_suspend = "0"; } else { is_suspend = "1"; } sysStringSql = new SysSQLString(); sysStringSql.cmdType = CommandType.Text; dic = new Dictionary<string, string>(); dic.Add("is_suspend", is_suspend); dic.Add("sale_plan_id", planId); dic.Add("parts_code", dr.Cells["parts_code"].Value.ToString()); string sql2 = "Update tb_parts_sale_plan_p set is_suspend=@is_suspend where sale_plan_id=@sale_plan_id and parts_code=@parts_code;"; sysStringSql.sqlString = sql2; sysStringSql.Param = dic; listSql.Add(sysStringSql); } if (DBHelper.BatchExeSQLStringMultiByTrans("修改采购计划单", listSql)) { MessageBoxEx.Show("保存成功!"); uc.BindgvSalePlanList(); deleteMenuByTag(this.Tag.ToString(), uc.Name); } else { MessageBoxEx.Show("保存失败!"); } } catch (Exception ex) { MessageBoxEx.Show("操作失败!"); } }
public List<ChapterInfo> GetChapters() { var chapters = new List<ChapterInfo>(); Regex regex = new Regex(@"<dt>(.*?)<\/dt>|<dd><a\s*href=""(.*?)"">(.*?)<\/a><\/dd>", RegexOptions.IgnoreCase | RegexOptions.Singleline); var matches = regex.Matches(_html); if (matches.Count > 0) { foreach (Match match in matches) { DateTime latestUpdateDate; DateTime.TryParse("20"+match.Groups[6].Value, out latestUpdateDate); if (string.IsNullOrEmpty(match.Groups[1].Value)) { chapters.Add(new ChapterInfo { IsSubTitle = false, ChapterUrl = match.Groups[2].Value, ChapterName = match.Groups[3].Value, }); } else { chapters.Add(new ChapterInfo { IsSubTitle = true, ChapterName = match.Groups[1].Value, }); } } } return chapters; }
/// <summary> /// 初始化窗体 /// </summary> public UCYTManager() { InitializeComponent(); base.AddEvent += new ClickHandler(UCYTManager_AddEvent); base.CopyEvent += new ClickHandler(UCYTManager_CopyEvent); base.EditEvent += new ClickHandler(UCYTManager_EditEvent); base.DeleteEvent += new ClickHandler(UCYTManager_DeleteEvent); base.VerifyEvent += new ClickHandler(UCYTManager_VerifyEvent); base.SubmitEvent += new ClickHandler(UCYTManager_SubmitEvent); base.ExportEvent += new ClickHandler(UCYTManager_ExportEvent); base.ViewEvent += new ClickHandler(UCYTManager_ViewEvent); base.PrintEvent += new ClickHandler(UCYTManager_PrintEvent); base.SetEvent += new ClickHandler(UCYTManager_SetEvent); #region 预览、打印设置 string printObject = "tb_parts_purchase_order_ytcg"; string printTitle = "宇通采购订单"; List<string> listNotPrint = new List<string>(); listNotPrint.Add(purchase_order_yt_id.Name); listNotPrint.Add(viewfile.Name); PaperSize paperSize = new PaperSize(); paperSize.Width = 297; paperSize.Height = 210; businessPrint = new BusinessPrint(gvYTPurchaseOrderList, printObject, printTitle, paperSize, listNotPrint); #endregion }
public async Task<ContentResponse> Find(string query, int maxItems = 25, bool getArtists = true, bool getAlbums = true, bool getTracks = true) { if (string.IsNullOrWhiteSpace(query)) throw new ArgumentNullException("query"); if (maxItems > 25) throw new ArgumentOutOfRangeException("maxItems"); await Authenticate(); RestRequest request = GetPopulatedRequest("1/content/{namespace}/search"); request.AddQueryString("q", query); if (maxItems != 25) { request.AddQueryString("maxItems", maxItems); } if (!(getArtists && getAlbums && getTracks)) { var filter = new List<string>(); if (getArtists) filter.Add("artists"); if (getAlbums) filter.Add("albums"); if (getTracks) filter.Add("tracks"); request.AddQueryString("filters", filter.Aggregate("", (c, n) => c.Length == 0 ? c + n : c + ("+" + n))); } request.AddQueryString("accessToken", "Bearer " + Token.AccessToken); return await _client.ExecuteAsync<ContentResponse>(request); }
public static void DelSubject(List<Priority> SP, List<String> SubjectID) { List<String> SB = new List<String>(); if (SubjectID != null) { foreach (var r in SP) if (!SubjectID.Contains(r.SubjectID.ToString())) SB.Add(r.SubjectID); } else { foreach (var r in SP) SB.Add(r.SubjectID); } for (int i = 0; i < SB.Count(); i++) { var a = SB[i]; var nhom = (from m in InputHelper.db.nhoms where m.MaMonHoc.Equals(a) select m.Nhom1).ToList(); foreach (var r in nhom) { byte aByte = Convert.ToByte(r); InputHelper.Groups.FirstOrDefault(m => m.Value.MaMonHoc == SB[i] && m.Value.Nhom == aByte).Value.IsIgnored = false; } OutputHelper.SaveOBJ("Groups", InputHelper.Groups); } }
public List<DicReader> GetPlistVisitingLogTrs(string key, DateTime? leftVisitOn, DateTime? rightVisitOn, PagingInput paging) { paging.Valid(); if (key != null) { key = key.Trim(); } Func<SqlFilter> filter = () => { var parameters = new List<DbParameter>(); var filterString = @" where a.LoginName like @key "; parameters.Add(CreateParameter("key", "%" + key + "%", DbType.String)); if (leftVisitOn.HasValue) { parameters.Add(CreateParameter("leftVisitOn", leftVisitOn.Value, DbType.DateTime)); filterString += " and a.VisitOn>=@leftVisitOn"; } if (rightVisitOn.HasValue) { parameters.Add(CreateParameter("rightVisitOn", rightVisitOn.Value, DbType.DateTime)); filterString += " and a.VisitOn<@rightVisitOn"; } return new SqlFilter(filterString, parameters.ToArray()); }; return base.GetPlist("VisitingLog", filter, paging); }
public List<DicReader> GetPlistCatalogAccountTrs(string key, string catalogCode , bool includeDescendants, PagingInput paging) { paging.Valid(); if (string.IsNullOrEmpty(catalogCode)) { throw new ArgumentNullException("catalogCode"); } Func<SqlFilter> filter = () => { var parameters = new List<DbParameter>(); var filterString = " where (a.Name like @key or a.Code like @key or a.LoginName like @key)"; parameters.Add(CreateParameter("key", "%" + key + "%", DbType.String)); if (!includeDescendants) { parameters.Add(CreateParameter("CatalogCode", catalogCode, DbType.String)); filterString += " and a.CatalogCode=@CatalogCode"; } else { parameters.Add(CreateParameter("CatalogCode", catalogCode + "%", DbType.String)); filterString += " and a.CatalogCode like @CatalogCode"; } return new SqlFilter(filterString, parameters.ToArray()); }; return base.GetPlist("CatalogAccountTr", filter, paging); }
public void InitializeDishOptionsChoicesList() { MyDishOptionsChoices = new List<DishOptionsChoice>(); var threeSideOptionalChoices = new FakeOptionalSideThreeOptionChoices().MyDishOptionsChoices; var fourSideOptionalChoices = new FakeOptionalSideFourOptionChoices().MyDishOptionsChoices; var threeSideRequiredChoices = new FakeRequiredSideThreeOptionChoices().MyDishOptionsChoices; var twelveSideRequiredChoices = new FakeRequiredSideOptionChoices().MyDishOptionsChoices; foreach (var dishOptionsChoice in threeSideOptionalChoices) { MyDishOptionsChoices.Add(dishOptionsChoice); } foreach (var dishOptionsChoice in fourSideOptionalChoices) { MyDishOptionsChoices.Add(dishOptionsChoice); } foreach (var dishOptionsChoice in threeSideRequiredChoices) { MyDishOptionsChoices.Add(dishOptionsChoice); } foreach (var dishOptionsChoice in twelveSideRequiredChoices) { MyDishOptionsChoices.Add(dishOptionsChoice); } }
public IList<User> GetUsers() { List<User> returnList = new List<User>(); returnList.Add(new User() { Id = Guid.NewGuid(), Name = "Tester0" }); returnList.Add(new User() { Id = Guid.NewGuid(), Name = "Tester1" }); returnList.Add(new User() { Id = Guid.NewGuid(), Name = "Tester2" }); returnList.Add(new User() { Id = Guid.NewGuid(), Name = "Tester3" }); returnList.Add(new User() { Id = Guid.NewGuid(), Name = "Tester4" }); return returnList; }
protected override IList<MappingConfiguration> PrepareMapping() { List<MappingConfiguration> mappingConfigurations = new List<MappingConfiguration>(); mappingConfigurations.Add(this.PrepareGroupMappingConfig()); mappingConfigurations.Add(this.PrepareUserMappingConfig()); if (this.shouldHaveDeletesTable) { mappingConfigurations.Add(this.PrepareEntityDeleteConfig()); } return mappingConfigurations; }
public List<DicReader> GetPlistGroupAccountTrs(string key, Guid groupId, PagingInput paging) { paging.Valid(); Func<SqlFilter> filter = () => { var parameters = new List<DbParameter>(); const string filterString = @" where (a.Name like @key or a.Code like @key or a.LoginName like @key) and a.GroupId=@GroupId"; parameters.Add(CreateParameter("key", "%" + key + "%", DbType.String)); parameters.Add(CreateParameter("GroupId", groupId, DbType.Guid)); return new SqlFilter(filterString, parameters.ToArray()); }; return base.GetPlist("GroupAccountTr", filter, paging); }
protected void Send_Click(object sender, EventArgs e) { string exception = ""; string mSenderID = (string)Session["username"]; string mMessage = Message.Text; int mRead = 0; DateTime mSendTime = DateTime.Now; string mTitle = Title.Text; List<Message> msgList = new List<Message>(); if (Receive.Text == "0") { List<string> names = new List<string>(); foreach (ListItem item in Receive.Items) { if (item.Value == "0") continue; Message msg = new Message(); msg.MSenderID = mSenderID; msg.MReceiveID = item.Value; msg.MMessage = mMessage; msg.MRead = mRead; msg.MSendTime = mSendTime; msg.MTitle = mTitle; msgList.Add(msg); } } else { string mReceiveID = Receive.Text; Message msg = new Message(); msg.MSenderID = mSenderID; msg.MReceiveID = mReceiveID; msg.MMessage = mMessage; msg.MRead = mRead; msg.MSendTime = mSendTime; msg.MTitle = mTitle; msgList.Add(msg); } if (MessageBLL.Insert(msgList, ref exception)) { Response.Write("<script>alert('发送成功!')</script>"); } else { Response.Write("<script>alert('发送失败!')</script>"); } }
public List<Order_entity> load_ordenow() { List<Order_entity> l = new List<Order_entity>(); var list = (from a in db.ESHOP_ORDERs join b in db.ESHOP_ORDER_ITEMs on a.ORDER_ID equals b.ORDER_ID join c in db.ESHOP_NEWs on b.NEWS_ID equals c.NEWS_ID join d in db.ESHOP_NEWS_CATs on c.NEWS_ID equals d.NEWS_ID select new { c.NEWS_TITLE, a.ORDER_NAME, a.ORDER_ID, c.NEWS_SEO_URL, c.NEWS_URL, d.ESHOP_CATEGORy.CAT_SEO_URL }).OrderByDescending(n => n.ORDER_ID).Take(10); foreach (var i in list) { Order_entity order = new Order_entity(); order.CAT_SEO_URL = i.CAT_SEO_URL; order.NEWS_SEO_URL = i.NEWS_SEO_URL; order.NEWS_URL = i.NEWS_URL; order.ORDER_NAME = i.ORDER_NAME; order.NEWS_TITLE = i.NEWS_TITLE; l.Add(order); } return l; }
public IList<ProductInfo> GetProductList(int pageIndex, int pageSize, out int Total) { using (MyContext db = new MyContext()) { Total = (from c in db.Product orderby c.ID select c).Count(); var items = (from c in db.Product orderby c.ID select c).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); IList<ProductInfo> ProductInfos = new List<ProductInfo>(); foreach (var item in items) { ProductInfo info = new ProductInfo(); info.ID = item.ID; info.ProductTypeID = item.ProductTypeID; info.ProductTypeName = item.ProductType.ProductTypeName;//导航属性的特点 info.Image = item.Image; info.ProductName = item.ProductName; info.MarketPrice = item.MarketPrice; info.NewPrice = item.NewPrice; info.GetDate = item.GetDate.ToShortDateString(); info.Enable = item.Enable; ProductInfos.Add(info); } return ProductInfos; } }
public void Filter_Get_Yarn_Head_Count(int iDisplayLength, int iDisplayStart, int iSortCol_0, string sSortDir_0, string sSearch) { int filteredCount = 0; List<Yarn_Head_Count> Yarn_Head_Count_List = new List<Yarn_Head_Count>(); DataTable dt = Yarn_Head_Count_DA.Filter_Get_Yarn_Head_Count(iDisplayLength, iDisplayStart, iSortCol_0, sSortDir_0, sSearch); foreach (DataRow row in dt.Rows) { filteredCount = int.Parse(row["TotalCount"].ToString()); Yarn_Head_Count_List.Add(new Yarn_Head_Count { ID = int.Parse(row["ID"].ToString()), Head_Count = int.Parse(row["Head_Count"].ToString()), ForEdit = row["ID"].ToString(), ForDelete = row["ID"].ToString() }); } var result = new { iTotalRecords = GetTotal_Yarn_Head_Count_Count(), iTotalDisplayRecords = filteredCount, aaData = Yarn_Head_Count_List }; JavaScriptSerializer js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(result)); }
public List<Template> GetTemplate(int pageSize,int pageIndex,ref int recordCount) { SqlParameter[] parameters = { SqlParamHelper.MakeParam("@RecordNum",SqlDbType.Int,4,ParameterDirection.InputOutput,recordCount), SqlParamHelper.MakeInParam("@SelectList",SqlDbType.VarChar,2000,Template_INFO_FIELDS), SqlParamHelper.MakeInParam("@TableSource",SqlDbType.VarChar,100,"[View_TemplateDictionary]"), SqlParamHelper.MakeInParam("@SearchCondition",SqlDbType.VarChar,2000,string.Empty), SqlParamHelper.MakeInParam("@OrderExpression",SqlDbType.VarChar,1000,"Addtime"), SqlParamHelper.MakeInParam("@PageSize",SqlDbType.Int,4,pageSize), SqlParamHelper.MakeInParam("@PageIndex",SqlDbType.Int,4,pageIndex) }; List<Template> list = new List<Template>(); using (IDataReader dr = SqlHelper.ExecuteReader(ReadConnectionString,CommandType.StoredProcedure,"PR_GetDataByPageIndex",parameters)){ while(dr.Read()){ list.Add(BindTemplate(dr)); } } try{ recordCount = Convert.ToInt32(parameters[0].Value); } catch{ recordCount = 0; } return list; }
/// <summary> /// 获得数据列表 /// </summary> public List<ObjectGroup> DataTableToList(DataTable dt) { List<ObjectGroup> modelList = new List<ObjectGroup>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ObjectGroup model; for (int n = 0; n < rowsCount; n++) { model = new ObjectGroup(); if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="") { model.ID=int.Parse(dt.Rows[n]["ID"].ToString()); } if(dt.Rows[n]["Code"]!=null && dt.Rows[n]["Code"].ToString()!="") { model.Code=dt.Rows[n]["Code"].ToString(); } if(dt.Rows[n]["Name"]!=null && dt.Rows[n]["Name"].ToString()!="") { model.Name=dt.Rows[n]["Name"].ToString(); } if(dt.Rows[n]["TypeCode"]!=null && dt.Rows[n]["TypeCode"].ToString()!="") { model.TypeCode=dt.Rows[n]["TypeCode"].ToString(); } if(dt.Rows[n]["OrganID"]!=null && dt.Rows[n]["OrganID"].ToString()!="") { model.OrganID=int.Parse(dt.Rows[n]["OrganID"].ToString()); } modelList.Add(model); } } return modelList; }
protected override IList<MappingConfiguration> PrepareMapping() { List<MappingConfiguration> mappingConfigurations = new List<MappingConfiguration>(); mappingConfigurations.Add(this.PrepareGroupMappingConfig()); mappingConfigurations.Add(this.PrepareUserMappingConfig()); //the DeleteOperation configuration should only be added //for the offline context if (this.shouldHaveDeletesTable) { mappingConfigurations.Add(this.PrepareEntityDeleteConfig()); } return mappingConfigurations; }
public void Filter_Get(int iDisplayLength, int iDisplayStart, int iSortCol_0, string sSortDir_0, string sSearch) { int filteredCount = 0; List<Commercial_Invoice> Commercial_Invoice_List = new List<Commercial_Invoice>(); DataTable dt = Commercial_Invoice_DA.Filter_Get(iDisplayLength, iDisplayStart, iSortCol_0, sSortDir_0, sSearch); foreach (DataRow row in dt.Rows) { filteredCount = int.Parse(row["TotalCount"].ToString()); Commercial_Invoice_List.Add(new Commercial_Invoice { ID = int.Parse(row["ID"].ToString()), Customer_Name = row["Customer_Name"].ToString(), Custom_Invoice_No = row["Custom_Invoice_No"].ToString(), BLDateString = Convert.ToDateTime(row["BLDate"].ToString()).ToShortDateString(), ForEdit = row["ID"].ToString(), ForDelete = row["ID"].ToString() }); } var result = new { iTotalRecords = GetTotal_Count(), iTotalDisplayRecords = filteredCount, aaData = Commercial_Invoice_List }; JavaScriptSerializer js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(result)); }
public List<District> getDistrictsList() { List<District> list = new List<District>(); list.Add(new District() { Id=-1, Name="[Select District]"}); list.AddRange(uOW.DistrictRepo.Get()); return list; }
public List<Pro_details_entity> Load_search_resultM(string _txt, int type, int skip, int limit) { List<Pro_details_entity> l = new List<Pro_details_entity>(); var list = (from c in db.ESHOP_NEWS_CATs join a in db.ESHOP_NEWs on c.NEWS_ID equals a.NEWS_ID join b in db.ESHOP_CATEGORies on c.CAT_ID equals b.CAT_ID where (SqlMethods.Like(a.NEWS_KEYWORD_ASCII, ClearUnicode(_txt)) || "" == _txt || "%%" == _txt) && a.NEWS_TYPE == type select new { a.NEWS_ID, a.NEWS_TITLE, a.NEWS_IMAGE3, a.NEWS_PRICE1, a.NEWS_PRICE2, a.NEWS_DESC, a.NEWS_SEO_URL, a.NEWS_URL, a.NEWS_ORDER, a.NEWS_ORDER_PERIOD, a.NEWS_PUBLISHDATE, b.CAT_SEO_URL }).Distinct().OrderByDescending(n => n.NEWS_ID).OrderByDescending(n => n.NEWS_ORDER).Skip(skip).Take(limit); foreach (var i in list) { Pro_details_entity pro = new Pro_details_entity(); pro.NEWS_ID = i.NEWS_ID; pro.NEWS_TITLE = i.NEWS_TITLE; pro.NEWS_IMAGE3 = i.NEWS_IMAGE3; pro.NEWS_DESC = i.NEWS_DESC; pro.NEWS_SEO_URL = i.NEWS_SEO_URL; pro.NEWS_URL = i.NEWS_URL; pro.NEWS_ORDER = Utils.CIntDef(i.NEWS_ORDER); pro.NEWS_ORDER_PERIOD = Utils.CIntDef(i.NEWS_ORDER_PERIOD); pro.NEWS_PRICE1 = Utils.CDecDef(i.NEWS_PRICE1); pro.NEWS_PRICE2 = Utils.CDecDef(i.NEWS_PRICE2); pro.NEWS_PUBLISHDATE = Utils.CDateDef(i.NEWS_PUBLISHDATE, DateTime.Now); pro.CAT_SEO_URL = i.CAT_SEO_URL; l.Add(pro); } return l; }
BusinessPrint businessPrint;//业务打印功能 #region 窗体初始化 /// <summary> 窗体初始化 /// </summary> public UCPurchaseBillManang() { InitializeComponent(); dateTimeStart.Value = DateTime.Now.AddDays(-DateTime.Now.Day + 1); dateTimeEnd.Value = DateTime.Now; base.AddEvent += new ClickHandler(UCPurchaseBillManang_AddEvent); base.EditEvent += new ClickHandler(UCPurchaseBillManang_EditEvent); base.CopyEvent += new ClickHandler(UCPurchaseBillManang_CopyEvent); base.DeleteEvent += new ClickHandler(UCPurchaseBillManang_DeleteEvent); base.VerifyEvent += new ClickHandler(UCPurchaseBillManang_VerifyEvent); base.SubmitEvent += new ClickHandler(UCPurchaseBillManang_SubmitEvent); base.ExportEvent += new ClickHandler(UCPurchaseBillManang_ExportEvent); base.ViewEvent += new ClickHandler(UCPurchaseBillManang_ViewEvent); base.PrintEvent += new ClickHandler(UCPurchaseBillManang_PrintEvent); base.SetEvent += new ClickHandler(UCPurchaseBillManang_SetEvent); #region 预览、打印设置 string printObject = "tb_parts_purchase_billing"; string printTitle = "采购开单"; List<string> listNotPrint = new List<string>(); listNotPrint.Add(purchase_billing_id.Name); PaperSize paperSize = new PaperSize(); paperSize.Width = 297; paperSize.Height = 210; businessPrint = new BusinessPrint(gvPurchaseOrderList, printObject, printTitle, paperSize, listNotPrint); #endregion }
public List<Pro_details_entity> Load_search_result(string _txt, int type, int _idcat) { List<Pro_details_entity> l = new List<Pro_details_entity>(); string test = ClearUnicode(_txt); var list = (from c in db.ESHOP_NEWS_CATs join a in db.ESHOP_NEWs on c.NEWS_ID equals a.NEWS_ID join b in db.ESHOP_CATEGORies on c.CAT_ID equals b.CAT_ID where (SqlMethods.Like(a.NEWS_KEYWORD_ASCII.ToString(), ClearUnicode(_txt)) || SqlMethods.Like(a.NEWS_TITLE.ToString(), _txt)) && b.CAT_TYPE == type &&(b.CAT_ID==_idcat||b.CAT_PARENT_PATH.Contains(_idcat.ToString())) select new {a.NEWS_VIDEO_URL, a.NEWS_FIELD1, a.NEWS_FIELD2, a.NEWS_FIELD4, a.NEWS_FIELD5, a.NEWS_ID, a.NEWS_TITLE, a.NEWS_IMAGE3, a.NEWS_PRICE1, a.NEWS_PRICE2, a.NEWS_DESC, a.NEWS_SEO_URL, a.NEWS_URL, a.NEWS_ORDER, a.NEWS_ORDER_PERIOD, a.NEWS_PUBLISHDATE, a.NEWS_FIELD3 }).Distinct().OrderByDescending(n => n.NEWS_ID).OrderByDescending(n => n.NEWS_ORDER); foreach (var i in list) { Pro_details_entity pro = new Pro_details_entity(); pro.NEWS_VIDEO_URL = i.NEWS_VIDEO_URL; pro.NEWS_ID = i.NEWS_ID; pro.NEWS_TITLE = i.NEWS_TITLE; pro.NEWS_IMAGE3 = i.NEWS_IMAGE3; pro.NEWS_DESC = i.NEWS_DESC; pro.NEWS_SEO_URL = i.NEWS_SEO_URL; pro.NEWS_URL = i.NEWS_URL; pro.NEWS_ORDER = Utils.CIntDef(i.NEWS_ORDER); pro.NEWS_ORDER_PERIOD = Utils.CIntDef(i.NEWS_ORDER_PERIOD); pro.NEWS_PRICE1 = Utils.CDecDef(i.NEWS_PRICE1); pro.NEWS_PRICE2 = Utils.CDecDef(i.NEWS_PRICE2); pro.NEWS_PUBLISHDATE = Utils.CDateDef(i.NEWS_PUBLISHDATE, DateTime.Now); pro.NEWS_FIELD1 = i.NEWS_FIELD1; pro.NEWS_FIELD2 = i.NEWS_FIELD2; pro.NEWS_FIELD4 = i.NEWS_FIELD4; pro.NEWS_FIELD5 = i.NEWS_FIELD5; l.Add(pro); } return l; }
//Pro or news hien thi trang chu public List<Pro_details_entity> Loadindex(int type, int period, int limit) { try { List<Pro_details_entity> l = new List<Pro_details_entity>(); var list = (from a in db.ESHOP_NEWS_CATs join b in db.ESHOP_NEWs on a.NEWS_ID equals b.NEWS_ID join c in db.ESHOP_CATEGORies on a.CAT_ID equals c.CAT_ID where b.NEWS_PERIOD == period && b.NEWS_TYPE == type select new { b.NEWS_ID, b.NEWS_TITLE, b.NEWS_IMAGE3,b.NEWS_PRICE1, b.NEWS_DESC, b.NEWS_SEO_URL, b.NEWS_URL, b.NEWS_ORDER_PERIOD, b.NEWS_PUBLISHDATE, c.CAT_SEO_URL }).OrderByDescending(n => n.NEWS_PUBLISHDATE).OrderByDescending(n => n.NEWS_ORDER_PERIOD).Take(limit).ToList(); foreach (var i in list) { Pro_details_entity pro = new Pro_details_entity(); pro.NEWS_ID = i.NEWS_ID; pro.NEWS_TITLE = i.NEWS_TITLE; pro.NEWS_IMAGE3 = i.NEWS_IMAGE3; pro.NEWS_DESC = i.NEWS_DESC; pro.NEWS_SEO_URL = i.NEWS_SEO_URL; pro.NEWS_URL = i.NEWS_URL; pro.NEWS_PRICE1 = Utils.CDecDef(i.NEWS_PRICE1); pro.NEWS_ORDER_PERIOD = Utils.CIntDef(i.NEWS_ORDER_PERIOD); pro.NEWS_PUBLISHDATE = Utils.CDateDef(i.NEWS_PUBLISHDATE, DateTime.Now); pro.CAT_SEO_URL = i.CAT_SEO_URL; l.Add(pro); } return l; } catch (Exception) { throw; } }
internal static string Build(List<TestAttribute> Categories) { string source = ""; var list = new List<string>(); Categories .ToList() .ForEach(c => list.Add(c.GetName())); list.Sort(); var catParams = new string[] { ExtentFlag.GetPlaceHolder("testCategory"), ExtentFlag.GetPlaceHolder("testCategoryU") }; list.ForEach(c => { var catValues = new string[] { c, c.ToLower().Replace(" ", "") }; source += SourceBuilder.Build(CategoryFilterHtml.GetOptionSource(), catParams, catValues); }); return source; }
public List<Pro_details_entity> load_ordenowHighlight(int limit) { List<Pro_details_entity> l = new List<Pro_details_entity>(); var list = (from a in db.ESHOP_ORDERs join b in db.ESHOP_ORDER_ITEMs on a.ORDER_ID equals b.ORDER_ID join c in db.ESHOP_NEWs on b.NEWS_ID equals c.NEWS_ID select new { a.ORDER_ID, c.NEWS_ID, c.NEWS_TITLE, c.NEWS_SEO_URL, c.NEWS_URL, c.NEWS_IMAGE3, c.NEWS_PRICE1, c.NEWS_PRICE2, c.NEWS_FIELD3 }).Distinct().OrderByDescending(n => n.ORDER_ID).Take(limit).ToList(); foreach (var i in list) { Pro_details_entity pro = new Pro_details_entity(); pro.NEWS_ID = i.NEWS_ID; pro.NEWS_PRICE1 = Utils.CDecDef(i.NEWS_PRICE1); pro.NEWS_PRICE2 = Utils.CDecDef(i.NEWS_PRICE2); pro.NEWS_IMAGE3 = i.NEWS_IMAGE3; pro.NEWS_FIELD3 = i.NEWS_FIELD3; pro.NEWS_SEO_URL = i.NEWS_SEO_URL; pro.NEWS_URL = i.NEWS_URL; pro.NEWS_TITLE = i.NEWS_TITLE; l.Add(pro); } return l; }
public Category[] GetAllCategories() { List<Category> myCategories = new List<Category>(); SqlConnection myConn = new SqlConnection(connstring); myConn.Open(); SqlCommand mySqlCommand = new SqlCommand("select * from Category", myConn); SqlDataReader reader = mySqlCommand.ExecuteReader(); while (reader.Read()) { Category myCategory = new Category(); object id = reader["Id"]; if (id != null) { int categoryId = -1; if (!int.TryParse(id.ToString(), out categoryId)) { throw new Exception("Failed to parse Id of video."); } myCategory.Id = categoryId; } myCategory.Name = reader["Name"].ToString(); myCategories.Add(myCategory); } myConn.Close(); return myCategories.ToArray(); }
public void Filter_Get_Category(int iDisplayLength, int iDisplayStart, int iSortCol_0, string sSortDir_0, string sSearch) { int filteredCount = 0; List<Category> CategorysList = new List<Category>(); DataTable dt = Category_DA.Filter_Get_Category(iDisplayLength, iDisplayStart, iSortCol_0, sSortDir_0, sSearch); foreach (DataRow row in dt.Rows) { int Id = int.Parse(row["Id"].ToString()); string Name = row["Name"].ToString(); bool IsDeleted = Convert.ToBoolean(row["IsDeleted"].ToString()); filteredCount = int.Parse(row["TotalCount"].ToString()); CategorysList.Add(new Category { Name = Name, ForEdit = Id, ForDelete = Id }); } var result = new { iTotalRecords = GetTotalCategoryCount(), iTotalDisplayRecords = filteredCount, aaData = CategorysList }; JavaScriptSerializer js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(result)); }