public void DealVoipAuidoFrame(IntPtr ip, uint dwContextEnc) { FrameHeadrDec pFrmHdrDec = (FrameHeadrDec)Marshal.PtrToStructure(ip, typeof(FrameHeadrDec)); if (pFrmHdrDec.data == IntPtr.Zero) { return; } PLAYFRAMEHDR hdr = new PLAYFRAMEHDR { m_byMediaType = pFrmHdrDec.mediaType, m_dwDataSize = pFrmHdrDec.data_size, m_byFrameRate = 0, m_dwFrameID = 0, m_dwTimeStamp = pFrmHdrDec.m_dwTimeStamp, union1 = new Anonymous_3d5d69df_3122_4137_83f1_a9b198afad7b { m_tAudioParam = new Anonymous_0584d86c_3910_4038_bad0_69ed09db9a8d { m_byAudioMode = pFrmHdrDec.audio_mode, } } }; int Temp_int = Marshal.SizeOf(hdr); byte[] pD = new byte[pFrmHdrDec.data_size]; Marshal.Copy(pFrmHdrDec.data, pD, 0, (int)pFrmHdrDec.data_size); byte[] pl = PubMethod.StructToBytes(hdr); byte[] bytes = pl.Concat(pD).ToArray(); uint len = Convert.ToUInt32(pFrmHdrDec.data_size + 40); bool bol = SDK_TLi.TLPlay_InputAudioData(m_hPlayPort, ref bytes[0], len); }
private void StopwatchEnabledEnd(ActionExecutedContext filterContext) { object value; if (filterContext.RouteData.Values.TryGetValue("Stopwatch", out value)) { System.Diagnostics.Stopwatch watch = value as System.Diagnostics.Stopwatch; if (watch != null && watch.IsRunning) { watch.Stop(); if (watch.ElapsedMilliseconds >= this.traceMilliseconds) { filterContext.HttpContext.Request.InputStream.Position = 0; var formdata = new System.IO.StreamReader(filterContext.HttpContext.Request.InputStream).ReadToEnd(); //string formdata = JsonModelHelper.ObjectJson(filterContext.HttpContext.Request.Form.AllKeys.Select(v => new { Key = v, Value = filterContext.HttpContext.Request.Form[v] })); string controller = filterContext.RouteData.Values["controller"].ToString().ToLower(); string action = filterContext.RouteData.Values["action"].ToString().ToLower(); string requestip = PubMethod.GetRequestIP(filterContext.HttpContext.Request); dbpt_logger.Info(new Ptlogs() { ServIp = ConfigManager.LocalIp, Controller = controller, Action = action, QueryUrl = filterContext.HttpContext.Request.Url.PathAndQuery.ToLower(), FromData = JsonConvert.SerializeObject(formdata), UserId = filterContext.HttpContext.User.Identity.Name, RequestIp = requestip, RunMilliseconds = watch.ElapsedMilliseconds }); } } } }
private static IRestResponse <T> GetApiInfo(string url, object pars, Method type) { var request = new RestRequest(type); if (pars != null) { request.AddObject(pars); } var cm = CacheManager <UserInfo> .GetInstance(); string uniqueKey = PubGet.GetUserKey; if (cm.ContainsKey(uniqueKey)) { request.AddCookie(PubConst.UserUniqueKey, CookiesManager <string> .GetInstance()[PubConst.UserUniqueKey]); } var client = new RestClient(RequestInfo.HttpDomain + url); client.CookieContainer = new System.Net.CookieContainer(); IRestResponse <T> reval = client.Execute <T>(request); if (reval.ErrorException != null) { PubMethod.WirteExp(new Exception(reval.Content)); throw new Exception("请求出错"); } return(reval); }
private void Bind() { string pageNav = ""; string sql = @"select flowID, billCode,billName,isnull((select '['+usercode+']'+userName from bill_users where usercode=bill_main.billUser),billUser) as billuser,isnull((select '['+deptCode+']'+deptName from bill_departments where deptcode=bill_main.billDept),billDept) as billDept,bill_main.billDept as deptCode,(select '['+usercode+']'+username from bill_users where usercode=billuser) as billUserName,convert(varchar(10),billDate,121) as billDate,billje ,Row_Number()over(order by billCode desc,billdate desc) as crow, b.travelDate,b.arrdess,b.reasion,b.needAmount,b.travelplan from bill_main ,(select distinct arrdess,reasion,travelDate,needamount,travelplan,maincode from bill_travelApplication) b where billCode=mainCode and billUser='******' and flowID='ccsq'"; int year = System.DateTime.Now.Year; int month = System.DateTime.Now.Month; DateTime end = System.DateTime.Now; DateTime beg = Convert.ToDateTime(year + "-" + month + "-01"); if (ddlTime.SelectedValue == "2") { beg = beg.AddMonths(-1); end = beg; } else if (ddlTime.SelectedValue == "3") { beg = beg.AddMonths(-2); } if (ddlTime.SelectedValue != "4") { sql += " and billDate >='" + beg.ToString("yyyy-MM-dd") + "' and billDate <='" + end.ToString("yyyy-MM-dd") + "'"; } //时间区间 string strDateType = ddlTime.SelectedValue.Trim(); string strURL = string.Format("travelApplyList.aspx?tp={0}", strDateType); DataTable dt = PubMethod.GetPageData(sql, strURL, out pageNav); Repeater1.DataSource = dt; Repeater1.DataBind(); lbPageNav.InnerHtml = pageNav; }
private void Bind() { string pageNav = ""; string sql = @"select flowID, billCode,isnull((select '['+usercode+']'+userName from bill_users where usercode=bill_main.billUser),billUser) as billuser,(select zynr from bill_lscg where cgbh=bill_main.billCode) as zynr,isnull((select '['+deptCode+']'+deptName from bill_departments where deptcode=bill_main.billDept),billDept) as billDept,bill_main.billDept as deptCode,(select '['+usercode+']'+username from bill_users where usercode=billuser) as billUserName,convert(varchar(10),billDate,121) as billDate,billje ,Row_Number()over(order by billCode desc,billdate desc) as crow from bill_main where (billUser='******' or billCode in (select cgbh from bill_lscg where cbr='" + Session["userCode"].ToString() + "')) and flowID='lscg'"; int year = System.DateTime.Now.Year; int month = System.DateTime.Now.Month; DateTime end = System.DateTime.Now; DateTime beg = Convert.ToDateTime(year + "-" + month + "-01"); if (ddlTime.SelectedValue == "2") { beg = beg.AddMonths(-1); end = beg; } else if (ddlTime.SelectedValue == "3") { beg = beg.AddMonths(-2); } if (ddlTime.SelectedValue != "4") { sql += " and billDate >='" + beg.ToString("yyyy-MM-dd") + "' and billDate <='" + end.ToString("yyyy-MM-dd") + "'"; } //时间区间 string strDateType = ddlTime.SelectedValue.Trim(); string strURL = string.Format("bgsqList.aspx?tp={0}", strDateType); DataTable dt = PubMethod.GetPageData(sql, strURL, out pageNav); Repeater1.DataSource = dt; Repeater1.DataBind(); lbPageNav.InnerHtml = pageNav; }
public void UnixTimestampToDateTimeTest() { long l = 1565262086911; DateTime timReult = PubMethod.UnixMillisecondsTimestampToDateTime(l); Assert.Fail(timReult.ToString(), "1"); }
public JsonResult RepliesSubmit(int tid, string content, int fid) { ResultModel <string> model = new ResultModel <string>(); _service.Command <MainOutsourcing>((db, o) => { model.IsSuccess = false; if (base.IsLogin.IsFalse()) { model.ResultInfo = "-1"; } else { db.BeginTran(); try { var prePost = db.Queryable <BBS_Posts>().OrderBy(it => it.Postdatetime, OrderByType.Desc).FirstOrDefault(it => it.Posterid == _userInfo.Id); if (prePost != null && (DateTime.Now - prePost.Postdatetime.TryToDate()).Seconds <= 6) { model.ResultInfo = "你回复的太快了,请在等" + (5 - (DateTime.Now - prePost.Postdatetime.TryToDate()).Seconds) + "秒!"; } else { BBS_Posts p = new BBS_Posts(); p.Title = ""; p.Parentid = tid; p.Message = content; p.Fid = fid; p.Tid = tid; p.Posterid = base._userInfo.Id; p.Poster = base._userInfo.NickName; p.Lastedit = base._userInfo.NickName; p.Postdatetime = DateTime.Now; p.Ip = RequestInfo.UserAddress; db.Insert(p); db.Update <BBS_Topics>(" Replies=isnull([Replies],0)+1,Lastpost=@lp,Lastposter=@Lastposter,Lastposterid=@Lastposterid", it => it.Tid == tid, new { lp = DateTime.Now, Lastposter = _userInfo.NickName, Lastposterid = _userInfo.Id });//回复数加1 model.IsSuccess = true; base.RemoveForumsStatisticsCache(); db.CommitTran(); //发送邮箱提醒 o.SendMail(base._userInfo, tid, p, db); //发送站内信 o.SendPMS(base._userInfo, tid, p, db); } } catch (Exception ex) { model.ResultInfo = "回复失败!"; PubMethod.WirteExp(ex); db.RollbackTran(); } } }); return(Json(model)); }
public JsonResult RegisterSubmit(UserInfo user, string vercode, string confirmPassword, string returnUrl) { string oldPassword = user.Password; var model = new ResultModel <string>(); _service.Command <HomeOutsourcing>((db, o) => { ExpCheck.Exception(user.UserName.IsNullOrEmpty() || user.Password.IsNullOrEmpty(), "用户名和密码不能为空!"); ExpCheck.Exception(user.UserName.IsEamil().IsFalse(), "不是有效邮箱!"); ExpCheck.Exception(user.NickName.IsNullOrEmpty(), "妮称不能为空!"); ExpCheck.Exception(user.Password != confirmPassword, "两次密码不一致!"); user.Password = new EncryptSugar().MD5(user.Password); var sm = SessionManager <string> .GetInstance(); var severCode = sm[PubConst.SessionVerifyCode]; try { if (oldPassword.Length < 6 || oldPassword.Length > 16) { model.IsSuccess = false; model.ResultInfo = "密码长度为6-16个字符"; } else if (severCode != vercode) { model.IsSuccess = false; model.ResultInfo = "验证码不正确!"; } else { var isAny = db.Queryable <UserInfo>().Any(it => it.UserName == user.UserName); if (isAny) { model.IsSuccess = false; model.ResultInfo = "邮箱已经被注册!"; } else { user.RoleId = PubEnum.RoleType.User.TryToInt(); user.CreateTime = DateTime.Now; var id = db.Insert(user).ObjToInt(); var loginUser = db.Queryable <UserInfo>().InSingle(id); var cm = CacheManager <UserInfo> .GetInstance(); string uniqueKey = PubGet.GetUserKey; cm.Add(uniqueKey, loginUser, cm.Day * 365);//保存一年 model.IsSuccess = true; model.ResultInfo = returnUrl; RemoveNewUserListCache(); } } } catch (Exception ex) { PubMethod.WirteExp(ex); model.IsSuccess = false; model.ResultInfo = "用户注册失败,请联系我们!"; } }); return(Json(model)); }
/// <summary> /// 发送邮件通知 /// </summary> /// <param name="isLogin"></param> /// <param name="_userInfo"></param> /// <param name="tid"></param> /// <param name="p"></param> /// <param name="db"></param> internal void SendMail(UserInfo currentUser, int tid, BBS_Posts p, SqlSugarClient db) { //未配置邮箱不发送 if (PubGet.GetEmailUserName.IsNullOrEmpty()) { return; } var topic = db.Queryable <BBS_Topics>().Single(it => it.Tid == tid); var isOneUser = currentUser.Id == topic.Posterid; var html = FileSugar.FileToString(FileSugar.GetMapPath("~/Template/mail/Replies.html")).Replace('\r', ' ').Replace('\n', ' '); var oldHtml = html; //发贴和回贴不是同一个人 if (isOneUser.IsFalse()) { var toUser = db.Queryable <UserInfo>().Single(it => it.Id == topic.Posterid); if (toUser.Email.IsEamil()) { string toUserName = toUser.NickName; string fromUserName = currentUser.NickName; string toMail = toUser.Email; MailSmtp ms = new MailSmtp(PubGet.GetEmailSmtp, PubGet.GetEmailUserName, PubGet.GetEmailPassword); string url = RequestInfo.HttpDomain + "/Ask/{0}/{1}#btnSubmit".ToFormat(topic.Fid, topic.Tid); html = html.ToFormat(toUserName, fromUserName, topic.Title, DateTime.Now, url); var title = PubMethod.RemoveAllSpace(fromUserName + "回复了:" + StringSugar.ToCutString(topic.Title, 10, "...")); ms.Send(PubGet.GetEmailUserName, PubConst.SiteMailUserName, toMail, title, html); System.Threading.Thread.Sleep(100); } } html = oldHtml; //处理@ if (p.Message.IsValuable() && p.Message.Contains("@")) { var adUserIds = db.Queryable <BBS_Posts>().Where(it => it.Tid == tid && it.Parentid > 0).Select(it => it.Posterid).ToList(); var adUsers = db.Queryable <UserInfo>().In(adUserIds).ToList(); var matchUsers = Regex.Matches(p.Message, @"\<span style\=""color:#4f99cf""\>@(.+?)\<\/span\>"); if (matchUsers != null && matchUsers.Count > 0) { var userNames = matchUsers.Cast <Match>().Select(it => it.Groups[1].Value).ToList(); adUsers = adUsers.Where(it => userNames.Contains(it.NickName)).ToList(); foreach (var item in adUsers) { if (item.Email.IsValuable() && item.Id != currentUser.Id) { string toUserName = item.NickName; string fromUserName = currentUser.NickName; string toMail = item.Email; MailSmtp ms = new MailSmtp(PubGet.GetEmailSmtp, PubGet.GetEmailUserName, PubGet.GetEmailPassword); string url = RequestInfo.HttpDomain + "/Ask/{0}/{1}#btnSubmit".ToFormat(topic.Fid, topic.Tid); html = html.ToFormat(toUserName, fromUserName, p.Message, DateTime.Now, url); var title = PubMethod.RemoveAllSpace(fromUserName + "在【" + topic.Title.TryToString().Trim() + "】@了你"); ms.Send(PubGet.GetEmailUserName, PubConst.SiteMailUserName, toMail, title, html); System.Threading.Thread.Sleep(100); } } } } }
public JsonResult AskSubmit(short fid, string title, string content, string vercode, int rate = 0, int id = 0) { ResultModel <string> model = new ResultModel <string>(); _service.Command <MainOutsourcing>((db, o) => { Check.Exception(fid == 0 || title.IsNullOrEmpty() || content.IsNullOrEmpty() || vercode.IsNullOrEmpty(), "参数不合法!"); Check.Exception(title.Length < 5 && content.Length < 20 || content.Length > 1000000, "参数不合法!"); Check.Exception(base.GetForumsList != null && base.GetForumsList.Any(it => it.Fid == fid).IsFalse(), "参数不合法!"); var sm = SessionManager <string> .GetInstance(); var severCode = sm[PubConst.SessionVerifyCode]; model.IsSuccess = false; if (vercode != severCode) { model.ResultInfo = "验证码错误!"; } else if (IsLogin.IsFalse()) { model.ResultInfo = "对不起您还没有登录!"; } else { try { db.BeginTran(); var isAdd = id == 0; if (isAdd) { //插贴子标题 BBS_Topics t = o.GetTopics(fid, title, rate, _userInfo); var tid = db.Insert(t).ObjToInt(); t.Tid = tid; //插贴子主体 BBS_Posts p = o.GetPosts(fid, content, _userInfo, t); db.Insert(p); } else { var topics = db.Queryable <BBS_Topics>().InSingle(id); Check.Exception(topics.Posterid != _userInfo.Id && _userInfo.RoleId == PubEnum.RoleType.User.TryToInt(), "您没有权限修改!"); db.Update <BBS_Topics>(new { Title = title, Rate = rate, Fid = fid }, it => it.Tid == id); db.Update <BBS_Posts>(new { Title = title, Rate = rate, Fid = fid, Message = content }, it => it.Tid == id && it.Parentid == 0); } db.CommitTran(); model.IsSuccess = true; base.RemoveForumsStatisticsCache();//清除统计缓存 } catch (Exception ex) { model.ResultInfo = "发布失败!"; db.RollbackTran(); PubMethod.WirteExp(ex); } } }); return(Json(model)); }
private void BindData() { string pageNav = ""; string sql = "select id, title, contents, writer, convert(varchar(10),date,121) as date, readTimes, mstype, notifierid,notifiername,endtime,Accessories,Row_Number()over(order by date desc) crow from bill_msg where writer='" + Session["userCode"].ToString() + "'"; DataTable dt = PubMethod.GetPageData(sql, "messageList.aspx", out pageNav); Repeater1.DataSource = dt; Repeater1.DataBind(); lbPageNav.InnerHtml = pageNav; }
public void DownloadFileTest() { CommonMethod.Common.Delay_Millisecond(1000); VideoInfo vInfo = TestDataSource.SKNVideoDatSource.GetSKData1(); string strPath = "VHS_ch09_63-00F628C55D02-1812_1565932748.h264"; PubMethod.DownloadFile(vInfo, strPath); CommonMethod.Common.Delay_Millisecond(30000); Assert.Fail(); }
private void BindData() { string pageNav = ""; string sql = GetSql(); DataTable dt = PubMethod.GetPageData(sql, "travelApplyAudit.aspx", out pageNav); Repeater1.DataSource = dt; Repeater1.DataBind(); lbPageNav.InnerHtml = pageNav; }
private void BindData() { ltrTitle.Text = GetTitleByFlowid(Request["flowid"]); string pageNav = ""; string sql = GetSql(); DataTable dt = PubMethod.GetPageData(sql, "ybbxAuditList.aspx", out pageNav); Repeater1.DataSource = dt; Repeater1.DataBind(); lbPageNav.InnerHtml = pageNav; }
private void BindData() { string pageNav = ""; string dtime = DateTime.Now.ToString("yyyy-MM-dd"); string userCode = Convert.ToString(Session["userCode"]); string username = Convert.ToString(Session["userName"]); string sql = "select Row_Number()over(order by date desc) as crow ,id,title,(select username from bill_users where usercode = writer) as writer,contents,CONVERT(varchar(100),date, 23) as date ,isnull(readtimes,0) as readtimes,mstype,endtime from bill_msg where endtime>='" + dtime + "' and (notifiername like'%" + userCode + "%' or notifiername like'%" + username + "%') and mstype='通知' or (mstype='新闻' and endtime>='" + dtime + "' )"; DataTable dt = PubMethod.GetPageData(sql, "messageGetList.aspx", out pageNav); Repeater1.DataSource = dt; Repeater1.DataBind(); lbPageNav.InnerHtml = pageNav; }
/// <summary> /// 创建删除子件BOM服务的DTO /// </summary> /// <param name="_bom"></param> /// <param name="_beBOM"></param> /// <returns></returns> private BOMMasterDTO4CreateSv DelBOMPartDTO(BOMMaster _bom, UFIDA.U9.CBO.MFG.BOM.BOMMaster _beBOM) { BOMMasterDTO4CreateSv dtoMasterDelPart = null; foreach (var beBOMPart in _beBOM.BOMComponents) { bool bCompIsExists = false; foreach (var bompart in _bom.Components) { //当传入的BOM子件中没有该物料编码,则从BOM中删除此子件 if (bompart.ItemCode == beBOMPart.ItemMaster.Code) { bCompIsExists = true; continue; } } if (!bCompIsExists) { if (dtoMasterDelPart == null) { dtoMasterDelPart = PubMethod.GetDataOfBOMMaster(_beBOM); dtoMasterDelPart.BOMComponents.Clear(); } //检索出原始BOM中存在的子件加入到需删除子件服务的dtoMasterDelPart中 UFIDA.U9.CBO.MFG.BOM.BOMComponent.EntityList elstBOMComponent = UFIDA.U9.CBO.MFG.BOM.BOMComponent.Finder.FindAll("BOMMaster=@BOMID and ItemMaster.Code=@ItemCode ", new OqlParam[] { new OqlParam(_beBOM.ID), new OqlParam(beBOMPart.ItemMaster.Code) }); if (elstBOMComponent != null && elstBOMComponent.Count > 0) { for (int i = 0; i < elstBOMComponent.Count; i++) { UFIDA.U9.CBO.MFG.BOM.BOMComponent beBOMComponent = elstBOMComponent[i]; BOMComponentDTO4CreateSv dtoComponent = PubMethod.GetDataOfBOMComponent(beBOMComponent); if (dtoMasterDelPart.BOMComponents.Contains(dtoComponent)) { continue; } else { dtoMasterDelPart.BOMComponents.Add(dtoComponent); } } } } } return(dtoMasterDelPart); }
public ActionResult CallBack(string state) { var current = OAuth2Factory.Current; if (current.openID.IsNullOrEmpty()) { return(Content("第三方登录失败!")); } _service.Command <OauthOutsourcing>((db, o) => { var pwd = new EncryptSugar().MD5(RandomSugar.GetRandomString(10)); try { var userMapping = db.Queryable <UserOAuthMapping>().SingleOrDefault(it => it.AppId == current.openID); if (userMapping == null)//注册 { db.BeginTran(); UserInfo u = o.GetUser(current, pwd); var id = db.Insert(u).ObjToInt(); UserOAuthMapping um = o.GetUserOauthMapping(current, id); db.Insert(um); db.CommitTran(); userMapping = um; RemoveNewUserListCache(); } var user = db.Queryable <UserInfo>().InSingle(userMapping.UserId); o.SaveAvatar(db, user); var cm = CacheManager <UserInfo> .GetInstance(); string uniqueKey = PubGet.GetUserKey; cm.Add(uniqueKey, user, cm.Day * 365);//保存一年 LoginHistory lh = new LoginHistory() { CreateDate = DateTime.Now, IsDeleted = false, Uid = user.Id, UniqueKey = uniqueKey }; db.Insert(lh); } catch (Exception ex) { PubMethod.WirteExp(ex); db.RollbackTran(); throw new Exception("第三方登录注册失败!" + ex.Message); } }); return(this.Redirect("~/ask")); }
public JsonResult UploadAvatar() { ResultModel <string> model = new ResultModel <string>(); if (base.IsLogin.IsFalse()) { model.ResultInfo = "您还没有登录!"; return(Json(model, JsonRequestBehavior.AllowGet)); } try { _service.Command <UserCenterOutsourcing>((db, o) => { var imgObj = new UploadImage(); var file = Request.Files[0]; if (file.ContentLength / 1024.0 / 1024.0 > 1) { model.ResultInfo = "上传图片不能超过一M!"; } else if (file.ContentType.IsIn("image/png", "image/gif", "image/jpg", "image/jpeg").IsFalse()) { model.ResultInfo = "上传失败,您的图片不是PNG GIF JPG 格式!"; } else { model.IsSuccess = true; string webPath = "/_theme/img/avatar" + _userInfo.Id + ".jpg"; string savePath = FileSugar.GetMapPath("~" + webPath); string smallPath = FileSugar.GetMapPath("~/_theme/img/_avatar" + _userInfo.Id + ".jpg"); file.SaveAs(savePath); model.ResultInfo = Url.Content("~/" + webPath) + "?r=" + Guid.NewGuid(); imgObj.CreateSmallPhoto(savePath, 100, 100, smallPath);//生成缩略图 FileSugar.DeleteFile(savePath); FileSugar.Move(smallPath, savePath); db.Update <UserInfo>(new { avatar = webPath + "?r=" + RandomSugar.GetRandomNum(5) }, it => it.Id == _userInfo.Id); RestCurrentUserCache(); } }); return(Json(model)); } catch (Exception ex) { PubMethod.WirteExp(ex); model.ResultInfo = "上传失败!"; } return(Json(model, JsonRequestBehavior.AllowGet)); }
public override void OnException(ExceptionContext filterContext) { if (filterContext.ExceptionHandled) { return; } var httpException = new HttpException(null, filterContext.Exception); if (httpException != null && httpException.GetHttpCode().Equals(500)) { filterContext.HttpContext.Response.StatusCode = (int)System.Net.HttpStatusCode.OK; //System.Net.HttpStatusCode.InternalServerError; string exid = Guid.NewGuid().ToString(); //捕获内部错误 if (filterContext.HttpContext.Request.IsAjaxRequest()) { filterContext.Result = new JsonResult() { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { Status = 0, Code = "-1", Data = exid } }; } else { filterContext.Result = new ViewResult() { ViewName = "~/Views/Shared/Error.cshtml", TempData = new TempDataDictionary() { { "exid", exid } } }; } //记录日志 string queryUrl = filterContext.HttpContext.Request.Url.PathAndQuery.ToLower(); filterContext.HttpContext.Request.InputStream.Position = 0; var formdata = new System.IO.StreamReader(filterContext.HttpContext.Request.InputStream).ReadToEnd(); //string formdata = JsonModelHelper.ObjectJson(filterContext.HttpContext.Request.Form.AllKeys.Select(v => new { Key = v, Value = filterContext.HttpContext.Request.Form[v] })); string controller = filterContext.RouteData.Values["controller"].ToString().ToLower(); string action = filterContext.RouteData.Values["action"].ToString().ToLower(); txtex_logger.Error(string.Format("请求地址{0}异常\r\n异常ID:{1}\r\nPOST参数:{2}\r\n异常信息:{3}", queryUrl, exid, formdata, filterContext.Exception)); string requestip = PubMethod.GetRequestIP(filterContext.HttpContext.Request); dbex_logger.Info(new Exlogs() { ServIp = ConfigManager.LocalIp, Controller = controller, Action = action, QueryUrl = queryUrl, FromData = formdata, ExceptionId = exid, ExceptionMsg = filterContext.Exception.Message.Length > 500 ? filterContext.Exception.Message.Substring(0, 500) : filterContext.Exception.Message, UserId = filterContext.HttpContext.User.Identity.Name, RequestIp = requestip }); } filterContext.ExceptionHandled = true; }
private void Button1_Click(object sender, EventArgs e) { //List<RemotePlaybackFileInfo> FileInfo = new List<RemotePlaybackFileInfo>(); //FileInfo.Add(new RemotePlaybackFileInfo //{ // StartTimeStamp = VideoCurrencyModule.PubMethod.DateTimeToUnixTimestamp(DateTime.Now.AddHours(-12)), // EndTimeStamp = VideoCurrencyModule.PubMethod.DateTimeToUnixTimestamp(DateTime.Now.AddHours(-11)), //}); //FileInfo.Add(new RemotePlaybackFileInfo //{ // StartTimeStamp = VideoCurrencyModule.PubMethod.DateTimeToUnixTimestamp(DateTime.Now.AddHours(-11)), // EndTimeStamp = VideoCurrencyModule.PubMethod.DateTimeToUnixTimestamp(DateTime.Now.AddHours(-10)), //}); //FileInfo.Add(new RemotePlaybackFileInfo //{ // StartTimeStamp = VideoCurrencyModule.PubMethod.DateTimeToUnixTimestamp(DateTime.Now.AddHours(-10)), // EndTimeStamp = VideoCurrencyModule.PubMethod.DateTimeToUnixTimestamp(DateTime.Now.AddHours(-4)), //}); //FileInfo.Add(new RemotePlaybackFileInfo //{ // StartTimeStamp = VideoCurrencyModule.PubMethod.DateTimeToUnixTimestamp(DateTime.Now.AddHours(-4)), // EndTimeStamp = VideoCurrencyModule.PubMethod.DateTimeToUnixTimestamp(DateTime.Now.AddHours(-1)), //}); DateTime timStart = DateTime.Now.AddDays(-1); DateTime timEnd = DateTime.Now.AddDays(1); string strPath = @"G:\Working\Currency\VideoPlayControl\VideoPlayControlTests\bin\Debug\Test\FILE_MAP_09"; List <RemotePlaybackFileInfo> Temp_lst = PubMethod.GetRemotePlaybackFileInfo_SKN(strPath, timStart, timEnd); VideoChannelRemotePlaybackInfo channelInfo = new VideoChannelRemotePlaybackInfo { ChnnelInfo = new PublicClassCurrency.CameraInfo { Channel = 1, CameraName = "通道1" }, StartTime = timStart, EndTime = timEnd, PlaybackFiles = Temp_lst, }; remoteBackplayInfoControl1.SetRemotePlaybackInfo(channelInfo); remoteBackplayControl1.SetRemotePlaybackInfo(channelInfo); //remoteBackplayControl1.SetCurrentPositionDateTime(DateTime.Now.AddHours(-3)); channelRemoteBackplayInfo1.SetRemotePlaybackInfo(channelInfo); }
//protected void Button1_Click(object sender, EventArgs e) //{ // txtBxzy.Text = Request["a"]; // //Response.Write(Request["a"]); //} protected void btnSave_Click(object sender, EventArgs e) { string ysGuid = (new GuidHelper()).getNewGuid(); string billName = txtBillCode.Text.Trim(); string flowid = hd_djtype.Value; string billUser = (string)Session["userCode"]; string date = txtBillDate.Text.Trim(); //beg发布时间 if (this.txtBillDate.Text.Trim() != "") { DateTime date1 = DateTime.MinValue; bool flag = DateTime.TryParse(this.txtBillDate.Text.ToString(), out date1); if (flag) { date = date1.ToString("yyyy-MM-dd"); } else { Response.Write("<script>alert('日期格式错误!');</script>"); txtBillDate.Focus(); return; } } else { Response.Write("<script>alert('请填制单日期!');</script>"); return; } //end发布时间 string dept = PubMethod.SubString(txtBillDept.Text.Trim()); string isgk = ddlIsGk.SelectedValue == "是" ? "1" : "0"; string gkdept = isgk == "0" ? dept : ddlGkDept.SelectedValue; string bxlx = ddlBxmxlx.SelectedValue; string bxzy = txtBxzy.Text.Trim(); string bxsm = txtBxsm.Text.Trim(); string sql = string.Format("insert into ph_main ([billCode],[billName] ,[flowID] ,[stepID] ,[billUser] ,[bxr] ,[billDate] ,[billDept] ,[loopTimes] ,[isgk] ,[gkdept] ,[bxmxlx] ,[bxzy] ,[bxsm]) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')", ysGuid, billName, flowid, "-1", billUser, billUser, date, dept, "0", isgk, gkdept, bxlx, bxzy, bxsm); if (server.ExecuteNonQuery(sql) > 0) { Response.Redirect("ybbxEditItem.aspx?billCode=" + ysGuid); } }
private string GetYskmStr(string code) { string result = ""; if (!string.IsNullOrEmpty(code)) { DataTable dt = server.GetDataTable(" select billcode,(select xmmc from bill_ysgc where gcbh=f.gcbh) as ysgc ,yskm as yskmCode,(select '['+yskmCode+']'+yskmMc as yskm from bill_yskm where yskmCode=f.yskm ) as yskmMc,isnull(ysje ,0) as je,sm from bill_ysmxb f where billCode='"+ code + "'", null); if (dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); DataTable ddt = PubMethod.GetNewDataTable(dt, "je>0"); sb.Append(SetKm(ddt, "调整入")); ddt = PubMethod.GetNewDataTable(dt, "je<0"); sb.Append(SetKm(ddt, "调整出")); result = sb.ToString(); } } return(result); }
private DescFlexSegmentsData GetRcvRptDocLineDescFlexField(CompleteApplyDocLine completeApplyDocLine) { List <string> srcEntityFullNames = new List <string> { CompleteApplyDocLine.EntityRes.BE_FullName }; List <string> targetEntityFullNames = new List <string> { RcvRptDocLine.EntityRes.BE_FullName }; FlexFieldMapingDTO mappingdto = PubMethod.GetFlexFieldMaping(srcEntityFullNames, targetEntityFullNames); if (mappingdto.PublicFlexFieldReferenceDTOs.Count > 0) { SourceEntityAndDescFieldsDTO sourceEntityAndDescFieldsDTO = new SourceEntityAndDescFieldsDTO { DescFlexSegments = completeApplyDocLine.DescFlexField, SourceEntity = completeApplyDocLine }; return(PubMethod.GetFlexField(CompleteApplyDocLine.EntityRes.BE_FullName, sourceEntityAndDescFieldsDTO, RcvRptDocLine.EntityRes.BE_FullName, mappingdto).ToEntityData()); } return(new DescFlexSegmentsData()); }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer) { HiddenField hf = e.Item.FindControl("hfCode") as HiddenField; string code = hf.Value.Trim(); if (!string.IsNullOrEmpty(code)) { DataTable dt = server.GetDataTable(" select billcode,(select xmmc from bill_ysgc where gcbh=f.gcbh) as ysgc ,yskm as yskmCode,(select '['+yskmCode+']'+yskmMc as yskm from bill_yskm where yskmCode=f.yskm ) as yskmMc,isnull(ysje ,0) as je,sm from bill_ysmxb f where billCode='"+ code + "'", null); if (dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); DataTable ddt = PubMethod.GetNewDataTable(dt, "je>0"); //sb.Append(SetKm(null, "调整入")); sb.Append(SetKm(ddt, "调整入")); ddt = PubMethod.GetNewDataTable(dt, "je<0"); // sb.Append(SetKm(null, "调整出")); sb.Append(SetKm(ddt, "调整出")); Label lb = e.Item.FindControl("lbmx") as Label; lb.Text = sb.ToString(); } } } }
protected void btnSave_Click(object sender, EventArgs e) { bill_travelApplicationBLL bllTravelApplication = new bill_travelApplicationBLL(); string strCtrl = Request["type"]; string strBillCode = Request["billCode"]; string str_billuser = PubMethod.SubString(txt_billUser.Text); string users = hfuser.Value; if (string.IsNullOrEmpty(users)) { ClientScript.RegisterStartupScript(this.GetType(), "", "alert('出差人不能为空!');", true); return; } string[] userArr = users.Split(','); string travelPersons = ""; for (int i = 0; i < userArr.Length; i++) { if (travelPersons.IndexOf(userArr[i]) != -1) { ClientScript.RegisterStartupScript(this.GetType(), "", "alert('有重复的出差人!');", true); return; } travelPersons += "|&|" + PubMethod.SubString(userArr[i]); } string str_billdate = txt_billDate.Text.Trim(); string str_billdept = server.GetCellValue("select userdept from bill_users where usercode='" + str_billuser + "'"); string bm = PubMethod.SubString(txt_userDept.Text); //申请表 Bill_TravelApplication modelTravelApplication = new Bill_TravelApplication(); //主表 Bill_Main modelMainBill = new Bill_Main(); string strMsg = ""; try { //添加修改 if (strCtrl.Equals("edit") && strBillCode.Equals("")) { if (strBillCode.Equals("")) { throw new Exception("单号丢失!"); } modelTravelApplication = bllTravelApplication.GetModel(strBillCode); } //添加 modelMainBill.BillName = "出差管理单"; modelMainBill.BillType = ""; modelMainBill.BillUser = str_billuser; modelMainBill.FlowId = "ccsq"; modelMainBill.GkDept = ""; modelMainBill.IsGk = ""; modelMainBill.LoopTimes = 0; modelMainBill.StepId = "-1"; //出差申请单表 modelTravelApplication.arrdess = this.txt_address.Text.Trim(); modelTravelApplication.maincode = txt_bh.Text.Trim(); modelTravelApplication.MoreThanStandard = Convert.ToInt32(ddlIsbz.SelectedValue); //modelTravelApplication.needAmount = int.Parse(this.txtFeePlan.Text.Trim()); modelTravelApplication.reasion = this.txt_reasion.Text.Trim(); modelTravelApplication.Transport = this.txt_jtgj.Text.Trim(); modelTravelApplication.travelDate = this.txt_travelDate.Text.Trim(); modelTravelApplication.sendDept = PubMethod.SubString(txt_bm.Text); string strAppPersion = this.txt_billUser.Text.Trim(); if (string.IsNullOrEmpty(strAppPersion)) { ClientScript.RegisterStartupScript(this.GetType(), "", "alert('申请人不能为空!');", true); return; } modelTravelApplication.travelPersionCode = travelPersons; modelTravelApplication.travelplan = this.txt_plan.Text.Trim();; modelTravelApplication.jiaotongfei = ToIntNum(txt_jtf.Text); modelTravelApplication.zhusufei = ToIntNum(txt_zsf.Text); modelTravelApplication.yewuzhaodaifei = ToIntNum(txt_zdf.Text); modelTravelApplication.huiyifei = ToIntNum(txt_hyf.Text); modelTravelApplication.yinshuafei = ToIntNum(txt_ysf.Text); modelTravelApplication.qitafei = ToIntNum(txt_qt.Text); modelTravelApplication.needAmount = modelTravelApplication.jiaotongfei + modelTravelApplication.zhusufei + modelTravelApplication.yewuzhaodaifei + modelTravelApplication.huiyifei + modelTravelApplication.yinshuafei + modelTravelApplication.qitafei; modelMainBill.BillJe = (decimal)modelTravelApplication.needAmount; //if (this.ddlTravelType.SelectedValue == null) //{ // throw new Exception("出差类型不能为空!"); //} //modelTravelApplication.typecode = this.ddlTravelType.SelectedValue.Trim(); modelMainBill.BillCode = txt_bh.Text.Trim(); DateTime dtBillDate; bool boBillDate = DateTime.TryParse(str_billdate, out dtBillDate); if (boBillDate) { modelMainBill.BillDate = dtBillDate; } else { throw new Exception("日期格式输入不正确!"); } UserMessage user = new UserMessage(modelMainBill.BillUser); string strBillDept = user.GetRootDept().DeptCode; if (string.IsNullOrEmpty(strBillDept)) { throw new Exception("未发现人员所在单位!"); } modelMainBill.BillDept = strBillDept; //modelMainBill.BillJe = int.Parse(this.txtFeePlan.Text.Trim());//单据金额 int iRel = bllTravelApplication.AddNote(modelMainBill, modelTravelApplication, out strMsg); if (iRel < 1) { throw new Exception(strMsg); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "alert('保存成功!');window.location.href='travelApplyList.aspx';", true); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "", "alert('保存失败,原因:" + ex.Message + "');", true); } }
/// <summary> /// 将错误信息写入日志 /// </summary> /// <param name="ex"></param> private static void WriteExMessage(Exception ex) { PubMethod.WirteExp(ex); }
public static void Main(string[] args) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); //设置执行的DEMO string switchOn = "update"; IDemos demo = null; switch (switchOn) { /****************************基本功能**************************************/ //查询 case "select": demo = new Select(); break; //删除 case "delete": demo = new Delete(); break; //插入 case "insert": demo = new Insert(); break; //更新 case "update": demo = new Update(); break; //基层函数的用法 case "ado": demo = new Ado(); break; //事务 case "tran": demo = new Tran(); break; //创建实体函数 case "createclass": demo = new CreateClass(); break; //T4生成 http://www.cnblogs.com/sunkaixuan/p/5751503.html //日志记录 case "log": demo = new Log(); break; //枚举支持 case "enum": demo = new EnumDemo(); break; /****************************实体映射**************************************/ //自动排除非数据库列 case "ignoreerrorcolumns": demo = new IgnoreErrorColumns(); break; //别名表 case "mappingtable": demo = new MappingTable(); break; //别名列 case "mappingcolumns": demo = new MappingColumns(); break; //通过属性的方法设置别名表和别名字段 case "attributesmapping": demo = new AttributesMapping(); break; /****************************业务应用**************************************/ //过滤器 case "filter": demo = new Filter(); break; //过滤器2 case "filter2": demo = new Filter2(); break; //流水号功能 case "serialnumber": demo = new SerialNumber(); break; //配置与实例的用法 case "initconfig": demo = new InitConfig(); break; /****************************支持**************************************/ //公开函数数 case "pubmethod": demo = new PubMethod(); break; //设置ToJson的日期格式 case "serializerdateformat": demo = new SerializerDateFormat(); break; /****************************测试用例**************************************/ case "test": demo = new Test(); break; default: Console.WriteLine("switchOn的值错误,请输入正确的 case"); break; } //执行DEMO demo.Init(); //更多例子请查看API //http://www.cnblogs.com/sunkaixuan/p/5654695.html Console.WriteLine("执行成功请关闭窗口"); Console.ReadKey(); }
/// <summary> /// <p> /// If buffer is non null stream assumed to be partial, otherwise the length will be used /// to output a fixed length packet. /// </p> /// <p> /// The stream created can be closed off by either calling Close() /// on the stream or Close() on the generator. Closing the returned /// stream does not close off the Stream parameter <c>outStr</c>. /// </p> /// </summary> private Stream Open( Stream outStr, long length, byte[] buffer) { if (cOut != null) { throw new InvalidOperationException("generator already in open state"); } if (methods.Count == 0) { throw new InvalidOperationException("No encryption methods specified"); } if (outStr == null) { throw new ArgumentNullException("outStr"); } pOut = new BcpgOutputStream(outStr); KeyParameter key; if (methods.Count == 1) { if (methods[0] is PbeMethod) { PbeMethod m = (PbeMethod)methods[0]; key = m.GetKey(); } else { key = PgpUtilities.MakeRandomKey(defAlgorithm, rand); byte[] sessionInfo = CreateSessionInfo(defAlgorithm, key); PubMethod m = (PubMethod)methods[0]; try { m.AddSessionInfo(sessionInfo, rand); } catch (Exception e) { throw new PgpException("exception encrypting session key", e); } } pOut.WritePacket((ContainedPacket)methods[0]); } else // multiple methods { key = PgpUtilities.MakeRandomKey(defAlgorithm, rand); byte[] sessionInfo = CreateSessionInfo(defAlgorithm, key); for (int i = 0; i != methods.Count; i++) { EncMethod m = (EncMethod)methods[i]; try { m.AddSessionInfo(sessionInfo, rand); } catch (Exception e) { throw new PgpException("exception encrypting session key", e); } pOut.WritePacket(m); } } string cName = PgpUtilities.GetSymmetricCipherName(defAlgorithm); if (cName == null) { throw new PgpException("null cipher specified"); } try { if (withIntegrityPacket) { cName += "/CFB/NoPadding"; } else { cName += "/OpenPGPCFB/NoPadding"; } c = CipherUtilities.GetCipher(cName); // TODO Confirm the IV should be all zero bytes (not inLineIv - see below) byte[] iv = new byte[c.GetBlockSize()]; c.Init(true, new ParametersWithRandom(new ParametersWithIV(key, iv), rand)); if (buffer == null) { // // we have to Add block size + 2 for the Generated IV and + 1 + 22 if integrity protected // if (withIntegrityPacket) { pOut = new BcpgOutputStream(outStr, PacketTag.SymmetricEncryptedIntegrityProtected, length + c.GetBlockSize() + 2 + 1 + 22); pOut.WriteByte(1); // version number } else { pOut = new BcpgOutputStream(outStr, PacketTag.SymmetricKeyEncrypted, length + c.GetBlockSize() + 2, oldFormat); } } else { if (withIntegrityPacket) { pOut = new BcpgOutputStream(outStr, PacketTag.SymmetricEncryptedIntegrityProtected, buffer); pOut.WriteByte(1); // version number } else { pOut = new BcpgOutputStream(outStr, PacketTag.SymmetricKeyEncrypted, buffer); } } int blockSize = c.GetBlockSize(); byte[] inLineIv = new byte[blockSize + 2]; rand.NextBytes(inLineIv, 0, blockSize); Array.Copy(inLineIv, inLineIv.Length - 4, inLineIv, inLineIv.Length - 2, 2); Stream myOut = cOut = new CipherStream(pOut, null, c); if (withIntegrityPacket) { string digestName = PgpUtilities.GetDigestName(HashAlgorithmTag.Sha1); IDigest digest = DigestUtilities.GetDigest(digestName); myOut = digestOut = new DigestStream(myOut, null, digest); } myOut.Write(inLineIv, 0, inLineIv.Length); return(new WrappedGeneratorStream(this, myOut)); } catch (Exception e) { throw new PgpException("Exception creating cipher", e); } }
private Stream Open(Stream outStr, long length, byte[] buffer) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (cOut != null) { throw new InvalidOperationException("generator already in open state"); } if (((global::System.Collections.ICollection)methods).get_Count() == 0) { throw new InvalidOperationException("No encryption methods specified"); } if (outStr == null) { throw new ArgumentNullException("outStr"); } pOut = new BcpgOutputStream(outStr); KeyParameter keyParameter; if (((global::System.Collections.ICollection)methods).get_Count() == 1) { if (methods.get_Item(0) is PbeMethod) { PbeMethod pbeMethod = (PbeMethod)methods.get_Item(0); keyParameter = pbeMethod.GetKey(); } else { keyParameter = PgpUtilities.MakeRandomKey(defAlgorithm, rand); byte[] si = CreateSessionInfo(defAlgorithm, keyParameter); PubMethod pubMethod = (PubMethod)methods.get_Item(0); try { pubMethod.AddSessionInfo(si, rand); } catch (global::System.Exception exception) { throw new PgpException("exception encrypting session key", exception); } } pOut.WritePacket((ContainedPacket)methods.get_Item(0)); } else { keyParameter = PgpUtilities.MakeRandomKey(defAlgorithm, rand); byte[] si2 = CreateSessionInfo(defAlgorithm, keyParameter); for (int i = 0; i != ((global::System.Collections.ICollection)methods).get_Count(); i++) { EncMethod encMethod = (EncMethod)methods.get_Item(i); try { encMethod.AddSessionInfo(si2, rand); } catch (global::System.Exception exception2) { throw new PgpException("exception encrypting session key", exception2); } pOut.WritePacket(encMethod); } } string symmetricCipherName = PgpUtilities.GetSymmetricCipherName(defAlgorithm); if (symmetricCipherName == null) { throw new PgpException("null cipher specified"); } try { symmetricCipherName = ((!withIntegrityPacket) ? (symmetricCipherName + "/OpenPGPCFB/NoPadding") : (symmetricCipherName + "/CFB/NoPadding")); c = CipherUtilities.GetCipher(symmetricCipherName); byte[] iv = new byte[c.GetBlockSize()]; c.Init(forEncryption: true, new ParametersWithRandom(new ParametersWithIV(keyParameter, iv), rand)); if (buffer == null) { if (withIntegrityPacket) { pOut = new BcpgOutputStream(outStr, PacketTag.SymmetricEncryptedIntegrityProtected, length + c.GetBlockSize() + 2 + 1 + 22); ((Stream)pOut).WriteByte((byte)1); } else { pOut = new BcpgOutputStream(outStr, PacketTag.SymmetricKeyEncrypted, length + c.GetBlockSize() + 2, oldFormat); } } else if (withIntegrityPacket) { pOut = new BcpgOutputStream(outStr, PacketTag.SymmetricEncryptedIntegrityProtected, buffer); ((Stream)pOut).WriteByte((byte)1); } else { pOut = new BcpgOutputStream(outStr, PacketTag.SymmetricKeyEncrypted, buffer); } int blockSize = c.GetBlockSize(); byte[] array = new byte[blockSize + 2]; rand.NextBytes(array, 0, blockSize); global::System.Array.Copy((global::System.Array)array, array.Length - 4, (global::System.Array)array, array.Length - 2, 2); Stream val = (Stream)(object)(cOut = new CipherStream((Stream)(object)pOut, null, c)); if (withIntegrityPacket) { string digestName = PgpUtilities.GetDigestName(HashAlgorithmTag.Sha1); IDigest digest = DigestUtilities.GetDigest(digestName); val = (Stream)(object)(digestOut = new DigestStream(val, null, digest)); } val.Write(array, 0, array.Length); return((Stream)(object)new WrappedGeneratorStream(this, val)); } catch (global::System.Exception exception3) { throw new PgpException("Exception creating cipher", exception3); } }
/// <summary> /// 创建修改BOM服务的DTO /// </summary> /// <param name="_bom"></param> /// <param name="_beBOM"></param> /// <returns></returns> private BOMMasterDTO4CreateSv ModifyBOMMasterDTO(BOMMaster _bom, UFIDA.U9.CBO.MFG.BOM.BOMMaster _beBOM, Organization _beOrgContext) { BOMMasterDTO4CreateSv dtoMasterModify = PubMethod.GetDataOfBOMMaster(_beBOM); try { //清除系统原有子件清单 dtoMasterModify.BOMComponents.Clear(); int iSeq = PubMethod.GetNextMaxSequence(_beBOM); //加入待修改的子件清单 bool isAllBomCompOK = true; foreach (var bomComp in _bom.Components) { UFIDA.U9.CBO.MFG.BOM.BOMComponent.EntityList elstBOMComponent = UFIDA.U9.CBO.MFG.BOM.BOMComponent.Finder.FindAll("BOMMaster=@BOMID and ItemMaster.Code=@ItemCode ", new OqlParam[] { new OqlParam(_beBOM.ID), new OqlParam(bomComp.ItemCode) }); //在系统后台根据BOM主ID和子件的物料编码检索,如果有此子件则由GetDataOfBOMComponent直接创建子件DTO添加dtoMasterModify。 if (elstBOMComponent != null && elstBOMComponent.Count > 0) { //处理母件下有相同的子件物料的明细行 for (int i = 0; i < elstBOMComponent.Count; i++) { UFIDA.U9.CBO.MFG.BOM.BOMComponent beBOMComponent = elstBOMComponent[i]; BOMComponentDTO4CreateSv dtoComponent = PubMethod.GetDataOfBOMComponent(beBOMComponent); if (dtoMasterModify.BOMComponents.Contains(dtoComponent)) { continue; } else { //修改内容 dtoComponent.UsageQty = bomComp.UsageQty; //用量 dtoComponent.Scrap = bomComp.Scrap; //损耗率 dtoComponent.ParentQty = bomComp.ParentQty; //母件底数 dtoComponent.Remark = bomComp.Remark; //备注 if (!String.IsNullOrEmpty(bomComp.CompProject)) { Project itemProject = Project.FindByCode(bomComp.CompProject); if (itemProject != null) { dtoComponent.CompProject = new CommonArchiveDataDTO(); dtoComponent.CompProject.ID = itemProject.ID; dtoComponent.CompProject.Code = itemProject.Code; dtoComponent.CompProject.Name = itemProject.Name; } } else { //原接口未对项目置空的处理(UFIDA.U9.ISV.MFG.BOM.PubMethod.UpdateBOMComponent) string strUpdateVersion = string.Format("update uu set uu.CompProject = null from CBO_BOMComponent uu " + "where uu.ID = {0}", beBOMComponent.ID.ToString()); DataAccessor.RunSQL(DatabaseManager.GetCurrentConnection(), strUpdateVersion, null); //dtoComponent.CompProject.ID = 1L;// //dtoComponent.CompProject.Code = string.Empty; //dtoComponent.CompProject.Name = string.Empty; //dtoComponent.CompProject = new CommonArchiveDataDTO(); } dtoMasterModify.BOMComponents.Add(dtoComponent); break; } } } else { #region 新增子件 BOMComponentDTO4CreateSv dtoComponent = CreateBOMComponentDTO(bomComp, iSeq, _bom, _beBOM.Org); if (dtoComponent == null) { isAllBomCompOK = false; } dtoMasterModify.BOMComponents.Add(dtoComponent); iSeq += 10; #endregion } } if (!isAllBomCompOK) { dtoMasterModify = null; } } catch (Exception ex) { strbError.AppendLine(string.Format(strErrorItem, _bom.ItemMasterCode, "", ex.Message)); dtoMasterModify = null; } return(dtoMasterModify); }
/// <summary> /// SqlSugar的功能介绍 /// </summary> /// <param name="args"></param> static void Main(string[] args) { //设置执行的DEMO string switchOn = "select"; IDemos demo = null; switch (switchOn) { /****************************基本功能**************************************/ //查询 case "select": demo = new Select(); break; //删除 case "delete": demo = new Delete(); break; //插入 case "insert": demo = new Insert(); break; //更新 case "update": demo = new Update(); break; //插入或者更新 case "insertorupdate": demo = new InsertOrUpdate(); break; //基层函数的用法 case "ado": demo = new Ado(); break; //主从模式 case "ms": demo = new MsterSlave(); break; //事务 case "tran": demo = new Tran(); break; //创建实体函数 case "createclass": demo = new CreateClass(); break; //T4生成 http://www.cnblogs.com/sunkaixuan/p/5751503.html //日志记录 case "log": demo = new Log(); break; //枚举支持 case "enum": demo = new EnumDemo(); break; /****************************实体映射**************************************/ //自动排除非数据库列 case "ignoreerrorcolumns": demo = new IgnoreErrorColumns(); break; //别名表 case "mappingtable":demo=new MappingTable(); break; //别名列 case "mappingcolumns": demo = new MappingColumns(); break; //通过属性的方法设置别名表和别名字段 case "attributesmapping": demo = new AttributesMapping(); break; /****************************业务应用**************************************/ //过滤器 case "filter": demo = new Filter(); break; //过滤器2 case "filter2": demo = new Filter2(); break; //流水号功能 case "serialnumber": demo = new SerialNumber(); break; //多语言支持 http://www.cnblogs.com/sunkaixuan/p/5709583.html //多库并行计算 http://www.cnblogs.com/sunkaixuan/p/5046517.html //配置与实例的用法 case "initconfig": demo = new InitConfig(); break; /****************************支持**************************************/ //公开函数数 case "pubmethod": demo = new PubMethod(); break; //Sql2012分页的支持 case "sqlpagemodel": demo=new SqlPageModel(); break; //设置ToJson的日期格式 case "serializerdateformat":demo =new SerializerDateFormat();break; /****************************测试用例**************************************/ case "test": demo = new Test(); break; default: Console.WriteLine("switchOn的值错误,请输入正确的 case"); break; } //执行DEMO demo.Init(); //更多例子请查看API //http://www.cnblogs.com/sunkaixuan/p/5654695.html Console.WriteLine("执行成功请关闭窗口"); Console.ReadKey(); }