private void gvDetail_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { SysParameter Curr_Sys = bsDetail.Current as SysParameter; if (Curr_Sys == null) { return; } ParameterMode Curr_paraMode = ParameterModes.Where(p => p.ParameterCode.Equals(Curr_Sys.ParameterCode)).FirstOrDefault(); if (Curr_paraMode == null) { return; } colParameterValue.ColumnEdit = null; if (Curr_paraMode.ExitType == 2) { string[] Items = Curr_paraMode.ChooseValues.Split(';'); RepositoryItemComboBox cbxvalue = new RepositoryItemComboBox(); cbxvalue.Appearance.Options.UseTextOptions = true; cbxvalue.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; cbxvalue.AppearanceDropDown.Options.UseTextOptions = true; cbxvalue.AppearanceDropDown.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; cbxvalue.AutoHeight = false; cbxvalue.Items.AddRange(Items); cbxvalue.Name = "cbxCarType"; cbxvalue.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; colParameterValue.ColumnEdit = cbxvalue; } } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
/// <summary> /// 按参数表绑定LookUpEdit控件 /// </summary> /// <param name="control">LookUpEdit控件</param> /// <param name="type">参数类型</param> /// <param name="isRefreshData">是否刷新数据</param> public static void BindLookUpByParameter(LookUpEdit control, string type, AppendType appendType, bool isRefreshData) { //加载数据 if (!dictParameter.ContainsKey(type) || isRefreshData) { List<SysParameter> _lstParameter = WcfServiceHelper.Client.GetParameterListByType(type).ToList(); dictParameter.Add(type, _lstParameter); } List<SysParameter> lstParameter = dictParameter[type].OrderBy(obj => obj.OrderID).ToList(); if (appendType != AppendType.None) { SysParameter para = new SysParameter(); para.Code = ""; if (appendType == AppendType.All) { para.DisplayName = "全部"; para.FullName = "全部"; } else if (appendType == AppendType.Blank) { para.DisplayName = ""; para.FullName = ""; } lstParameter.Insert(0, para); } control.Properties.DataSource = lstParameter; }
public IList <SysParameter> GetSysParameters(SysParameter SysParameter) { var reValue = base.GetSqlMapper(databaseName).QueryForList <SysParameter>("SysConfig.SysParameter.GetSysParameters", SysParameter); logger.Debug("GetSysParameters:" + (reValue == null ? 0 : reValue.Count)); return(reValue); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(SysParameter model) { using (DBHelper db = DBHelper.Create()) { db.Insert <SysParameter>(model); } }
public static IResultResponse OrderCheck(SysParameter para) { try { int sellerId = para.ToInt("FKId"); int dbId = para.ToInt("DBId"); string orderInfo = para.ToValue("ProductInfo"); int orderId = para.ToInt("OrderId"); bool result = false; if (!String.IsNullOrEmpty(orderInfo) && sellerId != 0) { var xml = new XmlDocument(); xml.LoadXml(orderInfo); //检测商品 var res = new ProductRelationBusiness(para.dapperFactory).CheckProduct(sellerId, dbId, xml); if (!res.Success) { return(res); } //检测订单 bool check = new OrderRelationBusiness(para.dapperFactory).CheckOrder(sellerId, dbId, orderId); if (check) { return(ResultResponse.ExceptionResult("你已经代下过单了")); } return(ResultResponse.GetSuccessResult(result)); } return(ResultResponse.ExceptionResult("订单信息不全")); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
//第一次加载显示的值 public void RealPrice() { //先获取房型房价 然后再打折扣 int room_type_Id = Convert.ToInt32(this.RoomTypeDdl.SelectedValue); Model.room_type model = rtBll.GetModel(room_type_Id); pricetxt.Value = Convert.ToDecimal(model.room_listedmoney).ToString("0.##"); int house_shame_id = Convert.ToInt32(this.HouseShameDdl.SelectedValue); Model.hourse_scheme hsmodel = hsBll.GetModel(house_shame_id); double room_money = (Convert.ToDouble(model.room_listedmoney)); double discount = (Convert.ToDouble(hsmodel.hs_Discount)); this.real_price.Value = (room_money * discount).ToString(); //默认来店时间 this.time_to.Value = System.DateTime.Now.Date.ToShortDateString(); //默认入住时间 this.real_time.Value = System.DateTime.Now.Date.AddDays(1).ToShortDateString() + " " + "18:00"; Model.SysParamter modelsys = new Model.SysParamter(); BLL.SysParameter blls = new SysParameter(); modelsys = blls.GetModel(1); TimeSpan dt1 = TimeSpan.Parse(modelsys.DayOutTime.ToString());//得到系统设置的天房退房时间 //默认离店时间 this.time_from.Value = System.DateTime.Now.Date.AddDays(2).AddHours(dt1.Hours).ToString(); }
/// <summary> /// 执行接口 /// </summary> /// <param name="para"></param> public IResultResponse Process(SysParameter para) { IResultResponse result = GetResultResponse(para); // 如果使用给定结果的方式返回可以直接输出二进制流 return(result != null ? result : ResultResponse.ExceptionResult("提交参数不正确", "", 4001)); }
/// <summary> /// 获取上游供应商的首页 /// </summary> /// <param name="para"></param> /// <returns></returns> public static IResultResponse GetUpDefalutUrl(SysParameter para) { IResultResponse resultResponse = OpsUtil.VerifyAccessToken(para); if (!resultResponse.Success) { return(resultResponse); } Sdk.AccessToken accessToken = resultResponse.Content as Sdk.AccessToken; try { ConnectorRelation connectorRelation = new ConnectorBusiness(para.dapperFactory).GetUpConnector(Utils.ToInt(accessToken.Id)); if (connectorRelation.VirtualDir != null) { Dictionary <string, string> dic = new Dictionary <string, string>() { { "method", "linker.login" }, { "userId", "0" }, { "storeId", connectorRelation.UpBuyerId.ToString() }, { "virtualdir", connectorRelation.VirtualDir }, }; var param = ApiRequest.GetPaySign(dic); return(ResultResponse.GetSuccessResult($"{connectorRelation.Domain}/linker.axd?{param}")); } return(ResultResponse.ExceptionResult("你没有上游供应商")); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public FrmParameterEdit(DBOperateType type, SysParameter parameter, string parameterType) { InitializeComponent(); Type = type; Parameter = parameter; ParameterType = parameterType; }
/// <summary> /// 订单支付 /// </summary> /// <param name="para"></param> /// <returns></returns> public static IResultResponse OrderPay(SysParameter para) { int sellerId = para.ToInt("FKId"); int dbId = para.ToInt("DBId"); int orderId = para.ToInt("OrderId"); try { ConnectorRelation connectorEntity = new ConnectorBusiness(para.dapperFactory).GetUpConnector(sellerId, dbId); if (connectorEntity.Id == null) { return(ResultResponse.ExceptionResult("没有找到对应的上游")); } RelationMappingEntity orderMappingEntity = new OrderRelationBusiness(para.dapperFactory).GetUpOrder(sellerId, dbId, orderId); if (!orderMappingEntity.OrderMapping.ContainsKey(orderId)) { return(ResultResponse.ExceptionResult("没有找到对应的订单")); } Dictionary <string, string> p = new Dictionary <string, string>() { { "domain", connectorEntity.Domain }, { "userId", connectorEntity.UpBuyerId.ToString() }, { "orderId", orderMappingEntity.OrderMapping[orderId].ToString() }, }; return(ResultResponse.GetSuccessResult(p)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex)); } }
/// <summary> /// 订单支付 /// </summary> /// <param name="para"></param> /// <returns></returns> public static IResultResponse OrderUpdate(SysParameter para) { int sellerId = para.ToInt("FKId"); int dbId = para.ToInt("DBId"); int orderId = para.ToInt("OrderId"); int upBuyerId = para.ToInt("BuyerId"); try { ConnectorRelation connectorEntity = new ConnectorBusiness(para.dapperFactory).GetDownConnector(sellerId, upBuyerId, dbId); if (connectorEntity.Id == null) { return(ResultResponse.ExceptionResult("没有找到对应的下游")); } RelationMappingEntity orderMappingEntity = new OrderRelationBusiness(para.dapperFactory).GetDownOrder(sellerId, dbId, orderId, upBuyerId); if (!orderMappingEntity.OrderMapping.ContainsKey(orderId)) { return(ResultResponse.ExceptionResult("没有找到对应的订单")); } new OrderRelationBusiness(para.dapperFactory).UpdateUpOrder(connectorEntity, para.ToDictionary()); return(ResultResponse.GetSuccessResult(200)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex)); } }
public static IResultResponse GetValidateCode(SysParameter para) { NetResponse response = null; string domain = para.ToValue("domain"); if (domain == null) { return(ResultResponse.ExceptionResult("域名为空")); } NetRequest request = new NetRequest(); request.SetTimeOut(8000); request.SetTryTimes(1); string url = domain + "/api/VerifyCode.axd?base64=1"; string msg = string.Empty; response = request.Get(url, string.Empty, out msg); string content = response.Content; string codeToken = response.Header["CodeToken"]; Dictionary <string, string> result = new Dictionary <string, string>() { { "content", content }, { "codeToken", codeToken }, }; return(ResultResponse.GetSuccessResult(result.ToJson())); }
/// <summary> /// 发货中转 /// </summary> /// <param name="sellerId"></param> /// <param name="dbId"></param> /// <param name="dispatchId"></param> /// <param name="dispatchInfo"></param> /// <returns></returns> public static IResultResponse DispatchSubmit(SysParameter para) { IResultResponse result = null; int sellerId = para.ToInt("FKId"); int dbId = para.ToInt("DBId"); string dispatchInfo = para.ToValue("DispatchInfo"); int dispatchId = para.ToInt("DispatchId"); int orderId = para.ToInt("OrderId"); int upBuyerId = para.ToInt("BuyerId"); string oddNumber = para.ToValue("OddNumber"); try { RelationMappingEntity productMappingEntity = new ProductRelationBusiness(para.dapperFactory).GetDownMappingEntity(sellerId, upBuyerId, dbId); if (productMappingEntity.GoodsMapping.Count == 0) { return(ResultResponse.ExceptionResult("没有找到商品映射关系")); } RelationMappingEntity orderMappingEntity = new OrderRelationBusiness(para.dapperFactory).GetDownOrder(sellerId, dbId, orderId, upBuyerId); if (!orderMappingEntity.OrderMapping.ContainsKey(orderId) || !orderMappingEntity.OrderOddNumberMapping.ContainsKey(oddNumber)) { return(ResultResponse.ExceptionResult("没有找到订单映射关系")); } //替换orderid dispatchInfo = ReplaceIds(orderMappingEntity.OrderMapping, dispatchInfo, "OrderId"); //替换商品oddnumbers dispatchInfo = ReplaceStr(orderMappingEntity.OrderOddNumberMapping, dispatchInfo, "OddNumber"); //替换product dispatchInfo = ReplaceIds(productMappingEntity.ProductMapping, dispatchInfo, "ProductId"); dispatchInfo = ReplaceIds(productMappingEntity.GoodsMapping, dispatchInfo, "GoodsId"); //发送 result = ApiRequest.GetResponse(productMappingEntity.ConnectorEntity.Domain, "order.dropshippingdispatch.submit", new Dictionary <string, string>() { { "OrderId", orderMappingEntity.OrderMapping[orderId].ToString() }, { "DispatchInfo", dispatchInfo } }); if (result.Success) { //入库 var orderDic = result.Content as Dictionary <string, object>; if (orderDic != null) { new DispatchRelationBusiness(para.dapperFactory).Insert(dispatchId, orderMappingEntity.OrderRelationEntity, orderDic); } return(ResultResponse.GetSuccessResult(dispatchId)); } else { return(result); } } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SysParameter model) { using (DBHelper db = DBHelper.Create()) { db.Update <SysParameter>(model); return(true); } }
public static IResultResponse ChangeIsOpen(SysParameter para) { int id = para.ToInt("Id", 0); int status = para.ToInt("Status"); int connectorId = para.ToInt("ConnectorId", 0); return(new RelationBusiness(para.dapperFactory).ChangeIsOpen(connectorId, id, status)); }
/// <summary> /// 授权登录 /// </summary> /// <param name="para"></param> /// <returns></returns> public static IResultResponse AuthLogin(SysParameter para) { try { string token = para.ToValue("exchange_token"); if (token.IndexOf("%") > -1) { token = HttpUtility.UrlDecode(token); } string sign = para.ToValue("exhange_sign"); string sign_new = Encrypt.MD532("rwxkj:" + token); if (sign_new != sign) { return(ResultResponse.ExceptionResult("参数被篡改")); } string tokenStr = AES.Decode(token); var dic = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, object> >(tokenStr); if (dic == null || dic.Count() == 0) { return(ResultResponse.ExceptionResult("交换token失败")); } int fk_id = dic.ToInt("fk_id", 0); int db_id = dic.ToInt("db_id", 0); IResultResponse resultResponse = new ConnectorBusiness(para.dapperFactory).ExchangeToken(fk_id, db_id); if (resultResponse.Success) { return(resultResponse); } else { string domain = dic.ToValue("domain"); string msg = string.Empty; resultResponse = ApiRequest.GetResponse(domain, "account.base.info", new Dictionary <string, string>() { { "exchange_token", HttpUtility.UrlEncode(token) }, { "exhange_sign", sign }, }); if (resultResponse.Success) { Dictionary <string, object> dic_content = resultResponse.Content as Dictionary <string, object>; resultResponse = new ConnectorBusiness(para.dapperFactory).Join(dic_content); if (!resultResponse.Success) { return(resultResponse); } resultResponse = new ConnectorBusiness(para.dapperFactory).ExchangeToken(fk_id, db_id); } } return(resultResponse); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse ValidateCode(SysParameter para) { string verifyCode = para.ToValue("verifyCode"); int connectorId = para.ToInt("connectorId", 0); int upConnectorId = para.ToInt("upConnectorId", 0); IResultResponse result = new RelationBusiness(para.dapperFactory).ValidateCode(connectorId, upConnectorId, verifyCode); return(result); }
public static IResultResponse GetScmCode(SysParameter para) { string verifyCode = para.ToValue("verifyCode"); string codeToken = para.ToValue("codeToken"); int connectorId = para.ToInt("connectorId", 0); IResultResponse result = new RelationBusiness(para.dapperFactory).GetValidateCode(connectorId, codeToken, verifyCode); return(result); }
/// <summary> /// 代下单中转 /// </summary> /// <param name="para"></param> /// <returns></returns> public static IResultResponse OrderSubmit(SysParameter para) { try { int sellerId = para.ToInt("FKId"); int dbId = para.ToInt("DBId"); string orderInfo = para.ToValue("Order"); int orderId = para.ToInt("OrderId"); string oddNumber = para.ToValue("OddNumber"); decimal downPayables = para.ToDecimal("Payables"); IResultResponse result = null; if (String.IsNullOrEmpty(orderInfo) && sellerId != 0) { return(ResultResponse.ExceptionResult("订单信息为空")); } RelationMappingEntity relationMappingEntity = new ProductRelationBusiness(para.dapperFactory).GetUpMappingEntity(sellerId, dbId); if (relationMappingEntity.GoodsMapping.Count == 0) { return(ResultResponse.ExceptionResult("没有找到商品映射关系")); } //替换供应商ids orderInfo = ReplaceIds(relationMappingEntity.ConnectorMapping, orderInfo, "SupplierIds"); orderInfo = ReplaceIds(relationMappingEntity.ConnectorMapping, orderInfo, "SupplierId"); //替换商品ids orderInfo = ReplaceIds(relationMappingEntity.ProductMapping, orderInfo, "ProductIds"); //替换productinfo里面的 orderInfo = ReplaceIds(relationMappingEntity.ProductMapping, orderInfo, "ProductId"); orderInfo = ReplaceIds(relationMappingEntity.GoodsMapping, orderInfo, "GoodsId"); //发送 result = ApiRequest.GetResponse(relationMappingEntity.ConnectorEntity.Domain, "order.dropshipping.submit", new Dictionary <string, string>() { { "StoreId", relationMappingEntity.ConnectorEntity.UpBuyerId.ToString() }, { "Order", orderInfo } }); if (result.Success) { //入库 var orderDic = result.Content as Dictionary <string, object>; if (orderDic != null) { new OrderRelationBusiness(para.dapperFactory).Insert(orderId, oddNumber, downPayables, relationMappingEntity.ConnectorEntity, orderDic); } return(ResultResponse.GetSuccessResult(orderId)); } else { return(result); } } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsAsyncRequest) { if (this.Request.QueryString["flowId"] != null) { WorkflowInstance wi = WorkflowInstance.Find(this.Request.QueryString["flowId"]); WorkflowTemplate tp = WorkflowTemplate.Find(wi.WorkflowTemplateID); IList <EasyDictionary> dicts = DataHelper.DataTableToDictList(GetNodes(tp.XAML)); this.PageState.Add("FlowEnum", dicts); tasks = Task.FindAll(Expression.Eq(Task.Prop_WorkflowInstanceID, wi.ID), Expression.Not(Expression.Eq("Status", 2))).OrderBy(ens => !ens.FinishTime.HasValue ? DateTime.Now : ens.FinishTime).OrderBy(ens => ens.CreatedTime).ToArray(); this.PageState.Add("SysWorkFlowTaskList", tasks); } } if (this.RequestActionString != null && this.RequestActionString == "sendMessage") { string flowId = this.RequestData.Get <string>("flowId"); string taskName = this.RequestData.Get <string>("TaskName"); if (Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, flowId, Task.Prop_ApprovalNodeName, taskName).Length > 0) { Task task = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, flowId, Task.Prop_ApprovalNodeName, taskName)[0]; string userId = task.OwnerId; string userName = task.Owner; SysUser user = SysUser.TryFind(userId); if (userId == this.UserInfo.UserID) { PageState.Add("Message", "您是要催办的审批人,无需给自己发送短信催办!"); } else if (user != null && (!string.IsNullOrEmpty(user.Phone) || !string.IsNullOrEmpty(user.Email))) { string method = this.RequestData.Get <string>("Method").ToLower(); string mailTemplate = SysParameter.FindAllByProperties("Code", "TaskAlertMail")[0].Description; //{[AuditCount]} {[TaskName]} string phoneTemplate = SysParameter.FindAllByProperties("Code", "TaskAlertPhone")[0].Description; //{[AuditCount]} {[LinkUrl]} {[SysEntry]} string tName = task.Title; string linkUrl = task.EFormName; string sysEntry = SysParameter.FindAllByProperties("Code", "SysEntry2")[0].Description; string auditCount = DataHelper.QueryValue <int>("select count(*) from Task where status='0' and ownerId='" + userId + "'").ToString(); string mailContent = mailTemplate.Replace("{[TaskName]}", tName).Replace("{[AuditCount]}", auditCount).Replace("{[SysEntry]}", sysEntry + task.ID); string phoneContent = phoneTemplate.Replace("{[AuditCount]}", auditCount).Replace("{[TaskName]}", tName).Replace("{[LinkUrl]}", linkUrl).Replace("{[SysEntry]}", sysEntry); //if (!string.IsNullOrEmpty(user.Phone) && method == "phone") // MessageTool.SendMessage(user.Phone, phoneContent); //if (!string.IsNullOrEmpty(user.Email) && method == "mail") // MessageTool.SendMessageMail(mailContent, user.Email); } else { PageState.Add("Message", "系统尚未配置相关审批人电话号码及邮箱信息,无法发送短信和邮件!"); } } } }
/// <summary> /// 推送克隆命令 /// </summary> /// <param name="accessToken"></param> /// <returns></returns> public static IResultResponse PushCloneCommand(SysParameter para) { IResultResponse resultResponse = OpsUtil.VerifyAccessToken(para); if (!resultResponse.Success) { return(resultResponse); } Sdk.AccessToken accessToken = resultResponse.Content as Sdk.AccessToken; if (accessToken.UpConnectorId == 0) { return(ResultResponse.ExceptionResult("上下游关系没生效,请重新登录!")); } try { string key = accessToken.Id + "_" + accessToken.UpConnectorId; if (!IsSendCmd(key)) { return(ResultResponse.ExceptionResult("三分钟之内发送次过多")); } //克隆权限 var cloneAuthority = new ProductRelationBusiness(para.dapperFactory).CloneAuthority(accessToken.Id, accessToken.UpConnectorId); if (!cloneAuthority) { return(ResultResponse.ExceptionResult("你已经克隆过了!")); } long re = DistributePubSub.RedisPub("product_clone", new Dictionary <string, int>() { { "upId", accessToken.UpConnectorId }, { "downId", accessToken.Id }, }); //bool sendCmd = WebSocketClient.SendCommand("Clone", "data.clone.push.command", new object[] { accessToken.Id, accessToken.UpConnectorId }, true); if (re == -1) { return(ResultResponse.ExceptionResult("命令已发送失败!")); } //插入发送记录 new CloneResultBusiness(para.dapperFactory).Insert(accessToken); //设置发送时间 SetSendCmd(key); return(ResultResponse.GetSuccessResult("命令已发送成功,请稍后!")); } catch (Exception ex) { new Exceptions(ex, "clone"); return(ResultResponse.ExceptionResult(ex.Message)); } }
public static IResultResponse Update(SysParameter para) { try { int result = new AccountBusiness(para.dapperFactory).Update(para.Properties); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse Delete(SysParameter para) { try { int id = para.ToInt("Id"); int result = new ConnectorBusiness(para.dapperFactory).Delete(id); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse Get(SysParameter para) { try { PagingQuery query = para.ToPagingQuery(); PagingResult result = new AccountBusiness(para.dapperFactory).GetList(query); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse CheckDownConnector(SysParameter para) { string mobile = para.ToValue("Mobile"); int upConnectorId = para.ToInt("UpConnectorId", 0); if (string.IsNullOrWhiteSpace(mobile)) { return(ResultResponse.ExceptionResult("请输入正确手机号")); } IResultResponse result = new RelationBusiness(para.dapperFactory).CheckDownConnector(mobile, upConnectorId); return(result); }
public static IResultResponse GetOrderInfo(SysParameter para) { try { int connectorId = para.ToInt("ConnectorId"); string oddNumber = para.ToValue("OddNumber"); return(new OrderRelationBusiness(para.dapperFactory).GetOrderInfo(connectorId, oddNumber)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse GetUpProductList(SysParameter para) { try { PagingQuery query = para.ToPagingQuery(); int connectorId = para.ToInt("ConnectorId", 0); PagingResult result = new AuthProductBusiness(para.dapperFactory).UpConnectorAuthList(query, connectorId); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse DeleteUnauthorized(SysParameter para) { try { string authProductIds = para.ToValue("AuthProductIds"); int connectorId = para.ToInt("ConnectorId", 0); int result = new AuthProductBusiness(para.dapperFactory).Delete(authProductIds, connectorId); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse DownConnectorStock(SysParameter para) { try { PagingQuery query = para.ToPagingQuery(); int connectorId = para.ToInt("ConnectorId", 0); PagingResult result = new ConnectorBusiness(para.dapperFactory).DownConnectorStock(connectorId, query); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public bool Insert(SysParameter SysParameter) { try { var result = base.GetSqlMapper(databaseName).Insert("SysConfig.SysParameter.Insert", SysParameter); SysParameter.ID = int.Parse(result.ToString()); return(true); } catch (Exception ex) { GlobalMethod.log.Error(ex); return(false); } }
public static IResultResponse ImportProduct(SysParameter para) { try { int connectorId = para.ToInt("ConnectorId"); int productId = para.ToInt("ProductId"); int upConnectorId = para.ToInt("UpConnectorId"); return(new ProductRelationBusiness(para.dapperFactory).ImportProduct(connectorId, upConnectorId, productId)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
public static IResultResponse AddAuth(SysParameter para) { try { int connectorId = para.ToInt("ConnectorId", 0); string ids = para.ToValue("CategoryIds"); int result = new AuthCategoryBusiness(para.dapperFactory).Insert(connectorId, ids); return(ResultResponse.GetSuccessResult(result)); } catch (Exception ex) { return(ResultResponse.ExceptionResult(ex, 500)); } }
//保存 private void btnSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (validationProvider.Validate()) { if (Type == DBOperateType.Insert) { Parameter = new SysParameter(); Parameter.Type = ParameterType; Parameter.Valid = true; } Parameter.Code = txtCode.Text.Trim(); Parameter.DisplayName = txtDisplayName.Text.Trim(); Parameter.FullName = txtFullName.Text.Trim(); Parameter.Mark1 = txtMark1.Text.Trim(); Parameter.Mark2 = txtMark2.Text.Trim(); Parameter.Mark3 = txtMark3.Text.Trim(); Parameter.Remark = txtRemark.Text.Trim(); Parameter.OrderID = Convert.ToInt16(spinEditOrderID.Value); Parameter.QueryWord = txtQueryWord.Text.Trim(); if (Type == DBOperateType.Insert) WcfServiceHelper.Client.InsertParameter(Parameter); else WcfServiceHelper.Client.UpdateParameter(Parameter); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } catch (Exception ex) { ControlsHelper.ShowErrorMessage("保存失败", ex.Message); } finally { this.Cursor = Cursors.Default; } }
void BindList() { string type = dictQuery[lookUpQueryType.Name].ToString(); string name = dictQuery[txtQueryDisplayName.Name].ToString(); dataSource = FrequentlyUsedData.GetParameterList(type,true).Where(obj=>obj.Valid == true).ToList().OrderBy(obj => obj.OrderID).ToList(); parameterType = parameterTypeList.Find(obj => obj.Type == type); if (parameterType.TreeFlag) { SysParameter rootParameter = new SysParameter(); rootParameter.Code = "0"; rootParameter.DisplayName = "根节点"; rootParameter.Valid = true; dataSource.Insert(0, rootParameter); } if (string.IsNullOrEmpty(name)) treeListData.DataSource = dataSource; else treeListData.DataSource = dataSource.Where(obj => obj.DisplayName.Contains(name)).ToList(); }
/// <summary> /// 获取参数列表 /// </summary> public static List<SysParameter> GetParameterList(string type, bool isRefreshData, AppendType appendType) { if (!dictData.ContainsKey("para_" + type) || isRefreshData) { int version = WcfServiceHelper.Client.GetVersion(type); if (version != -1) //按版本加载 { EF.Version v = LocalStoreHelper.Context.Version.FirstOrDefault(obj => obj.Type.ToLower().Trim() == type.ToLower().Trim()); #region 保存到本地 if (v == null || v.Version1 != version) { //下载到本地 List<SysParameter> objs = WcfServiceHelper.Client.GetParameterListByType(type).ToList(); //删除本地的数据 EF.LocalStoreEntities context = LocalStoreHelper.Context; IQueryable<EF.Parameter> paras = LocalStoreHelper.Context.Parameter.Where(obj => obj.Type.ToLower().Trim() == type.ToLower().Trim()); foreach (EF.Parameter p in paras) context.Parameter.DeleteObject(p); //加载到本地 foreach (SysParameter p in objs) { EF.Parameter newObj = new EF.Parameter(); newObj.Type = type; newObj.Code = p.Code; newObj.Name = p.DisplayName; newObj.ParentCode = p.ParentCode; newObj.OrderID = p.OrderID; newObj.Valid = p.Valid; context.Parameter.AddObject(newObj); } if (v != null) context.Version.DeleteObject(v); EF.Version newVersion = new EF.Version(); newVersion.Type = type; newVersion.Version1 = version; context.Version.AddObject(newVersion); context.SaveChanges(); } #endregion #region 从本地加载 List<EF.Parameter> lstParameter = LocalStoreHelper.Context.Parameter.Where(obj => obj.Type.ToLower().Trim() == type.ToLower().Trim()).OrderBy(obj => obj.OrderID).ToList(); List<SysParameter> _lstParameterType = new List<SysParameter>(); foreach (EF.Parameter p in lstParameter) { SysParameter newObj = new SysParameter(); newObj.Type = p.Type; newObj.Code = p.Code; newObj.DisplayName = p.Name; newObj.ParentCode = p.ParentCode; newObj.OrderID = p.OrderID; newObj.Valid = p.Valid; _lstParameterType.Add(newObj); } dictData["para_" + type] = _lstParameterType; #endregion } else //直接加载 { List<SysParameter> _lstParameterType = WcfServiceHelper.Client.GetParameterListByType(type).ToList(). OrderBy(obj => obj.OrderID).ToList(); dictData["para_" + type] = _lstParameterType; } } List<SysParameter> resultObj = ((List<SysParameter>)dictData["para_" + type]).Clone(); if (appendType != AppendType.None) { SysParameter p = new SysParameter(); p.Code = ""; if (appendType == AppendType.Blank) p.DisplayName = ""; else if (appendType == AppendType.All) p.DisplayName = "全部"; p.Valid = true; resultObj.Insert(0, p); } return resultObj; }