Beispiel #1
0
        public HttpResponseMessage GetEqiw_R_History(historypra obj)
        {
            string result = string.Empty;

            try
            {
                DataTable dt = new DataTable();
                RuletblEQIW_R_Basedata ru = new RuletblEQIW_R_Basedata();

                string itemname = obj.fldItemName;
                string praname  = "";
                if (itemname != null && itemname != "")
                {
                    string[] listname = itemname.Split('、');
                    for (int i = 0; i < listname.Length; i++)
                    {
                        praname += "[" + listname[i].Substring(0, listname[i].IndexOf("(")) + "],";
                    }
                }
                praname = praname.Substring(0, praname.Length - 1);

                string ti = DateTime.Now.AddYears(-2).ToShortDateString();
                dt     = ru.GetHistory(obj.fldSTName, obj.fldRName, obj.fldRSName, ti, praname);
                result = rule.JsonStr("ok", "", dt);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        /// <summary>
        /// 功能描述    :  获得水自动发布数据
        /// 创建者      :  徐雍文
        /// 创建日期    :  2018-03-15
        /// 修改者      :
        /// 修改日期    :
        /// 修改原因    :
        /// </summary>
        /// <param name="type">数据类型 1 审核的自动数据 2未审核的自动数据</param>
        /// <param name="BeginDate">开始时间</param>
        /// <param name="EndDate">结束时间</param>
        /// <returns></returns>
        public HttpResponseMessage GetSectionData_Auto(int type, string BeginDate = "", string EndDate = "")
        {
            string result = string.Empty;

            try
            {
                DataTable dt = new DataTable();
                if (type == 1)
                {
                    dt = rule.GetWaterAutoPublish("tblEQIW_R_BaseData_Auto", BeginDate, EndDate);
                }
                else if (type == 2)
                {
                    dt = rule.GetWaterAutoPublish("tblEQIW_R_BaseData_Raw", BeginDate, EndDate);
                }
                result = rule.JsonStr("ok", "", dt);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage GetAccountingSystem(string Merchant)
        {
            string result = string.Empty;

            try
            {
                using (YYPlayContext db = new YYPlayContext())
                {
                    //查询所有的数据  用于前端筛选
                    List <vwtblAccountingSystem> AccountingSystem = (from x in db.vwtblAccountingSystem
                                                                     where x.fldMerchID == Merchant
                                                                     select x).ToList();

                    if (AccountingSystem.Count > 0)
                    {
                        result = rule.JsonStr("ok", "", AccountingSystem);
                    }
                    else
                    {
                        result = rule.JsonStr("nodata", "无数据!", AccountingSystem);
                    }
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Beispiel #4
0
        public HttpResponseMessage GetCityLIST(string stcode)
        {
            string result = "";

            string where = "1=1";
            try
            {
                if (rule.Judge(stcode))
                {
                    where += " and fldSTCode='" + stcode + "'";
                }
                string    sql = "select * from tblFW_RegCity where " + where + " and fldParentID='2'";
                DataTable dt  = rule.GetMiddleData(sql);

                result = rule.JsonStr("ok", "", dt);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage GetCondition(string type)
        {
            if (type.Contains(",") == true)
            {
                if (type.Split(',')[1] != "")
                {
                    string strLocalpathother = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/Config/" + type.Split(',')[1] + ".json");//配置的json文件地址
                    strLocalpath = strLocalpathother;
                }
            }
            string returntxt = "";

            try
            {
                string getjson = rule.GetJson(strLocalpath);//json配置文件转换
                JArray jsonObj = JArray.Parse(getjson);
                for (int i = 0; i < jsonObj.Count; i++)
                {
                    string typemodel = jsonObj[i]["type"].ToString();
                    if (type.Split(',')[0] == typemodel)
                    {
                        JArray jsonObjs = JArray.Parse(jsonObj[i]["condition"].ToString());
                        JArray jsonend  = JArray.Parse(jsonObjs[0]["one"].ToString());//配置每次的第一个,索引为0
                        returntxt = rule.JsonStr("ok", "", jsonend);
                    }
                }
            }
            catch (Exception e)
            {
                returntxt = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(returntxt, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage Gethalfhour(parm reparm)
        {
            string result = string.Empty;

            try
            {
                int count = 0;
                string where = parwhere(reparm);



                //查询分页的数据
                DataTable dt = rule.getpaging("vwtblAgentPay", "*", "1=1" + where, reparm.page, reparm.limit, reparm.sort, out count);

                getdata getdata = new getdata();
                getdata.Table = dt;
                getdata.total = count;
                result        = rule.JsonStr("ok", "成功", getdata);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        //[SupportFilter]
        public HttpResponseMessage ByParentName(string parentname)
        {
            string result = string.Empty;

            try
            {
                DataTable tblData = ruleDict.ByParentName(parentname);
                if (tblData.Rows.Count > 0)
                {
                    result = rule.JsonStr("ok", "", tblData);
                }
                else
                {
                    result = rule.JsonStr("nodata", "无数据", tblData);
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Beispiel #8
0
        //
        public HttpResponseMessage Geteqia_r_daySTG(string itemcontent, string standardnum, string std, string type)
        {
            string result = string.Empty;

            try
            {
                string                    itemCode1000 = System.Configuration.ConfigurationManager.AppSettings["itemCode1000"].ToString();//因子单位mg转ug *1000
                List <ItemSTD>            itemstd      = new List <ItemSTD>();
                RuletblEQIA_R_ItemSTD     rule_itemstd = new RuletblEQIA_R_ItemSTD();
                IList <tblEQIA_R_ItemSTD> list         = rule_itemstd.GetDaySTG(itemcontent.TrimEnd(new char[] { ',' }), standardnum);
                if (list != null && list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (itemCode1000.Contains(list[i].fldItemCode))
                        {
                            list[i].fldDaySTG1  = list[i].fldDaySTG1;
                            list[i].fldDaySTG2  = list[i].fldDaySTG2;
                            list[i].fldDaySTG3  = list[i].fldDaySTG3;
                            list[i].fldHourSTG1 = list[i].fldHourSTG1;
                            list[i].fldHourSTG2 = list[i].fldHourSTG2;
                            list[i].fldHourSTG3 = list[i].fldHourSTG3;
                        }
                        string stgstr = "";
                        switch (std)
                        {
                        case "1":
                            stgstr = type == "0" ? list[i].fldDaySTG1.ToString() : list[i].fldHourSTG1.ToString();
                            break;

                        case "2":
                            stgstr = type == "0" ? list[i].fldDaySTG2.ToString() : list[i].fldHourSTG2.ToString();
                            break;

                        case "3":
                            stgstr = type == "0" ? list[i].fldDaySTG3.ToString() : list[i].fldHourSTG3.ToString();
                            break;
                        }
                        ItemSTD str = new ItemSTD();
                        str.key = list[i].fldItemCode;
                        str.stg = stgstr;
                        itemstd.Add(str);
                    }
                    result = rule.JsonStr("ok", "", itemstd);
                }
                else
                {
                    result = rule.JsonStr("nodata", "没有因子对应的执行质量标准", itemstd);
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        //
        public HttpResponseMessage Geteqiw_r_daySTG(string itemcontent, string standardnum, string std, string type)
        {
            string result = string.Empty;

            try
            {
                RuletblEQIW_R_DAQLTSTD     rule_itemstd = new RuletblEQIW_R_DAQLTSTD();
                List <ItemSTD>             itemstd      = new List <ItemSTD>();
                IList <tblEQIW_R_DAQLTSTD> list         = rule_itemstd.GetSTD(itemcontent, standardnum);
                if (list != null && list.Count > 0)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        string stgstr = "";
                        switch (std)
                        {
                        case "1":
                            stgstr = list[i].fldST10.ToString();
                            break;

                        case "2":
                            stgstr = list[i].fldST20.ToString();
                            break;

                        case "3":
                            stgstr = list[i].fldST30.ToString();
                            break;

                        case "4":
                            stgstr = list[i].fldST40.ToString();
                            break;

                        case "5":
                            stgstr = list[i].fldST50.ToString();
                            break;
                        }
                        ItemSTD str = new ItemSTD();
                        str.key = list[i].fldItemCode;
                        str.stg = stgstr;
                        itemstd.Add(str);
                    }
                    result = rule.JsonStr("ok", "", itemstd);
                }
                else
                {
                    result = rule.JsonStr("nodata", "没有因子对应的执行质量标准", itemstd);
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage Login(string username, string password)
        {
            string     result = string.Empty;
            RuleCommon rule   = new RuleCommon();

            try
            {
                tblFW_User objUser = new tblFW_User();
                //到数据库进行校验
                if (CheckUser(username, password, "", ref objUser) == false)
                {
                    result = rule.JsonStr("error", "用户名或密码错误", "");
                    return(new HttpResponseMessage {
                        Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                    });
                }
                DateTime          dtime    = DateTime.Parse(DateTime.Now.ToShortDateString());
                IDateTimeProvider provider = new UtcDateTimeProvider();
                var now               = provider.GetNow();
                var unixEpoch         = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
                var secondsSinceEpoch = Math.Round((now - unixEpoch).TotalSeconds);
                var payload           = new Dictionary <string, object>
                {
                    { "pass", password },
                    { "exp", secondsSinceEpoch + 10000 },
                    { "name", username }
                };
                IJwtAlgorithm     algorithm  = new HMACSHA256Algorithm();
                IJsonSerializer   serializer = new JsonNetSerializer();
                IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
                IJwtEncoder       encoder    = new JwtEncoder(algorithm, serializer, urlEncoder);
                var token = encoder.Encode(payload, "YYplay");

                ////返回登录结果、用户信息、用户验证票据信息
                //var Token = FormsAuthentication.Encrypt(token);
                ////将身份信息保存在session中,验证当前请求是否是有效请求
                //if (HttpContext.Current.Session[username] == null)
                //    HttpContext.Current.Session[username] = Token;
                LoginInfo lginfo = new LoginInfo();

                lginfo.token = token;

                result = rule.JsonStr("ok", "", lginfo);
                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
        }
        public HttpResponseMessage UserInfo(string token)
        {
            string     result = string.Empty;
            RuleCommon rule   = new RuleCommon();

            try
            {
                string message = "";

                //var strTicket = FormsAuthentication.Decrypt(token).UserData;

                IJsonSerializer   serializer = new JsonNetSerializer();
                IDateTimeProvider provider   = new UtcDateTimeProvider();
                IJwtValidator     validator  = new JwtValidator(serializer, provider);
                IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
                IJwtDecoder       decoder    = new JwtDecoder(serializer, validator, urlEncoder);
                string            json       = "[" + decoder.Decode(token, "YYplayMerchant", verify: true).ToString() + "]";//token为之前生成的字符串
                string            userName   = "";
                JArray            jsonObj    = JArray.Parse(json);
                string            password   = "";
                for (int i = 0; i < jsonObj.Count; i++)
                {
                    userName = jsonObj[i]["name"].ToString();
                }



                LoginInfo lginfo = new LoginInfo();

                lginfo.userid       = "1";
                lginfo.roleid       = "1";
                lginfo.token        = "";
                lginfo.cityid       = "1";
                lginfo.username     = userName;
                lginfo.roles        = "super_admin";
                lginfo.introduction = "super_admin";
                lginfo.avatar       = "super_admin";

                result = rule.JsonStr("ok", "", lginfo);
                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
        }
        /// <summary>
        /// 功能描述    :  根据城市代码获取各业务测点城市经纬度
        /// 创建者      :  徐雍文
        /// 创建日期    :  2017-08-11
        /// 修改者      :
        /// 修改日期    :
        /// 修改原因    :
        /// </summary>
        /// <param name="stcode">城市代码 全部填-1</param>
        /// <returns></returns>
        public HttpResponseMessage GetLatitudeAndLongitude(string stcode = "-1")
        {
            string result = string.Empty;

            try
            {
                result = rule.JsonStr("ok", "", true);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage GetAccountflowlist(parm reparm)
        {
            string result = string.Empty;

            try
            {
                int count = 0;
                string where = parwhere(reparm);

                DataTable dt = rule.getpaging("vwAccountflow", "*", "1=1" + where, reparm.page, reparm.limit, reparm.sort, out count);

                getdata getdata = new getdata();
                getdata.Table = dt;
                getdata.total = count;
                result        = rule.JsonStr("ok", "成功", getdata);
            }
            catch (Exception e)
            {
                //错误保存日志
                throw new InsertException(e.Message, " Accountflow", "GetAccountflowlist", reparm.ToString());
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Beispiel #14
0
        public HttpResponseMessage Reissuenotice(List <tblOrdertable> ordertables)
        {
            string result = string.Empty;
            string orid   = "";

            try
            {
                //循环多条订单
                for (int i = 0; i < ordertables.Count; i++)
                {
                    //获得商户的Key
                    RuleCommon rule     = new RuleCommon();
                    DataTable  Merchant = rule.getdt("select *  from tbleMerchant where fldMerchID='" + ordertables[i].fldMerchID + "'");

                    //获得异步通知地址
                    AsynParameterPay asynParameter = new AsynParameterPay();
                    asynParameter.Amount      = ordertables[i].fldOrderAmount.ToString();
                    asynParameter.MerchantId  = ordertables[i].fldMerchID;
                    asynParameter.OrderID     = ordertables[i].fldOrdernum;
                    asynParameter.OrderTime   = ordertables[i].fldchangstautetime.ToString();
                    asynParameter.Paystate    = ordertables[i].fldStaute;
                    asynParameter.Paytype     = ordertables[i].fldRateName.ToString();
                    asynParameter.ProductName = ordertables[i].fldOrederdetailed.ToString();

                    string getpram = JsonHelper.SerializeObject(asynParameter);
                    //json 转换成Dictionary
                    Dictionary <string, string> valuePairs = JsonHelper.DeserializeStringToDictionary <string, string>(getpram);
                    //排序
                    RulePayBehavior behavior = new RulePayBehavior();
                    string          pxrams   = behavior.AsciiDesc(valuePairs);
                    //添加key值
                    pxrams += "key=" + Merchant.Rows[0]["fldSecretKey"].ToString();
                    //md5加密
                    string signkey = behavior.EncryptionMd5(pxrams);

                    asynParameter.Sign = signkey;

                    //转换成json 格式
                    string prams = JsonHelper.SerializeObject(asynParameter);

                    //请求  通知
                    RulePayRequest rulePayRequest = new RulePayRequest();
                    string         rest           = rulePayRequest.PostUrl(ordertables[i].fldNotice.ToString(), prams);
                    if (rest == "ok")
                    {
                        result = "成功" + i + 1;
                    }
                }
                result = rule.JsonStr("ok", "成功", result);
            }
            catch (Exception e)
            {
                //错误保存日志
                throw new InsertException(e.Message, " Ordertable", "Reissuenotice", "补发通知失败,失败订单号:" + orid);
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        /// <summary>
        /// 功能描述    :  根据城市代码获取省和城市地图边界限
        /// 创建者      :  徐雍文
        /// 创建日期    :  2017-08-18
        /// 修改者      :
        /// 修改日期    :
        /// 修改原因    :
        /// </summary>
        /// <param name="prcode">省代码</param>
        /// <param name="stcode">城市代码 默认-1获取该省所有城市边界线</param>
        /// <returns></returns>
        public HttpResponseMessage GetProvAndCityBoundGL(string prcode, string stcode = "-1")
        {
            string result = string.Empty;

            try
            {
                Region map = new Region(prcode);
                result = rule.JsonStr("ok", "", map.getRegionItem(stcode));
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Beispiel #16
0
        /// <summary>
        /// 功能描述    :  根据城市代码获取各业务测点城市经纬度
        /// 创建者      :  徐雍文
        /// 创建日期    :  2017-08-17
        /// 修改者      :
        /// 修改日期    :
        /// 修改原因    :
        /// </summary>
        /// <param name="stcode">城市代码 全部填-1</param>
        /// <returns></returns>
        public HttpResponseMessage GetPointLatitudeAndLongitude(string stcode = "-1")
        {
            string result = string.Empty;

            try
            {
                DataTable dt = Middle.GetPoint_Country_Select(stcode);
                result = rule.JsonStr("ok", "", dt);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        //[SupportFilter]
        public HttpResponseMessage GetSysUrlAll()
        {
            string result = string.Empty;

            try
            {
                DataTable dt = rule.GetSysUrl();
                result = rule.JsonStr("ok", "", dt);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage Execute_usp_getEQIN_F_Value_ByAllForGis()
        {
            string    result = null;
            DataTable dt     = new DataTable();

            try
            {
                dt = rule.ExecProcessPrd("usp_getEQIN_F_Value_ByAllForGis", null, null);



                dt.Columns.Add("fldStaLod", typeof(string));
                dt.Columns.Add("fldStaLad", typeof(string));

                DataTable dt2 = rule.getdt("select * from tblEQIN_F_Point");

                foreach (DataRow item in dt.Rows)
                {
                    foreach (DataRow item2 in dt2.Rows)
                    {
                        if
                        (
                            item["fldSTCode"].ToString() == item2["fldSTCode"].ToString() &&
                            item["fldPCode"].ToString() == item2["fldPCode"].ToString() &&
                            item["fldYear"].ToString() == item2["fldYear"].ToString()
                        )
                        {
                            item["fldStaLod"] = item2["fldStaLod"];
                            item["fldStaLad"] = item2["fldStaLad"];
                        }
                    }
                }



                result = rule.JsonStr("ok", "", dt);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        //[SupportFilter]
        public HttpResponseMessage GetItemAll(dynamic obj)
        {
            string result = string.Empty;

            try
            {
                if (Convert.ToString(obj.modeltype) != "" || Convert.ToString(obj.modeltype) != null)
                {
                    if (obj.typetwo == null)
                    {
                        DataTable dt = rule.GetItem(Convert.ToString(obj.modeltype));
                        result = rule.JsonStr("ok", "", dt);
                    }
                    else
                    {
                        DataTable dt = rule.GetItembytype(Convert.ToString(obj.typetwo));
                        result = rule.JsonStr("ok", "", dt);
                    }
                }
                else
                {
                    result = rule.JsonStr("error", "参数错误", "");
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Beispiel #20
0
        public HttpResponseMessage upload()
        {
            string             result    = "";
            HttpFileCollection filelist  = HttpContext.Current.Request.Files;
            string             chinaname = filelist.Keys[0];

            try
            {
                if (filelist != null && filelist.Count > 0)
                {
                    for (int i = 0; i < filelist.Count; i++)
                    {
                        HttpPostedFile file     = filelist[i];
                        String         Tpath    = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
                        string         filename = file.FileName;
                        filename = System.Web.HttpUtility.UrlDecode(chinaname) + ".doc";
                        string        FileName = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        string        FilePath = "C://exportword/download";
                        DirectoryInfo di       = new DirectoryInfo(FilePath);
                        if (!di.Exists)
                        {
                            di.Create();
                        }
                        try
                        {
                            file.SaveAs(FilePath + @"//" + filename);
                        }
                        catch (Exception ex)
                        {
                            result = rule.JsonStr("error", "", ex.Message);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", "", e.Message);
            }



            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        //
        public HttpResponseMessage GetNDISCAll()
        {
            string result = string.Empty;

            try
            {
                RuletblEQIN_F_FuncCode rule_func = new RuletblEQIN_F_FuncCode();
                DataTable dt = rule_func.GetAllData();
                result = rule.JsonStr("ok", "", dt);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Beispiel #22
0
        public HttpResponseMessage GetReportDocList(dynamic concent)
        {
            string result = "";

            try
            {
                string    sql = "select * from tblReport_Doc where fldReportName='" + concent.fldReportName + "' and fldType='" + concent.fldType + "'";
                DataTable dt  = rule.SqlQueryForDataTatable("EntityContext", sql);
                result = rule.JsonStr("ok", "", dt);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", "", e.Message);
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage logout()
        {
            string     result = string.Empty;
            RuleCommon rule   = new RuleCommon();

            try
            {
                HttpContext.Current.Session.Abandon();
                result = rule.JsonStr("ok", "", "");
                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
        }
        /// <summary>
        ///  功能描述:H5支付
        ///  创建  人:周文卿
        ///  创建时间:2018-11-20
        /// </summary>
        /// <param name="payparameter">参数</param>
        /// <returns></returns>

        public HttpResponseMessage X_PayH5(payparameter payparameter)
        {
            string result = string.Empty;

            try
            {
                //首先判断商户号是否存在
                RulePayMethod rulePay    = new RulePayMethod();
                rerurnpram    rerurnpram = rulePay.Islegitimate(payparameter);

                result = rule.JsonStr(rerurnpram.statecode, rerurnpram.message, rerurnpram.data);
                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
            catch (Exception e)
            {
                //错误保存日志
                throw new InsertException(e.Message, "Transaction", "LB_PayH5", payparameter.ToString());
            }
        }
Beispiel #25
0
        public HttpResponseMessage GetUserList()
        {
            string result = string.Empty;

            try
            {
                string    sql = "select [fldAutoID],[fldUserName] from LAPtblFW_User";
                DataTable dt  = rule.getdt(sql);
                if (dt.Rows.Count > 0)
                {
                    result = rule.JsonStr("ok", "", dt);
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage GetSection(string year)
        {
            string result = string.Empty;

            try
            {
                DataTable dt = new DataTable();
                dt     = rule.getdt("select * from tblEQIW_N_Section where fldyear=" + year);
                result = rule.JsonStr("ok", "", dt);
                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
        }
        //
        public HttpResponseMessage Geteqih_f_ddlPName(string Edate, string stcode)
        {
            string result = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(Edate))
                {
                    result = rule.JsonStr("error", "缺少结束日期", "");
                }
                else if (string.IsNullOrEmpty(stcode))
                {
                    result = rule.JsonStr("error", "缺少城市代码", "");
                }
                else
                {
                    RuletblEQIN_F_Point     rule_point = new RuletblEQIN_F_Point();
                    IList <tblEQIN_F_Point> list       = rule_point.GetPCodeByYear(stcode,
                                                                                   Convert.ToInt32(Edate), 1);
                    if (list != null && list.Count > 0)
                    {
                        result = rule.JsonStr("ok", "", list);
                    }
                    else
                    {
                        result = rule.JsonStr("nodata", "没有测点数据", "");
                    }
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage getimg(dynamic img)
        {
            string result = "";

            try
            {
                string path     = img.path;
                string datetime = GetTimeStamp();
                string suffix   = ".png"; //文件的后缀名根据实际情况
                string strPath  = path + img.filename + suffix;

                //获取图片并保存
                Base64ToImg(img.firstName.ToString().Split(',')[1]).Save(strPath);
                result = rule.JsonStr("ok", "", img.filename + suffix);
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", "", e.Message);
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage GetMerchantLog(string mid)
        {
            string result = string.Empty;

            try
            {
                using (Model1 db = new Model1())
                {
                    var merchant = (from x in db.tblMerchantLog
                                    where x.fldMerchant == mid
                                    orderby x.fldLoginTime descending
                                    select x).Skip(1).Take(1);
                    result = rule.JsonStr("ok", "", merchant);
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", "", e.Message);
            }

            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Beispiel #30
0
        public HttpResponseMessage Successdatate(string indextime)
        {
            string result = string.Empty;

            try
            {
                RuleSuccessStatecs statecs = new RuleSuccessStatecs();
                DataTable          table   = statecs.successStatedataTable(indextime);

                result = rule.JsonStr("ok", "成功", table);

                return(new HttpResponseMessage {
                    Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
                });
            }
            catch (Exception e)
            {
                //错误保存日志
                throw new InsertException(e.Message, " SuccessState", "Success", indextime);
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }