/// <summary> 激活/作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void UCPurchasePlanOrderView_InvalidOrActivationEvent(object sender, EventArgs e) { string strmsg = string.Empty; List<SysSQLString> listSql = new List<SysSQLString>(); SysSQLString sysStringSql = new SysSQLString(); sysStringSql.cmdType = CommandType.Text; Dictionary<string, string> dic = new Dictionary<string, string>();//参数 dic.Add("purchase_order_yt_id", purchase_order_yt_id);//单据ID dic.Add("update_by", GlobalStaticObj.UserID);//修改人Id dic.Add("update_name", GlobalStaticObj.UserName);//修改人姓名 dic.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());//修改时间 if (orderstatus != Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { strmsg = "作废"; dic.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString());//单据状态编号 dic.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.Invalid, true));//单据状态名称 } else { strmsg = "激活"; string order_status = string.Empty; string order_status_name = string.Empty; DataTable dvt = DBHelper.GetTable("获得宇通采购订单的前一个状态", "tb_parts_purchase_order_2_BackUp", "order_status,order_status_name", "purchase_order_yt_id='" + purchase_order_yt_id + "'", "", "order by update_time desc"); if (dvt != null && dvt.Rows.Count > 0) { DataRow dr = dvt.Rows[0]; order_status = CommonCtrl.IsNullToString(dr["order_status"]); if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { DataRow dr1 = dvt.Rows[1]; order_status = CommonCtrl.IsNullToString(dr1["order_status"]); order_status_name = CommonCtrl.IsNullToString(dr1["order_status_name"]); } } order_status = !string.IsNullOrEmpty(order_status) ? order_status : Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString(); if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true); } else if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true); } dic.Add("order_status", order_status);//单据状态 dic.Add("order_status_name", order_status_name);//单据状态名称 } sysStringSql.sqlString = "update tb_parts_purchase_order_2 set order_status=@order_status,order_status_name=@order_status_name,update_by=@update_by,update_name=@update_name,update_time=@update_time where purchase_order_yt_id=@purchase_order_yt_id"; sysStringSql.Param = dic; listSql.Add(sysStringSql); if (MessageBoxEx.Show("确认要" + strmsg + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } if (DBHelper.BatchExeSQLStringMultiByTrans("更新单据状态为" + strmsg + "", listSql)) { MessageBoxEx.Show("" + strmsg + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); uc.BindgvYTPurchaseOrderList(); deleteMenuByTag(this.Tag.ToString(), uc.Name); } else { MessageBoxEx.Show("" + strmsg + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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 FolderInfo() { dicVectorFile = new Dictionary<string, string>(); UploadResult = new StringBuilder(); WaitUploadFilesCount = 0; SucessfulUploadFilesCount = 0; }
private static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: Importer [directory to process]"); return; } string directory = args[0]; if (!Directory.Exists(directory)) { Console.WriteLine("{0} does not exists", directory); return; } Dictionary<Guid, Post> posts = new Dictionary<Guid, Post>(); IDictionary<string, Category> categories = new Dictionary<string, Category>(); List<Comment> comments = new List<Comment>(); AddPosts(categories, directory, posts); foreach (string file in Directory.GetFiles(directory, "*feedback*.xml")) { IList<Comment> day_comments = ProcessComments(file, posts); comments.AddRange(day_comments); } Console.WriteLine("Found {0} posts in {1} categories with {2} comments", posts.Count, categories.Count, comments.Count); SaveToDatabase(categories, posts.Values, comments); }
public static Dictionary<int, List<Visit>> GetVisitData(string path) { Dictionary<int, List<Visit>> data = new Dictionary<int, List<Visit>>(); Random r = new Random(); foreach (string row in File.ReadLines(path)) { string[] split = row.Split(','); if (split.Length > 0) { int id = int.Parse(split[0]); Visit visit = new Visit(id, r.Next(1, 10), int.Parse(split[2]), DateTime.Parse(split[1])); if (data.ContainsKey(id)) { data[id].Add(visit); } else { data.Add(id, new List<Visit>(){visit}); } } } return data; }
private void Load() { this.UiTypes = new Dictionary<UIType, IUIFactory>(); Assembly[] assemblies = Game.EntityEventManager.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type[] types = assembly.GetTypes(); foreach (Type type in types) { object[] attrs = type.GetCustomAttributes(typeof(UIFactoryAttribute), false); if (attrs.Length == 0) { continue; } UIFactoryAttribute attribute = attrs[0] as UIFactoryAttribute; if (this.UiTypes.ContainsKey(attribute.Type)) { throw new GameException($"已经存在同类UI Factory: {attribute.Type}"); } IUIFactory iIuiFactory = Activator.CreateInstance(type) as IUIFactory; if (iIuiFactory == null) { throw new GameException("UI Factory没有继承IUIFactory"); } this.UiTypes.Add(attribute.Type, iIuiFactory); } } }
/// <summary> /// 查询主表 /// </summary> public JsonResult QueryMain(string OrderNoOrGoodsCode, DateTime CheckTimeS, DateTime CheckTimeE) { int page = int.Parse(Request["page"].ToString()); int rows = int.Parse(Request["rows"].ToString()); int total = 0; VenderUser model = (VenderUser)Session["UserInfo"]; string where = " rt.flag in(20 ,40,90,100) ";//and rt.venderid=" + model.VENDERID; //管理员测试数据放开 if (model.VUSERCODE != "system") { where += " and rt.venderid=" + model.VENDERID; } if (!string.IsNullOrEmpty(OrderNoOrGoodsCode)) { where += " and rt.sheetid='" + OrderNoOrGoodsCode + "'"; } if (CheckTimeS != null) { where += " and rt.EditDate> to_date('" + CheckTimeS + "','yyyy-mm-dd hh24:mi:ss')"; } if (CheckTimeE != null) { where += " and rt.EditDate< to_date('" + CheckTimeE + "','yyyy-mm-dd hh24:mi:ss')"; } BPurchaseOut ogc = new BPurchaseOut(); var result = ogc.GetPurchaseInMain(page, rows, out total, where); Dictionary<string, object> json = new Dictionary<string, object>(); json.Add("total", total); json.Add("rows", result); return Json(json, JsonRequestBehavior.AllowGet); }
public async Task<Photoset> GetCoverPhotoAsync(User user, Preferences preferences, bool onlyPrivate) { var extraParams = new Dictionary<string, string> { { ParameterNames.UserId, user.UserNsId }, { ParameterNames.SafeSearch, preferences.SafetyLevel }, { ParameterNames.PerPage, "1" }, { ParameterNames.Page, "1" }, { ParameterNames.PrivacyFilter, onlyPrivate ? "5" : "1" // magic numbers: https://www.flickr.com/services/api/flickr.people.getPhotos.html } }; var photosetsResponseDictionary = (Dictionary<string, object>) await this._oAuthManager.MakeAuthenticatedRequestAsync(Methods.PeopleGetPhotos, extraParams); var photo = photosetsResponseDictionary.GetPhotosResponseFromDictionary(false).Photos.FirstOrDefault(); return photo != null ? new Photoset(null, null, null, null, 0, 0, 0, onlyPrivate ? "All Photos" : "All Public Photos", "", onlyPrivate ? PhotosetType.All : PhotosetType.Public, photo.SmallSquare75X75Url) : null; }
public async Task<PhotosResponse> GetPhotosAsync(Photoset photoset, User user, Preferences preferences, int page, IProgress<ProgressUpdate> progress) { var progressUpdate = new ProgressUpdate { OperationText = "Getting list of photos...", ShowPercent = false }; progress.Report(progressUpdate); var methodName = GetPhotosetMethodName(photoset.Type); var extraParams = new Dictionary<string, string> { { ParameterNames.UserId, user.UserNsId }, { ParameterNames.SafeSearch, preferences.SafetyLevel }, { ParameterNames.PerPage, preferences.PhotosPerPage.ToString(CultureInfo.InvariantCulture) }, { ParameterNames.Page, page.ToString(CultureInfo.InvariantCulture) } }; var isAlbum = photoset.Type == PhotosetType.Album; if (isAlbum) { extraParams.Add(ParameterNames.PhotosetId, photoset.Id); } var photosResponse = (Dictionary<string, object>) await this._oAuthManager.MakeAuthenticatedRequestAsync(methodName, extraParams); return photosResponse.GetPhotosResponseFromDictionary(isAlbum); }
public int AddDictionary(Dictionary model) { string cmdText = @" DECLARE @NEWID INT INSERT INTO [Dictionary] (Cname,ParentId,IsChild,Remarks) values (@Cname,@ParentId,@IsChild,@Remarks) SET @NEWID=@@IDENTITY SELECT @NEWID"; SqlParameter[] parameters = { SqlParamHelper.MakeInParam("@Cname",SqlDbType.VarChar,100,model.Cname), SqlParamHelper.MakeInParam("@ParentId",SqlDbType.Int,4,model.ParentId), SqlParamHelper.MakeInParam("@IsChild",SqlDbType.Bit,1,model.IsChild), SqlParamHelper.MakeInParam("@Remarks",SqlDbType.VarChar,120,model.Remarks) }; int id = 0; using (IDataReader dataReader = SqlHelper.ExecuteReader(WriteConnectionString,CommandType.Text,cmdText,parameters)){ if(dataReader.Read()){ object obj = dataReader[0]; if(obj != null && obj != DBNull.Value){ id = Convert.ToInt32(obj); } } } return id; }
private void Init() { seriesNameMapping = this.config.getSeriesNameMap(); seriesIgnore = this.config.getIgnoredSeries(); this.language = SetLanguage(); this.IntializeRegexMappings(); }
public static List<Movie> GetRecommendations(List<Movie> all, Dictionary<int, int> newRanks, List<Tuple<int, int, float>> oldRanks) { int newUserId = 0; Ratings ratings = new Ratings(); foreach (var r in oldRanks) { ratings.Add(r.Item1, r.Item2, r.Item3); if (r.Item1 > newUserId) newUserId = r.Item1; } // this makes us sure that the new user has a unique id (bigger than all other) newUserId = newUserId + 1; foreach (var k in newRanks) { ratings.Add(newUserId, k.Key, (float)k.Value); } var engine = new BiPolarSlopeOne(); // different algorithm: // var engine = new UserItemBaseline(); engine.Ratings = ratings; engine.Train(); // warning: this could take some time! return all.Select(m => { m.Rank = engine.Predict(newUserId, m.Id); // do the prediction! return m; }).ToList(); }
public IAnswer AskAnswer(IQuestion question) { var j = 0; var choices = new Dictionary<char,IChoice>(); question.Choices.ForEach(c => choices.Add((char)('a' + j++), c)); var answerChar = '\0'; do { Console.Clear(); Console.WriteLine("Question: {0}", question.QuestionString); foreach (var choice in choices) { Console.WriteLine("{0}. {1}", choice.Key, choice.Value.ChoiceText); } Console.Write("\nAnswer: "); var readLine = Console.ReadLine(); if (readLine == null) continue; if (new[] { "back", "b", "oops", "p", "prev" }.Contains(readLine.ToLower())) { return question.CreateAnswer(Choice.PREVIOUS_ANSWER); } answerChar = readLine[0]; } while (!choices.ContainsKey(answerChar)); return question.CreateAnswer(choices[answerChar]); }
public static Dictionary<SiteType, IEnumerable<string>> GetIPSiteTypeDictionary() { Dictionary<SiteType, IEnumerable<string>> dic = new Dictionary<SiteType, IEnumerable<string>>(); List<string> tpolist = new List<string>(); List<string> weclist = new List<string>(); List<string> cdwlist = new List<string>(); foreach (EnvironmentSettings a in EnvironmentConfigSection.EnvironmentSettingCollection) { if (!string.IsNullOrEmpty(a.TPO)) { tpolist.Add(a.TPO); } if (!string.IsNullOrEmpty(a.WebCenter)) { weclist.Add(a.WebCenter); } if (!string.IsNullOrEmpty(a.ConsumerDirect)) { cdwlist.Add(a.ConsumerDirect); } } dic.Add(SiteType.TPO, tpolist); dic.Add(SiteType.WBC, weclist); dic.Add(SiteType.CDW, cdwlist); return dic; }
public CreatedAtRouteNegotiatedContentResult<IEnumerable<Figure>> GetCreatedAtRouteNegotiatedContentResult() { IDictionary<string, object> route = new Dictionary<string, object>(); route["controller"] = "Figure"; route["action"] = "GetAll"; return new CreatedAtRouteNegotiatedContentResult<IEnumerable<Figure>>("DefaultApi", route, FigureManager.Figures, this); }
public async Task<PhotosetsResponse> GetPhotosetsAsync(string methodName, User user, Preferences preferences, int page, IProgress<ProgressUpdate> progress) { var progressUpdate = new ProgressUpdate { OperationText = "Getting list of albums...", ShowPercent = false }; progress.Report(progressUpdate); var extraParams = new Dictionary<string, string> { { ParameterNames.UserId, user.UserNsId }, { ParameterNames.SafeSearch, preferences.SafetyLevel }, { ParameterNames.PerPage, "21" }, { ParameterNames.Page, page.ToString(CultureInfo.InvariantCulture) } }; var photosetsResponseDictionary = (Dictionary<string, object>) await this._oAuthManager.MakeAuthenticatedRequestAsync(methodName, extraParams); return photosetsResponseDictionary.GetPhotosetsResponseFromDictionary(); }
public HomeModule() { int pagesize = 5; Dictionary<string, object> dic = new Dictionary<string, object>(); Get["/"] = P => { dic["ip"] = CommonHelper.GetIPAddress(Request.UserHostAddress); dic["nav"]= CreatNavHtml(1, pagesize); IEnumerable<Weblog> list = WeBlogService.GetPageWeblog(1, pagesize); dic["data"] = list; return View["Home", dic]; }; Get["/page_{pageindex}"] = p => { IEnumerable<Weblog> list = WeBlogService.GetPageWeblog(p.pageindex, pagesize); dic["ip"] = CommonHelper.GetIPAddress(Request.UserHostAddress); dic["data"] = list; dic["nav"] = CreatNavHtml(p.pageindex, pagesize); return View["Home", dic]; }; Get["/Error"] = p => { return View["Error"]; }; }
public async Task<User> PopulateUserInfo(User user) { var exraParams = new Dictionary<string, string> { { ParameterNames.UserId, user.UserNsId } }; dynamic userWithUserInfo = await this._oAuthManager.MakeAuthenticatedRequestAsync(Methods.PeopleGetInfo, exraParams); var userInfo = (Dictionary<string, object>) userWithUserInfo["person"]; user.Info = new UserInfo { Id = user.UserNsId, IsPro = Convert.ToBoolean(userInfo["ispro"]), IconServer = userInfo["iconserver"].ToString(), IconFarm = int.Parse(userInfo["iconfarm"].ToString()), PathAlias = userInfo["path_alias"] == null ? string.Empty : userInfo["path_alias"].ToString(), Description = userInfo.GetSubValue("description").ToString(), PhotosUrl = userInfo.GetSubValue("photosurl").ToString(), ProfileUrl = userInfo.GetSubValue("profileurl").ToString(), MobileUrl = userInfo.GetSubValue("mobileurl").ToString(), PhotosCount = int.Parse(((Dictionary<string, object>) userInfo["photos"]).GetSubValue("count").ToString()) }; return user; }
public void SetInfo(Dictionary<string, string> SystemInfo) { foreach (KeyValuePair<string, string> pair in SystemInfo) { properties.Info.Add(pair.Key, pair.Value); } }
public static void Init(int capacity) { for (int i = 0; i < capacity; i++) { Dictionary<string, IssueRecEntity> item = new Dictionary<string, IssueRecEntity>(); recEntity.Add(item); } }
// sets parameters for insert/update private Dictionary<string, object> SetParams(Roles department) { Dictionary<string, object> result = new Dictionary<string, object>(); result.Add("@departmentName", department.Name); return result; }
public Enricher(IConfiguration configuration, TvdbLibAccess tvdbLibAccess, List<IEpisodeMatchMethod> matchMethods) { this.config = configuration; this.enrichedPrograms = new List<GuideEnricherProgram>(); this.tvdbLibAccess = tvdbLibAccess; this.matchMethods = matchMethods; this.seriesToEnrich = new Dictionary<string, GuideEnricherSeries>(); }
public Dictionary<string, string> ToDictionary() { Dictionary<string, string> dict = new Dictionary<string, string>(); dict.Add("LayerThickness", layer_thickness.ToString()); dict.Add("LayerMaterialName", layer_material_name); dict.Add("LayerMaterialType", layer_material_type); return dict; }
public CreatedNegotiatedContentResult<IEnumerable<Figure>> GetCreatedNegotiatedContentResult() { UrlHelper helper = new UrlHelper(Request); IDictionary<string, object> route = new Dictionary<string, object>(); route["controller"] = "Figure"; route["action"] = "GetAll"; return new CreatedNegotiatedContentResult<IEnumerable<Figure>>(new Uri(helper.Link("DefaultApi", route)), FigureManager.Figures, this); }
public static string _host = ".kerlaii.com";//从数据库动态获取 public void OnActionExecuting(ActionExecutingContext filterContext) { bool isajax = filterContext.HttpContext.Request.IsAjaxRequest(); UserPC user = filterContext.HttpContext.Session["user"] as UserPC; string host = filterContext.HttpContext.Request.Url.Host; string key = host.Replace(_host, ""); //本地调试,模拟e0001企业 opera if (host.ToLower() == "localhost") { key = "e0001"; } EnterpriseBll bll = new EnterpriseBll(); string[] keys = bll.GetAllEnteriseKey(); if (key !="opera" && !keys.Contains(key)) { filterContext.Result = new HttpNotFoundResult(); return; //没有该企业 } filterContext.HttpContext.Session["enterpriseKey"] = key; if (check) { if (user == null) { ReturnData<string> ret = new ReturnData<string>(); if (isajax) { ret.Status = false; Dictionary<string, object> Identify = new Dictionary<string, object>(); Identify.Add("expired", true); ret.Identify = Identify; filterContext.Result = new ContentResult() { Content = ret.GetJson() }; return; } //跳转页面 filterContext.Result = new ContentResult() { Content = "<script>window.top.location.href ='/';</script>" }; return ; } LogAdapter.Write(user.UserBasic.EnterpriseID+" "+key, LogAdapter.LogMode.ERROR); //当前用户不是当前企业 if (user.UserBasic.EnterpriseID != key) { filterContext.HttpContext.Response.Redirect("/Login"); } } }
public CompanyDetailViewModel(Company company) { this.ID = company.ID; this.Name = company.Name; this.Market = company.Market; this.Mail = company.Mail; this.Logo = company.Logo; competitors = new Dictionary<int, string>(); }
public static void AddWorkerRoleToDef(string path, Dictionary<string, object> parameters) { RoleInfo role = parameters["Role"] as RoleInfo; ServiceComponents components = parameters["Components"] as ServiceComponents; ServicePathInfo paths = parameters["Paths"] as ServicePathInfo; WorkerRole workerRole = General.DeserializeXmlFile<ServiceDefinition>(path).WorkerRole[0]; role.AddRoleToDefinition(components.Definition, workerRole); components.Save(paths); }
public Dictionary<string, ChannelAliasModel> GetAliasList() { var res = new Dictionary<string, ChannelAliasModel>(); foreach (var item in ItemList) { var temp = item.GetAlias(); res.Add(temp.ChannelName, temp); } return res; }
public static void AddRoleToConfig(string path, Dictionary<string, object> parameters) { RoleInfo role = parameters["Role"] as RoleInfo; ServiceComponents components = parameters["Components"] as ServiceComponents; ServicePathInfo paths = parameters["Paths"] as ServicePathInfo; RoleSettings settings = General.DeserializeXmlFile<ServiceConfiguration>(path).Role[0]; components.AddRoleToConfiguration(settings, DevEnv.Cloud); components.AddRoleToConfiguration(settings, DevEnv.Local); components.Save(paths); }
public void Process(DirectoryInfo directory, ref Dictionary<string, package> packages) { foreach (var fileToProcess in directory.GetFiles("*.nuspec", SearchOption.AllDirectories)) { var p = new package(); new FileProcessor().Process(fileToProcess, ref p); packages.Add(fileToProcess.DirectoryName, p); } new PackageListProcessor().Process(packages); }