Example #1
0
        private void GetAllKwCon(string strSql)
        {
            try
            {
                var webRequest            = new WebRequest();
                Service51021Client client = new Service51021Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service51021"));
                //var client = new Service51021Client();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S5102Codes.OptSelectAssignKwContent;
                OperationReturn optReturn = XMLHelper.SeriallizeObject(strSql);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }
                webRequest.ListData.Add(optReturn.Data.ToString());
                WebReturn webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("{0}: ,{1}",
                                                CurrentApp.GetLanguageInfo("5102T00065", "Insert data failed"), webReturn.Message));
                    return;
                }

                if (webReturn.ListData.Count <= 0)
                {
                    return;
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    optReturn = XMLHelper.DeserializeObject <KwContentInfoParam>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        continue;
                    }
                    var param = optReturn.Data as KwContentInfoParam;
                    if (param == null)
                    {
                        ShowException("Fail. filesItem is null");
                        return;
                    }
                    _mlstConnectInfo.Add(param);
                    _mlstConnectInfoTemp.Add(param);
                }
                SetKwContentTable();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Example #2
0
        private bool AddKwContent(KwContentInfoParam kwConnectInfoParam)
        {
            try
            {
                string strLog;
                var    webRequest = new WebRequest();
                webRequest.Session = CurrentApp.Session;
                webRequest.Code    = (int)S5102Codes.OptAddKwContent;
                OperationReturn optReturn = XMLHelper.SeriallizeObject(kwConnectInfoParam);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return(false);
                }
                webRequest.ListData.Add(optReturn.Data.ToString());
                var client = new Service51021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                                    WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service51021"));
                //   var client = new Service51021Client();
                var webReturn = client.UmpTaskOperation(webRequest);
                client.Close();
                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("5102T00029", "Create"));
                if (!webReturn.Result)
                {
                    #region 写操作日志

                    strLog = string.Format("{0} {1} : {2}", Utils.FormatOptLogString("5102T00029"),
                                           Utils.FormatOptLogString("5102T00038"), webReturn.Message);
                    CurrentApp.WriteOperationLog(S5102Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_FAIL, strLog);

                    #endregion

                    CurrentApp.WriteLog(webReturn.Message);
                    ShowException(webReturn.Message);
                    return(false);
                }

                #region 写操作日志

                strLog = string.Format("{0} {1}", Utils.FormatOptLogString("5102T00029"),
                                       Utils.FormatOptLogString("5102T00039"));
                CurrentApp.WriteOperationLog(S5102Consts.OPT_Add.ToString(), ConstValue.OPT_RESULT_SUCCESS, strLog);

                #endregion

                CurrentApp.WriteLog(CurrentApp.GetLanguageInfo("5102T00039", "Create Success"));
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
                return(false);
            }
            return(true);
        }
 private long CreateNum()
 {
     try
     {
         if (!S5102App.GQueryModify)
         {
             //生成新的查询配置表主键
             WebRequest webRequest = new WebRequest
             {
                 Session = CurrentApp.Session,
                 Code    = (int)RequestCode.WSGetSerialID
             };
             webRequest.ListData.Add("51");
             webRequest.ListData.Add("5102");
             webRequest.ListData.Add(DateTime.Now.ToString("yyyyMMddHHmmss"));
             Service51021Client client =
                 new Service51021Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session),
                                        WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service51021"));
             //var client = new Service51021Client();
             WebReturn webReturn = client.UmpTaskOperation(webRequest);
             client.Close();
             if (!webReturn.Result)
             {
                 return(0);
             }
             string strNewResultId = webReturn.Data;
             if (string.IsNullOrEmpty(strNewResultId))
             {
                 return(0);
             }
             return(Convert.ToInt64(strNewResultId));
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
     return(0);
 }