Ejemplo n.º 1
0
        public frmRouteActivityRouting(GeneralActivityDTO pActivityDTO)
        {
            InitializeComponent();
            this.Background = new LinearGradientBrush(Colors.AliceBlue, Colors.LightGray, 90);

            refActivityDTO = pActivityDTO;



            SetGridRoutes();

            dtGridRoute.ItemsSource = new List <OsmRouteData>();
        }
Ejemplo n.º 2
0
        public frmActivityEdit(structTransportCommonProperty CommonProperty, GeneralActivityDTO ActivityDTO)
        {
            InitializeComponent();
            this.Background           = new LinearGradientBrush(Colors.AliceBlue, Colors.LightGray, 90);
            txPlatformName.IsReadOnly = true;

            AtomCommonProperty = CommonProperty;
            refActivityDTO     = ActivityDTO;

            if (AtomCommonProperty != null)
            {
                txPlatformName.Text = AtomCommonProperty.AtomName;
            }
        }
Ejemplo n.º 3
0
        public static IEnumerable <GeneralActivityDTO> GetAllActivites()
        {
            try
            {
                List <GeneralActivityDTO> Activites = new List <GeneralActivityDTO>();
                string sql = "select * from Activites order by ActivityId,Activity_SeqNumber";
                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                    using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection))
                    {
                        DataSet   ds = new DataSet();
                        DataTable dt = new DataTable();
                        ds.Reset();
                        da.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt == null || dt.Rows == null || dt.Rows.Count == 0)
                        {
                            return(null);
                        }
                        foreach (DataRow row in dt.Rows)
                        {
                            GeneralActivityDTO activity = new GeneralActivityDTO();
                            activity.ActivityType        = (enumActivity)Convert.ToInt32(row["ActivityType"]);                              //  enumActivity.MovementActivity;
                            activity.ActivityId          = System.Convert.ToInt32(row["ActivityId"]);
                            activity.Activity_SeqNumber  = System.Convert.ToInt32(row["Activity_SeqNumber"]);
                            activity.StartActivityOffset = TimeSpan.Parse(row["StartActivityOffset"].ToString());
                            activity.DurationActivity    = TimeSpan.Parse(row["DurationActivity"].ToString());
                            activity.Speed = System.Convert.ToInt32(row["Speed"]);

                            activity.ReferencePoint   = new DPoint();
                            activity.ReferencePoint.x = System.Convert.ToDouble(row["ReferencePointX"]);
                            activity.ReferencePoint.y = System.Convert.ToDouble(row["ReferencePointY"]);

                            string RouteGuid = row["route_guid"].ToString();
                            activity.RouteActivity = TDS.DAL.RoutesDB.GetRouteByGuid(RouteGuid);


                            Activites.Add(activity);
                        }
                    }
                return(Activites);
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
Ejemplo n.º 4
0
        async void  frm_ActivityDTOEditEvent(object sender, ActivityDTOEditEventArgs args)
        {
            if (args.isNew)
            {
                int n = ((List <ActivityDTONotify>)(dtGridActivities.ItemsSource)).Count + 1;
                args.ActivityDTO.Activity_SeqNumber = n;

                GeneralActivityDTO activity = await SAGSignalR.SaveActivity(VMMainViewModel.Instance.SimulationHubProxy, args.ActivityDTO);

                ActivityDTONotify Rdata = new ActivityDTONotify();
                Rdata.ActivityDTO = activity;

                ((List <ActivityDTONotify>)(dtGridActivities.ItemsSource)).Add(Rdata);

                dtGridActivities.Items.Refresh();
                dtGridActivities.SelectedItem = Rdata;
                dtGridActivities.CurrentItem  = Rdata;
                DataGridWPFUtility.DataGridGotoLast(dtGridActivities);
            }
            else
            {
                GeneralActivityDTO activity = await SAGSignalR.SaveActivity(VMMainViewModel.Instance.SimulationHubProxy, args.ActivityDTO);

                if (dtGridActivities.ItemsSource == null)
                {
                    return;
                }

                List <ActivityDTONotify> listData = (List <ActivityDTONotify>)(dtGridActivities.ItemsSource);

                //  RouteData currRouteData = null;
                for (int j = 0; j < listData.Count; j++)
                {
                    if (listData[j].ActivityId == activity.ActivityId)
                    {
                        // currRouteData = listData[j];
                        listData[j].ActivityDTO = activity;
                        dtGridActivities.Items.Refresh();
                        break;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private async void cmdExit_Click(object sender, RoutedEventArgs e)
        {
            bool isCheckOk = await CheckOk();

            if (isCheckOk == false)
            {
                return;
            }

            DrawPolygonEventArgs arg = new DrawPolygonEventArgs();

            arg.isCancel = false;
            arg.isNew    = true;

            arg.PolygonName = txtRouteName.Text.Trim();

            arg.PolygonPnts = m_PolygonPnts.ToArray <DPoint>();
            //  isOK = true;
            if (EndDrawPolygonEvent != null)
            {
                EndDrawPolygonEvent(this, arg);
            }


            GeneralActivityDTO ActivityDTO = new GeneralActivityDTO();

            ActivityDTO.ActivityType = enumActivity.MovementActivity;

            AtomData atomdata = new AtomData();

            atomdata.UnitName = txPlatformName.Text;
            atomdata.Location = m_PolygonPnts[0];

            ActivityDTO.StartActivityOffset = (TimeSpan)startActivity.Value;
            ActivityDTO.DurationActivity    = (TimeSpan)durationActivity.Value;
            ActivityDTO.Speed = (int)speedUpDown.Value;

            Route route = new Route();

            route.RouteName           = txtRouteName.Text;
            route.Points              = m_PolygonPnts;
            ActivityDTO.RouteActivity = route;

            if (refActivityDTO != null)
            {
                atomdata.UnitGuid      = refActivityDTO.Atom.UnitGuid;
                ActivityDTO.ActivityId = refActivityDTO.ActivityId;
                if (ActivityDTO.RouteActivity != null)
                {
                    ActivityDTO.RouteActivity.RouteGuid = refActivityDTO.RouteActivity.RouteGuid;
                }
            }



            ActivityDTO.Atom = atomdata;



            await SAGSignalR.SaveActivity(VMMainViewModel.Instance.SimulationHubProxy, ActivityDTO);


            this.Close();
        }
Ejemplo n.º 6
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            //  bool isCheckOk = await CheckOk();
            bool isCheckOk = CheckOk();

            if (isCheckOk == false)
            {
                return;
            }

            GeneralActivityDTO ActivityDTO = new GeneralActivityDTO();

            ActivityDTO.Atom          = new AtomData();
            ActivityDTO.Atom.UnitName = AtomCommonProperty.AtomName;

            ActivityDTO.ActivityType        = enumActivity.MovementActivity;
            ActivityDTO.StartActivityOffset = (TimeSpan)startActivity.Value;
            ActivityDTO.Speed = (int)speedUpDown.Value;


            double X = 0;
            double Y = 0;

            if (txtReferenceX.Tag != null)
            {
                double.TryParse(txtReferenceX.Tag.ToString(), out X);
                double.TryParse(txtReferenceY.Tag.ToString(), out Y);

                ActivityDTO.ReferencePoint = new DPoint(X, Y);
            }



            //  Route route = new Route();
            //  route.RouteName = txtRoute.Text;

            ActivityDTO.RouteActivity = ActivityRoute; // route;

            ActivityDTOEditEventArgs args = new ActivityDTOEditEventArgs();

            args.isNew = false;
            if (refActivityDTO == null)
            {
                args.isNew = true;
            }
            else
            {
                ActivityDTO.ActivityId         = refActivityDTO.ActivityId;
                ActivityDTO.Activity_SeqNumber = refActivityDTO.Activity_SeqNumber;
            }
            args.ActivityDTO = ActivityDTO;



            if (ActivityDTOEditEvent != null)
            {
                ActivityDTOEditEvent(this, args);
            }

            Close();
        }
Ejemplo n.º 7
0
        public static void SaveActivityOLD(GeneralActivityDTO ActivityDTO)
        {
            try
            {
                int    Actid = ActivityDTO.ActivityId;
                object ob    = null;
                string sql;

                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                {
                    connection.Open();
                    NpgsqlTransaction sqlTran = connection.BeginTransaction();
                    try
                    {
                        //  ******  Atom  *******
                        if (string.IsNullOrEmpty(ActivityDTO.Atom.UnitGuid)) //new Atom
                        {
                            ActivityDTO.Atom.UnitGuid = Util.CretaeGuid().ToString();

                            sql = "insert into AtomObjects (atom_guid,atom_name,CountryId,pointX,pointY)" +
                                  "values ('" + ActivityDTO.Atom.UnitGuid + "','" +
                                  ActivityDTO.Atom.UnitName + "'," +
                                  0 + "," +
                                  ActivityDTO.Atom.Location.x + "," +
                                  ActivityDTO.Atom.Location.y +

                                  " )  ";
                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                command.ExecuteNonQuery();
                            }
                        }
                        else
                        {
                            sql = "update AtomObjects set atom_guid='" + ActivityDTO.Atom.UnitGuid + "'" +
                                  " ,atom_name='" + ActivityDTO.Atom.UnitName + "'" +
                                  " ,CountryId=" + 0 +
                                  " ,pointX=" + ActivityDTO.Atom.Location.x +
                                  " ,pointY=" + ActivityDTO.Atom.Location.y +
                                  " where atom_guid='" + ActivityDTO.Atom.UnitGuid + "'";
                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                command.ExecuteNonQuery();
                            }
                        }

                        // ******  Route  ******

                        if (string.IsNullOrEmpty(ActivityDTO.RouteActivity.RouteGuid))
                        {
                            ActivityDTO.RouteActivity.RouteGuid = Util.CretaeGuid().ToString();
                        }
                        RoutesDB.SaveRoute(ActivityDTO.RouteActivity, connection, sqlTran);



                        //  ******  Activity  *******
                        if (ActivityDTO.ActivityId == 0) //new Activity
                        {
                            sql = "insert into ActivityMovement (atom_guid,StartActivityOffset,DurationActivity,Speed,route_guid)" +
                                  "values ('" + ActivityDTO.Atom.UnitGuid + "','" +
                                  ActivityDTO.StartActivityOffset.ToString() + "','" +
                                  ActivityDTO.DurationActivity.ToString() + "'," +
                                  ActivityDTO.Speed + ",'" +
                                  ActivityDTO.RouteActivity.RouteGuid + "'" +

                                  " )  RETURNING ActivityId";


                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                Actid = (int)command.ExecuteScalar();
                                ActivityDTO.ActivityId = Actid;
                            }
                        }
                        else
                        {
                            sql = "update ActivityMovement set atom_guid='" + ActivityDTO.Atom.UnitGuid + "'" +
                                  " ,StartActivityOffset='" + ActivityDTO.StartActivityOffset.ToString() + "'" +
                                  " ,DurationActivity='" + ActivityDTO.DurationActivity.ToString() + "'" +
                                  " ,Speed=" + ActivityDTO.Speed +
                                  " ,route_guid='" + ActivityDTO.RouteActivity.RouteGuid + "'" +
                                  " where ActivityId=" + ActivityDTO.ActivityId;

                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                command.ExecuteNonQuery();
                            }
                        }
                        //**********************************************************



                        sqlTran.Commit();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            sqlTran.Rollback();
                        }
                        catch (Exception exRollback)
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 8
0
        public static GeneralActivityDTO SaveActivity(GeneralActivityDTO ActivityDTO)
        {
            try
            {
                int    Actid = ActivityDTO.ActivityId;
                object ob    = null;
                string sql;

                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                {
                    connection.Open();
                    NpgsqlTransaction sqlTran = connection.BeginTransaction();
                    try
                    {
                        AtomData atomdata = DAL.AtomsDB.GetAtomByName(ActivityDTO.Atom.UnitName);
                        ActivityDTO.Atom.UnitGuid = atomdata.UnitGuid;
                        //  ******  Activity  *******
                        if (ActivityDTO.ActivityId == 0) //new Activity
                        {
                            sql = "insert into Activites (   atom_guid,StartActivityOffset,DurationActivity,ActivityType,Speed,route_guid,ReferencePointX,ReferencePointY,Activity_SeqNumber)" +
                                  "values ('" + atomdata.UnitGuid + "','" +
                                  ActivityDTO.StartActivityOffset.ToString() + "','" +
                                  ActivityDTO.DurationActivity.ToString() + "'," +
                                  (int)ActivityDTO.ActivityType + "," +
                                  ActivityDTO.Speed + ",'" +
                                  ActivityDTO.RouteActivity.RouteGuid + "'," +
                                  ActivityDTO.ReferencePoint.x + "," +
                                  ActivityDTO.ReferencePoint.y + "," +
                                  ActivityDTO.Activity_SeqNumber +
                                  " )  RETURNING ActivityId";


                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                Actid = (int)command.ExecuteScalar();
                                ActivityDTO.ActivityId = Actid;
                            }
                        }
                        else
                        {
                            sql = "update Activites set atom_guid='" + atomdata.UnitGuid + "'" +
                                  " ,StartActivityOffset='" + ActivityDTO.StartActivityOffset.ToString() + "'" +
                                  " ,DurationActivity='" + ActivityDTO.DurationActivity.ToString() + "'" +
                                  " ,ActivityType=" + (int)ActivityDTO.ActivityType +
                                  " ,Speed=" + ActivityDTO.Speed +
                                  " ,route_guid='" + ActivityDTO.RouteActivity.RouteGuid + "'" +

                                  " ,ReferencePointX=" + ActivityDTO.ReferencePoint.x +
                                  " ,ReferencePointY=" + ActivityDTO.ReferencePoint.y +
                                  " ,Activity_SeqNumber=" + ActivityDTO.Activity_SeqNumber +
                                  " where ActivityId=" + ActivityDTO.ActivityId;

                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                command.ExecuteNonQuery();
                            }
                        }
                        //**********************************************************



                        sqlTran.Commit();

                        return(ActivityDTO);
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            sqlTran.Rollback();
                        }
                        catch (Exception exRollback)
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }


            return(null);
        }
Ejemplo n.º 9
0
        public static IEnumerable<GeneralActivityDTO> GetAllActivites()
        {
            try
            {
                List<GeneralActivityDTO> Activites = new List<GeneralActivityDTO>();
                string sql = "select * from Activites order by ActivityId,Activity_SeqNumber";
                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection))
                {
                    DataSet ds = new DataSet();
                    DataTable dt = new DataTable();
                    ds.Reset();
                    da.Fill(ds);
                    dt = ds.Tables[0];

                    if (dt == null || dt.Rows == null || dt.Rows.Count == 0)
                    {
                        return null;
                    }
                    foreach (DataRow row in dt.Rows)
                    {
                        GeneralActivityDTO activity = new GeneralActivityDTO();
                        activity.ActivityType = (enumActivity)Convert.ToInt32(row["ActivityType"]);                                         //  enumActivity.MovementActivity;
                        activity.ActivityId = System.Convert.ToInt32(row["ActivityId"]);
                        activity.Activity_SeqNumber = System.Convert.ToInt32(row["Activity_SeqNumber"]);
                        activity.StartActivityOffset = TimeSpan.Parse(row["StartActivityOffset"].ToString());
                        activity.DurationActivity = TimeSpan.Parse(row["DurationActivity"].ToString());
                        activity.Speed = System.Convert.ToInt32(row["Speed"]);

                        activity.ReferencePoint = new DPoint();
                        activity.ReferencePoint.x = System.Convert.ToDouble(row["ReferencePointX"]);
                        activity.ReferencePoint.y = System.Convert.ToDouble(row["ReferencePointY"]);

                        string RouteGuid = row["route_guid"].ToString();
                        activity.RouteActivity = TDS.DAL.RoutesDB.GetRouteByGuid(RouteGuid);


                        Activites.Add(activity);
                    }
                }
                return Activites;
            }
            catch (Exception ex)
            {

            }
            return null;
        }
Ejemplo n.º 10
0
        public static void SaveActivityOLD(GeneralActivityDTO ActivityDTO)
        {
            try
            {
                int Actid = ActivityDTO.ActivityId;
                object ob = null;
                string sql;
      
                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                {
                    connection.Open();
                    NpgsqlTransaction sqlTran = connection.BeginTransaction();
                    try
                    {

                        //  ******  Atom  *******
                        if (string.IsNullOrEmpty(ActivityDTO.Atom.UnitGuid)) //new Atom
                        {
                            ActivityDTO.Atom.UnitGuid = Util.CretaeGuid().ToString();

                            sql = "insert into AtomObjects (atom_guid,atom_name,CountryId,pointX,pointY)" +
                                  "values ('" + ActivityDTO.Atom.UnitGuid + "','" +
                                    ActivityDTO.Atom.UnitName + "'," +
                                    0 + "," +
                                    ActivityDTO.Atom.Location.x + "," +
                                    ActivityDTO.Atom.Location.y +

                                    " )  ";
                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                command.ExecuteNonQuery();
                            }
                        }
                        else
                        {
                            sql = "update AtomObjects set atom_guid='" + ActivityDTO.Atom.UnitGuid + "'" +
                                    " ,atom_name='" + ActivityDTO.Atom.UnitName + "'" +
                                    " ,CountryId=" + 0 +
                                    " ,pointX=" + ActivityDTO.Atom.Location.x +
                                    " ,pointY=" + ActivityDTO.Atom.Location.y +
                                    " where atom_guid='" + ActivityDTO.Atom.UnitGuid + "'";
                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                command.ExecuteNonQuery();
                            }
                        }

                        // ******  Route  ******

                        if (string.IsNullOrEmpty(ActivityDTO.RouteActivity.RouteGuid))
                        {
                            ActivityDTO.RouteActivity.RouteGuid = Util.CretaeGuid().ToString();
                        }
                        RoutesDB.SaveRoute(ActivityDTO.RouteActivity, connection, sqlTran);



                        //  ******  Activity  *******
                        if (ActivityDTO.ActivityId == 0) //new Activity
                        {
                            sql = "insert into ActivityMovement (atom_guid,StartActivityOffset,DurationActivity,Speed,route_guid)" +
                                   "values ('" + ActivityDTO.Atom.UnitGuid + "','" +
                                                      ActivityDTO.StartActivityOffset.ToString() + "','" +
                                                      ActivityDTO.DurationActivity.ToString() + "'," +
                                                      ActivityDTO.Speed + ",'" +
                                                      ActivityDTO.RouteActivity.RouteGuid + "'" +

                                                       " )  RETURNING ActivityId";


                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                Actid = (int)command.ExecuteScalar();
                                ActivityDTO.ActivityId = Actid;
                            }
                        }
                        else
                        {
                            sql = "update ActivityMovement set atom_guid='" + ActivityDTO.Atom.UnitGuid + "'" +
                                     " ,StartActivityOffset='" + ActivityDTO.StartActivityOffset.ToString() + "'" +
                                     " ,DurationActivity='" + ActivityDTO.DurationActivity.ToString() + "'" +
                                     " ,Speed=" + ActivityDTO.Speed +
                                     " ,route_guid='" + ActivityDTO.RouteActivity.RouteGuid + "'" +
                                  " where ActivityId=" + ActivityDTO.ActivityId;

                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                command.ExecuteNonQuery();
                            }

                        }
                        //**********************************************************



                       



                        sqlTran.Commit();
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            sqlTran.Rollback();
                        }
                        catch (Exception exRollback)
                        {

                        }
                       
                    }
                }             


            }
            catch (Exception ex)
            {

            }
        }
Ejemplo n.º 11
0
        public static GeneralActivityDTO SaveActivity(GeneralActivityDTO ActivityDTO)
        {
            try
            {
                int Actid = ActivityDTO.ActivityId;
                object ob = null;
                string sql;

                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                {
                    connection.Open();
                    NpgsqlTransaction sqlTran = connection.BeginTransaction();
                    try
                    {                      
                        AtomData atomdata=DAL.AtomsDB.GetAtomByName(ActivityDTO.Atom.UnitName);
                        ActivityDTO.Atom.UnitGuid = atomdata.UnitGuid;
                        //  ******  Activity  *******
                        if (ActivityDTO.ActivityId == 0) //new Activity
                        {
                            sql = "insert into Activites (   atom_guid,StartActivityOffset,DurationActivity,ActivityType,Speed,route_guid,ReferencePointX,ReferencePointY,Activity_SeqNumber)" +
                                   "values ('" + atomdata.UnitGuid + "','" +
                                                 ActivityDTO.StartActivityOffset.ToString() + "','" +
                                                 ActivityDTO.DurationActivity.ToString() + "'," +
                                                 (int)ActivityDTO.ActivityType+ ","+
                                                 ActivityDTO.Speed + ",'" +
                                                 ActivityDTO.RouteActivity.RouteGuid + "'," +
                                                 ActivityDTO.ReferencePoint.x+"," +
                                                 ActivityDTO.ReferencePoint.y+ ","+
                                                 ActivityDTO.Activity_SeqNumber+
                                                       " )  RETURNING ActivityId";


                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                Actid = (int)command.ExecuteScalar();
                                ActivityDTO.ActivityId = Actid;
                            }
                        }
                        else
                        {
                            sql = "update Activites set atom_guid='" + atomdata.UnitGuid + "'" +
                                     " ,StartActivityOffset='" + ActivityDTO.StartActivityOffset.ToString() + "'" +
                                     " ,DurationActivity='" + ActivityDTO.DurationActivity.ToString() + "'" +
                                     " ,ActivityType=" + (int)ActivityDTO.ActivityType +
                                     " ,Speed=" + ActivityDTO.Speed +
                                     " ,route_guid='" + ActivityDTO.RouteActivity.RouteGuid + "'" +

                                     " ,ReferencePointX=" + ActivityDTO.ReferencePoint.x +
                                     " ,ReferencePointY=" + ActivityDTO.ReferencePoint.y +
                                     " ,Activity_SeqNumber=" + ActivityDTO.Activity_SeqNumber + 
                                  " where ActivityId=" + ActivityDTO.ActivityId;

                            using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                            {
                                command.Transaction = sqlTran;
                                command.ExecuteNonQuery();
                            }

                        }
                        //**********************************************************







                        sqlTran.Commit();

                        return ActivityDTO;
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            sqlTran.Rollback();
                        }
                        catch (Exception exRollback)
                        {

                        }

                    }
                }


            }
            catch (Exception ex)
            {

            }


            return null;
        }