Пример #1
0
        /// <summary>
        /// 功能描述    :  拼接数据来源查询条件
        /// 创建者      :  马立军
        /// 创建日期    :  2009-12-02
        /// 修改者      :
        /// 修改日期    :
        /// 修改原因    :
        /// </summary>
        /// <param name="hasTable"></param>
        /// <returns></returns>
        private string QueryBTypeSql(Hashtable hasTable)
        {
            string sSourceSql = "";

            if (hasTable["BType"] != null)
            {
                RuletblDictionary ruleDict = new RuletblDictionary();
                sSourceSql = "fldBType='" + ruleDict.ByParentIDAndValue("生物种类", hasTable["BType"].ToString()) + "'";
            }
            return(sSourceSql);
        }
Пример #2
0
        //[SupportFilter]
        public string Delete(dynamic obj)
        {
            try
            {
                if (obj.typemodel.ToString() == "eqise")
                {
                    obj.typemodel = "eqiw_r";
                }
                RuletblDictionary dic      = new RuletblDictionary();
                string            list     = dic.ByParentIDAndValue("数据审核视图", obj.typemodel.ToString());
                string            listone  = list.Split(',')[0].ToString().Substring(2);
                string            listones = listone.Substring(0, listone.Length - 7);
                string            table    = "";
                if (obj.typemodel.ToString() == "eqib_v")
                {
                    table = "tbl_" + listones;
                }
                else if (obj.typemodel.ToString() == "eqiw_r_auto")
                {
                    table = "tblEQIW_R_Basedata_Pre_Auto";
                }
                else
                {
                    table = "tbl" + listones;
                }
                List <long> lstDelID = new List <long>();
                string[]    fld      = obj.fldAutoId.ToString().Split(',');
                for (int i = 0; i < fld.Length; i++)
                {
                    string[] pk = fld[i].Split('_');
                    for (int j = 0; j < pk.Length; j++)
                    {
                        lstDelID.Add(Convert.ToInt64(pk[j].ToString()));
                    }
                }
                RuletblEQIA_RPI_Basedata_Pre rule_basedata = new RuletblEQIA_RPI_Basedata_Pre();

                bool isb = rule_basedata.delById(lstDelID, table);
                if (isb)
                {
                    return("删除成功!");
                }
                else
                {
                    return("删除失败!");
                }
            }
            catch (Exception e)
            {
                throw new Exception("删除数据失败!");
            }
        }
Пример #3
0
        /// <summary>
        /// 功能描述    :  拼接数据来源查询条件
        /// 创建者      :  马立军
        /// 创建日期    :  2009-12-02
        /// 修改者      :
        /// 修改日期    :
        /// 修改原因    :
        /// </summary>
        /// <param name="hasTable"></param>
        /// <returns></returns>
        private string QuerySourceSql(Hashtable hasTable)
        {
            string sSourceSql = "";

            if (hasTable["Source"] != null)
            {
                RuletblDictionary ruleDict = new RuletblDictionary();
                if (hasTable["Source"].ToString() != "1")
                {
                    sSourceSql = "fldSource='" + ruleDict.ByParentIDAndValue("数据来源", "0") + "'";
                }
            }

            return(sSourceSql);
        }
        public HttpResponseMessage Subtable(string type, string fldAutoId)
        {
            string fldAutoID = fldAutoId.ToString();
            string listtype  = type.ToString();

            fldAutoID = fldAutoID.Replace('_', ',');
            RuletblDictionary dic        = new RuletblDictionary();
            string            list       = dic.ByParentIDAndValue("数据审核视图", listtype);
            string            table      = list.Split(',')[1];
            string            execsql    = "select fldItemName,fldItemCode,fldItemValue,fldComment from " + table + " where fldAutoID in (" + fldAutoID + ")";
            RuletblEQI_publi  pub        = new RuletblEQI_publi();
            DataTable         dtItemInfo = pub.getdt(execsql);
            string            json       = JsonHelper.SerializeObject(dtItemInfo);

            #region 返回数据给前台
            return(new HttpResponseMessage {
                Content = new StringContent(json, System.Text.Encoding.UTF8, "application/xm")
            });

            #endregion
        }
Пример #5
0
        /// <summary>
        /// 功能描述:获得二级节点
        /// 创建  人:周文卿
        /// 创建时间:2017/06/06
        /// 修改时间:
        /// 修改  人:
        /// 修改原因:
        /// </summary>
        /// <param name="stcode">城市代码</param>
        /// <param name="table">表名称</param>
        /// <param name="field">二级字段名称</param>
        /// <param name="level">几级节点</param>
        /// <param name="year">年份</param>
        /// <param name="threefield">三级节点</param>
        /// <param name="istranslate">是否需要翻译</param>
        /// <param name="returnpoint">最后得到的点位是几级(2=fldSTCode.fldPCode,3=fldSTCode.fldRCode.fldRSCode)</param>
        /// <param name="where">筛选条件</param>
        /// <param name="screenflied">筛选字段</param>
        /// <param name="DName">字典名称</param>
        /// <param name="pionttype">返回的点位类型(第一级为(0是城市代码,1是区县代码))</param>
        /// <returns></returns>
        private string GetTwoLevel(string stcode, string table, string field, string level, string year, string threefield, string istranslate, string returnpoint, string where, string screenflied, string DName, string pionttype)
        {
            try
            {
                string sqlyear = year == null?DateTime.Now.Year.ToString() : year;

                string dname = DName == null ? "测点级别" : DName;
                field = screenflied == null ? field : screenflied;
                DataTable         dt    = rule.getdt("select distinct " + field + " from " + table + " where fldSTCode =" + stcode + "  and  fldYear=" + sqlyear + where);
                string            label = "";
                string            json  = "[";
                RuletblDictionary dic   = new RuletblDictionary();
                if (int.Parse(level) > 2)
                {
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (istranslate == "0")
                            {
                                label = dic.ByParentIDAndValue(dname, dt.Rows[i][field.Split(',')[0].ToString()].ToString());
                            }
                            else
                            {
                                label = dt.Rows[i][field.Split(',')[1].ToString()].ToString();
                            }

                            if (i == dt.Rows.Count - 1)
                            {
                                json += "{stcode:'" + stcode + "." + dt.Rows[i][field.Split(',')[0].ToString()].ToString() + "',label:'" + label +
                                        "',children:" + GetThreeLevel(stcode, table, threefield, sqlyear,
                                                                      field, dt.Rows[i][field.Split(',')[0].ToString()].ToString(), returnpoint, pionttype,
                                                                      dt.Rows[i][field.Split(',')[2].ToString()].ToString()) + "}]";
                            }
                            else
                            {
                                json += "{stcode:'" + stcode + "." + dt.Rows[i][field.Split(',')[0].ToString()].ToString() + "',label:'" + label +
                                        "',children:" + GetThreeLevel(stcode, table, threefield, sqlyear,
                                                                      field, dt.Rows[i][field.Split(',')[0].ToString()].ToString(), returnpoint, pionttype,
                                                                      dt.Rows[i][field.Split(',')[2].ToString()].ToString()) + "},";
                            }
                        }
                    }
                    else
                    {
                        json += "{stcode:'8',label:'无数据'}]";
                    }
                }
                #region 只有两级节点
                else
                {
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (istranslate == "0")
                            {
                                label = dic.ByParentIDAndValue("测点级别", dt.Rows[i][field.Split(',')[0].ToString()].ToString());
                            }
                            else
                            {
                                label = dt.Rows[i][field.Split(',')[1].ToString()].ToString();
                            }
                            if (i == dt.Rows.Count - 1)
                            {
                                json += "{stcode:'" + stcode + "." + dt.Rows[i][field.Split(',')[0].ToString()].ToString() + "',label:'" + label + "'}]";
                            }
                            else
                            {
                                json += "{stcode:'" + stcode + "." + dt.Rows[i][field.Split(',')[0].ToString()].ToString() + "',label:'" + label + "'},";
                            }
                        }
                    }
                    else
                    {
                        json += "{stcode:'8',label:'其他'}]";
                    }
                }
                #endregion
                return(json);
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
        //
        public HttpResponseMessage Geteqicom_data(string type, string wherequery, string pageshow, string cityid)
        {
            string returnjson = "[{data: ";

            try
            {
                string sbtype = type;
                #region 拼接原始条件
                string defaultwhere = "";//原始条件
                if (wherequery == "undefined" || wherequery == "" || wherequery == null)
                {
                    wherequery = " and fldSource=0";
                }
                if (pageshow == "1")
                {
                    defaultwhere = "  fldImport=1 and fldFlag=0 and fldCityID_Operate=" + cityid;
                }
                if (pageshow == "0")
                {
                    defaultwhere = " fldFlag=1 ";
                }
                #endregion

                #region 基本数据获取
                RuletblDictionary           dic               = new RuletblDictionary();
                string                      list              = dic.ByParentIDAndValue("数据审核视图", sbtype);//获取需要的视图名称
                RuleEQIV_WaitTable_Auditing rulAud            = new RuleEQIV_WaitTable_Auditing();
                string                      ViewName          = list.Split(',')[0].ToString();
                string                      ChinesizeViewName = list.Split(',')[1].ToString(); //汉化表头需要的视图名称
                wherequery = defaultwhere + HttpUtility.UrlDecode(wherequery);
                DataTable dt = rulAud.GetEqiv_AuditingData(ViewName, wherequery, sbtype);      //需要的数据数据
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dt.Rows[i]["fldAutoID"] = dt.Rows[i]["fldAutoID"].ToString().Replace(',', '_');
                }
                #endregion


                #region 数据源转化为Json格式
                string json = JsonHelper.SerializeObject(dt);
                returnjson += json;
                #endregion

                #region 拼数据对应列名
                returnjson += ",head: [";
                //拼标题并汉化
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    string    engname = "'" + dt.Columns[i].ColumnName + "'";
                    DataTable dtDesc  = rule.ChinesizeTitleNamebyViewName(ChinesizeViewName, engname);//根据视图名称在字典表中查出对应字段的中文名称

                    if (dtDesc.Rows.Count > 0)
                    {
                        if (i == dt.Columns.Count - 1)
                        {
                            returnjson += "'" + dtDesc.Rows[0]["fldFieldDesc"].ToString() + "'";
                        }
                        else
                        {
                            returnjson += "'" + dtDesc.Rows[0]["fldFieldDesc"].ToString() + "',";
                        }
                    }
                }
                #endregion

                returnjson += "]}]";
                #region 最后返回数据给前台
                if (dt.Rows.Count > 0)
                {
                    returnjson = rule.JsonStr("ok", "", returnjson.ToString());//有数据
                }
                else
                {
                    returnjson = rule.JsonStr("nodata", "没有数据", returnjson.ToString());//没数据
                }
            }
            catch (Exception e)
            {
                returnjson = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(returnjson, System.Text.Encoding.UTF8, "application/json")
            });

            #endregion
        }
        public HttpResponseMessage Geteqicom_data(Geteqicom_data_Info info)
        {
            string returnjson = "[{data: ";

            try
            {
                string sbtype = info.type;
                #region 拼接原始条件
                string defaultwhere = "";//原始条件
                if (info.wherequery == "undefined" || info.wherequery == "")
                {
                    info.wherequery = " and fldSource=0";
                }
                if (info.pageshow == "1")
                {
                    defaultwhere = "fldCityID_Operate=" + info.cityid + " and fldFlag=0 and fldImport=1 ";
                }
                if (info.pageshow == "0")
                {
                    defaultwhere = " fldFlag=1 ";
                }

                #endregion

                #region 基本数据获取
                RuletblDictionary      dic         = new RuletblDictionary();
                RuleEQICommon_Auditing rulAud      = new RuleEQICommon_Auditing();
                string           list              = dic.ByParentIDAndValue("数据审核视图", sbtype);
                RuletblEQI_publi exec              = new RuletblEQI_publi();
                string           ViewName          = list.Split(',')[0].ToString();
                string           ChinesizeViewName = list.Split(',')[1].ToString();
                info.wherequery = defaultwhere + HttpUtility.UrlDecode(info.wherequery);
                DataTable dt = rulAud.GetAuditingDatabyBusinessType(sbtype, ViewName, info.wherequery, 0);//需要的数据数据

                #endregion
                #region 数据源转化为Json格式
                string json = JsonHelper.SerializeObject(dt);
                returnjson += json;
                #endregion

                #region 拼数据对应列名
                returnjson += ",head: [";//标题
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    string    engname = "'" + dt.Columns[i].ColumnName + "'";
                    DataTable dtDesc  = rule.ChinesizeTitleNamebyViewName(ChinesizeViewName, engname);//根据视图名称在字典表中查出对应字段的中文名称

                    if (dtDesc.Rows.Count > 0)
                    {
                        if (i == dt.Columns.Count - 1)
                        {
                            returnjson += "'" + dtDesc.Rows[0]["fldFieldDesc"].ToString() + "']}]";
                        }
                        else
                        {
                            returnjson += "'" + dtDesc.Rows[0]["fldFieldDesc"].ToString() + "',";
                        }
                    }
                }
                #endregion

                #region 对应列填数据

                #endregion

                #region 最后返回数据给前台
                if (dt.Rows.Count > 0)
                {
                    returnjson = rule.JsonStr("ok", "", returnjson.ToString());
                }
                else
                {
                    returnjson = rule.JsonStr("nodata", "没有数据", returnjson.ToString());
                }
            }
            catch (Exception e)
            {
                returnjson = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(returnjson, System.Text.Encoding.UTF8, "application/json")
            });

            #endregion
        }
Пример #8
0
        //[SupportFilter]
        public string DeleteAll(dynamic obj)
        {
            string isSuccess = "";

            try
            {
                string table   = obj.table.ToString();
                string bImport = obj.bImport.ToString();
                string where = obj.where.ToString();

                // bImport = context.Request["bImport"];
                RuletblDictionary dic      = new RuletblDictionary();
                string            list     = dic.ByParentIDAndValue("数据审核视图", table);
                string            listone  = list.Split(',')[0].ToString().Substring(2);
                string            listones = listone.Substring(0, listone.Length - 7);
                if (obj.table.ToString() == "eqib_v")
                {
                    table = "tbl_" + listones;
                }
                else if (obj.table.ToString() == "eqiw_r_auto")
                {
                    table = "tblEQIW_R_Basedata_Pre_Auto";
                }
                else
                {
                    table = "tbl" + listones;
                }
                if (where == "undefined" || where == "")
                {
                    string type = obj.table.ToString();
                    if (type.Substring(type.Length - 3, 3) == "_hm")
                    {
                        where = " fldSource=1";
                    }
                    else
                    {
                        where = " fldSource=0";
                    }
                }
                else
                {
                    where = " 1=1 " + where;
                }
                RuletblEQI_Auditing_COM_DeleteAll rule = new RuletblEQI_Auditing_COM_DeleteAll();
                if (bImport == "1")
                {
                    #region 市站登录
                    int    cityID   = int.Parse(obj.cityId.ToString());
                    int    iresult  = -1;
                    short  flag     = 0;
                    string strWhere = " fldImport=1 ";
                    iresult = rule.DelAllData(flag, where, cityID, table);
                    if (iresult >= 0)
                    {
                        isSuccess = "删除数据成功!";
                    }

                    #endregion
                }
                else
                {
                    try
                    {
                        short import = short.Parse(bImport);
                        short flag   = 1;
                        if (obj.table.ToString() == "eqiw_r_auto")
                        {
                            flag = 0;
                        }
                        int cityID  = int.Parse(obj.cityId.ToString());
                        int result  = -1;
                        int iresult = -1;

                        string strWhere = "   ";
                        iresult = rule.DelAllData(flag, where, cityID, table);

                        if (iresult > 0)
                        {
                            isSuccess = "数据删除成功!";
                        }
                        else if (iresult == 0)
                        {
                            isSuccess = "删除数据失败,没有找到可删除的数据!";
                        }
                        else
                        {
                            isSuccess = "删除数据失败,请重试!";
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("删除数据失败!");
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception("删除数据失败!");
            };
            return(isSuccess);
            // context.Response.Write(resposne);
        }
Пример #9
0
        public string Update(string fldAutoId, string typemodel, string userId, string userName, string cityId, string NewFlag = null)
        {
            try
            {
                userId = rule.ConductUserinfo(userId);
                RuletblDictionary dic = new RuletblDictionary();
                if (typemodel.ToString() == "eqise")
                {
                    typemodel = "eqiw_r";
                }
                string list = dic.ByParentIDAndValue("数据审核视图", typemodel.ToString());

                string listone  = list.Split(',')[0].ToString().Substring(2);
                string listones = null;
                if (listone.ToLower().Contains("auto"))
                {
                    listones = listone.Substring(0, listone.Length - 12);
                }
                else
                {
                    listones = listone.Substring(0, listone.Length - 7);
                }
                string table = "";
                if (typemodel.ToString() == "eqib_v")
                {
                    table = "tbl_" + listones;
                }
                else
                {
                    table = "tbl" + listones;
                }


                List <long> lstDelID = new List <long>();
                string[]    fld      = fldAutoId.ToString().Split(',');
                for (int i = 0; i < fld.Length; i++)
                {
                    string[] pk = fld[i].Split('_');
                    for (int j = 0; j < pk.Length; j++)
                    {
                        lstDelID.Add(Convert.ToInt64(pk[j].ToString()));
                    }
                }
                RuletblEQIA_RPI_Basedata_Pre rule_basedata = new RuletblEQIA_RPI_Basedata_Pre();
                RuleWriteOperateLog          rule_wol      = new RuleWriteOperateLog();
                if (NewFlag == null)
                {
                    NewFlag = "1";
                }
                bool isb = rule_basedata.delBytable(lstDelID, table, NewFlag.ToString());
                if (isb)
                {
                    rule_wol.WriteLog(0, "提交审核选中的数据数据,进入监测数据审核状态录入这ID=" + userId.ToString(), userName.ToString(), int.Parse(userId.ToString()), int.Parse(cityId.ToString()));
                    return("提交审核数据成功!");
                }
                else
                {
                    return("提交审核数据失败,请重试!");
                }
            }
            catch (Exception e)
            {
                throw new Exception("提交审核数据失败!");
            }
        }
        /// <summary>
        /// 功能描述:数据插入到临时表
        /// 创建  人:周文卿
        /// 创建时间:2017/07/11
        /// 修改原因:
        /// 修改时间:
        /// 修改  人:
        /// </summary>
        /// <param name="inputdata">插入的实体类</param>
        /// <returns>json(是否成功)</returns>
        public HttpResponseMessage ItemSave(List <tbleqia_rd_table> inputdata)
        {
            string returntext = "";

            try
            {
                Regex regexvalue  = new Regex(@"^(\d*\.?\d+)+$");
                Regex regexvalue2 = new Regex(@"^(\d*\.?\d+)?[lL]$");
                List <tblEQIA_RDPI_Basedata_Pre> lstData = new List <tblEQIA_RDPI_Basedata_Pre>();
                tblEQIA_RDPI_Basedata_Pre        objData = new tblEQIA_RDPI_Basedata_Pre();
                tblEQI_InputDate inputdate_new           = new tblEQI_InputDate();
                RuletblEQI_publi ruleSense = new RuletblEQI_publi();
                for (int i = 0; i < inputdata.Count; i++)
                {
                    List <tbaeqia_rd_value> valueall = inputdata[i].valueall;
                    for (int j = 0; j < valueall.Count; j++)
                    {
                        RuletblDictionary ruleDict = new RuletblDictionary();

                        objData.fldSTCode         = valueall[j].fldSTCode;
                        objData.fldUserID         = int.Parse(inputdata[i].fldUserID);
                        objData.fldFlag           = 0;
                        objData.fldCityID_Operate = int.Parse(inputdata[i].fldCityID_Operate);
                        objData.fldCityID_Submit  = inputdata[i].fldCityID_Submit;
                        objData.fldDate_Operate   = DateTime.Now;
                        decimal dValue     = -1;
                        string  samphvalue = valueall[j].monitorvalue;
                        #region 因子值的处理
                        if (samphvalue != "")
                        {
                            if (regexvalue2.IsMatch(samphvalue))
                            {
                                if (samphvalue.ToLower() == "l")
                                {
                                    string itemname = "";
                                    itemname = ruleSense.GetSenseNameBytbl("EQIA_RD", inputdata[i].itemcode);
                                    decimal temp = Convert.ToDecimal(valueall[j].monitorvalue);
                                    if (temp <= 0)
                                    {
                                        returntext = "项目的检出限<=0,不能输入 L 作为监测值'";
                                    }
                                    dValue = -temp;
                                }
                                else
                                {
                                    dValue = -Convert.ToDecimal(samphvalue.Replace("l", "").Replace("L", ""));
                                }
                                if (dValue == -1)
                                {
                                    dValue = Convert.ToDecimal(-0.99999999);
                                }
                            }
                            else
                            {
                                dValue = Convert.ToDecimal(samphvalue);
                            }
                        }
                        #endregion
                        tblEQIA_RDPI_Basedata_Pre objTmp = objData.Clone();
                        objTmp.fldPCode = valueall[j].fldPCode;

                        DateTime time = DateTime.Parse(valueall[j].fldDate.ToString());
                        objTmp.fldSYear     = time.Year;
                        objTmp.fldSMonth    = time.Month;
                        objTmp.fldSDay      = time.Day;
                        objTmp.fldSHour     = 0;
                        objTmp.fldSMinute   = 0;
                        objTmp.fldEYear     = time.Year;
                        objTmp.fldEMonth    = time.Month;
                        objTmp.fldEDay      = time.Day;
                        objTmp.fldEHour     = 0;
                        objTmp.fldEMinute   = 0;
                        objTmp.fldFlag      = 0;
                        objTmp.fldImport    = 0;
                        objTmp.fldItemCode  = inputdata[i].itemcode;
                        objTmp.fldItemValue = dValue;
                        lstData.Add(objTmp);
                    }
                }
                RuletblEQIA_RDPI_Basedata_Pre rule_basedata = new RuletblEQIA_RDPI_Basedata_Pre();
                bool issave = rule_basedata.InsertAll(lstData);
                if (issave)
                {
                    RuleWriteOperateLog rule_wol = new RuleWriteOperateLog();
                    rule_wol.WriteLog(0, "录入降尘数据到临时表", "", int.Parse(inputdata[0].fldUserID), int.Parse(inputdata[0].fldCityID_Operate));
                    returntext = rule.JsonStr("ok", "录入成功!您保存的数据,已进入“待提交审核的数据”状态", "");
                }
                else
                {
                    returntext = rule.JsonStr("error", "录入失败 !请重试!", "");
                }
            }
            catch (InputException ex)
            {
                returntext = rule.JsonStr("error", ex.Message, "");
            }
            catch (InsertException ex)
            {
                returntext = rule.JsonStr("error", ex.Message, "");
            }
            catch (Exception ex)
            {
                returntext = rule.JsonStr("error", ex.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(returntext, System.Text.Encoding.UTF8, "application/json")
            });
        }