Example #1
0
        public string Checkrw(string json, string columns, string clientInf)
        {
            Dictionary <string, string> resultDic = new Dictionary <string, string>();

            resultDic["result"]  = "";
            resultDic["message"] = "";
            try
            {
                sara.dd.ldsw.model.tbl_ld_rwb model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_rwb>(json);
                if (model.f_rwid != null && model.f_rwid != "")
                {
                    object[] args   = { int.Parse(model.f_rwid) };
                    string   result = Eva.Library.WebService.DynamicWebServices.InvokeWebService("http://162.16.166.1/sara.dd.waterdatacenter/service/service_tbl_waterdb_rw.asmx", "getLongdaRwZt", args).ToString();


                    IDictionary <string, string> resultdic = Eva.Library.Format.FormatEntityTool.FormatJsonToDic(result);
                    DataTable dt = Eva.Library.Format.FormatEntityTool.FormatJsonToDataTable(resultdic["message"]);
                    if (dt.Rows.Count > 0)
                    {
                        switch (dt.Rows[0]["f_zt"].ToString())
                        {
                        case "待执行":
                            model.f_zt   = "待执行";
                            model.f_ztid = "1";
                            break;

                        case "执行中":
                            model.f_zt   = "执行中";
                            model.f_ztid = "2";
                            break;

                        case "完成":
                            model.f_zt   = "完成";
                            model.f_ztid = "3";
                            break;
                        }

                        columns              = FormatColumns(columns).Replace("^", ",");
                        resultDic["result"]  = "true";
                        resultDic["message"] = _idal_tbl_ld_rwb.Update(model, columns, null);
                    }
                    else
                    {
                        resultDic["result"]  = "false";
                        resultDic["message"] = "任务异常";
                    }
                }


                NewLog("数据更新成功,更新的数据为:json:" + json + ",columns:" + columns, "sql_update", clientInf);
            }
            catch (Exception ex)
            {
                resultDic["result"]  = "false";
                resultDic["message"] = Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace);

                NewLog("数据更新失败,更新的数据为:json:" + json + ",columns:" + columns + ",异常信息:" + Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace), "sql_update", clientInf);
            }
            return(Eva.Library.Format.FormatEntityTool.FormatDicToJson(resultDic));
        }
Example #2
0
        public string Add(string json, string clientInf)
        {
            Dictionary <string, string> resultDic = new Dictionary <string, string>();

            resultDic["result"]  = "";
            resultDic["message"] = "";
            try
            {
                sara.dd.ldsw.model.tbl_ld_rwb model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_rwb>(json);

                //int count = int.Parse(_idal_tbl_ld_rwb.GetCount("f_khbh='" + model.f_khbh + "' and f_ztid!='3'",null));

                //if(count > 0)
                //{
                //    resultDic["result"] = "false";
                //    resultDic["message"] = "该用户有未执行完成的任务";
                //}
                //else
                //{
                resultDic["result"]  = "true";
                resultDic["message"] = _idal_tbl_ld_rwb.Add(model, null);
                //}



                NewLog("数据创建成功,创建的数据为:" + json, "sql_insert", clientInf);
            }
            catch (Exception ex)
            {
                resultDic["result"]  = "false";
                resultDic["message"] = Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace);
                NewLog("数据创建失败,创建的数据为:" + json + ",异常信息:" + Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace), "sql_insert", clientInf);
            }
            return(Eva.Library.Format.FormatEntityTool.FormatDicToJson(resultDic));
        }
Example #3
0
        public string Update(string json, string columns, string clientInf)
        {
            Dictionary <string, string> resultDic = new Dictionary <string, string>();

            resultDic["result"]  = "";
            resultDic["message"] = "";
            try
            {
                sara.dd.ldsw.model.tbl_ld_rwb model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_rwb>(json);

                columns              = FormatColumns(columns).Replace("^", ",");
                resultDic["result"]  = "true";
                resultDic["message"] = _idal_tbl_ld_rwb.Update(model, columns, null);

                NewLog("数据更新成功,更新的数据为:json:" + json + ",columns:" + columns, "sql_update", clientInf);
            }
            catch (Exception ex)
            {
                resultDic["result"]  = "false";
                resultDic["message"] = Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace);

                NewLog("数据更新失败,更新的数据为:json:" + json + ",columns:" + columns + ",异常信息:" + Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace), "sql_update", clientInf);
            }
            return(Eva.Library.Format.FormatEntityTool.FormatDicToJson(resultDic));
        }
Example #4
0
        public string Startrw(string json, string columns, string clientInf)
        {
            Dictionary <string, string> resultDic = new Dictionary <string, string>();

            resultDic["result"]  = "";
            resultDic["message"] = "";
            try
            {
                sara.dd.ldsw.model.tbl_ld_rwb model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_rwb>(json);
                object[] args   = { model.f_mlid, model.f_sbbh };
                string   result = Eva.Library.WebService.DynamicWebServices.InvokeWebService("http://162.16.166.1/sara.dd.waterdatacenter/service/service_tbl_waterdb_rw.asmx", "addLongdaRw", args).ToString();


                IDictionary <string, string> resultdic = Eva.Library.Format.FormatEntityTool.FormatJsonToDic(result);
                DataTable dt = Eva.Library.Format.FormatEntityTool.FormatJsonToDataTable(resultdic["message"]);
                if (dt.Rows.Count > 0)
                {
                    model.f_rwid         = dt.Rows[0]["sys_id"].ToString();
                    model.f_rwmc         = dt.Rows[0]["f_rwmc"].ToString();
                    model.f_yjzxsj       = Convert.ToDateTime(dt.Rows[0]["f_yjzxsj"].ToString());
                    model.f_zt           = "待执行";
                    model.f_ztid         = "1";
                    columns              = FormatColumns(columns).Replace("^", ",");
                    resultDic["result"]  = "true";
                    resultDic["message"] = _idal_tbl_ld_rwb.Update(model, columns, null);
                }
                else
                {
                    resultDic["result"]  = "false";
                    resultDic["message"] = "任务异常";
                }

                NewLog("数据更新成功,更新的数据为:json:" + json + ",columns:" + columns, "sql_update", clientInf);
            }
            catch (Exception ex)
            {
                resultDic["result"]  = "false";
                resultDic["message"] = Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace);

                NewLog("数据更新失败,更新的数据为:json:" + json + ",columns:" + columns + ",异常信息:" + Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace), "sql_update", clientInf);
            }
            return(Eva.Library.Format.FormatEntityTool.FormatDicToJson(resultDic));
        }