示例#1
0
        /// <summary>
        /// 删除字典明细
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Del_DicLeaf_Click(object sender, RoutedEventArgs e)
        {
            var count = 0;

            foreach (var item in Dic.Items)
            {
                var box = Common.GetTemplateColumn <CheckBox>(Dic, 0, "dicBox", item);
                if (box != null && box.IsChecked == true)
                {
                    var temp = item as Data_Dic_Details;
                    if (temp != null && !string.IsNullOrEmpty(temp.Id))
                    {
                        FastWrite.Delete <Data_Dic_Details>(a => a.Id == temp.Id);
                    }
                    count++;
                }
            }

            if (count == 0)
            {
                CodeBox.Show("请选择字典明细", this);
            }
            else
            {
                InitDic();
                CodeBox.Show("删除成功", this);
            }
        }
示例#2
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <returns></returns>
        public ActionResult DeleteUser(string userid)
        {
            var isSuccess = FastWrite.Delete <GI_USERINFO>(a => a.USERID == userid, null, AppEmr.DbConst.EmrDb).IsSuccess;

            if (isSuccess)
            {
                return(Json(new { code = 0 }));
            }
            else
            {
                return(Json(new { code = 1 }));
            }
        }
示例#3
0
        /// <summary>
        /// 删除字典类型
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Del_Dic_Click(object sender, RoutedEventArgs e)
        {
            var success = false;
            var item    = Dic.SelectedItem as Data_Dic;

            if (!string.IsNullOrEmpty(item.Id))
            {
                success = FastWrite.Delete <Data_Dic>(a => a.Id == item.Id).IsSuccess;
            }

            if (success)
            {
                InitDic();
                CodeBox.Show("删除成功", this);
            }
            else
            {
                CodeBox.Show("删除失败", this);
            }
        }
示例#4
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Del_Click(object sender, RoutedEventArgs e)
        {
            var item = dbTypeLink.SelectedItem as Data_Source;

            if (item != null)
            {
                if (FastRead.Query <Data_Business_Details>(a => a.DataSourceId == item.Id).ToCount() == 0)
                {
                    FastWrite.Delete <Data_Source>(a => a.LinkName == item.LinkName);
                    AppCache.RemoveLink();
                    dbTypeLink.ItemsSource = AppCache.GetAllLink;
                    InitLinkInfo();
                    CodeBox.Show("删除成功", this);
                }
                else
                {
                    InitLinkInfo();
                    CodeBox.Show("删除失败数据源在使用中", this);
                }
            }
        }
示例#5
0
        /// <summary>
        /// 处理请求
        /// </summary>
        /// <param name="downparam">下游</param>
        /// <param name="param">请求参数</param>
        /// <param name="content">请求参数body</param>
        /// <returns></returns>
        private static ReturnModel GetReuslt(ApiGatewayDownParam downparam, string param, string key, int isTextLog, int isDbLog, DataContext db, HttpContext context, string ActionId, int OrderBy, IHttpClientFactory client)
        {
            var info = FastRead.Query <ApiGatewayWait>(a => a.Key.ToLower() == key.ToLower() && a.Url.ToLower() == downparam.Url.ToLower()).ToItem <ApiGatewayWait>(db) ?? new ApiGatewayWait();

            if (info.Key.ToStr().ToLower() == key.ToLower() && DateTime.Compare(info.NextAction, DateTime.Now) > 0)
            {
                //return time out
                var dic = new Dictionary <string, object>();
                dic.Add("success", false);
                dic.Add("result", "等待恢复");
                return(new ReturnModel {
                    msg = BaseJson.ModelToJson(dic), status = 408
                });
            }
            else
            {
                var result    = new ReturnModel();
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                if (downparam.Protocol.ToLower() == "soap")
                {
                    result = BaseUrl.SoapUrl(downparam.Url, downparam.SoapParamName, downparam.SoapMethod, param, client, key, downparam.SoapNamespace);
                }
                else if (downparam.Protocol.ToLower() == "http")
                {
                    //http
                    if (downparam.Method.ToStr().ToLower() == "post")
                    {
                        if (downparam.IsBody == 1)
                        {
                            result = BaseUrl.PostContent(downparam.Url, param, key, client);
                        }
                        else
                        {
                            result = BaseUrl.PostUrl(downparam.Url, param, key, client);
                        }
                    }
                    else if (downparam.Method.ToStr().ToLower() == "get")
                    {
                        result = BaseUrl.GetUrl(downparam.Url, param, key, client);
                    }
                }
                //else if (downparam.Protocol.ToLower() == "mq")
                //    //mq
                //    result = BaseUrl.RabbitUrl(downparam.QueueName, param);
                else
                {
                    result.status = 408;
                }

                if (result.status == 408)
                {
                    //time out
                    var wait = new ApiGatewayWait();
                    wait.Key        = key;
                    wait.Url        = downparam.Url;
                    wait.WaitHour   = downparam.WaitHour.ToInt(0);
                    wait.ErrorMsg   = result.msg;
                    wait.NextAction = DateTime.Now.AddHours(wait.WaitHour.ToStr().ToDouble(0));

                    FastWrite.Add(wait, db);
                }
                else if (info.Key.ToStr().ToLower() == key.ToLower())
                {
                    FastWrite.Delete <ApiGatewayWait>(a => a.Key.ToLower() == key.ToLower(), db);
                }

                stopwatch.Stop();

                var logInfo = new ApiGatewayLog();
                logInfo.ActionId     = ActionId;
                logInfo.OrderBy      = OrderBy;
                logInfo.Key          = key;
                logInfo.ActionTime   = DateTime.Now;
                logInfo.Url          = downparam.Url;
                logInfo.Protocol     = downparam.Protocol;
                logInfo.Success      = result.status == 200 ? 1 : 0;
                logInfo.Result       = result.msg;
                logInfo.Milliseconds = stopwatch.Elapsed.TotalMilliseconds;
                logInfo.ActionIp     = GetClientIp(context);
                logInfo.ActionParam  = param;

                if (isDbLog == 1)
                {
                    FastWrite.Add(logInfo, null, DbApi);
                }

                if (isTextLog == 1)
                {
                    BaseLog.SaveLog(BaseJson.ModelToJson(logInfo), logInfo.Key);
                }

                return(result);
            }
        }