public DataResult Submit(SubmitData submitData) { FlowWFServices service = new FlowWFServices(); if (submitData.SubmitFlag == SubmitFlag.New) { CommonBLL bll = new CommonBLL(""); IEntityBase obj = bll.GetEntity(submitData.ModelCode.ToUpper(), submitData.FormID); string xml = GetFullXml(obj, submitData.ModelCode.ToUpper(), submitData).ToString(); XElement element = XElement.Parse(xml); element = bll.GetXml(obj, element); submitData.XML = element.ToString(); } return service.SubmitFlow(submitData); }
/// <summary> /// 订单未支付-发送微信模板消息 /// </summary> public void ProcessNotPayMsg() { // var numCount = 100; var commonBLL = new CommonBLL(); // var customerIDs = CustomerBLL.Instance.GetCustomerList();//获取所有商户 foreach (var customer in customerIDs) { // var count = RedisOpenAPI.Instance.CCOrderNotPay().GetOrderNotPayLength(new CC_OrderNotPay { CustomerID = customer.Key }); if (count.Code != ResponseCode.Success) { continue; } if (count.Result <= 0) { continue; } // if (count.Result < numCount) { numCount = Convert.ToInt32(count.Result); } // for (var i = 0; i < numCount; i++) { // try { var response = RedisOpenAPI.Instance.CCOrderNotPay().GetOrderNotPay(new CC_OrderNotPay { CustomerID = customer.Key }); if (response.Code == ResponseCode.Success) { var templateID = response.Result.ConfigData.TemplateID; var openID = response.Result.ConfigData.OpenID; var vipID = response.Result.ConfigData.VipID; var loggingSessionInfo = CustomerBLL.Instance.GetBSLoggingSession(customer.Key, "1"); //response.Result.ConfigData.LogSession.JsonDeserialize<LoggingSessionInfo>(); var Data = new NotPay { first = new DataInfo { value = response.Result.OrderNotPayData.first.value, color = response.Result.OrderNotPayData.first.color }, orderProductPrice = new DataInfo { value = response.Result.OrderNotPayData.orderProductPrice.value, color = response.Result.OrderNotPayData.orderProductPrice.color }, orderProductName = new DataInfo { value = Math.Round(Convert.ToDecimal(response.Result.OrderNotPayData.orderProductName.value), 2).ToString(), color = response.Result.OrderNotPayData.orderProductName.color }, orderAddress = new DataInfo { value = response.Result.OrderNotPayData.orderAddress.value, color = response.Result.OrderNotPayData.orderAddress.color }, orderName = new DataInfo { value = response.Result.OrderNotPayData.orderName.value, color = response.Result.OrderNotPayData.orderName.color }, remark = new DataInfo { value = response.Result.OrderNotPayData.remark.value, color = response.Result.OrderNotPayData.remark.color } }; commonBLL.SendMatchWXTemplateMessage(templateID, null, null, null, null, null, null, null, Data, "2", openID, null, loggingSessionInfo); } } catch { continue; } } } }
/// 绑定系统信息表 --add on 20170610 by Lingjia Qiu /// <summary> /// 绑定系统信息表 /// </summary> /// <param name="riItem"></param> private void BindSysTableInfo(RoomIndoor r) { if (thisProject.SystemList.Count == 0) { return; } dgvSystemInfo.Rows.Clear(); //清空数据 ProjectBLL bll = new ProjectBLL(thisProject); foreach (SystemVRF sysItem in thisProject.SystemList) { if (sysItem.OutdoorItem == null) { this.dgvSystemInfo.Visible = false; return; } if (sysItem.Id.Equals(r.SystemID)) { //this.jclblUnitInfo.Text = sysItem.Name + ShowText.SystemInfo; double totestIndCap_h = 0; double totestIndCap_c = getTotestIndCap_c(sysItem, bll, out totestIndCap_h); string coolingReqd = ""; if (totestIndCap_c != 0d) { coolingReqd = Unit.ConvertToControl(totestIndCap_c, UnitType.POWER, ut_power).ToString("n1"); } else { coolingReqd = "-"; } double sysRH = bll.CalculateRH(sysItem.DBHeating, sysItem.WBHeating, thisProject.Altitude); //this.dgvSystemInfo.Rows[0].Height = 30; //先添加一条系统室外机记录 this.dgvSystemInfo.Rows.Add( "", coolingReqd, // cooling Req'd totestIndCap_h != 0d ? Unit.ConvertToControl(totestIndCap_h, UnitType.POWER, ut_power).ToString("n1") : "-", //Heating Req'd "-", //Sensible Req'd sysItem.Name, //系统名字 sysItem.OutdoorItem.AuxModelName, //室外机型号 Unit.ConvertToControl(sysItem.CoolingCapacity, UnitType.POWER, ut_power).ToString("n1"), //Cooling Actual Unit.ConvertToControl(sysItem.HeatingCapacity, UnitType.POWER, ut_power).ToString("n1"), //Heating Actual "-", Unit.ConvertToControl(sysItem.DBCooling, UnitType.TEMPERATURE, ut_temperature).ToString("n1"), //CoolingDB "-", //CoolingWB Unit.ConvertToControl(sysItem.DBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1"), //HeatingDB Unit.ConvertToControl(sysItem.WBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1"), //HeatingWB (sysRH * 100).ToString("n0") //RH ); //添加系统室内机记录 List <RoomIndoor> riItemList = bll.GetSelectedIndoorBySystem(sysItem.Id); int colorIndex = 0; string RoomId = ""; string SensibleHeat = ""; foreach (RoomIndoor riItem in riItemList) { double riRH = (new ProjectBLL(thisProject)).CalculateRH(riItem.DBCooling, riItem.WBCooling, thisProject.Altitude); //添加不基于房间的室内机riItem.IndoorName 改为 DisplayRoom string DisplayRoom = string.IsNullOrEmpty(riItem.DisplayRoom) ? riItem.IndoorName : riItem.DisplayRoom + ":" + riItem.IndoorName; string RqCoolingCapacity = riItem.RqCoolingCapacity != 0d ? Unit.ConvertToControl(riItem.RqCoolingCapacity, UnitType.POWER, ut_power).ToString("n1") : "-"; string RqHeatingCapacity = riItem.RqHeatingCapacity != 0d ? Unit.ConvertToControl(riItem.RqHeatingCapacity, UnitType.POWER, ut_power).ToString("n1") : "-"; string RqSensibleHeat = riItem.RqSensibleHeat != 0d ? Unit.ConvertToControl(riItem.RqSensibleHeat, UnitType.POWER, ut_power).ToString("n1") : "-"; string RoomName = "-"; if (!string.IsNullOrEmpty(riItem.RoomName) && !string.IsNullOrEmpty(riItem.RoomID)) { if (RoomId != riItem.RoomID) { RoomName = riItem.RoomName; Room ri = bll.GetRoom(riItem.RoomID); RqCoolingCapacity = ri.RqCapacityCool != 0d ? Unit.ConvertToControl(ri.RqCapacityCool, UnitType.POWER, ut_power).ToString("n1") : " "; RqHeatingCapacity = ri.RqCapacityHeat != 0d ? Unit.ConvertToControl(ri.RqCapacityHeat, UnitType.POWER, ut_power).ToString("n1") : " "; RqSensibleHeat = ri.SensibleHeat != 0d ? Unit.ConvertToControl(ri.SensibleHeat, UnitType.POWER, ut_power).ToString("n1") : "-"; RoomId = riItem.RoomID; SensibleHeat = RqSensibleHeat; } else { RoomName = ""; RqCoolingCapacity = ""; RqHeatingCapacity = ""; RqSensibleHeat = ""; //if (!string.IsNullOrEmpty(SensibleHeat) && SensibleHeat == "-") // RqSensibleHeat = "-"; } } this.dgvSystemInfo.Rows.Add( RoomName, //riItem.IsAuto ? Unit.ConvertToControl(riItem.RqCoolingCapacity, UnitType.POWER, ut_power).ToString("n1") + ut_power : "-", // cooling Req'd RqCoolingCapacity, // cooling Req'd RqHeatingCapacity, //Heating Req'd RqSensibleHeat, //riItem.IsAuto ? Unit.ConvertToControl(riItem.RqSensibleHeat, UnitType.POWER, ut_power).ToString("n1") + ut_power : "-", //Sensible Req'd riItem.IndoorName, //室内机名字 thisProject.BrandCode == "Y" ? riItem.IndoorItem.Model_York : riItem.IndoorItem.Model_Hitachi, //室内机型号 Unit.ConvertToControl(riItem.ActualCoolingCapacity, UnitType.POWER, ut_power).ToString("n1"), //Cooling Actual //riItem.IsAuto ?Unit.ConvertToControl(riItem.RqHeatingCapacity, UnitType.POWER, ut_power).ToString("n1") + ut_power : "-", //Heating Req'd Unit.ConvertToControl(riItem.ActualHeatingCapacity, UnitType.POWER, ut_power).ToString("n1"), //Heating Actual Unit.ConvertToControl(riItem.ActualSensibleHeat, UnitType.POWER, ut_power).ToString("n1"), //Sensible Actual Unit.ConvertToControl(riItem.DBCooling, UnitType.TEMPERATURE, ut_temperature).ToString("n1"), //CoolingDB Unit.ConvertToControl(riItem.WBCooling, UnitType.TEMPERATURE, ut_temperature).ToString("n1"), //CoolingWB Unit.ConvertToControl(riItem.DBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1"), //HeatingDB riItem.WBHeating != 0d ? Unit.ConvertToControl(riItem.WBHeating, UnitType.TEMPERATURE, ut_temperature).ToString("n1") : "-", //HeatingWB (riRH * 100).ToString("n0") //RH ); colorIndex++; string wType; if (!CommonBLL.MeetRoomRequired(riItem, thisProject, 0, thisProject.RoomIndoorList, out wType)) { dgvSystemInfo.Rows[colorIndex].Cells[1].Style.ForeColor = Color.Chocolate; switch (wType) { case "reqCool": dgvSystemInfo.Rows[colorIndex].Cells[4].Style.ForeColor = Color.Chocolate; dgvSystemInfo.Rows[colorIndex].Cells[5].Style.ForeColor = Color.Chocolate; break; case "reqHeat": dgvSystemInfo.Rows[colorIndex].Cells[10].Style.ForeColor = Color.Chocolate; dgvSystemInfo.Rows[colorIndex].Cells[11].Style.ForeColor = Color.Chocolate; break; case "sensible": dgvSystemInfo.Rows[colorIndex].Cells[6].Style.ForeColor = Color.Chocolate; dgvSystemInfo.Rows[colorIndex].Cells[7].Style.ForeColor = Color.Chocolate; break; } } } break; } } dgvSystemInfo.ClearSelection(); //取消默认选中 this.dgvSystemInfo.Visible = true; }
/// <summary> /// /// </summary> private void GenerateReportPortfolio(Domain.Application[] ApplicationsArray, Snapshot[] ApplicationsSnapshots, string[] IgnoredApps, string[] IgnoredSnapshots) { string tmpReportFile = string.Empty; string tmpReportFileFlexi = string.Empty; try { //Create temporary report string workDirectory = SettingsBLL.GetApplicationPath(); tmpReportFile = PathUtil.CreateTempCopy(workDirectory, SelectedTemplateFile.FullName); if (tmpReportFile.Contains(".xlsx")) { tmpReportFileFlexi = PathUtil.CreateTempCopyFlexi(workDirectory, SelectedTemplateFile.FullName); } //Build report ReportData reportData = new ReportData { FileName = tmpReportFile, Application = null, CurrentSnapshot = null, PreviousSnapshot = null, Parameter = Setting.ReportingParameter, RuleExplorer = new RuleBLL(ActiveConnection), SnapshotExplorer = new SnapshotBLL(ActiveConnection, SelectedSnapshot), CurrencySymbol = "$", ServerVersion = CommonBLL.GetServiceVersion(ActiveConnection), Applications = ApplicationsArray, Category = SelectedCategory, Tag = SelectedTag, Snapshots = ApplicationsSnapshots, IgnoresApplications = IgnoredApps, IgnoresSnapshots = IgnoredSnapshots }; using (IDocumentBuilder docBuilder = BuilderFactory.CreateBuilder(reportData, tmpReportFileFlexi)) { docBuilder.BuildDocument(); } if (tmpReportFile.Contains(".xlsx")) { tmpReportFile = tmpReportFileFlexi; } ConvertToPdfIfNeeded(tmpReportFile); } catch (Exception) { ReportFileName = string.Empty; throw; } finally { if (!string.IsNullOrEmpty(tmpReportFile)) { File.Delete(tmpReportFile); } } }
protected override EmptyResponseData ProcessRequest(APIRequest <SetVipIntegralRP> pRequest) { var rd = new EmptyResponseData(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; //登录状态信息 var vipIntegralDetail = new VipIntegralDetailBLL(loggingSessionInfo); //积分变更业务对象实例化 var objectImagesBLL = new ObjectImagesBLL(loggingSessionInfo); //图片表业务对象实例化 var unitBLL = new t_unitBLL(loggingSessionInfo); var vipIntegralBLL = new VipIntegralBLL(loggingSessionInfo); var vipBLL = new VipBLL(loggingSessionInfo); var vipInfo = vipBLL.GetByID(para.VipID); var unitInfo = unitBLL.GetByID(loggingSessionInfo.CurrentUserRole.UnitId); var pTran = vipIntegralDetail.GetTran(); //事务 var vipIntegral = vipIntegralBLL.GetByID(para.VipID); using (pTran.Connection) { try { var IntegralDetail = new VipIntegralDetailEntity() { Integral = para.Qty, IntegralSourceID = para.IntegralSourceID, ObjectId = "", Reason = para.Reason, Remark = para.Remark }; if (IntegralDetail.Integral != 0) { //变动前积分 string OldIntegral = string.Empty; if (vipIntegral != null) { OldIntegral = (vipIntegral.ValidIntegral ?? 0).ToString(); } else { OldIntegral = "0"; } //变动积分 string ChangeIntegral = (IntegralDetail.Integral ?? 0).ToString(); string vipIntegralDetailId = vipIntegralBLL.AddIntegral(ref vipInfo, unitInfo, IntegralDetail, pTran, loggingSessionInfo); //发送微信积分变动通知模板消息 if (!string.IsNullOrWhiteSpace(vipIntegralDetailId)) { var CommonBLL = new CommonBLL(); CommonBLL.PointsChangeMessage(OldIntegral, vipInfo, ChangeIntegral, vipInfo.WeiXinUserId, loggingSessionInfo); } //增加图片上传 if (!string.IsNullOrEmpty(para.ImageUrl)) { var objectImagesEntity = new ObjectImagesEntity() { ImageId = Guid.NewGuid().ToString(), ObjectId = vipIntegralDetailId, ImageURL = para.ImageUrl }; objectImagesBLL.Create(objectImagesEntity); } } pTran.Commit(); //提交事物 } catch (APIException apiEx) { pTran.Rollback();//回滚事物 throw new APIException(apiEx.ErrorCode, apiEx.Message); } catch (Exception ex) { pTran.Rollback();//回滚事物 throw new Exception(ex.Message); } } return(rd); }
/// <summary> /// 投诉热线 /// </summary> /// <returns></returns> public ActionResult MemberComplaint() { ViewBag.ComplaintsHotline = CommonBLL.GetGlobalConstVariable(YiDaBusConst.投诉热线).FirstOrDefault()?.F_Description; return(View()); }
/// <summary> /// 获取填充xml /// </summary> /// <param name="obj">要填充的实体</param> /// <param name="modelCode">实体名称</param> /// <returns>返回xml</returns> public XElement GetFullXml(IEntityBase obj, string modelCode, SubmitData submitData) { XElement element = null; Metadata meta = new Metadata(); string modelType = string.Empty; if (!string.IsNullOrEmpty(modelCode)) { modelType = modelCode.ToUpper(); } else { modelType = obj.GetType().Name; } List<AutoDictionary> listAutoDic = new List<AutoDictionary>(); string strMainKey = string.Empty; string strMainValue = string.Empty; CommonBLL bll = new CommonBLL(""); #region 处理元数据 #region " T_HR_EMPLOYEEOVERTIMERECORD " if (modelType.ToUpper() == Constants.T_HR_EMPLOYEEOVERTIMERECORD) { strMainKey = "OVERTIMERECORDID"; strMainValue = string.Empty; Type objtype = obj.GetType(); PropertyInfo[] propinfos = objtype.GetProperties(); foreach (PropertyInfo propinfo in propinfos) { string keyValue = propinfo.GetValue(obj, null) != null ? propinfo.GetValue(obj, null).ToString() : string.Empty; if (propinfo.Name == strMainKey) { strMainValue = keyValue; } } if (obj is T_HR_EMPLOYEEOVERTIMERECORD) { T_HR_EMPLOYEEOVERTIMERECORD entity = obj as T_HR_EMPLOYEEOVERTIMERECORD; if (submitData.SubmitFlag != SubmitFlag.New && submitData.ApprovalResult == ApprovalResult.NoPass) { var overtimeDetail = bll.Query<T_HR_EMPLOYEEOVERTIMERECORD>().Where(w => w.OVERTIMERECORDID == strMainValue).ToList(); //Dictionary<object, object> detail = new Dictionary<object, object>(); //detail.Add(overtimeDetail, null);//normItemConfigList 是2级从表列表 Dictionary<object, object> detail = new Dictionary<object, object>(); detail.Add(entity.T_HR_EMPLOYEEOVERTIMEDETAILRD, null); listAutoDic.Add(new AutoDictionary { TableName = modelType, KeyValue = "CREATEUSERID", DataValue = submitData.ApprovalUser.UserID, DataText = submitData.ApprovalUser.UserName, Name = "CREATEUSERID" }); listAutoDic.Add(new AutoDictionary { TableName = modelType, KeyValue = "CREATEPOSTID", DataValue = submitData.ApprovalUser.PostID, DataText = submitData.ApprovalUser.PostName, Name = "CREATEPOSTID" }); listAutoDic.Add(new AutoDictionary { TableName = modelType, KeyValue = "CREATEDEPARTMENTID", DataValue = submitData.ApprovalUser.DepartmentID, DataText = submitData.ApprovalUser.DepartmentName, Name = "CREATEDEPARTMENTID" }); listAutoDic.Add(new AutoDictionary { TableName = modelType, KeyValue = "CREATECOMPANYID", DataValue = submitData.ApprovalUser.CompanyID, DataText = submitData.ApprovalUser.CompanyName, Name = "CREATECOMPANYID" }); } } } #endregion #endregion //auditInfo.ObjXml = metaData.TableToXml(yearNormDraft, null, auditInfo.SystemCode, auditInfo.ModelCode, listAutoDic);// 将Detail设置成了null string xml = meta.TableToXml(obj, null, "HR", modelType, listAutoDic); element = XElement.Parse(xml); //SMT.Portal.Common.MetaData metaData = new MetaData(); return element; }
protected void Page_Load(object sender, EventArgs e) { #region Script Resource ScriptReference scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/CreateScheduleScriptResource.js"; string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(','); scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); scriptManager.Scripts.Add(scriptReference); scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/jQueryCalendarScriptResource.js"; scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); scriptManager.Scripts.Add(scriptReference); #endregion int siteID = CommonBLL.ValidateSiteID(Request); if (siteID == 0) { Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString()); } //if loading page from maintenance schedule if (Request.QueryString["ismaintenance"] != null && Request.QueryString["ismaintenance"].Trim().Length > 0) { scheduleType = Request.QueryString["ismaintenance"].ToString().Trim() == "true" ? "S" : scheduleType; } //if loading page from measuring point else if (Request.QueryString["ischecklist"] != null && Request.QueryString["ischecklist"].Trim().Length > 0) { scheduleType = Request.QueryString["ischecklist"].ToString().Trim() == "true" ? "I" : scheduleType; } //if loading page in edit mode int maintScheduleID = 0; if (Request.QueryString["maintscheduleid"] != null && Request.QueryString["maintscheduleid"].Trim().Length > 0) { maintScheduleID = Convert.ToInt32(Request.QueryString["maintscheduleid"].ToString().Trim()); } int userID = this.CurrentUser.UserID; int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel); AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID); string basePath = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/'); string webServicePath = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim(); Vegam_MaintenanceService.SiteDateTimeFormatInfo dateTimeFormat = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID); string datePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeFormat.DateFormat); if (accessType == AccessType.FULL_ACCESS || accessType == AccessType.EDIT_ONLY) { btnSaveScheduleInfo.Attributes.Add("onclick", "javascript:SaveScheduleInfo();return false;"); } else { btnSaveScheduleInfo.Attributes.Add("disabled", "disabled"); } BasicParam basicParam = new BasicParam(); basicParam.SiteID = siteID; basicParam.UserID = userID; basicParam.AccessLevelID = accessLevelID; ScriptManager.RegisterStartupScript(this, this.GetType(), "LoadScheduleInfo", "javascript:LoadScheduleInfo(" + (new JavaScriptSerializer()).Serialize(basicParam) + ",'" + basePath + "','" + webServicePath + "','" + datePickerFormat + "','" + dateTimeFormat.DateFormat + "','" + dateTimeFormat.TimeFormat + "','" + scheduleType + "'," + maintScheduleID + ",'" + btnSaveScheduleInfo.ClientID + "');", true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region Script Resource ScriptReference scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/TaskGroupScriptResource.js"; string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(','); scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); scriptManager.Scripts.Add(scriptReference); #endregion int siteID = CommonBLL.ValidateSiteID(Request); int versionNumber = 0; int.TryParse(Request.QueryString["v"], out versionNumber); int taskGroupIdentifier = 0; if (Request.QueryString["gid"] != null && Request.QueryString["gid"].Trim().Length > 0) { taskGroupIdentifier = Convert.ToInt32(Request.QueryString["gid"].Trim()); } if (siteID == 0 || versionNumber < 0 || taskGroupIdentifier < 0) { Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString()); } bool isMaintShowAll = false; if (Request.QueryString["showall"] != null && Request.QueryString["showall"].Trim().Length > 0) { isMaintShowAll = Request.QueryString["showall"].Trim().ToLower() == "true" ? true : false; } int userID = this.CurrentUser.UserID; int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel); AccessType access = ValidateUserPrivileges(siteID, accessLevelID); AccessType approveAccess = CommonBLL.ValidateUserPrivileges(siteID, this.CurrentUser.SiteID, this.CurrentUser.UserID, accessLevelID, Convert.ToInt32(Language_Resources.MaintenancePageID_Resource.taskGroupApprove)); Vegam_MaintenanceService.BasicParam basicParam = new Vegam_MaintenanceService.BasicParam(); basicParam.SiteID = siteID; basicParam.UserID = userID; basicParam.AccessLevelID = accessLevelID; string basePath = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/'); string webServicePath = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim(); string uploaderPath = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/'); string imagePath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/'); string taskDocumentPath = ConfigurationManager.AppSettings["MaintenanceTaskDocumentsPath"].TrimEnd('/'); if (access == AccessType.FULL_ACCESS) { btnGroupInfoSave.Attributes.Add("onclick", "javascript:SaveTaskGroupInfo();return false;"); if (taskGroupIdentifier == 0) { btnGroupInfoSave.InnerText = Language_Resources.TaskGroup_Resource.save; } else { btnGroupInfoSave.InnerText = Language_Resources.TaskGroup_Resource.update; } } else if (access == AccessType.EDIT_ONLY) { btnGroupInfoSave.Attributes.Add("onclick", "javascript:SaveTaskGroupInfo();return false;"); btnGroupInfoSave.InnerText = Language_Resources.TaskGroup_Resource.update; } else { btnGroupInfoSave.Attributes.Add("disabled", "disabled"); } bool isUserHasApprovePermission = false; if (approveAccess == AccessType.FULL_ACCESS) { isUserHasApprovePermission = true; } //else if (approveAccess == AccessType.READ_ONLY) //{ // isUserHasApproveVisiblePermission = true; //} //using pager for displaying maintenance master data in configure maintenance types modal popup UserControls.PagerData maintTypePagerData = new UserControls.PagerData(); maintTypePagerData.PageIndex = 0; maintTypePagerData.PageSize = int.Parse(hdnPageSize.Value.ToString()); maintTypePagerData.SelectMethod = "LoadMaintTypesInfo"; maintTypePagerData.ServicePath = webServicePath; maintTypePagerData.SiteID = siteID; maintTypePagerData.UserID = userID; maintTypePagerData.AccessLevelID = accessLevelID; maintTypePagerData.LoadControlID = btnAddMaintType.ClientID; maintTypePagerData.PageAccessRights = access.ToString(); if (access == AccessType.FULL_ACCESS) { btnAddMaintType.Attributes.Add("onclick", "javascript:InsertOrUpdateMaintType(" + (new JavaScriptSerializer()).Serialize(0) + ");return false;"); } else { btnAddMaintType.Attributes.Add("disabled", "disabled"); } thMaintTypes.Attributes.Add("onclick", "javascript:SortMaintTypesTabs('" + thMaintTypes.ClientID + "','MasterDataName');"); Page.ClientScript.RegisterStartupScript(GetType(), "LoadTaskGroupInfo", "LoadTaskGroupInfo(" + (new JavaScriptSerializer()).Serialize(maintTypePagerData) + "," + (new JavaScriptSerializer()).Serialize(basicParam) + ",'" + basePath + "','" + webServicePath + "','" + uploaderPath + "','" + imagePath + "'," + taskGroupIdentifier + "," + versionNumber + ",'" + btnGroupInfoSave.ClientID + "','" + access.ToString() + "','" + taskDocumentPath + "','" + isUserHasApprovePermission + "','" + maintScheduleID + "','" + isMaintShowAll + "');", true); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var OrderID = context.Request["OrderID"]; var OrderStatus = context.Request["OrderStatus"]; var CustomerID = context.Request["CustomerID"]; var UserID = context.Request["UserID"]; var ChannelID = context.Request["ChannelID"]; var SerialPay = context.Request["SerialPay"]; try { if (string.IsNullOrEmpty(OrderID) || string.IsNullOrEmpty(OrderStatus) || string.IsNullOrEmpty(CustomerID) || string.IsNullOrEmpty(UserID) || string.IsNullOrEmpty(ChannelID)) { throw new Exception("参数不全:OrderID,OrderStatus,CustomerID,UserID"); } else { if (OrderStatus == "2") { //支付成功,更新卡的支付状态 //OrderID就是VIPCardID // //var rp = pRequest.DeserializeJSONTo<APIRequest<SetVipCardRP>>(); //if (string.IsNullOrEmpty(rp.Parameters.PayID)) //{ // throw new APIException("缺少参数【PayID】或参数值为空") { ErrorCode = 135 }; //} var loggingSessionInfo = Default.GetBSLoggingSession(CustomerID, UserID); //会员 var vipBll = new VipBLL(loggingSessionInfo); var vipAmountBll = new VipAmountBLL(loggingSessionInfo); var vipCardVipMappingBll = new VipCardVipMappingBLL(loggingSessionInfo); //支付 var tPaymentTypeCustomerMappingBll = new TPaymentTypeCustomerMappingBLL(loggingSessionInfo); var tPaymentTypeBll = new T_Payment_TypeBLL(loggingSessionInfo); var paymentDetailBll = new T_Payment_detailBLL(loggingSessionInfo); //门店 var unitBLL = new t_unitBLL(loggingSessionInfo); //商品订单支付 //更新积分和状态 //var loggingSessionInfo = Default.GetBSLoggingSession(CustomerID, "1"); var inoutBll = new T_InoutBLL(loggingSessionInfo);//订单业务对象实例化 var trrBll = new T_RewardRecordBLL(loggingSessionInfo); //辨别打赏订单 var rewardOrderPrefix = "REWARD|"; if (OrderID.Contains(rewardOrderPrefix)) { OrderID = OrderID.Substring(rewardOrderPrefix.Length, OrderID.Length - rewardOrderPrefix.Length); var trrEntity = trrBll.GetByID(OrderID); trrEntity.PayStatus = 2; trrEntity.LastUpdateTime = DateTime.Now; trrEntity.LastUpdateBy = loggingSessionInfo.UserID; trrBll.Update(trrEntity); #region 员工余额变更--需要独立出来处理 var userAmountBll = new VipAmountBLL(loggingSessionInfo); //作为员工余额使用 var employeeId = trrEntity.RewardedOP; var rewardAmount = trrEntity.RewardAmount == null ? 0 : (decimal)trrEntity.RewardAmount; //转为非null的decimal类型 //门店 var unitService = new UnitService(loggingSessionInfo); var unitInfo = unitService.GetUnitByUser(CustomerID, employeeId).FirstOrDefault();//获取员工所属门店 var tran = userAmountBll.GetTran(); using (tran.Connection)//事务 { try { var userAmountEntity = userAmountBll.GetByID(trrEntity.RewardedOP); if (userAmountEntity == null) { //创建 userAmountEntity = new VipAmountEntity { VipId = employeeId,//员工ID VipCardCode = string.Empty, BeginAmount = 0, InAmount = rewardAmount, OutAmount = 0, EndAmount = rewardAmount, TotalAmount = rewardAmount, BeginReturnAmount = 0, InReturnAmount = 0, OutReturnAmount = 0, ReturnAmount = 0, ImminentInvalidRAmount = 0, InvalidReturnAmount = 0, ValidReturnAmount = 0, TotalReturnAmount = 0, IsLocking = 0, CustomerID = CustomerID }; userAmountBll.Create(userAmountEntity, tran);//创建员工余额表 } else { //修改 if (rewardAmount > 0) { userAmountEntity.InAmount = (userAmountEntity.InAmount == null ? 0 : userAmountEntity.InAmount.Value) + rewardAmount; userAmountEntity.TotalAmount = (userAmountEntity.TotalAmount == null ? 0 : userAmountEntity.TotalAmount.Value) + rewardAmount; } else { userAmountEntity.OutAmount = (userAmountEntity.OutAmount == null ? 0 : userAmountEntity.OutAmount.Value) + Math.Abs(rewardAmount); } userAmountEntity.EndAmount = (userAmountEntity.EndAmount == null ? 0 : userAmountEntity.EndAmount.Value) + rewardAmount; userAmountBll.Update(userAmountEntity, tran);//更新余额 } var vipamountDetailBll = new VipAmountDetailBLL(loggingSessionInfo); var vipAmountDetailEntity = new VipAmountDetailEntity { VipAmountDetailId = Guid.NewGuid(), VipCardCode = string.Empty, VipId = employeeId,//员工ID UnitID = unitInfo != null ? unitInfo.unit_id : string.Empty, UnitName = unitInfo != null ? unitInfo.Name : string.Empty, Amount = rewardAmount, UsedReturnAmount = 0, EffectiveDate = DateTime.Now, DeadlineDate = Convert.ToDateTime("9999-12-31 23:59:59"), AmountSourceId = "26", Reason = "Reward", CustomerID = CustomerID }; vipamountDetailBll.Create(vipAmountDetailEntity, tran); //创建余额详情 tran.Commit(); //提交事务 } catch (Exception ex) { tran.Rollback(); Loggers.Debug(new DebugLogInfo() { Message = "异常-->支付成功回调时更新会员打赏金额出错(PayNotify.ashx):" + ex }); } } #endregion if (trrEntity != null) { context.Response.Write("SUCCESS"); } else { context.Response.Write("FAIL"); } return; } //获取会员信息 var vipInfo = vipBll.GetByID(loggingSessionInfo.UserID); //支付信息 Bear //var tPaymentTypeCustomerMappingEntity = tPaymentTypeCustomerMappingBll.QueryByEntity(new TPaymentTypeCustomerMappingEntity(){ChannelId = ChannelID,CustomerId = loggingSessionInfo.ClientID },null).FirstOrDefault(); var paymentTypeList = tPaymentTypeBll.GetAll(); var tPaymentType = paymentTypeList.ToList() .Find(t => t.Payment_Type_Code == "WXJS"); //var tPaymentType = tPaymentTypeBll.GetByID(tPaymentTypeCustomerMappingEntity.PaymentTypeID); //获取订单信息 var inoutInfo = inoutBll.GetByID(OrderID); if (inoutInfo != null) { var bll = new TInOutStatusNodeBLL(loggingSessionInfo); string msg; if (!bll.SetOrderPayment(OrderID, out msg, ChannelID, SerialPay)) //if (!bll.SetOrderPayment(OrderID, out msg, ChannelID)) { throw new Exception(msg); } else if (string.IsNullOrEmpty(inoutInfo.Field17) && string.IsNullOrEmpty(inoutInfo.Field18)) { #region 发送订单支付成功微信模板消息 var SuccessCommonBLL = new CommonBLL(); //SuccessCommonBLL.SentPaymentMessage(inoutInfo, vipInfo.WeiXinUserId,vipInfo.VIPID, loggingSessionInfo); new SendOrderPaySuccessMsgBLL().SentPaymentMessage(inoutInfo, vipInfo.WeiXinUserId, vipInfo.VIPID, loggingSessionInfo); #endregion Loggers.Debug(new DebugLogInfo() { Message = "调用SetOrderPayment方法更新订单成功" }); } //获取订单信息,根据Field3==1判断,如果是ALD订单,则调用ALD接口更新ALD订单的状态 #region 更新ALD状态 //var orderbll = new InoutService(loggingSessionInfo); //var orderInfo = orderbll.GetInoutInfoById(OrderID); //if (orderInfo.Field3 == "1") //{ // Loggers.Debug(new DebugLogInfo() { Message = string.Format("更新O2OMarketing订单状态成功[OrderID={0}].", OrderID) }); // //更新阿拉丁的订单状态 // JIT.CPOS.Web.OnlineShopping.data.DataOnlineShoppingHandler.ALDChangeOrderStatus aldChangeOrder = new data.DataOnlineShoppingHandler.ALDChangeOrderStatus(); // if (string.IsNullOrEmpty(orderInfo.vip_no)) // throw new Exception("会员ID不能为空,OrderID:" + OrderID); // aldChangeOrder.MemberID = new Guid(orderInfo.vip_no); // aldChangeOrder.SourceOrdersID = OrderID; // aldChangeOrder.Status = int.Parse(orderInfo.status); // aldChangeOrder.IsPaid = true; // JIT.CPOS.Web.OnlineShopping.data.DataOnlineShoppingHandler.ALDChangeOrderStatusRequest aldRequest = new data.DataOnlineShoppingHandler.ALDChangeOrderStatusRequest(); // aldRequest.BusinessZoneID = 1;//写死 // aldRequest.Locale = 1; // aldRequest.UserID = new Guid(orderInfo.vip_no); // aldRequest.Parameters = aldChangeOrder; // var url = ConfigurationManager.AppSettings["ALDGatewayURL"]; // var postContent = string.Format("Action=ChangeOrderStatus&ReqContent={0}", aldRequest.ToJSON()); // Loggers.Debug(new DebugLogInfo() { Message = "通知ALD更改状态:" + postContent }); // var strAldRsp = HttpWebClient.DoHttpRequest(url, postContent); // var aldRsp = strAldRsp.DeserializeJSONTo<JIT.CPOS.Web.OnlineShopping.data.DataOnlineShoppingHandler.ALDResponse>(); // if (!aldRsp.IsSuccess()) // { // Loggers.Debug(new DebugLogInfo() { Message = string.Format("更新阿拉丁订单状态失败[Request ={0}][Response={1}]", aldRequest.ToJSON(), strAldRsp) }); // } //} #endregion #region 格力推送通知 //try //{ // GLServiceOrderBLL glsobll = new GLServiceOrderBLL(loggingSessionInfo); // if (glsobll.ValidateGree(CustomerID, "cpos_bs_lj"))//先写死 // glsobll.GreePushPaymentOorder(CustomerID, OrderID, loggingSessionInfo); //} //catch (Exception ex) //{ // Loggers.Debug(new DebugLogInfo() { Message = string.Format("付款推送评价师傅链接失败[OrderID={0}].", OrderID) }); //} #endregion #region ALD生活服务处理 //var rechargeBll = new RechargeStrategyBLL(loggingSessionInfo); //var vipAmountBll = new VipAmountBLL(loggingSessionInfo); //var couponBll = new CouponBLL(loggingSessionInfo); //var vipCouponMappingBll = new VipCouponMappingBLL(loggingSessionInfo); //var unitBll = new UnitBLL(loggingSessionInfo); //DataSet dsOrderInfo = rechargeBll.GetInoutOrderItems(OrderID); //int itemSort = 0; //商品业务分类 //string skuId = string.Empty; //商品SkuId //string vipId = string.Empty; //会员ID //string itemId = string.Empty;//商品ID //string couponId = string.Empty;//优惠券ID //if (dsOrderInfo.Tables[0].Rows.Count > 0) //{ // //if (dsOrderInfo.Tables[0].Rows[0]["ItemSort"] != DBNull.Value && Convert.ToString(dsOrderInfo.Tables[0].Rows[0]["ItemSort"]) != "0") // itemSort = int.Parse(dsOrderInfo.Tables[0].Rows[0]["ItemSort"].ToString()); // switch (itemSort) // { // case 2://充 // #region 充值金额处理 // VipAmountDetailBLL vipAmountDetailBll = new VipAmountDetailBLL(loggingSessionInfo); // List<IWhereCondition> complexCondition = new List<IWhereCondition> { }; // complexCondition.Add(new EqualsCondition() { FieldName = "ObjectId", Value = OrderID }); // var vipAmountDetal = vipAmountDetailBll.Query(complexCondition.ToArray(), null); // if (vipAmountDetal.Count() == 0)//确认没有多次执行回调 // { // ////查询 // //RechargeStrategyEntity[] rechargeList = rechargeBll.Query(complexCondition.ToArray(), lstOrder.ToArray()); // skuId = dsOrderInfo.Tables[0].Rows[0]["SkuId"].ToString(); // //RechargeStrategyEntity rechargeEntity = rechargeBll.GetByID(skuId); // DataSet dsSkuPirce = unitBll.GetSkuPirce(skuId); // decimal salePrice = 0;//购买金额 // decimal returnCash = 0;//奖励金额 // if (dsSkuPirce.Tables[0].Rows.Count > 0) // { // salePrice = Convert.ToDecimal(dsSkuPirce.Tables[0].Rows[0]["SalesPrice"].ToString()); // returnCash = Convert.ToDecimal(dsSkuPirce.Tables[0].Rows[0]["ReturnCash"].ToString()); // InoutService server = new InoutService(loggingSessionInfo); // #region 充值金额 // var tran = server.GetTran(); // using (tran.Connection)//事物 // { // try // { // //充值金额 // vipAmountBll.AddVipEndAmount(UserID, salePrice, tran, "4", OrderID, loggingSessionInfo);//4=充值 // tran.Commit(); // } // catch (Exception) // { // tran.Rollback(); // throw; // } // } // #endregion // #region 奖励金额 // var tran2 = server.GetTran(); // using (tran2.Connection)//事物 // { // try // { // //奖励金额 // vipAmountBll.AddVipEndAmount(UserID, returnCash, tran2, "6", OrderID, loggingSessionInfo);//6=奖励金额 // tran2.Commit(); // } // catch (Exception) // { // tran2.Rollback(); // throw; // } // } // #endregion // } // } // #endregion // break; // case 3://券 // #region 券类商品绑定到会员 // itemId = dsOrderInfo.Tables[0].Rows[0]["ItemId"].ToString(); // vipId = dsOrderInfo.Tables[0].Rows[0]["VipId"].ToString(); // couponId = couponBll.GetCouponByItemId(itemId); // if (!string.IsNullOrEmpty(couponId)) // { // VipCouponMappingEntity coupon = new VipCouponMappingEntity // { // VIPID = vipId, // CouponID = couponId, // }; // vipCouponMappingBll.Create(coupon); // } // #endregion // break; // default: // break; // } //} #endregion #region 订单与分润关系处理 add by Henry 2014-10-10 //var orderSubBll = new OrderOrderSubRunObjectMappingBLL(loggingSessionInfo); //dynamic o = orderSubBll.SetOrderSub(CustomerID, OrderID); //Type t = o.GetType(); //var Desc = t.GetProperty("Desc").GetValue(o, null).ToString(); //var IsSuccess = t.GetProperty("IsSuccess").GetValue(o, null).ToString(); //if (int.Parse(IsSuccess.ToString()) == 0) //失败 // Loggers.Debug(new DebugLogInfo() { Message = string.Format("订单与分润关系处理失败:{0}", Desc) }); #endregion CustomerBasicSettingBLL customerBasicSettingBll = new CustomerBasicSettingBLL(loggingSessionInfo); string AfterPaySetStock = customerBasicSettingBll.GetSettingValueByCode("AfterPaySetStock"); if (AfterPaySetStock == "1") { var inoutServiceBLL = new InoutService(loggingSessionInfo); var inoutDetailList = inoutServiceBLL.GetInoutDetailInfoByOrderId(OrderID); inoutBll.SetStock(OrderID, inoutDetailList, 1, loggingSessionInfo); } ///超级分销商订单入队列 if (inoutInfo.data_from_id == "35" || inoutInfo.data_from_id == "36") { BS.BLL.RedisOperationBLL.Order.SuperRetailTraderOrderBLL bllSuperRetailTraderOrder = new BS.BLL.RedisOperationBLL.Order.SuperRetailTraderOrderBLL(); bllSuperRetailTraderOrder.SetRedisToSuperRetailTraderOrder(loggingSessionInfo, inoutInfo); } //购卡 if (!string.IsNullOrEmpty(inoutInfo.Field17) && !string.IsNullOrEmpty(inoutInfo.Field18)) { //更新订单状态 inoutInfo = inoutBll.GetByID(OrderID); inoutInfo.Field7 = "700"; inoutInfo.status = "700"; inoutInfo.status_desc = "已完成"; inoutInfo.Field10 = "已完成"; inoutBll.Update(inoutInfo); //会员卡升级 vipCardVipMappingBll.BindVirtualItem(vipInfo.VIPID, vipInfo.VipCode, inoutInfo.sales_unit_id, Convert.ToInt32(inoutInfo.Field18), orderId: inoutInfo.order_id); //分润计算 RedisSalesVipCardOrderBLL redisSalesVipCardOrderBll = new RedisSalesVipCardOrderBLL(); redisSalesVipCardOrderBll.SetRedisSalesVipCardOrder(loggingSessionInfo, inoutInfo); //售卡处理积分、返现、佣金[完成订单] new SendOrderRewardMsgBLL().OrderReward(inoutInfo, loggingSessionInfo, null);//存入到缓存 } else { //订单入队列 RedisCalculateVipConsumeForUpgrade redisCalculateVipConsumeForUpgrade = new RedisCalculateVipConsumeForUpgrade(); redisCalculateVipConsumeForUpgrade.SetVipConsumeForUpgradeList(loggingSessionInfo, inoutInfo); } // add by liangx 2016-09-27 获取订单中的虚拟商品 start CouponTypeBLL couponTypeBLL = new CouponTypeBLL(loggingSessionInfo); RedisVipMappingCouponBLL redisVipMappingCouponBLL = new RedisVipMappingCouponBLL(); var couponTypes = couponTypeBLL.GetVirtualItemCouponTypes(inoutInfo.order_id); if (couponTypes.Any()) { redisVipMappingCouponBLL.SetVipMappingCoupon(couponTypes, "", couponTypes.FirstOrDefault().VipId, "PayVirtualItem"); } // add by liangx 2016-09-27 获取订单中的虚拟商品 end //获取门店信息 t_unitEntity unitInfo = null; if (!string.IsNullOrEmpty(inoutInfo.sales_unit_id)) { unitInfo = unitBLL.GetByID(inoutInfo.sales_unit_id); } //入支付明细表 var paymentDetail = new T_Payment_detailEntity() { Payment_Id = Guid.NewGuid().ToString(), Inout_Id = inoutInfo.order_id, UnitCode = unitInfo == null ? "" : unitInfo.unit_code, Payment_Type_Id = tPaymentType.Payment_Type_Id, Payment_Type_Code = tPaymentType.Payment_Type_Code, Payment_Type_Name = tPaymentType.Payment_Type_Name, Price = inoutInfo.actual_amount, Total_Amount = inoutInfo.total_amount, Pay_Points = inoutInfo.pay_points, CustomerId = loggingSessionInfo.ClientID }; paymentDetailBll.Create(paymentDetail); List <IWhereCondition> complexCondition = new List <IWhereCondition> { }; complexCondition.Add(new EqualsCondition() { FieldName = "Inout_Id", Value = inoutInfo.order_id }); var paymentDetailList = paymentDetailBll.Query(complexCondition.ToArray(), null); try { var msgRabbitMQ = new EventContract { Operation = OptEnum.Create, EntityType = EntityTypeEnum.Order, Id = inoutInfo.order_id }; var service = new EventService(); service.PublishMsg(msgRabbitMQ); foreach (var detail in paymentDetailList) { var paymentMQ = new EventContract { Operation = OptEnum.Create, EntityType = EntityTypeEnum.OrderPayment, Id = detail.Payment_Id }; service.PublishMsg(paymentMQ); } } catch (Exception) { throw new Exception("RabbitMQ Error"); } } else//充值订单 { var rechargeOrderBll = new RechargeOrderBLL(loggingSessionInfo); var vipamountDetailBll = new VipAmountDetailBLL(loggingSessionInfo); var rechargeOrderInfo = rechargeOrderBll.GetByID(OrderID); if (rechargeOrderInfo != null) { //获取门店信息 t_unitEntity unitInfo = null; if (!string.IsNullOrEmpty(rechargeOrderInfo.UnitId)) { unitInfo = unitBLL.GetByID(rechargeOrderInfo.UnitId); } //充值 rechargeOrderBll.Recharge(rechargeOrderInfo, vipInfo, unitInfo, tPaymentType.Payment_Type_Id); //入支付明细表 var paymentDetail = new T_Payment_detailEntity() { Payment_Id = Guid.NewGuid().ToString(), Inout_Id = rechargeOrderInfo.OrderID.ToString(), UnitCode = unitInfo == null ? "" : unitInfo.unit_code, Payment_Type_Id = tPaymentType.Payment_Type_Id, Payment_Type_Code = tPaymentType.Payment_Type_Code, Payment_Type_Name = tPaymentType.Payment_Type_Name, Price = rechargeOrderInfo.ActuallyPaid, Total_Amount = rechargeOrderInfo.TotalAmount, Pay_Points = rechargeOrderInfo.PayPoints, CustomerId = loggingSessionInfo.ClientID }; paymentDetailBll.Create(paymentDetail); } else { var receiveAmountOrderBll = new ReceiveAmountOrderBLL(loggingSessionInfo); var receiveAmountOrderEntity = receiveAmountOrderBll.GetByID(OrderID); //更新订单状态 if (receiveAmountOrderEntity != null) { VipIntegralBLL vipIntegralBll = new VipIntegralBLL(loggingSessionInfo); //更新订单 receiveAmountOrderEntity.PayStatus = "10"; // Bear //receiveAmountOrderEntity.PayTypeId = tPaymentTypeCustomerMappingEntity.PaymentTypeID; receiveAmountOrderEntity.PayTypeId = tPaymentType.Payment_Type_Id; receiveAmountOrderEntity.PayDatetTime = DateTime.Now; receiveAmountOrderBll.Update(receiveAmountOrderEntity); //获取门店信息 t_unitEntity unitInfo = null; if (!string.IsNullOrEmpty(receiveAmountOrderEntity.ServiceUnitId)) { unitInfo = unitBLL.GetByID(receiveAmountOrderEntity.ServiceUnitId); } //使用过积分,处理积分 if (receiveAmountOrderEntity.PayPoints != 0 && receiveAmountOrderEntity.PayPoints != null) { string sourceId = "20"; //积分抵扣 var IntegralDetail = new VipIntegralDetailEntity() { Integral = -Convert.ToInt32(receiveAmountOrderEntity.PayPoints), IntegralSourceID = sourceId, ObjectId = receiveAmountOrderEntity.OrderId.ToString() }; if (IntegralDetail.Integral != 0) { //变动前积分 string OldIntegral = (vipInfo.Integration ?? 0).ToString(); //变动积分 string ChangeIntegral = (IntegralDetail.Integral ?? 0).ToString(); var vipIntegralDetailId = vipIntegralBll.AddIntegral(ref vipInfo, unitInfo, IntegralDetail, loggingSessionInfo); //发送微信积分变动通知模板消息 if (!string.IsNullOrWhiteSpace(vipIntegralDetailId)) { var CommonBLL = new CommonBLL(); CommonBLL.PointsChangeMessage(OldIntegral, vipInfo, ChangeIntegral, vipInfo.WeiXinUserId, loggingSessionInfo); } } } //if (receiveAmountOrderEntity.CouponUsePay != 0 || receiveAmountOrderEntity.CouponUsePay != null) //{ // //更新使用记录 // var couponUseBll = new CouponUseBLL(loggingSessionInfo); // var couponUseEntity = new CouponUseEntity() // { // CouponUseID = Guid.NewGuid(), // CouponID = rp.CouponId, // VipID = vipInfo.VIPID, // UnitID = rp.UnitId, // OrderID = orderId.ToString(), // Comment = "商城使用电子券", // CustomerID = CurrentUserInfo.ClientID, // CreateBy = CurrentUserInfo.UserID, // CreateTime = DateTime.Now, // LastUpdateBy = CurrentUserInfo.UserID, // LastUpdateTime = DateTime.Now, // IsDelete = 0 // }; // couponUseBll.Create(couponUseEntity); // var couponBll = new CouponBLL(CurrentUserInfo); // var couponEntity = couponBll.GetByID(rp.CouponId); // //更新CouponType数量 // var conponTypeBll = new CouponTypeBLL(CurrentUserInfo); // var conponTypeEntity = conponTypeBll.QueryByEntity(new CouponTypeEntity() { CouponTypeID = new Guid(couponEntity.CouponTypeID), CustomerId = CurrentUserInfo.ClientID }, null).FirstOrDefault(); // conponTypeEntity.IsVoucher += 1; // conponTypeBll.Update(conponTypeEntity); // //停用该优惠券 // couponEntity.Status = 1; // couponBll.Update(couponEntity); //} //处理余额 if (receiveAmountOrderEntity.AmountAcctPay != null && receiveAmountOrderEntity.AmountAcctPay != 0) { var vipAmountDetailBll = new VipAmountDetailBLL(loggingSessionInfo); var vipAmountEntity = vipAmountBll.QueryByEntity(new VipAmountEntity() { VipId = vipInfo.VIPID, VipCardCode = vipInfo.VipCode }, null).FirstOrDefault(); if (vipAmountEntity != null) { var detailInfo = new VipAmountDetailEntity() { Amount = -receiveAmountOrderEntity.AmountAcctPay, AmountSourceId = "1", ObjectId = receiveAmountOrderEntity.OrderId.ToString() }; var vipAmountDetailId = vipAmountBll.AddVipAmount(vipInfo, unitInfo, ref vipAmountEntity, detailInfo, loggingSessionInfo); if (!string.IsNullOrWhiteSpace(vipAmountDetailId)) {//发送微信账户余额变动模板消息 var CommonBLL = new CommonBLL(); CommonBLL.BalanceChangedMessage(receiveAmountOrderEntity.OrderNo, vipAmountEntity, detailInfo, vipInfo.WeiXinUserId, vipInfo.VIPID, loggingSessionInfo); } } } //收款订单积分奖励 vipIntegralBll.OrderReward(receiveAmountOrderEntity, null); var paymentDetail = new T_Payment_detailEntity() { Payment_Id = Guid.NewGuid().ToString(), Inout_Id = receiveAmountOrderEntity.OrderId.ToString(), UnitCode = unitInfo == null ? "" : unitInfo.unit_code, Payment_Type_Id = tPaymentType.Payment_Type_Id, Payment_Type_Code = tPaymentType.Payment_Type_Code, Payment_Type_Name = tPaymentType.Payment_Type_Name, Price = receiveAmountOrderEntity.TransAmount, Total_Amount = receiveAmountOrderEntity.TotalAmount, Pay_Points = receiveAmountOrderEntity.PayPoints, CustomerId = loggingSessionInfo.ClientID }; paymentDetailBll.Create(paymentDetail); } } } context.Response.Write("SUCCESS"); } } } catch (Exception ex) { Loggers.Exception(new ExceptionLogInfo(ex)); context.Response.Write("ERROR:" + ex.Message); } }
/// <summary> /// 获取会员扫码信息详情 /// </summary> /// <param name="pReques"></param> /// <returns></returns> public string GetVipCartDetail(string pReques) { getVipCardDetailData respData = new getVipCardDetailData(); try { var reqObj = pReques.DeserializeJSONTo <reqConunbondata>(); BaseService.WriteLogWeixin("GetVipCartDetail获取会员扫码信息请求参数:" + reqObj.ToJSON()); if (string.IsNullOrEmpty(reqObj.userId)) { respData.ResultCode = "103"; respData.Message = "登陆用户不能为空"; return(respData.ToJSON()); } //redis使用缓存地址 string redisUrl = ConfigurationManager.AppSettings["RedisApiUrl"]; Random rd = new Random(); int num = rd.Next(100000, 1000000); int num2 = rd.Next(100000, 1000000); string redisKey = num.ToString() + num2.ToString(); //缓存的Key值二维码 string redisTime = "2"; //缓存过期时间分为单位 string url = ""; BaseService.WriteLogWeixin("开始获取用户信息:" + redisUrl); var loggingSessionInfo = Default.GetBSLoggingSession(reqObj.customerId, reqObj.userId); CouponBLL bll = new CouponBLL(loggingSessionInfo); DataSet ds = bll.GetVipCartDetail(reqObj.userId); if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { string vipCardCode = "" + ds.Tables[0].Rows[0]["VipCardCode"]; respData.QRUrl = GeneratedQR(redisKey); //生成redisKey值会员的二维码 respData.BarUrl = Utils.GeneratedBar(redisKey, 350, 100); //生成redisKey值会员的条形码 respData.vipCardCode = redisKey; //二维码返回信息 respData.ExpiredTime = "90"; //过期时间 //存入缓存 url = redisUrl + "keyvalue/set/" + redisKey + "/" + vipCardCode + "/" + redisTime; var data = CommonBLL.GetRemoteData(url, "Get", string.Empty); var redisEntity = data.DeserializeJSONTo <RedisEntity>(); if (redisEntity.Message == "success") { BaseService.WriteLogWeixin(vipCardCode + "值缓存成功!"); } } else { respData.ResultCode = "103"; respData.Message = "无效的会员扫码信息"; return(respData.ToJSON()); } } catch (Exception ex) { respData.ResultCode = "103"; respData.Message = "数据库操作失败"; BaseService.WriteLogWeixin("GetVipCartDetail程序异常:" + ex.Message + ";堆栈信息:" + ex.StackTrace); } return(respData.ToJSON()); }
private void btnLogin_Click(object sender, EventArgs e) { try { CommonBLL.SetLocalSystemDateTime( ); bool flag = false; string strUser = txtUserNo.Text.Trim( ); string strPassword = txtPassword.Text.Trim( ); if (strUser.Length == 0) { MessageBox.Show("工号不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Question); this.txtUserNo.Focus( ); return; } if (strPassword.Length == 0) { MessageBox.Show("密码不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Question); this.txtPassword.Focus( ); return; } flag = bll.EmployeeExists(strUser); if (!flag) { MessageBox.Show("工号输入错误!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Question); txtUserNo.Select(0, txtUserNo.Text.Trim( ).Length); this.txtUserNo.Focus( ); return; } flag = bll.ValidateEmployee(strUser, strPassword); if (!flag) { MessageBox.Show("密码输入错误!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Question); txtPassword.Select(0, txtPassword.Text.Trim( ).Length); this.txtPassword.Focus( ); return; } DataSet dsEmployeeInfo = elBLL.GetDsEmployeeInfo(strUser); if (dsEmployeeInfo.Tables[0].Rows.Count > 0) { UserId = dsEmployeeInfo.Tables[0].Rows[0]["EmployeeId"].ToString( ); } elBLL.DeleteEmployeeLogin(UserId, StrIP); //将非法退出的记录进行删除 DataTable dt = elBLL.GetEmployeeLoginByEmployeeId(UserId).Tables[0]; DateTime curDT = DateTime.Parse(CommonBLL.GetDate("yyyy-MM-dd HH:mm:ss")); bool flag1 = false; if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { if (bool.Parse(row["Flag"].ToString( ))) { DateTime tempdt = DateTime.Parse(row["CurrentTime"].ToString( )); if (curDT > tempdt) { TimeSpan ts = curDT - tempdt; //ts.TotalSeconds //DateTime diffDT = curDT.Subtract(tempdt); if (ts.TotalSeconds >= 0 && ts.TotalSeconds <= 60) { flag1 = true; } } else { flag1 = true; } } else { DateTime tempdt = DateTime.Parse(row["LoginTime"].ToString( )); if (curDT > tempdt) { TimeSpan ts = curDT - tempdt; //ts.TotalSeconds //DateTime diffDT = curDT.Subtract(tempdt); if (ts.TotalSeconds >= 0 && ts.TotalSeconds <= 60) { flag1 = true; } } else { flag1 = true; } } } } if (flag1) { MessageBox.Show("该用户正在登陆系统,该系统不允许重复登陆!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Question); this.Dispose( ); Application.Exit( ); return; } else { EmployeeLoginEntity elEntity = new EmployeeLoginEntity( ); StrMAC = "1111111111111111111"; elEntity.EmployeeId = UserId; elEntity.IpAddress = StrIP; elEntity.MacAddress = StrMAC; elEntity.LoginTime = DateTime.Parse(CommonBLL.GetDate("yyyy-MM-dd HH:mm:ss")); elEntity.Flag = false; LoginId = elBLL.AddEmployeeLogin(elEntity); FrmMain main = new FrmMain( ); this.Hide( ); main.Show( ); return; } //FrmMain main = new FrmMain(); //this.Hide(); //main.Show(); } catch (Exception Err) { MessageBox.Show("无法连接服务器,请联系管理员.\n" + Err.Message, "系统提示"); Environment.Exit(0); } }
const int ERROR_LOAD_WRONG = 302; //打开出错 protected override GetSetoffToolDetailRD ProcessRequest(APIRequest <GetSetoffToolDetailRP> pRequest) { string content = string.Empty; string customerId = string.Empty; GetSetoffToolDetailRD setoffToolDetailRD = new GetSetoffToolDetailRD(); var para = pRequest.Parameters; customerId = CurrentUserInfo.CurrentUser.customer_id; try { var imageUrl = string.Empty; Random ro = new Random(); var iUp = 100000000; var iDown = 50000000; var rpVipDCode = 0; //临时二维码 var iResult = ro.Next(iDown, iUp); //随机数 var userQrCodeBll = new WQRCodeManagerBLL(CurrentUserInfo); var imgBll = new ObjectImagesBLL(CurrentUserInfo); var setOffPosterBLL = new SetoffPosterBLL(CurrentUserInfo); var SetoffToolUserViewBLL = new SetoffToolUserViewBLL(CurrentUserInfo); var SetoffToolsBll = new SetoffToolsBLL(CurrentUserInfo); var SetOffPosterInfo = setOffPosterBLL.QueryByEntity(new SetoffPosterEntity() { SetoffPosterID = new Guid(para.ObjectId) }, null); //获取集客海报信息 var setoffEventBLL = new SetoffEventBLL(CurrentUserInfo); var setoffEventInfo = setoffEventBLL.QueryByEntity(new SetoffEventEntity() { Status = "10", SetoffType = 1, CustomerId = customerId }, null); //var SetoffToolsInfo = SetoffToolsBll.QueryByEntity(new SetoffToolsEntity() { ObjectId = para.ObjectId, Status = "10", ToolType = para.ToolType, SetoffEventID = setoffEventInfo[0].SetoffEventID }, null);//获取工具信息 //VipDcode=9生成永久二维码 if (para.VipDCode == 9) { //根据分享人ID和对象ID获取永久二维码信息 var userQrCode = userQrCodeBll.QueryByEntity(new WQRCodeManagerEntity() { ObjectId = para.ObjectId }, null); if (userQrCode != null && userQrCode.Length > 0) { if (para.ToolType == "Coupon")//如果类型为优惠券则返回二维码 { setoffToolDetailRD.ToolType = para.ToolType; } if (para.ToolType == "SetoffPoster")//如果为集客海报则返回背景图和二维码 { if (SetOffPosterInfo != null) { var backImgInfo = imgBll.QueryByEntity(new ObjectImagesEntity() { ObjectId = SetOffPosterInfo[0].ImageId }, null); setoffToolDetailRD.ToolType = para.ToolType; setoffToolDetailRD.imageUrl = userQrCode[0].ImageUrl; setoffToolDetailRD.paraTemp = userQrCode[0].QRCode; setoffToolDetailRD.backImgUrl = backImgInfo[0].ImageURL; } } setoffToolDetailRD.imageUrl = userQrCode[0].ImageUrl; setoffToolDetailRD.paraTemp = userQrCode[0].QRCode; return(setoffToolDetailRD); } //获取当前二维码 最大值 iResult = new WQRCodeManagerBLL(CurrentUserInfo).GetMaxWQRCod() + 1; rpVipDCode = 1; } #region 获取微信帐号 var server = new WApplicationInterfaceBLL(CurrentUserInfo); var wxObj = new WApplicationInterfaceEntity(); wxObj = server.QueryByEntity(new WApplicationInterfaceEntity { CustomerId = customerId }, null).FirstOrDefault(); if (wxObj == null) { throw new APIException("不存在对应的微信帐号.") { ErrorCode = ERROR_NULL_WXOBJ }; } else { var commonServer = new CommonBLL(); //rpVipDCode 二维码类型 0: 临时二维码 1:永久二维码 imageUrl = commonServer.GetQrcodeUrl(wxObj.AppID, wxObj.AppSecret, rpVipDCode.ToString(""), iResult, CurrentUserInfo);//iResult作为场景值ID,临时二维码时为32位整型,永久二维码时只支持1--100000 //供本地测试时使用 "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQGN7zoAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL1dreENCS1htX0xxQk94SEJ6MktIAAIEUk88VwMECAcAAA=="; } #endregion if (para.VipDCode == 9 && !string.IsNullOrEmpty(imageUrl)) //永久二维码 { #region 创建店员永久二维码匹配表 var userQrTypeBll = new WQRCodeTypeBLL(CurrentUserInfo); string pTypeCode = string.Empty; if (para.ToolType.ToLower() == "coupon") { pTypeCode = "CouponQrCode"; } if (para.ToolType.ToLower() == "setoffposter") { pTypeCode = "SetoffPosterQrCode"; } if (para.ToolType.ToLower() == "superretail") { pTypeCode = "SuperRetailQrCode"; } var userQrType = userQrTypeBll.QueryByEntity(new WQRCodeTypeEntity() { TypeCode = pTypeCode }, null); //"SuperRetailQrCode=超级分销商二维码" if (userQrType != null && userQrType.Length > 0) { var userQrcodeBll = new WQRCodeManagerBLL(CurrentUserInfo); var userQrCode = new WQRCodeManagerEntity(); userQrCode.QRCode = iResult.ToString();//记录传过去的二维码场景值 userQrCode.QRCodeTypeId = userQrType[0].QRCodeTypeId; userQrCode.IsUse = 1; userQrCode.CustomerId = customerId; userQrCode.ImageUrl = imageUrl; userQrCode.ApplicationId = wxObj.ApplicationId; //objectId 为集客海报ID或者优惠券ID userQrCode.ObjectId = para.ObjectId; userQrcodeBll.Create(userQrCode); } #endregion } else { #region 创建临时匹配表 VipDCodeBLL vipDCodeServer = new VipDCodeBLL(CurrentUserInfo); VipDCodeEntity info = new VipDCodeEntity(); info.DCodeId = iResult.ToString();//记录传过去的二维码场景值****(保存到数据库时没加空格) info.CustomerId = customerId; VipBLL vipBll = new VipBLL(CurrentUserInfo); info.UnitId = ""; info.Status = "0"; info.IsReturn = 0; info.DCodeType = para.VipDCode; info.CreateBy = CurrentUserInfo.UserID; info.ImageUrl = imageUrl; info.VipId = ""; info.ObjectId = para.ObjectId; //工具对象ID(优惠券或集客海报对象ID) info.OwnerUserId = para.ShareVipId; //分享人ID vipDCodeServer.Create(info); #endregion } int flag = 0;//定义是否需要新增打开数据,0=不需要新增,1=需要新增 var UserViewData = SetoffToolUserViewBLL.QueryByEntity(new SetoffToolUserViewEntity() { ObjectId = para.ObjectId, UserID = CurrentUserInfo.UserID }, null); if (!string.IsNullOrEmpty(para.SetoffToolID)) { UserViewData = SetoffToolUserViewBLL.QueryByEntity(new SetoffToolUserViewEntity() { ObjectId = para.ObjectId, UserID = CurrentUserInfo.UserID, SetoffToolID = new Guid(para.SetoffToolID) }, null); } if (UserViewData.Length == 0 && !string.IsNullOrEmpty(para.SetoffToolID) && para.PlatformType != "3") { flag = 1; //当为1时进行增加打开工具记录 } if (para.ToolType == "Coupon") //如果类型为优惠券则返回二维码 { #region 用户领优惠券过程 var CouponTypeBLL = new CouponTypeBLL(CurrentUserInfo); var couponBLL = new CouponBLL(CurrentUserInfo); var CouponSourceBLL = new CouponSourceBLL(CurrentUserInfo); var VipCouponMappingBLL = new VipCouponMappingBLL(CurrentUserInfo); int?SurplusCount = 0; //先获得剩余张数 int hasCouponCount = 0; //已领张数 如果>0表示已领取过就不让他领,=0就领取 var couponTypeInfo = CouponTypeBLL.QueryByEntity(new CouponTypeEntity() { CouponTypeID = new Guid(para.ObjectId) }, null); if (couponTypeInfo != null) { string couponIsVocher = string.Empty; if (couponTypeInfo[0].IsVoucher == null) { SurplusCount = couponTypeInfo[0].IssuedQty - 0; } else { SurplusCount = couponTypeInfo[0].IssuedQty - couponTypeInfo[0].IsVoucher; } if (SurplusCount != 0 && para.ShareVipId != null && para.ShareVipId != "")// 通过列表进详细自己不能领券 { //当剩余数量不为0时,进行下一步判断是否存在已领券的信息 hasCouponCount = VipCouponMappingBLL.GetReceiveCouponCount(CurrentUserInfo.UserID, para.ObjectId, "Share"); if (hasCouponCount == 0)//如果等于零,开始领券流程 { //关联优惠券让用户领券 var redisVipMappingCouponBLL = new JIT.CPOS.BS.BLL.RedisOperationBLL.Coupon.RedisVipMappingCouponBLL(); try { //执行领取操作 redisVipMappingCouponBLL.InsertDataBase(CurrentUserInfo.CurrentUser.customer_id, CurrentUserInfo.UserID, para.SetoffToolID, "Share", new CC_Coupon() { CustomerId = CurrentUserInfo.CurrentUser.customer_id, CouponTypeId = para.ObjectId }); setoffToolDetailRD.Name = couponTypeInfo[0].CouponTypeName + ",已飞入您的账户"; } catch (Exception ex) { setoffToolDetailRD.Name = "很遗憾此次优惠券" + couponTypeInfo[0].CouponTypeName + "的分享已失效,下次请及时领取."; } } } else { //如果剩余数量为0时,给出已领完提示 if (para.ShareVipId != null && para.ShareVipId != "") { setoffToolDetailRD.Name = "很遗憾您来迟一步优惠券" + couponTypeInfo[0].CouponTypeName + "已被领完."; //throw new APIException("很遗憾您来迟一步券已被领完.") { ErrorCode = ERROR_LOAD_WRONG }; } } if (setoffToolDetailRD.Name == null || setoffToolDetailRD.Name == "") { setoffToolDetailRD.Name = couponTypeInfo[0].CouponTypeName; } setoffToolDetailRD.StartTime = couponTypeInfo[0].BeginTime == null?Convert.ToDateTime(couponTypeInfo[0].CreateTime).ToString("yyyy-MM-dd") : Convert.ToDateTime(couponTypeInfo[0].BeginTime).ToString("yyyy-MM-dd"); setoffToolDetailRD.EndTime = couponTypeInfo[0].EndTime == null ? "" : Convert.ToDateTime(couponTypeInfo[0].EndTime).ToString("yyyy-MM-dd"); setoffToolDetailRD.ServiceLife = couponTypeInfo[0].ServiceLife.ToString(); } #endregion setoffToolDetailRD.ToolType = para.ToolType; //返回工具类别 setoffToolDetailRD.imageUrl = imageUrl; //返回临时二维码 setoffToolDetailRD.paraTemp = iResult.ToString().Insert(4, " "); //加空格,加空格有什么作用? } if (para.ToolType == "SetoffPoster") //如果为集客海报则返回背景图和二维码 { if (SetOffPosterInfo != null && SetOffPosterInfo.Length > 0) { var backImgInfo = imgBll.QueryByEntity(new ObjectImagesEntity() { ImageId = SetOffPosterInfo[0].ImageId }, null); setoffToolDetailRD.ToolType = para.ToolType; setoffToolDetailRD.imageUrl = imageUrl; setoffToolDetailRD.paraTemp = iResult.ToString().Insert(4, " "); //加空格,加空格有什么作用? setoffToolDetailRD.backImgUrl = backImgInfo[0].ImageURL; setoffToolDetailRD.Name = SetOffPosterInfo[0].Name; } } if (flag == 1)//当为1是需进行打开工具的记录 { var SetoffToolUserView = new SetoffToolUserViewEntity(); SetoffToolUserView.SetoffToolUserViewID = Guid.NewGuid(); SetoffToolUserView.SetoffEventID = setoffEventInfo[0].SetoffEventID; SetoffToolUserView.SetoffToolID = new Guid(para.SetoffToolID); SetoffToolUserView.ToolType = para.ToolType; SetoffToolUserView.ObjectId = para.ObjectId; SetoffToolUserView.NoticePlatformType = 1; SetoffToolUserView.UserID = CurrentUserInfo.UserID; SetoffToolUserView.IsOpen = 1; SetoffToolUserView.OpenTime = System.DateTime.Now; SetoffToolUserView.CustomerId = customerId; SetoffToolUserView.CreateTime = System.DateTime.Now; SetoffToolUserView.CreateBy = CurrentUserInfo.UserID; SetoffToolUserView.LastUpdateTime = System.DateTime.Now; SetoffToolUserView.LastUpdateBy = CurrentUserInfo.UserID; SetoffToolUserView.IsDelete = 0; SetoffToolUserViewBLL.Create(SetoffToolUserView); } } catch (Exception ex) { throw new APIException(ex.Message) { ErrorCode = ERROR_CODES.DEFAULT_ERROR }; } return(setoffToolDetailRD); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region Script Resource ScriptReference scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/MeasuringPointScriptResource.js"; string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(','); scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); scriptManager.Scripts.Add(scriptReference); #endregion int siteID = CommonBLL.ValidateSiteID(Request); int equipmentID = 0; int fLocationID = 0; int measuringPointID = 0; string mptDataType = Request.QueryString["type"];//E : Equipment, L:Location, M: Master if (Request.QueryString["flid"] != null && Request.QueryString["flid"].Trim().Length > 0) { fLocationID = Convert.ToInt32(Request.QueryString["flid"].Trim()); } if (Request.QueryString["eid"] != null && Request.QueryString["eid"].Trim().Length > 0) { equipmentID = Convert.ToInt32(Request.QueryString["eid"].Trim()); } if (Request.QueryString["mpid"] != null && Request.QueryString["mpid"].Trim().Length > 0) { measuringPointID = Convert.ToInt32(Request.QueryString["mpid"].Trim()); } if (siteID == 0 && string.IsNullOrEmpty(mptDataType) && equipmentID < 0) { Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString()); } int userID = this.CurrentUser.UserID; int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel); ValidateUserPrivileges(siteID, accessLevelID, mptDataType); Vegam_MaintenanceService.BasicParam basicParam = new Vegam_MaintenanceService.BasicParam(); basicParam.SiteID = siteID; basicParam.UserID = userID; basicParam.AccessLevelID = accessLevelID; string basePath = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/'); string webServicePath = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim(); string uploaderPath = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/'); string restAPIPath = ConfigurationManager.AppSettings["VegamViewServicePath"].TrimEnd('/'); string measuringPointImgPath = ConfigurationManager.AppSettings["MeasuringPointImagePath"].ToString().Trim('/') + "/" + basicParam.SiteID + "/" + "Thumbnail"; string imagePath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images/Measuring_Point.png"; UserControls.PagerData measuringPointpagerData = new UserControls.PagerData(); measuringPointpagerData.PageIndex = 0; measuringPointpagerData.PageSize = int.Parse(hdnMeasuringPointPageSize.Value.ToString()); measuringPointpagerData.CurrentPage = currentPage; measuringPointpagerData.SelectMethod = "LoadMeasuringPointList"; measuringPointpagerData.ServicePath = webServicePath; measuringPointpagerData.SiteID = siteID; measuringPointpagerData.UserID = userID; measuringPointpagerData.AccessLevelID = accessLevelID; measuringPointpagerData.PageAccessRights = PageAccessRights.ToString(); if (measuringPointpagerData.PageAccessRights == AccessType.FULL_ACCESS.ToString()) { btnSaveMeasuringPoint.Attributes.Add("onclick", "javascript:InsertOrUpdateMeasuringPointInfo(" + (new JavaScriptSerializer()).Serialize(0) + ");return false;"); } else { btnSaveMeasuringPoint.Attributes.Add("disabled", "disabled"); btnGenerateCode.Attributes.Add("disabled", "disabled"); } if (measuringPointpagerData.PageAccessRights == AccessType.FULL_ACCESS.ToString() || measuringPointpagerData.PageAccessRights == AccessType.EDIT_ONLY.ToString()) { uploadImageAccess = true; } else { uploadImageAccess = false; } //using pager for displaying master data in configure maintenance types modal popup UserControls.PagerData maintTypePagerData = new UserControls.PagerData(); maintTypePagerData.PageIndex = 0; maintTypePagerData.PageSize = int.Parse(hdnModelPageSize.Value.ToString()); maintTypePagerData.CurrentPage = currentPage; maintTypePagerData.SelectMethod = "LoadMaintTypesInfo"; maintTypePagerData.ServicePath = webServicePath; maintTypePagerData.SiteID = siteID; maintTypePagerData.UserID = userID; maintTypePagerData.AccessLevelID = accessLevelID; maintTypePagerData.PageAccessRights = PageAccessRights.ToString(); if (maintTypePagerData.PageAccessRights == AccessType.FULL_ACCESS.ToString()) { btnAddMaintType.Attributes.Add("onclick", "javascript:InsertOrUpdateMaintType(" + (new JavaScriptSerializer()).Serialize(0) + ");return false;"); } else { btnAddMaintType.Attributes.Add("disabled", "disabled"); } thMaintTypes.Attributes.Add("onclick", "javascript:SortMaintenanceTypeTabs('" + thMaintTypes.ClientID + "','MasterDataName');"); sortMeasuringPoint.Attributes.Add("onclick", "javascript:SortByMeasuringPointName('" + sortMeasuringPoint.ClientID + "','MeasuringPointName');"); Page.ClientScript.RegisterStartupScript(GetType(), "LoadMeasuringPointInfo", "LoadMeasuringPointInfo(" + (new JavaScriptSerializer()).Serialize(basicParam) + ",'" + basePath + "','" + imagePath + "','" + uploaderPath + "','" + measuringPointImgPath + "','" + restAPIPath + "','" + btnSaveMeasuringPoint.ClientID + "','" + mptDataType + "'," + equipmentID + "," + fLocationID + "," + measuringPointID + "," + (new JavaScriptSerializer()).Serialize(measuringPointpagerData) + "," + (new JavaScriptSerializer()).Serialize(maintTypePagerData) + ");", true); } }
/// <summary> /// 关注或者注册日志 /// </summary> /// <param name="strCTWEventId">主题活动标识</param> /// <param name="strVipId">注册操作的vipid</param> /// <param name="strFocusVipId">关注操作的vipid</param> public void CTWRegOrFocusLog(string strCTWEventId, string strRegVipId, string strFocusVipId, LoggingSessionInfo loggingSession, string strType) { string strVipId = string.Empty; if (strType == "Reg") { strVipId = strRegVipId; } if (strType == "Focus") { strVipId = strFocusVipId; } BaseService.WriteLogWeixin(" 创意仓库日志:" + strCTWEventId + "+" + strVipId + "+" + strType); try { int intResult = this._currentDAO.IsExistsLog(strCTWEventId, strVipId, strType, loggingSession.ClientID); if (intResult == 0) { T_LEventsRegVipLogEntity entityRegVipLog = new T_LEventsRegVipLogEntity(); entityRegVipLog.BusTypeCode = "CTW"; entityRegVipLog.ObjectId = strCTWEventId; entityRegVipLog.RegVipId = strRegVipId; entityRegVipLog.FocusVipId = strFocusVipId; entityRegVipLog.CustomerId = loggingSession.ClientID; this._currentDAO.Create(entityRegVipLog); //触点奖励 ContactEventBLL bllContactEvent = new ContactEventBLL(loggingSession); var entityContact = bllContactEvent.QueryByEntity(new ContactEventEntity() { EventId = strCTWEventId, IsDelete = 0, IsCTW = 1, ContactTypeCode = strType }, null).SingleOrDefault(); if (entityContact != null) { LPrizesBLL bllPrize = new LPrizesBLL(loggingSession); var prize = DataTableToObject.ConvertToList <LPrizesEntity>(bllPrize.GetCouponTypeIDByEventId(entityContact.ContactEventId.ToString()).Tables[0]).FirstOrDefault(); if (prize != null) { CouponBLL bllCoupon = new CouponBLL(loggingSession); if (prize.PrizeTypeId == "Coupon") { bllCoupon.CouponBindVip(strVipId, prize.CouponTypeID, entityContact.ContactEventId.ToString(), strType); } if (prize.PrizeTypeId == "Point") { #region 调用积分统一接口 var salesReturnBLL = new T_SalesReturnBLL(loggingSession); VipIntegralBLL bllVipIntegral = new VipIntegralBLL(loggingSession); var vipBLL = new VipBLL(loggingSession); var vipInfo = vipBLL.GetByID(strVipId); string strIntegralSourceID = string.Empty; switch (entityContact.ContactTypeCode.ToString().TrimEnd()) { case "Reg": strIntegralSourceID = "2"; break; case "Focus": strIntegralSourceID = "3"; break; case "Share": strIntegralSourceID = "28"; break; default: strIntegralSourceID = "22"; break; } var IntegralDetail = new VipIntegralDetailEntity() { Integral = prize.Point, IntegralSourceID = strIntegralSourceID, ObjectId = entityContact.ContactEventId.ToString() }; //变动前积分 string OldIntegral = (vipInfo.Integration ?? 0).ToString(); //变动积分 string ChangeIntegral = (IntegralDetail.Integral ?? 0).ToString(); var vipIntegralDetailId = bllVipIntegral.AddIntegral(ref vipInfo, null, IntegralDetail, null, loggingSession); //发送微信积分变动通知模板消息 if (!string.IsNullOrWhiteSpace(vipIntegralDetailId)) { var CommonBLL = new CommonBLL(); CommonBLL.PointsChangeMessage(OldIntegral, vipInfo, ChangeIntegral, vipInfo.WeiXinUserId, loggingSession); } #endregion } //LPrizeWinnerEntity entityPrizeWinner = new LPrizeWinnerEntity() //{ // PrizeWinnerID = Guid.NewGuid().ToString(), // VipID = strVipId, // PrizeID = prize.PrizesID, // PrizeName = prize.PrizeName, // PrizePoolID = entityPrizePool == null ? "" : entityPrizePool.PrizePoolsID, // CreateBy = this.CurrentUserInfo.UserID, // CreateTime = DateTime.Now, // IsDelete = 0 //}; //bllPrizeWinner.Create(entityPrizeWinner); } } } } catch (Exception ex) { BaseService.WriteLogWeixin(" 创意仓库日志:" + ex.ToString() + "+"); } }
/// <summary> /// /// </summary> /// <param name="arguments"></param> /// <param name="help"></param> /// <returns></returns> private static string GenerateReport(XmlCastReport arguments, out string help) { if (arguments.ReportType != null) { string reportPath = string.Empty; string tmpReportFile = string.Empty; try { help = string.Empty; //Get RG settings var settings = SettingsBLL.GetSetting(); LogHelper.Instance.LogInfo("RG settings have been read successfully"); //Initialize temporary directory string workDirectory = SettingsBLL.GetApplicationPath(); //tmpReportFile = PathUtil.CreateTempCopy(workDirectory, Path.Combine(settings.ReportingParameter.TemplatePath, arguments.Template.Name)); //tmpReportFile = PathUtil.CreateTempCopy(workDirectory, arguments.Template.Name); //Initialize Web services var connection = new WSConnection(arguments.Webservice.Name, arguments.Username.Name, arguments.Password.Name, string.Empty); using (CommonBLL commonBLL = new CommonBLL(connection)) { if (!commonBLL.CheckService()) { help = string.Format("Webservice can't be access or is bad formatted. Url:{0} Username:{1} Password:{2}", arguments.Webservice.Name, arguments.Username.Name, arguments.Password.Name); return string.Empty; } } LogHelper.Instance.LogInfo("Web services Initialized successfully"); List<Application> Apps = new List<Application>(); try { using (CastDomainBLL castDomainBLL = new CastDomainBLL(connection)) { if (arguments.Tag == null) { Apps = castDomainBLL.GetCommonTaggedApplications(null); } else { Apps = castDomainBLL.GetCommonTaggedApplications(arguments.Tag.Name); } } } catch (Exception ex) { LogHelper.Instance.LogInfo("Error occured while trying get applications for the portfolio"); } Application[] SelectedApps = Apps.ToArray<Application>(); LogHelper.Instance.LogInfo("Applications is the portfolio found successfully"); string[] AppsToIgnorePortfolioResult = PortfolioBLL.BuildPortfolioResult(connection, SelectedApps); LogHelper.Instance.LogInfo("Build result for the portfolio"); string[] SnapsToIgnore = null; List<Application> N_Apps = new List<Application>(); //Remove from Array the Ignored Apps for (int i = 0; i < SelectedApps.Count(); i++) { int intAppYes = 0; foreach (string s in AppsToIgnorePortfolioResult) { if (s == SelectedApps[i].Name) { intAppYes = 1; break; } else { intAppYes = 0; } } if (intAppYes == 0) { N_Apps.Add(SelectedApps[i]); } } Application[] N_SelectedApps = N_Apps.ToArray(); List<Snapshot> Snapshots = new List<Snapshot>(); try { using (CastDomainBLL castDomainBLL = new CastDomainBLL(connection)) { Snapshots = castDomainBLL.GetAllSnapshots(N_SelectedApps); } } catch (Exception ex) { LogHelper.Instance.LogInfo("Error occured while trying get snapshots of applications for the portfolio"); } LogHelper.Instance.LogInfo("Snapshots is the portfolio found successfully"); List<Snapshot> N_Snaps = new List<Snapshot>(); if (Snapshots != null) { Snapshot[] SelectedApps_Snapshots = Snapshots.ToArray<Snapshot>(); SnapsToIgnore = PortfolioSnapshotsBLL.BuildSnapshotResult(connection, SelectedApps_Snapshots, true); LogHelper.Instance.LogInfo("Build result for snapshots in portfolio"); for (int i = 0; i < SelectedApps_Snapshots.Count(); i++) { int intRemoveYes = 0; foreach (string s in SnapsToIgnore) { if (s == SelectedApps_Snapshots[i].Href) { intRemoveYes = 1; break; } else { intRemoveYes = 0; } } if (intRemoveYes == 0) { N_Snaps.Add(SelectedApps_Snapshots[i]); } } Snapshot[] N_SelectedApps_Snapshots = N_Snaps.ToArray(); //GenerateReportPortfolio(N_SelectedApps, N_SelectedApps_Snapshots); //string tmpReportFile = String.Empty; string tmpReportFileFlexi = String.Empty; try { //Create temporary report //string workDirectory = SettingsBLL.GetApplicationPath(); //tmpReportFile = PathUtil.CreateTempCopy(workDirectory + "\\Portfolio\\", arguments.Template.Name); tmpReportFile = PathUtil.CreateTempCopy(workDirectory, Path.Combine(settings.ReportingParameter.TemplatePath + "\\Portfolio", arguments.Template.Name)); if (tmpReportFile.Contains(".xlsx")) { tmpReportFileFlexi = PathUtil.CreateTempCopyFlexi(workDirectory, arguments.Template.Name); } //Build report ReportData reportData = new ReportData(); if (arguments.Category != null && arguments.Tag != null) { reportData = new ReportData() { FileName = tmpReportFile, Application = null, CurrentSnapshot = null, PreviousSnapshot = null, RuleExplorer = new RuleBLL(connection), CurrencySymbol = "$", Applications = N_SelectedApps, Category = arguments.Category.Name, Tag = arguments.Tag.Name, snapshots = N_SelectedApps_Snapshots, IgnoresApplications = AppsToIgnorePortfolioResult, IgnoresSnapshots = SnapsToIgnore }; } else if (arguments.Category != null && arguments.Tag == null) { reportData = new ReportData() { FileName = tmpReportFile, Application = null, CurrentSnapshot = null, PreviousSnapshot = null, RuleExplorer = new RuleBLL(connection), CurrencySymbol = "$", Applications = N_SelectedApps, Category = arguments.Category.Name, Tag = null, snapshots = N_SelectedApps_Snapshots, IgnoresApplications = AppsToIgnorePortfolioResult, IgnoresSnapshots = SnapsToIgnore }; } else if (arguments.Category == null && arguments.Tag != null) { reportData = new ReportData() { FileName = tmpReportFile, Application = null, CurrentSnapshot = null, PreviousSnapshot = null, RuleExplorer = new RuleBLL(connection), CurrencySymbol = "$", Applications = N_SelectedApps, Category = null, Tag = arguments.Tag.Name, snapshots = N_SelectedApps_Snapshots, IgnoresApplications = AppsToIgnorePortfolioResult, IgnoresSnapshots = SnapsToIgnore }; } else { reportData = new ReportData() { FileName = tmpReportFile, Application = null, CurrentSnapshot = null, PreviousSnapshot = null, RuleExplorer = new RuleBLL(connection), CurrencySymbol = "$", Applications = N_SelectedApps, Category = null, Tag = null, snapshots = N_SelectedApps_Snapshots, IgnoresApplications = AppsToIgnorePortfolioResult, IgnoresSnapshots = SnapsToIgnore }; } using (IDocumentBuilder docBuilder = BuilderFactory.CreateBuilder(reportData, tmpReportFile)) { docBuilder.BuildDocument(); } LogHelper.Instance.LogInfo("Report generated successfully"); //Set filte report SetFileName(arguments); if (string.IsNullOrEmpty(settings.ReportingParameter.GeneratedFilePath)) reportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), arguments.File.Name); else reportPath = Path.Combine(settings.ReportingParameter.GeneratedFilePath, arguments.File.Name); if (tmpReportFile.Contains(".xlsx")) { tmpReportFile = tmpReportFileFlexi; } //Copy report file to the selected destination File.Copy(tmpReportFile, reportPath, true); } catch (Exception ex) { reportPath = String.Empty; throw (ex); } finally { if (!String.IsNullOrEmpty(tmpReportFile)) File.Delete(tmpReportFile); } } return reportPath; } catch (Exception ex) { help = string.Format("An exception occured : {0}", ex); return string.Empty; } finally { if (!string.IsNullOrEmpty(tmpReportFile)) File.Delete(tmpReportFile); } } else { string tmpReportFile = string.Empty; try { help = string.Empty; //Get RG settings var settings = SettingsBLL.GetSetting(); LogHelper.Instance.LogInfo("RG settings have been read successfully"); //Initialize temporary directory string workDirectory = SettingsBLL.GetApplicationPath(); tmpReportFile = PathUtil.CreateTempCopy(workDirectory, Path.Combine(settings.ReportingParameter.TemplatePath, arguments.Template.Name)); //Initialize Web services var connection = new WSConnection(arguments.Webservice.Name, arguments.Username.Name, arguments.Password.Name, string.Empty); using (CommonBLL commonBLL = new CommonBLL(connection)) { if (!commonBLL.CheckService()) { help = string.Format("Webservice can't be access or is bad formatted. Url:{0} Username:{1} Password:{2}", arguments.Webservice.Name, arguments.Username.Name, arguments.Password.Name); return string.Empty; } } LogHelper.Instance.LogInfo("Web services Initialized successfully"); //Initialize Application Application application = GetApplication(arguments.Application.Name, connection); if (application == null) { help = string.Format("Application {0} can't be found.", arguments.Application.Name); return string.Empty; } LogHelper.Instance.LogInfo(string.Format("Application {0} Initialized successfully", arguments.Application.Name)); //Initialize snapshots SetSnapshots(connection, application); if (application.Snapshots == null) { help = "There is no snapshots for this application."; return string.Empty; } LogHelper.Instance.LogInfo(string.Format("List of Snapshots Initialized successfully", arguments.Application.Name)); //Build Application results ApplicationBLL.BuildApplicationResult(connection, application); LogHelper.Instance.LogInfo(string.Format("Application results built successfully", arguments.Application.Name)); //Set current snapshot Snapshot currentSnapshot = GetSnapshotOrDefault(arguments.Snapshot.Current, application.Snapshots, 0); if (currentSnapshot == null) { help = string.Format("Current snapshot {0} can't be found", arguments.Snapshot.Current.Name); return string.Empty; } LogHelper.Instance.LogInfo(string.Format("Current snapshot {0} initialized successfully", currentSnapshot.Name)); //Build current snapshot results SnapshotBLL.BuildSnapshotResult(connection, currentSnapshot, true); LogHelper.Instance.LogInfo(string.Format("Result of current snapshot {0} built successfully", currentSnapshot.Name)); //Set previous snapshot Snapshot prevSnapshot = GetSnapshotOrDefault(arguments.Snapshot.Previous, application.Snapshots, 1); if (arguments.Snapshot.Previous != null && !string.IsNullOrEmpty(arguments.Snapshot.Previous.Name) && prevSnapshot == null) { help = string.Format("Previous snapshot {0} can't be found", arguments.Snapshot.Previous.Name); return string.Empty; } if (prevSnapshot != null) LogHelper.Instance.LogInfo(string.Format("Previous snapshot {0} Initialized successfully", prevSnapshot.Name)); //Build previous snapshot results if (prevSnapshot != null) { SnapshotBLL.BuildSnapshotResult(connection, prevSnapshot, false); LogHelper.Instance.LogInfo(string.Format("Result of previous snapshot {0} built successfully", prevSnapshot.Name)); } //Build report ReportData reportData = new ReportData() { FileName = tmpReportFile, Application = application, CurrentSnapshot = currentSnapshot, PreviousSnapshot = prevSnapshot, Parameter = settings.ReportingParameter, RuleExplorer = new RuleBLL(connection), SnapshotExplorer = new SnapshotBLL(connection, currentSnapshot), CurrencySymbol = "$" }; using (IDocumentBuilder docBuilder = BuilderFactory.CreateBuilder(reportData, "")) { docBuilder.BuildDocument(); } LogHelper.Instance.LogInfo("Report generated successfully"); //Set filte report SetFileName(arguments); string reportPath; if (string.IsNullOrEmpty(settings.ReportingParameter.GeneratedFilePath)) reportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), arguments.File.Name); else reportPath = Path.Combine(settings.ReportingParameter.GeneratedFilePath, arguments.File.Name); File.Copy(tmpReportFile, reportPath, true); LogHelper.Instance.LogInfo("Report moved to generation directory successfully"); return reportPath; } catch (Exception ex) { help = string.Format("An exception occured : {0}", ex); return string.Empty; } finally { if (!string.IsNullOrEmpty(tmpReportFile)) File.Delete(tmpReportFile); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region Script Resource ScriptReference scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/ViewWorkOrderInfoScriptResource.js"; string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(','); scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); scriptManager.Scripts.Add(scriptReference); scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/JQueryCalendarScriptResource.js"; scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); scriptManager.Scripts.Add(scriptReference); scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js"; scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); scriptManager.Scripts.Add(scriptReference); #endregion int siteID = CommonBLL.ValidateSiteID(Request); if (siteID == 0) { Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString()); } int userID = this.CurrentUser.UserID; int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel); string workOrder = string.Empty; if (Request.QueryString["workorder"] != null && Request.QueryString["workorder"].Trim().Length > 0) { workOrder = Request.QueryString["workorder"].Trim(); } if (Request.QueryString["equipment"] != null && Request.QueryString["equipment"].Trim().Length > 0) { equipmentID = Convert.ToInt32(Request.QueryString["equipment"].Trim()); } string pType = string.Empty; if (Request.QueryString["ptype"] != null && Request.QueryString["ptype"].Trim().Length > 0) { pType = Request.QueryString["ptype"].Trim(); } AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID); string servicePath = ConfigurationManager.AppSettings["MaintWebServicePath"].TrimEnd('/'); string imagePath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images/"; string basePath = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/'); string uploaderPath = ConfigurationManager.AppSettings["uploaderPath"].ToString().Trim('/'); string maintScheduleAttachmentPath = ConfigurationManager.AppSettings["MaintScheduleAttachmentPath"].TrimEnd('/'); Vegam_MaintenanceService.SiteDateTimeFormatInfo dateTimeFormat = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID); hdfDatePickerFormat.Value = CommonBLL.GetDatePickerDateFormat(dateTimeFormat.DateFormat); Vegam_MaintenanceService.BasicParam basicParam = new Vegam_MaintenanceService.BasicParam(); basicParam.SiteID = siteID; basicParam.UserID = userID; basicParam.AccessLevelID = accessLevelID; basicParam.LanguageCode = this.CurrentUser.LanguageCode; UserControls.PagerData pagerData = new UserControls.PagerData(); pagerData.PageIndex = 0; pagerData.PageSize = int.Parse(hdnEquipmentHistoryPageSize.Value.ToString()); pagerData.SelectMethod = "LoadEquipmentHistory"; pagerData.ServicePath = servicePath; pagerData.SiteID = siteID; pagerData.UserID = userID; pagerData.AccessLevelID = accessLevelID; string usercontrolPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/'); UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(usercontrolPath + "/DynamicGridControl.ascx"); divDynamicGridContent.Controls.Add(dynamicGridControl); #region Feature List <string> featureName = new List <string>(); featureName.Add(Language_Resources.MaintenanceFeatures.viewMeasuringPointReadings); int featureID = 0; List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName); if (featurePageToLoad.Count > 0) { ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == Language_Resources.MaintenanceFeatures.viewMeasuringPointReadings); if (result != null) { featureID = result.FeatureID; } } #endregion SiteDateTimeFormatInfo dateTimeForamt = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID); int currentDate = BLL.MaintenanceBLL.GetSiteCurrentDateTime(siteID).CurrentDate; UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties(); dynamicGridProperties.CurrentDate = currentDate; dynamicGridProperties.TableHeaderText = Language_Resources.ViewWorkOrderResource.measuringPointList; //dynamicGridProperties.CustomRowNavigationMethod = "ViewWorkOrderInfo"; dynamicGridProperties.FeatureID = featureID; dynamicGridProperties.GridType = UserControls.DynamicGridType.Table; dynamicGridProperties.PagerData = pagerData; //dynamicGridProperties.ImagePath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images"; dynamicGridProperties.WebServiceName = "Vegam_MaintenanceService.asmx"; dynamicGridProperties.DatePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeForamt.DateFormat); // dynamicGridProperties.ShowGroupRowsByDefault = false; dynamicGridProperties.ExcelSheetName = "MeasuringPointList"; ScriptManager.RegisterStartupScript(this, this.GetType(), "LoadWorkOrderBasicInfo", "javascript:LoadWorkOrderBasicInfo(" + (new JavaScriptSerializer()).Serialize(basicParam) + "," + (new JavaScriptSerializer()).Serialize(pagerData) + "," + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + servicePath + "','" + workOrder + "','" + imagePath + "','" + basePath + "','" + uploaderPath + "','" + maintScheduleAttachmentPath + "','" + accessType.ToString() + "','" + hdfDatePickerFormat.Value + "'," + equipmentID + "," + "'" + dateTimeFormat.DateFormat + "','" + dateTimeFormat.TimeFormat + "','" + pType + "');", true); } }
/// <summary> /// 出 订单支付完成 队列 /// </summary> public void ProcessPaySuccessMsg() { // var numCount = 100; var commonBLL = new CommonBLL(); // var customerIDs = CustomerBLL.Instance.GetCustomerList(); foreach (var customer in customerIDs) { // var count = RedisOpenAPI.Instance.CCOrderPaySuccess().GetPaySuccessLength(new CC_PaySuccess { CustomerID = customer.Key }); if (count.Code != ResponseCode.Success) { continue; } if (count.Result <= 0) { continue; } // if (count.Result < numCount) { numCount = Convert.ToInt32(count.Result); } // for (var i = 0; i < numCount; i++) { // var response = RedisOpenAPI.Instance.CCOrderPaySuccess().GetPaySuccess(new CC_PaySuccess { CustomerID = customer.Key }); if (response.Code == ResponseCode.Success) { var templateID = response.Result.ConfigData.TemplateID; var openID = response.Result.ConfigData.OpenID; var vipID = response.Result.ConfigData.VipID; var loggingSessionInfo = CustomerBLL.Instance.GetBSLoggingSession(customer.Key, "1");//response.Result.ConfigData.LogSession.JsonDeserialize<LoggingSessionInfo>(); var paySuccessData = new PaySuccess { first = new DataInfo { value = response.Result.PaySuccessData.first.value, color = response.Result.PaySuccessData.first.color }, orderAddress = new DataInfo { value = response.Result.PaySuccessData.orderAddress.value, color = response.Result.PaySuccessData.orderAddress.color }, orderName = new DataInfo { value = response.Result.PaySuccessData.orderName.value, color = response.Result.PaySuccessData.orderName.color }, orderProductName = new DataInfo { value = response.Result.PaySuccessData.orderProductName.value, color = response.Result.PaySuccessData.orderProductName.color }, orderProductPrice = new DataInfo { value = response.Result.PaySuccessData.orderProductPrice.value, color = response.Result.PaySuccessData.orderProductPrice.color }, remark = new DataInfo { value = response.Result.PaySuccessData.remark.value, color = response.Result.PaySuccessData.remark.color } }; // //return commonBLL.SendMatchWXTemplateMessage(wxTMConfigData.TemplateID, null, null, null, PaySuccessData, null, "15", OpenID, VipID, loggingSessionInfo); commonBLL.SendMatchWXTemplateMessage(templateID, null, null, null, paySuccessData, null, null, null, null, "15", openID, vipID, loggingSessionInfo); } } } }
protected void btnLogin_Click(object sender, EventArgs e) { //登录日志对象 Model.SYS_LOGIN_LOG sys_login_log = new Model.SYS_LOGIN_LOG(); //登录日志对象赋值 sys_login_log.LOGIN_TIME = System.DateTime.Now; // 登录时间 sys_login_log.SYS_USER_ID = userAccount.Value.Trim(); // 用户名 sys_login_log.LOGINIP = Request.UserHostAddress; // 用户 ip if (Session["CheckCode"] != null) { #region 验证录入项 string code = Session["CheckCode"].ToString(); string errMsg = ""; if (!code.ToUpper().Equals(checkcode.Value.Trim().ToUpper()))//验证码错误 { errMsg += "验证码不正确!\\n"; errorInfo += "验证码不正确"; Response.Write("<script>alert('验证码不正确!')</script>"); return; } #endregion #region 登录 try { string account = userAccount.Value.Trim(); StringHelper stringHelper = new StringHelper(); string pwd = stringHelper.ToMD5(password.Value.Trim()); // 数据库存储的是加密过后的数据 // Response.Write("<script>alert('"+ pwd + "')</script>"); string sql = "select * from USERINFO where username='******'"; CommonBLL combll = new CommonBLL(); DataTable dt = combll.ExecuteTable(sql); if (dt.Rows.Count == 0) { Response.Write("<script>alert('用户不存在!!')</script>"); errorInfo += ". 用户不存在"; sys_login_log.IS_SUCCESS = "用户不存在"; LogM.SaveLoginLog(sys_login_log); return; } if (dt.Rows[0]["password"].ToString() != pwd) { Response.Write("<script>alert('用户名或密码错误!')</script>"); errorInfo += ". 密码错误!"; sys_login_log.IS_SUCCESS = "密码错误"; LogM.SaveLoginLog(sys_login_log); return; } sys_login_log.IS_SUCCESS = "登录成功"; LogM.SaveLoginLog(sys_login_log); //登陆成功,跳转到主页 Response.Redirect("MainPage.aspx", false); // 如果设置 true,下面catch会出现异常!! } catch (Exception e1) { try { /*登录失败:记录登录失败日志*/ errorInfo += ". 服务器数据库异常->"; errorInfo += e1.Message; sys_login_log.IS_SUCCESS = errorInfo; LogM.SaveLoginLog(sys_login_log); } catch { } } #endregion } }
private NextGenBLL.PipingBLL GetPipingBLLInstanceValidation(WL.AddFlow AddFlowAutoPiping) { bool isInch = CommonBLL.IsDimension_inch(); return(new NextGenBLL.PipingBLL(this.projectLegacy, utilPiping, AddFlowAutoPiping, isInch, ut_weight, ut_length, ut_power)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region Script Resource ScriptReference scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js"; string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(','); scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); ScriptManager1.Scripts.Add(scriptReference); scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/ManageWorkOrderScriptResource.js"; scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); ScriptManager1.Scripts.Add(scriptReference); scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/jQueryCalendarScriptResource.js"; scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); ScriptManager1.Scripts.Add(scriptReference); #endregion int siteID = CommonBLL.ValidateSiteID(Request); if (siteID == 0) { Response.Redirect(ConfigurationManager.AppSettings["NoAccessPage"].ToString()); } int userID = this.CurrentUser.UserID; int accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel); ValidateUserPrivileges(userID, siteID, accessLevelID); string basePath = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/'); string userControlPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/'); SiteDateTimeFormatInfo dateTimeForamt = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID); UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(userControlPath + "/DynamicGridControl.ascx"); divDynamicGridContent.Controls.Add(dynamicGridControl); int featureID = 0; List <string> featureName = new List <string>(); featureName.Add(Language_Resources.MaintenanceFeatures.ManageWorkOrder); List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName); if (featurePageToLoad.Count > 0) { ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == featureName[0]); if (result != null) { featureID = result.FeatureID; } } Vegam_MaintenanceService.SiteDateTimeFormatInfo dateTimeFormat = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID); string dateFormat = CommonBLL.GetDatePickerDateFormat(dateTimeFormat.DateFormat); UserControls.PagerData pagerData = new UserControls.PagerData(); pagerData.PageIndex = 0; pagerData.PageSize = Convert.ToInt32(hdnPageSize.Value); pagerData.CurrentPage = 0; pagerData.SelectMethod = "LoadDynamicGridContent"; pagerData.ServicePath = ConfigurationManager.AppSettings["MaintWebServicePath"].Trim(); pagerData.SiteID = siteID; pagerData.UserID = userID; pagerData.PlantDateFormat = dateTimeForamt.DateFormat; pagerData.PlantTimeFormat = dateTimeForamt.TimeFormat; pagerData.AccessLevelID = accessLevelID; string imagePath = ConfigurationManager.AppSettings["MaintImagePath"].TrimEnd('/') + "/Styles/Images"; UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties(); dynamicGridProperties.FeatureID = featureID; dynamicGridProperties.DatePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeForamt.DateFormat); dynamicGridProperties.GridType = UserControls.DynamicGridType.Table; dynamicGridProperties.PagerData = pagerData; dynamicGridProperties.TableHeaderText = Language_Resources.ManageWorkOrder_Resource.listOfWorkOrders; dynamicGridProperties.WebServiceName = "Vegam_MaintenanceService.asmx"; dynamicGridProperties.ExcelSheetName = "MaintenanceWorkOrder"; dynamicGridProperties.ImagePath = imagePath; string newWorkOrderHTML = "<input id='btnNewWorkOrder' type='button'class='btn btn-sm btn-success pull-xs-right pover' data-placement='top' data-content='" + Language_Resources.ManageWorkOrder_Resource.addMaintWorkOrder + "' value='" + Language_Resources.ManageWorkOrder_Resource.addMaintWorkOrder + "' disabled='disabled'/>"; string editWorkOrderHTML = "<i class='fa fa-edit linkcolor big tiny-leftmargin tiny-rightmargin v-icon cursor-pointer icon-muted'></i>"; string deleteWorkOrderHTML = "<i class='fa fa-trash-o red big tiny-leftmargin tiny-rightmargin v-icon cursor-pointer icon-muted '></i>"; //if (_manageWorkOrderAccess.ToLower() != "read_only") //{ editWorkOrderHTML = "<i class='fa fa-edit linkcolor big tiny-leftmargin tiny-rightmargin v-icon cursor-pointer' onclick='javascript:EditWorkOrderInfo(this);' title='Edit'></i>"; if (_manageWorkOrderAccess.ToLower() == "full_access") { newWorkOrderHTML = "<input id='btnNewWorkOrder' type='button'class='btn btn-sm btn-success pull-xs-right pover' data-placement='top' data-content='" + Language_Resources.ManageWorkOrder_Resource.addMaintWorkOrder + "' value='" + Language_Resources.ManageWorkOrder_Resource.addMaintWorkOrder + "' onclick='javascript:AddNewWorkOrder();'/>"; deleteWorkOrderHTML = "<i class='fa fa-trash-o red big tiny-leftmargin tiny-rightmargin v-icon cursor-pointer' onclick='javascript:DeleteWorkOrderInfoConfirm(this);' title='Delete'></i>"; } //} Page.ClientScript.RegisterStartupScript(GetType(), "LoadManageWorkOrderInfo", "LoadManageWorkOrderInfo(" + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + _manageWorkOrderAccess + "',\"" + newWorkOrderHTML + "\",\"" + editWorkOrderHTML + "\",\"" + deleteWorkOrderHTML + "\",'" + basePath + "','" + dateFormat + "')", true); } }
/// <summary> /// 创建潜在分经销商 /// </summary> /// <param name="loggingSessionInfo">loggingSessionInfo</param> /// <param name="vip_no">vip_no</param> public void CreatePrepRetailTrader(LoggingSessionInfo loggingSessionInfo, string vip_no) { VipEntity vipEntity = new VipBLL(loggingSessionInfo).GetVipDetailByVipID(vip_no); RetailTraderDAO retailTraderDao = new RetailTraderDAO(loggingSessionInfo); if (vipEntity == null || string.IsNullOrWhiteSpace(vipEntity.Col20)) { return; } /// 判断当前vip会员手机号是否存在经销记录 var entiryList = this.QueryByEntity(new RetailTraderEntity() { RetailTraderLogin = vipEntity.Phone }, null); if (entiryList != null && entiryList.Length > 0) { return; } t_unitEntity unitEntity = new t_unitBLL(loggingSessionInfo).GetMainUnit(loggingSessionInfo.ClientID); int RetailTraderCode = getMaxRetailTraderCode(loggingSessionInfo.ClientID); RetailTraderEntity pEntity = new RetailTraderEntity(); pEntity.RetailTraderID = Guid.NewGuid().ToString(); pEntity.RetailTraderType = "MultiLevelSaler"; pEntity.RetailTraderCode = RetailTraderCode + 1; pEntity.RetailTraderName = vipEntity.VipName; pEntity.RetailTraderLogin = vipEntity.Phone; pEntity.RetailTraderPass = MD5Helper.Encryption("888888"); pEntity.SalesType = ""; pEntity.RetailTraderMan = ""; pEntity.RetailTraderPhone = vipEntity.Phone; pEntity.RetailTraderAddress = ""; pEntity.CooperateType = ""; pEntity.SellUserID = ""; pEntity.UnitID = unitEntity.unit_id; pEntity.MultiLevelSalerFromVipId = vip_no; if (!string.IsNullOrEmpty(vipEntity.Col20)) { pEntity.HigheRetailTraderID = vipEntity.Col20; } pEntity.CreateTime = DateTime.Now;; pEntity.CreateBy = "sys"; pEntity.LastUpdateBy = "sys"; pEntity.LastUpdateTime = DateTime.Now; pEntity.IsDelete = 0; pEntity.CustomerId = loggingSessionInfo.ClientID; pEntity.Status = "2"; retailTraderDao.Create(pEntity); this.Create2Ap(pEntity);//ap库里的RetailTraderID和商户里的RetailTraderID是一样的 new ObjectImagesBLL(loggingSessionInfo).SaveRetailTraderHeadImg(vipEntity, pEntity); // todo CommonBLL commonBll = new CommonBLL(); string content = "您的帐号:" + pEntity.RetailTraderLogin + ",密码:888888,已经在连锁掌柜注册成功,请在地址http://app.chainclouds.com/download/chengguo/下载一起发码APP,早下载早成为经销商赚钱"; JIT.CPOS.BS.Entity.WX.SendMessageEntity messageEntity = new JIT.CPOS.BS.Entity.WX.SendMessageEntity(); messageEntity.content = content; messageEntity.touser = vipEntity.WeiXinUserId; messageEntity.msgtype = "text"; WApplicationInterfaceEntity[] wApplicationInterfaceEntities = new WApplicationInterfaceBLL(loggingSessionInfo).QueryByEntity(new WApplicationInterfaceEntity { CustomerId = loggingSessionInfo.ClientID }, null); commonBll.SendMessage(messageEntity, wApplicationInterfaceEntities[0].AppID, wApplicationInterfaceEntities[0].AppSecret, loggingSessionInfo); }
/// <summary> /// 微信推送 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void bw_DoWorkWx(object sender, DoWorkEventArgs e) { while (true) { try { ConfigurationManager.RefreshSection("appSettings"); var time = ConfigurationManager.AppSettings["Timing"]; //支持配置多客户 string[] customerIDs = ConfigurationManager.AppSettings["CustomerIDs"].Split(','); foreach (string customerID in customerIDs) { loggingSessionInfo = GetLoggingSession(customerID, "PushService"); //微信推送 var vipBll = new VipBLL(loggingSessionInfo); //会员BLL实例化 var orderBll = new Car_OrderBLL(loggingSessionInfo); //订单BLL实例化 var orderEntity = new Car_OrderEntity(); VipEntity vipEntity = null; //查询参数 List <IWhereCondition> complexCondition = new List <IWhereCondition> { }; complexCondition.Add(new LessThanCondition() { FieldName = "ReserveTime", Value = DateTime.Now.AddMinutes(30), IncludeEquals = true, DateTimeAccuracy = DateTimeAccuracys.DateTime }); // complexCondition.Add(new MoreThanCondition() { FieldName = "ReserveTime", Value = DateTime.Now, IncludeEquals = true, DateTimeAccuracy = DateTimeAccuracys.DateTime }); // complexCondition.Add(new LessThanCondition() { FieldName = "Status", Value = 3 }); //???? complexCondition.Add(new DirectCondition(" (PushStatus = '0') ")); //未推送 //排序参数 List <OrderBy> lstOrder = new List <OrderBy> { }; lstOrder.Add(new OrderBy() { FieldName = "ReserveTime", Direction = OrderByDirections.Asc }); //orderEntity = orderBll.QueryByEntity(new Car_OrderEntity { ReserveTime > DateTime.Now }, null); var tempOrderList = orderBll.Query(complexCondition.ToArray(), lstOrder.ToArray()); if (tempOrderList != null && tempOrderList.Length != 0) { vipEntity = vipBll.GetByID(tempOrderList[0].VipID); if (!string.IsNullOrEmpty(vipEntity.WeiXinUserId)) { #if DEBUG //var appService = new WApplicationInterfaceBLL(loggingSessionInfo); //var appList = appService.QueryByEntity(new WApplicationInterfaceEntity { CustomerId = customerID }, null); //if (appList != null && appList.Length > 0) //{ // var app = appList.FirstOrDefault(); // if (app != null) // { // var commonBll = new CommonBLL(); // commonBll.SendTemplateMessage(app.WeiXinID, "亲,距离您的爱车洗澡时间只有30分钟了,请尽快到店哦!");//模板消息 // } //} #endif if (tempOrderList[0].ServiceItemID == 1)//为洗车消息 { CommonBLL.SendWeixinMessage("亲,距离您的爱车洗澡时间只有30分钟了,请尽快到店哦!", tempOrderList[0].VipID, loggingSessionInfo, vipEntity); } orderEntity = orderBll.GetByID(tempOrderList[0].OrderID); orderEntity.PushStatus = 1; orderBll.Update(orderEntity); } } } Thread.Sleep(TimeSpan.FromSeconds(Interval)); } catch (Exception ex) { Loggers.Exception(new ExceptionLogInfo(ex)); } } }
public ActionResult WeiXin() { //var bgpath = AppDomain.CurrentDomain.BaseDirectory + "\\App_Data\\" + "button.json"; //StreamReader sr = new StreamReader(bgpath, Encoding.Default); //string jsons = sr.ReadToEnd(); // List <Button> list = ButtonBLL.GetBaseButton(); StringBuilder sb = new StringBuilder(); sb.Append("{\"button\": ["); foreach (var item in list) { sb.Append(" {"); sb.Append("\"name\": \"" + item.name + "\","); if (item.type != "base") { sb.Append("\"type\": \"" + item.type + "\","); if (item.type == "view") { sb.Append("\"url\": \"" + item.value + "\""); } else { sb.Append("\"key\": \"" + item.value + "\""); }; } else { var x = ButtonBLL.GetSubButton(item.id); List <Newtonsoft.Json.Linq.JObject> subList = new List <Newtonsoft.Json.Linq.JObject>(); foreach (var subBtn in x) { Newtonsoft.Json.Linq.JObject subt = new Newtonsoft.Json.Linq.JObject(); subt.Add("name", subBtn.name); subt.Add("type", subBtn.type); if (subBtn.type == "view") { subt.Add("url", subBtn.value); } else { subt.Add("key", subBtn.value); }; subList.Add(subt); } sb.Append("\"sub_button\":" + JsonConvert.SerializeObject(subList)); } sb.Append("}"); if (item.id != list.Last().id) { sb.Append(","); } } sb.Append("]}"); var res = CommonBLL.GetInfomation("https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + CommonBLL.GetAccess_token(), sb.ToString()); return(Json(res)); }
/// <summary> /// 发送消息业务(短信,微信) /// </summary> private void ActivitySendMessige() { #region Business Object var ActivityBLL = new C_ActivityBLL(c_loggingSessionInfo); var MessageSendBLL = new C_MessageSendBLL(c_loggingSessionInfo); var ActivityMessageBLL = new C_ActivityMessageBLL(c_loggingSessionInfo); var CommonBLL = new CommonBLL(); #endregion #region 获取所有营销活动 List <IWhereCondition> complexCondition = new List <IWhereCondition> { }; complexCondition.Add(new EqualsCondition() { FieldName = "CustomerID", Value = c_loggingSessionInfo.ClientID }); //complexCondition.Add(new DirectCondition(" ((IsLongTime=1 and GETDATE()>=StartTime) OR (GETDATE()>=StartTime AND GETDATE()<=EndTime)) AND STATUS=0 and IsDelete=0 ")); complexCondition.Add(new DirectCondition(" (IsLongTime=1 or (IsLongTime=0 and GETDATE()<=EndTime)) and STATUS=0 and IsDelete=0 ")); var ActivityList = ActivityBLL.Query(complexCondition.ToArray(), null);//营销活动 #endregion //轮循活动获取到当前活动与发送短信,微信消息集合 foreach (var item in ActivityList) { //预发送消息源 var ActivityMessageList = ActivityMessageBLL.QueryByEntity(new C_ActivityMessageEntity() { ActivityID = item.ActivityID }, null).ToList(); var ActivitySMSMessageList = new List <C_ActivityMessageEntity>(); //短信消息集合 var ActivityWeChatMessageList = new List <C_ActivityMessageEntity>(); //微信消息集合 ActivitySMSMessageList = ActivityMessageList.Where(m => m.MessageType.Trim().Equals("SMS")).ToList(); ActivityWeChatMessageList = ActivityMessageList.Where(m => m.MessageType.Trim().Equals("WeChat")).ToList(); //遍历消息集合,调用发送消息方法 #region 发送短信 string content = ""; string mobile = ""; foreach (var SMSMessage in ActivitySMSMessageList) { List <IWhereCondition> MessageCondition = new List <IWhereCondition> { }; //获取未发送的信息 MessageCondition.Add(new DirectCondition("MessageID='" + SMSMessage.MessageID + "' and IsSend <>2 order by Priority desc ")); var MessageSendList = MessageSendBLL.Query(MessageCondition.ToArray(), null).ToList().Take(5000).ToList(); StringBuilder PhoneStr = new StringBuilder(); //群发短信接口对象 api api1 = new api(); if (MessageSendList.Count > 100) { #region 大于一百条 foreach (var MessageSend in MessageSendList) { if (MessageSend.SendTime <= DateTime.Now) { PhoneStr.Append(MessageSend.Phone + ",");//手机号 } if (string.IsNullOrWhiteSpace(content)) { content = "尊敬的会员," + SMSMessage.Content + "回TD退订【连锁掌柜】"; //消息内容 } mobile = PhoneStr.ToString(); //手机号 } mobile = mobile.TrimEnd(','); //调用群发发送短信接口 SendSmsResult SendSmsResult1 = api1.SendSms("hy_znxx", "znxx", content, mobile, "", "17"); //事物对象 var pTran = ActivityBLL.GetTran(); using (pTran.Connection) { try { if (SendSmsResult1.code == 2) {//发送成功 foreach (var updateItem in MessageSendList) { updateItem.ActualSendTime = DateTime.Now; updateItem.IsSend = 2; updateItem.SendNumber++; MessageSendBLL.Update(updateItem, pTran); } } else {//失败 foreach (var updateItem in MessageSendList) { updateItem.SendNumber++; updateItem.Priority = 1; MessageSendBLL.Update(updateItem, pTran); } } //提交 pTran.Commit(); System.Threading.Thread.Sleep(2000); // 1秒为单位 } catch (Exception ex) { pTran.Rollback(); throw ex; } } #endregion } //else //{ #region 单发 // foreach (var MessageSend in MessageSendList) // { // if (MessageSend.SendTime < DateTime.Now) // { // //移动手机号不能单发 // string yidong = @"^1(34[0-8]|(3[5-9]|5[017-9]|8[278])\\d)\\d{7}$"; // Regex YD = new Regex(yidong); // if (YD.IsMatch(MessageSend.Phone)) // continue; // string NewContent = "尊敬的会员," + MessageSend.Content + "回TD退订【连锁掌柜】"; // //调用群发发送短信接口 // SendSmsResult SendSmsResult2 = api1.SendSms("hy_znxx", "znxx", NewContent, MessageSend.Phone, "", "17"); // if (SendSmsResult2.code == 2) // {//发送成功 // MessageSend.ActualSendTime = DateTime.Now; // MessageSend.IsSend = 2; // MessageSend.SendNumber++; // MessageSendBLL.Update(MessageSend); // } // else // {//失败 // MessageSend.SendNumber++; // MessageSend.Priority = 1; // MessageSendBLL.Update(MessageSend); // } // } // } #endregion //} } #endregion #region 发送微信 foreach (var Weitem in ActivityWeChatMessageList) { List <IWhereCondition> WeMessageCondition = new List <IWhereCondition> { }; //获取预发送的微信 WeMessageCondition.Add(new DirectCondition("MessageID='" + Weitem.MessageID + "' and IsSend =0 order by Priority desc ")); var WeMessageSendList = MessageSendBLL.Query(WeMessageCondition.ToArray(), null).ToList().Take(10000); List <string> OpenIDList = new List <string>(); string WXcontent = ""; foreach (var WeMessageSend in WeMessageSendList) { if (WeMessageSend.SendTime <= DateTime.Now) { OpenIDList.Add(WeMessageSend.OpenID); } if (string.IsNullOrWhiteSpace(WXcontent)) { WXcontent = WeMessageSend.Content; } } if (OpenIDList.Count > 1) { //调用 string Json = CommonBLL.BulkSendWXTemplateMessage(OpenIDList.ToArray(), WXcontent, c_loggingSessionInfo); if (!string.IsNullOrWhiteSpace(Json)) { var Data = JsonHelper.JsonDeserialize <Result>(Json); //事物对象 var pTranWX = ActivityBLL.GetTran(); using (pTranWX.Connection) { try { if (Data.errcode == 0) { foreach (var WXUpdateitem in WeMessageSendList) { WXUpdateitem.ActualSendTime = DateTime.Now; WXUpdateitem.IsSend = 2; WXUpdateitem.SendNumber++; MessageSendBLL.Update(WXUpdateitem, pTranWX); } } else {//失败 foreach (var WXUpdateitem in WeMessageSendList) { WXUpdateitem.SendNumber++; WXUpdateitem.Priority = 1; WXUpdateitem.IsSend = 3; MessageSendBLL.Update(WXUpdateitem, pTranWX); } } //提交 pTranWX.Commit(); System.Threading.Thread.Sleep(2000); // 5秒为单位 } catch (Exception ex) { pTranWX.Rollback(); throw ex; } } } } } #endregion #region 发送邮件 #endregion } }
void PopulateDropDown(int Number, DropDownList ddl, int?Filter1, int?Filter2) { CommonBLL.PopulateDropdown(Number, ddl, Filter1, Filter2); }
public ActionResult SubmitForm(string keyValue, Orders orders) { OperatorModel op = OperatorProvider.Provider.GetCurrent(); if (string.IsNullOrEmpty(keyValue)) { orders.CreateTime = DateTime.Now; orders.UpdateTime = DateTime.Now; } else { orders.Id = keyValue.ToInt(); orders.UpdateTime = DateTime.Now; var ticketPriceData = CommonBLL.GetGlobalConstVariable(); //修改座位 decimal SingleTicketPrice = 0; //单程 decimal MutilTicketPrice = 0; //双程 decimal ShuttlePrice = 0; //接送费 decimal SeatPrice = 0; //票价 var IsShuttlePrice = orders.IsShuttle == 1; var IsOneWay = orders.IsOneWay == 1; if (orders.Area == AreaType.shanghai.ToString()) { //接送费 if (IsShuttlePrice) { ShuttlePrice = ticketPriceData.Where(d => d.F_ItemCode == YiDaBusConst.海接送费).FirstOrDefault().F_Description.ToDecimal(); } //单程 if (IsOneWay) { SingleTicketPrice = ticketPriceData.Where(d => d.F_ItemCode == YiDaBusConst.海单程票价不含接送).FirstOrDefault().F_Description.ToDecimal(); } //双程 if (!IsOneWay) { MutilTicketPrice = ticketPriceData.Where(d => d.F_ItemCode == YiDaBusConst.海双程票价不含接送).FirstOrDefault().F_Description.ToDecimal(); } } else { //单程 if (IsOneWay) { SingleTicketPrice = ticketPriceData.Where(d => d.F_ItemCode == YiDaBusConst.杭州单程票价).FirstOrDefault().F_Description.ToDecimal(); } //双程 if (!IsOneWay) { MutilTicketPrice = ticketPriceData.Where(d => d.F_ItemCode == YiDaBusConst.杭州双程票价).FirstOrDefault().F_Description.ToDecimal(); } } var ChooseSeatsArr = orders.SeatTexts.Replace("座", "").Split('、'); if (ChooseSeatsArr.Length == 0) { return(Error("请先选择座位!")); } string SeatIds = string.Empty; string SeatTexts = string.Empty; string areaCn = string.Empty; var SeatCount = ChooseSeatsArr.Length; var selectWeek = (int)Convert.ToDateTime(orders.DepartureTime).DayOfWeek; if (selectWeek == 0) { selectWeek = 7; } orders.Week = selectWeek; foreach (var item in ChooseSeatsArr) { SeatIds += YiDaBusConst.SeatSign + item + YiDaBusConst.SeatSign; //判断座位是否已经被其他人下单 var isExist = Db.MySqlContext.Exists <Orders>(d => d.DepartureTime == orders.DepartureTime && d.IsDel == (int)IsDel.否 && d.SeatIds.Contains(SeatIds) && d.Area == orders.Area && d.UserId != orders.UserId); if (orders.Area == AreaType.shanghai.ToString()) { areaCn = "上海"; } else if (orders.Area == AreaType.hangzhou.ToString()) { areaCn = "杭州"; } if (isExist) { return(Error($"车号:{orders.CarNumber}</br>前往:{areaCn}</br>时间:{orders.DepartureTime}</br>座位号:{item}</br>已被其他人购买,请选择其他座位。")); } SeatIds += ","; SeatTexts += item + "座、"; } orders.SeatIds = SeatIds.TrimEnd(','); orders.SeatTexts = SeatTexts.TrimEnd('、'); orders.WeekTextCn = Enum.GetName(typeof(WeekCn), orders.Week.ToInt()); SeatPrice = IsOneWay ? SingleTicketPrice : MutilTicketPrice; var totalMoney = (SeatCount * (SeatPrice + ShuttlePrice)).ToDecimal(2); orders.TotalAmount = totalMoney; } return(SubmitForms(Db.MySqlContext, orders, keyValue)); }
private void PopulateTransactionType() { List <BaseEntity <string> > lstType = CommonBLL.GetTransactionType(); GeneralFunctions.PopulateDropDownList <BaseEntity <string> >(ddlTxnType, lstType, "Id", "Desc", false); }
public CommonBLL.TEmpInfo GetEmployeeInfo(string snr) { return(CommonBLL.GetEmployeeInfo(snr.Trim())); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region Script_Resource_Refernce ScriptReference scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/DynamicGridScriptResource.js"; string[] cultures = ConfigurationManager.AppSettings["SupportLanguages"].ToString().Split(','); scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); ScriptManager1.Scripts.Add(scriptReference); scriptReference = new ScriptReference(); scriptReference.Path = ConfigurationManager.AppSettings["MaintJsPath"].ToString().TrimEnd('/') + "/ScriptResources/SparePartsScriptResource.js"; scriptReference.ResourceUICultures = CommonBLL.GetCultures(cultures, scriptReference.Path); ScriptManager1.Scripts.Add(scriptReference); #endregion userID = this.CurrentUser.UserID; siteID = this.CurrentUser.SiteID; accessLevelID = CommonBLL.GetAccessLevelID(this.CurrentUser.AccessLevel); AccessType accessType = ValidateUserPrivileges(siteID, accessLevelID); Vegam_MaintenanceService.BasicParam basicParam = new Vegam_MaintenanceService.BasicParam(); basicParam.SiteID = siteID; basicParam.UserID = userID; string usercontrolPath = ConfigurationManager.AppSettings["MaintUserControls"].ToString().TrimEnd('/'); string webServicePath = ConfigurationManager.AppSettings["MaintWebServicePath"].ToString().TrimEnd('/'); string basePath = ConfigurationManager.AppSettings["MaintBasePath"].ToString().TrimEnd('/'); SiteDateTimeFormatInfo dateTimeForamt = BLL.MaintenanceBLL.GetSiteDateTimeFormatInfo(siteID); UserControls.DynamicGridControl dynamicGridControl = (UserControls.DynamicGridControl)Page.LoadControl(usercontrolPath + "/DynamicGridControl.ascx"); divDynamicGridContent.Controls.Add(dynamicGridControl); #region Feature Equipment Model List <string> featureName = new List <string>(); featureName.Add(Language_Resources.SparePartsInfo_Resource.sparePartsFeatureName); int featureID = 0; List <ipas_UserService.SiteFeatureInfo> featurePageToLoad = BLL.UserBLL.GetCompanyFeatureConfiguredURL(siteID, 0, featureName); if (featurePageToLoad.Count > 0) { ipas_UserService.SiteFeatureInfo result = featurePageToLoad.SingleOrDefault(x => x.FeatureName == Language_Resources.SparePartsInfo_Resource.sparePartsFeatureName); if (result != null) { featureID = result.FeatureID; } } #endregion UserControls.PagerData pagerData = new UserControls.PagerData(); pagerData.PageIndex = 0; pagerData.PageSize = int.Parse(hdnPageSize.Value.ToString()); pagerData.CurrentPage = currentPage; pagerData.ServicePath = webServicePath; pagerData.SelectMethod = "LoadDynamicGridContent"; pagerData.LoadControlID = uploadFile.ClientID; pagerData.SiteID = siteID; pagerData.UserID = userID; pagerData.AccessLevelID = accessLevelID; pagerData.PlantDateFormat = dateTimeForamt.DateFormat; pagerData.PlantTimeFormat = dateTimeForamt.TimeFormat; pagerData.PageAccessRights = accessType.ToString(); UserControls.DynamicGridProperties dynamicGridProperties = new UserControls.DynamicGridProperties(); dynamicGridProperties.GridType = UserControls.DynamicGridType.Table; dynamicGridProperties.FeatureID = featureID; dynamicGridProperties.DatePickerFormat = CommonBLL.GetDatePickerDateFormat(dateTimeForamt.DateFormat); dynamicGridProperties.TableHeaderText = Language_Resources.SparePartsInfo_Resource.listOfSpareParts; dynamicGridProperties.PagerData = pagerData; dynamicGridProperties.WebServiceName = "Vegam_MaintenanceService.asmx"; dynamicGridProperties.ExcelSheetName = "SparePartsInfo"; if (accessType == AccessType.FULL_ACCESS) { uploadFile.Attributes.Add("onchange", "javascript:UploadSparePartsInfo(); return false;"); } else { btnUploadExcel.Attributes.Add("disabled", "disabled"); } Page.ClientScript.RegisterStartupScript(GetType(), "LoadSparePartsPage", "LoadSparePartsPage(" + (new JavaScriptSerializer()).Serialize(dynamicGridProperties) + ",'" + basePath + "')", true); } }
public int InsertInfo(StzldInfo info) { info = CommonBLL.FieldNullToEmpty(info) as StzldInfo; return(dal.Add(info)); }
public ActionResult Login(LoginViewModel model) { if (!ModelState.IsValid) { return(View(model)); } SYS_LOGIN_LOG sys_login_log = new SYS_LOGIN_LOG(); //登录日志对象赋值 sys_login_log.LOGIN_TIME = System.DateTime.Now; // 登录时间 sys_login_log.SYS_USER_ID = model.username.Trim(); // userAccount.Value; // 用户名 sys_login_log.LOGINIP = Request.UserHostAddress; // 用户 ip if (Session["CheckCode"] != null) { #region 验证录入项 string code = Session["CheckCode"].ToString(); string errMsg = ""; if (!code.ToUpper().Equals(model.code.Trim().ToUpper()))//验证码错误 { errMsg += "验证码不正确!\\n"; errorInfo += "验证码不正确"; Response.Write("<script>alert('验证码不正确!')</script>"); return(View(model)); } #endregion #region 登录 try { string account = model.username.Trim(); StringHelper stringHelper = new StringHelper(); string pwd = stringHelper.ToMD5(model.password.Trim()); // 数据库存储的是加密过后的数据 // Response.Write("<script>alert('"+ pwd + "')</script>"); string sql = "select * from USERINFO where username='******'"; CommonBLL combll = new CommonBLL(); DataTable dt = combll.ExecuteTable(sql); if (dt.Rows.Count == 0) { Response.Write("<script>alert('用户不存在!!')</script>"); errorInfo += ". 用户不存在"; sys_login_log.IS_SUCCESS = "用户不存在"; LogM.SaveLoginLog(sys_login_log); return(Content("用户不存在")); } if (dt.Rows[0]["password"].ToString() != pwd) { Response.Write("<script>alert('用户名或密码错误!')</script>"); errorInfo += ". 密码错误!"; sys_login_log.IS_SUCCESS = "密码错误"; LogM.SaveLoginLog(sys_login_log); return(Content("密码错误"));; } sys_login_log.IS_SUCCESS = "登录成功"; LogM.SaveLoginLog(sys_login_log); //登陆成功,跳转到主页 return(Content("login success")); //RedirectToAction("Index"); } catch (Exception e1) { try { /*登录失败:记录登录失败日志*/ errorInfo += ". 服务器数据库异常->"; errorInfo += e1.Message; sys_login_log.IS_SUCCESS = errorInfo; LogM.SaveLoginLog(sys_login_log); } catch { } } #endregion } return(Content("loginning")); }
public static int UpdateCheckState(string EntityType, string EntityKey, string EntityId, int CheckState, string xmlDoc, ref string msg) { CommonBLL bll = new CommonBLL(""); var entityInfo = bll.GetEntity(EntityType.ToUpper(), EntityId); if (entityInfo == null) { return 0; } var newCheckState = CheckState; var oldCheckState = entityInfo.GetType().GetProperty("CHECKSTATES").GetValue(entityInfo, null); int oState = 0; if (oldCheckState != null) { oState = int.Parse(oldCheckState.ToString()); } if ((oState == 0 && newCheckState == 1) || oState == 3 && newCheckState == 1) { entityInfo.Action = EntityAction.AuditSubmit; entityInfo.GetType().GetProperty("CHECKSTATES").SetValue(entityInfo, newCheckState.ToString(), null); } else if (newCheckState == 2) { entityInfo.Action = EntityAction.AuditPass; entityInfo.GetType().GetProperty("CHECKSTATES").SetValue(entityInfo, newCheckState.ToString(), null); } else if (newCheckState == 3) { entityInfo.Action = EntityAction.AuditFail; entityInfo.GetType().GetProperty("CHECKSTATES").SetValue(entityInfo, newCheckState.ToString(), null); } else if (newCheckState == 5) { //entityInfo.Action = EntityAction.AuditRollBack; } else { } ErrorLog.Log("处理状态:" + newCheckState.ToString()); var saverResult = bll.Audit(entityInfo); if (saverResult.State == SaveResultState.Success) { return 1; } else { msg = saverResult.Message; return 0; } }
/// <summary> /// Implement test service Command /// </summary> private void ExecuteTestCommand(object prameter) { bool resutTest = true; if (prameter == null) //Test of WS defined on "Add service area" { if (!String.IsNullOrEmpty(NewConnectionUrl) && Uri.IsWellFormedUriString(NewConnectionUrl, UriKind.Absolute)) { using (CommonBLL commonBLL = new CommonBLL(new WSConnection(NewConnectionUrl, NewConnectionLogin, NewConnectionPassword, string.Empty))) { resutTest= commonBLL.CheckService(); base.MessageManager.OnServiceChecked(NewConnectionUrl, resutTest); } } } else { using (CommonBLL commonBLL = new CommonBLL(SelectedWSConnection)) { resutTest = commonBLL.CheckService(); base.MessageManager.OnServiceChecked(SelectedWSConnection.Url, resutTest); } } }
/// <summary> /// 入 订单支付完成 队列 /// </summary> public void SentPaymentMessage(T_InoutEntity Inout, string OpenID, string VipID, LoggingSessionInfo loggingSessionInfo) { // var commonBLL = new CommonBLL(); // var wxTMConfigData = new WXTMConfigBLL(loggingSessionInfo).QueryByEntity(new WXTMConfigEntity { TemplateIdShort = "TM00398", CustomerId = loggingSessionInfo.ClientID, IsDelete = 0 }, null).FirstOrDefault(); if (wxTMConfigData == null) { return; } // string ItemName = commonBLL.GetItemName(Inout.order_no, loggingSessionInfo); PaySuccess PaySuccessData = new PaySuccess(); PaySuccessData.first = new DataInfo() { value = wxTMConfigData.FirstText, color = wxTMConfigData.FirstColour }; PaySuccessData.orderProductPrice = new DataInfo() { value = Math.Round(Inout.actual_amount ?? 0, 2).ToString(), color = wxTMConfigData.Colour1 }; PaySuccessData.orderProductName = new DataInfo() { value = ItemName, color = wxTMConfigData.Colour2 }; PaySuccessData.orderAddress = new DataInfo() { value = Inout.Field4, color = wxTMConfigData.Colour3 }; PaySuccessData.orderName = new DataInfo() { value = Inout.order_no, color = wxTMConfigData.Colour3 }; PaySuccessData.remark = new DataInfo() { value = wxTMConfigData.RemarkText, color = wxTMConfigData.RemarkColour }; // var response = RedisOpenAPI.Instance.CCOrderPaySuccess().SetPaySuccess(new CC_PaySuccess { CustomerID = loggingSessionInfo.ClientID, ConfigData = new CC_ConfigData { LogSession = loggingSessionInfo.JsonSerialize(), OpenID = OpenID, TemplateID = wxTMConfigData.TemplateID, VipID = VipID }, PaySuccessData = new CC_PaySuccessData { first = new CC_DataInfo { value = PaySuccessData.first.value, color = PaySuccessData.first.color }, orderAddress = new CC_DataInfo { value = PaySuccessData.orderAddress.value, color = PaySuccessData.orderAddress.color }, orderName = new CC_DataInfo { value = PaySuccessData.orderName.value, color = PaySuccessData.orderName.color }, orderProductName = new CC_DataInfo { value = PaySuccessData.orderProductName.value, color = PaySuccessData.orderProductName.color }, orderProductPrice = new CC_DataInfo { value = PaySuccessData.orderProductPrice.value, color = PaySuccessData.orderProductPrice.color }, remark = new CC_DataInfo { value = PaySuccessData.remark.value, color = PaySuccessData.remark.color } } }); if (response.Code != ResponseCode.Success) { commonBLL.SendMatchWXTemplateMessage(wxTMConfigData.TemplateID, null, null, null, PaySuccessData, null, null, null, null, "15", OpenID, VipID, loggingSessionInfo); new RedisXML().RedisReadDBCount("OrderPaySuccess", "微信端支付成功通知", 2); } else { new RedisXML().RedisReadDBCount("OrderPaySuccess", "微信端支付成功通知", 1); } //return commonBLL.SendMatchWXTemplateMessage(wxTMConfigData.TemplateID, null, null, null, PaySuccessData, null, "15", OpenID, VipID, loggingSessionInfo); }