Beispiel #1
0
 public int UpdatePathEx(TrafficPath trafficPath_0)
 {
     string[][] pathSegments = trafficPath_0.PathSegments;
     int num = (pathSegments == null) ? 0 : pathSegments.Length;
     string str = "";
     bool flag = true;
     for (int i = 0; i < num; i++)
     {
         if (flag)
         {
             str = string.Concat(new object[] { trafficPath_0.PathId, ",''", pathSegments[i][0], "'',''", pathSegments[i][1], "''" });
             flag = false;
         }
         else
         {
             object obj2 = str;
             str = string.Concat(new object[] { obj2, "#", trafficPath_0.PathId, ",''", pathSegments[i][0], "'',''", pathSegments[i][1], "''" });
         }
     }
     string str2 = "WebGpsClientJTB_UpdatePath";
     SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@PathID", trafficPath_0.PathId), new SqlParameter("@pathStr", trafficPath_0.pathStr), new SqlParameter("@pathName", trafficPath_0.pathName), new SqlParameter("@pathType", trafficPath_0.pathType), new SqlParameter("@region_Radius", trafficPath_0.region_Radius), new SqlParameter("@factoryName", trafficPath_0.factoryName), new SqlParameter("@lon_Factory", trafficPath_0.lon_Factory), new SqlParameter("@lat_Factory", trafficPath_0.lat_Factory), new SqlParameter("@buildingSitName", trafficPath_0.buildingSitName), new SqlParameter("@lon_BuildingSit", trafficPath_0.lon_BuildingSit), new SqlParameter("@lat_BuildingSit", trafficPath_0.lat_BuildingSit), new SqlParameter("@remark", trafficPath_0.remark), new SqlParameter("@SegmentList", str), new SqlParameter("@iNewPath", trafficPath_0.isNewPath ? 1 : 0), new SqlParameter("@pathgroupID", trafficPath_0.pathgroupID) };
     DataTable table = new SqlDataAccess().getDataBySP(str2, parameterArray);
     return ((((table == null) || (table.Rows.Count == 0)) || (table.Rows[0][0] == DBNull.Value)) ? -3 : int.Parse(table.Rows[0][0].ToString()));
 }
Beispiel #2
0
 public static int UpdatePathEx(TrafficPath pathinfo)
 {
     int num;
     if (RemotingClient.app == null)
     {
         return 0;
     }
     try
     {
         num = RemotingClient.app.UpdatePathEx(pathinfo);
     }
     catch (SocketException socketException)
     {
         Record.execFileRecord("预设路线", socketException.Message);
         num = 0;
     }
     catch (Exception exception)
     {
         Record.execFileRecord("预设路线", exception.ToString());
         num = 0;
     }
     return num;
 }
Beispiel #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string text = this.cmbGroup.Text;
            string pathName = this.txtName.Text.Trim();
            if (text.Length <= 0)
            {
                MessageBox.Show("请选择组别");
                this.cmbGroup.Focus();
            }
            else if (text == "(无)")
            {
                MessageBox.Show("没有组别");
                this.cmbGroup.Focus();
            }
            else if (pathName.Length <= 0)
            {
                MessageBox.Show("请输入名称");
                this.txtName.Focus();
            }
            else if (this.preType == itmPreSetPath.PreType.预设报警路线)
            {
                int pathType = int.Parse(this.cmbPathType.SelectedValue.ToString());
                string factoryName = this.txtBeginName.Text.Trim();
                string buildingSitName = this.txtEndName.Text.Trim();
                int num2 = int.Parse(this.numRadius.Value.ToString());
                double num3 = 0.0;
                double num4 = 0.0;
                double num5 = 0.0;
                double num6 = 0.0;
                string pathStr = "";
                if (pathName.IndexOf('^') >= 0)
                {
                    MessageBox.Show("路线名称中不允许包含字符('^')!");
                    this.txtName.Focus();
                }
                else
                {
                    if (pathType == 1)
                    {
                        if (factoryName.Length <= 0)
                        {
                            MessageBox.Show("请输入起点名称");
                            this.txtBeginName.Focus();
                            return;
                        }
                        if (buildingSitName.Length <= 0)
                        {
                            MessageBox.Show("请输入终点名称");
                            this.txtEndName.Focus();
                            return;
                        }
                    }
                    string[] strArray = this.PathDot.Split(new char[] { ';' });
                    string[] strArray2 = strArray[0].Split(new char[] { ',' });
                    num3 = double.Parse(strArray2[0]);
                    num4 = double.Parse(strArray2[1]);
                    strArray2 = strArray[strArray.Length - 1].Split(new char[] { ',' });
                    num5 = double.Parse(strArray2[0]);
                    num6 = double.Parse(strArray2[1]);
                    foreach (string str6 in strArray)
                    {
                        string[] strArray3 = str6.Split(new char[] { ',' });
                        pathStr = (pathStr + this.getDotStr(strArray3[0]) + "*") + this.getDotStr(strArray3[1]) + "/";
                    }
                    if (!this._isUpdate)
                    {
                        switch (this.PreSetPath(pathStr, pathName, pathType, num2, factoryName, num3, num4, buildingSitName, num5, num6))
                        {
                            case 0:
                                this.PathDot = pathStr;
                                this.PathName = pathName;
                                this._group = this.cmbGroup.SelectedValue.ToString();
                                this._pathType = this.cmbPathType.SelectedValue.ToString();
                                this._beginName = this.txtBeginName.Text;
                                this._endName = this.txtEndName.Text;
                                this._mark = this.txtMark.Text;
                                if (!base.Modal)
                                {
                                    if (this.dtPath != null)
                                    {
                                        DataRow row = this.dtPath.NewRow();
                                        row["PathId"] = this.PathId;
                                        row["PathName"] = this.PathName;
                                        row["AlarmPathDot"] = this.PathDot;
                                        this.dtPath.Rows.Add(row);
                                    }
                                    base.Close();
                                }
                                base.DialogResult = DialogResult.OK;
                                return;

                            case 1:
                                base.DialogResult = DialogResult.Cancel;
                                base.Close();
                                return;
                        }
                    }
                    else
                    {
                        try
                        {
                            TrafficPath pathinfo = new TrafficPath {
                                pathStr = pathStr,
                                pathName = pathName,
                                PathId = Convert.ToInt32(this.PathId),
                                pathType = pathType,
                                region_Radius = num2,
                                factoryName = factoryName,
                                lon_Factory = num3,
                                lat_Factory = num4,
                                buildingSitName = buildingSitName,
                                lon_BuildingSit = num5,
                                lat_BuildingSit = num6,
                                isNewPath = this.PathLonLatChange,
                                pathgroupID = Convert.ToInt32(this.cmbGroup.SelectedValue),
                                PathSegments = this.getSegment(),
                                remark = this.txtMark.Text
                            };
                            switch (this.UpdatePathEx(pathinfo))
                            {
                                case 1:
                                    this.PathDot = pathStr;
                                    this.PathName = pathName;
                                    this._group = this.cmbGroup.SelectedValue.ToString();
                                    this._pathType = this.cmbPathType.SelectedValue.ToString();
                                    this._beginName = this.txtBeginName.Text;
                                    this._endName = this.txtEndName.Text;
                                    this._mark = this.txtMark.Text;
                                    base.DialogResult = DialogResult.OK;
                                    return;

                                case 0:
                                    base.DialogResult = DialogResult.Cancel;
                                    base.Close();
                                    return;
                            }
                        }
                        catch (Exception exception)
                        {
                            Record.execFileRecord("预设路线-->路线添加页面", exception.Message);
                        }
                    }
                }
            }
            else
            {
                string regionStr = "";
                int iRegionFeature = 0;
                if (pathName.IndexOf('^') >= 0)
                {
                    MessageBox.Show("区域命名中不能包含字符('^')!");
                    this.txtName.Focus();
                }
                else
                {
                    if (this.PathDot.Split(new char[] { ';' }).Length == 1)
                    {
                        this.iRadius = int.Parse(this.numDistance.Value.ToString());
                        string[] strArray4 = this.PathDot.Split(new char[] { ',' });
                        regionStr = this.getDotStr(strArray4[0]) + @"\" + this.getDotStr(strArray4[1]) + @"\" + this.iRadius.ToString() + "*";
                    }
                    else
                    {
                        foreach (string str8 in this.PathDot.Split(new char[] { ';' }))
                        {
                            string[] strArray6 = str8.Split(new char[] { ',' });
                            regionStr = (regionStr + this.getDotStr(strArray6[0]) + @"\") + this.getDotStr(strArray6[1]) + "*";
                        }
                    }
                    if (this.preType == itmPreSetPath.PreType.预设多功能报警区域)
                    {
                        iRegionFeature = 1;
                    }
                    switch (this.PreSetRegion(regionStr, pathName, iRegionFeature))
                    {
                        case 1:
                            this.PathDot = regionStr;
                            this.PathName = pathName;
                            this._group = this.cmbGroup.SelectedValue.ToString();
                            base.DialogResult = DialogResult.OK;
                            return;

                        case 0:
                            base.DialogResult = DialogResult.Cancel;
                            break;
                    }
                }
            }
        }
Beispiel #4
0
 private int UpdatePathEx(TrafficPath pathinfo)
 {
     try
     {
         if (RemotingClient.UpdatePathEx(pathinfo) < 0)
         {
             if (MessageBox.Show("上传路线信息失败,是否重新上传?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
             {
                 return this.UpdatePathEx(pathinfo);
             }
             return 0;
         }
         MessageBox.Show("上传路线信息成功!");
         return 1;
     }
     catch (Exception exception)
     {
         Record.execFileRecord("路线修改", exception.Message);
         return 0;
     }
 }
Beispiel #5
0
 public int UpdatePathEx(TrafficPath traffic)
 {
     try
     {
         return this.myAlarm.UpdatePathEx(traffic);
     }
     catch (Exception exception)
     {
         ErrorMsg msg = new ErrorMsg("Alarm", "UpdatePathEx", exception.Message);
         this.m_LogHelper.WriteError(msg);
         return -1;
     }
 }