Пример #1
0
        //ShareOnServer
        public bool ServerUpdate(SqlTransaction _transaction, SqlConnection _connection, bool BringOperation, bool BringSubEquips, SqlTransaction LocalTransaction, SqlConnection LocalConnection)
        {
            SqlConnection connection = _connection;
            SqlCommand    command    = new SqlCommand("E_Ramp_Update", connection);

            command.CommandType = CommandType.StoredProcedure;
            command.Transaction = _transaction;

            //command.Parameters.Add(new SqlParameter("iXCode", XCode));
            command.Parameters.Add(new SqlParameter("iProductCode", ProductCode));
            command.Parameters.Add(new SqlParameter("iCode", Code));
            command.Parameters.Add(new SqlParameter("iName", Name));
            command.Parameters.Add(new SqlParameter("iIsDefault", IsDefault));

            try
            {
                //command.ExecuteNonQuery();
                //command.Parameters.Clear();
                //command.CommandType = CommandType.Text;
                //command.CommandText = "SELECT @@IDENTITY";
                command.ExecuteNonQuery();

                if (BringOperation)
                {
                    if (Atend.Base.Equipment.EOperation.Delete(_transaction, _connection, Code, (int)Atend.Control.Enum.ProductType.Ramp))
                    {
                        DataTable operations = Atend.Base.Equipment.EOperation.SelectByXCodeType(XCode, (int)Atend.Control.Enum.ProductType.Ramp, LocalTransaction, LocalConnection);
                        foreach (DataRow dr in operations.Rows)
                        {
                            Atend.Base.Equipment.EOperation SelectedOperation = Atend.Base.Equipment.EOperation.SelectByCodeForLocal(new Guid(dr["Code"].ToString()), LocalTransaction, LocalConnection);
                            SelectedOperation.ProductCode = Code;
                            if (!SelectedOperation.Insert(_transaction, _connection))
                            {
                                throw new System.Exception("operation failed in RAMp");
                            }
                        }
                    }
                    else
                    {
                        throw new System.Exception("Deleted Operation Failed in Ramp");
                    }
                }

                if (BringSubEquips)
                {
                    if (!Atend.Base.Equipment.EContainerPackage.SentFromLocalToServer(XCode, (int)Atend.Control.Enum.ProductType.Ramp, Code, _transaction, _connection, LocalTransaction, LocalConnection))
                    {
                        throw new System.Exception("SentFromLocalToServer Ramp failed");
                    }
                }

                return(true);
            }
            catch (System.Exception ex1)
            {
                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage(string.Format("Error ERamp.ServerUpdate : {0} \n", ex1.Message));
                return(false);
            }
        }
Пример #2
0
        //HATAMI //ShareOnServer
        public bool ServerInsert(SqlTransaction _transaction, SqlConnection _connection, bool BringOperation, bool BringSubEquips, SqlTransaction LocalTransaction, SqlConnection LocalConnection)
        {
            Editor     ed      = Application.DocumentManager.MdiActiveDocument.Editor;
            SqlCommand command = new SqlCommand("E_JackPanelWeekCell_Insert", _connection);

            command.CommandType = CommandType.StoredProcedure;
            command.Transaction = _transaction;

            command.Parameters.Add(new SqlParameter("iXCode", XCode));
            command.Parameters.Add(new SqlParameter("iNum", Num));
            command.Parameters.Add(new SqlParameter("iJackPAnelWeekCode", JackPanelWeekCode));
            command.Parameters.Add(new SqlParameter("iIsNightLight", IsNightLight));
            command.Parameters.Add(new SqlParameter("iIsDefault", IsDefault));
            try
            {
                //command.ExecuteNonQuery();
                //command.Parameters.Clear();
                //command.CommandType = CommandType.Text;
                //command.CommandText = "SELECT @@IDENTITY";
                Code = Convert.ToInt32(command.ExecuteScalar());


                if (BringOperation)
                {
                    DataTable operations = Atend.Base.Equipment.EOperation.SelectByXCodeType(XCode, (int)Atend.Control.Enum.ProductType.Cell);
                    foreach (DataRow dr in operations.Rows)
                    {
                        Atend.Base.Equipment.EOperation SelectedOperation = Atend.Base.Equipment.EOperation.SelectByCodeForLocal(new Guid(dr["Code"].ToString()));
                        SelectedOperation.ProductCode = Code;
                        if (!SelectedOperation.Insert(_transaction, _connection))
                        {
                            throw new System.Exception("operation failed in Cell");
                        }
                    }
                }


                if (BringSubEquips)
                {
                    ed.WriteMessage("Main Parent is Cell: {0}\n", Code);
                    if (!Atend.Base.Equipment.EContainerPackage.SentFromLocalToServer(XCode, (int)Atend.Control.Enum.ProductType.Cell, Code, _transaction, _connection, LocalTransaction, LocalConnection))
                    {
                        throw new System.Exception("SentFromLocalToServer Cell failed");
                    }
                }



                return(true);
            }
            catch (System.Exception ex1)
            {
                ed.WriteMessage(string.Format(" ERROR JackPanelWeekCell.ServerInsert: {0} \n", ex1.Message));

                return(false);
            }
        }
Пример #3
0
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Server Part~~~~~~~~~~~~~~~~~~~~~~~~//

        ////////public bool Insert()
        ////////{
        ////////    SqlConnection connection = new SqlConnection(Atend.Control.ConnectionString.ServercnString);
        ////////    SqlCommand command = new SqlCommand("E_Ramp_Insert", connection);
        ////////    command.CommandType = CommandType.StoredProcedure;

        ////////    command.Parameters.Add(new SqlParameter("iXCode", XCode));
        ////////    command.Parameters.Add(new SqlParameter("iCode", Code));
        ////////    command.Parameters.Add(new SqlParameter("iName", Name));
        ////////    try
        ////////    {
        ////////        connection.Open();
        ////////        Code = Convert.ToInt32(command.ExecuteScalar());
        ////////        connection.Close();
        ////////        return true;
        ////////    }
        ////////    catch (System.Exception ex1)
        ////////    {
        ////////        Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
        ////////        ed.WriteMessage(string.Format("Error ERamp.Insert : {0} \n", ex1.Message));
        ////////        connection.Close();
        ////////        return false;
        ////////    }
        ////////}


        //HATAMI //ShareOnServer
        public bool ServerInsert(SqlTransaction _transaction, SqlConnection _connection, bool BringOperation, bool BringSubEquips, SqlTransaction LocalTransaction, SqlConnection LocalConnection)
        {
            SqlConnection connection = _connection;
            SqlCommand    command    = new SqlCommand("E_Arm_Insert", connection);

            command.CommandType = CommandType.StoredProcedure;
            command.Transaction = _transaction;

            command.Parameters.Add(new SqlParameter("iXCode", XCode));
            command.Parameters.Add(new SqlParameter("iProductCode", ProductCode));

            command.Parameters.Add(new SqlParameter("iName", Name));
            command.Parameters.Add(new SqlParameter("iIsDefault", IsDefault));

            try
            {
                Code = Convert.ToInt32(command.ExecuteScalar());

                if (BringOperation)
                {
                    DataTable operations = Atend.Base.Equipment.EOperation.SelectByXCodeType(XCode, (int)Atend.Control.Enum.ProductType.Arm, LocalTransaction, LocalConnection);
                    foreach (DataRow dr in operations.Rows)
                    {
                        Atend.Base.Equipment.EOperation SelectedOperation = Atend.Base.Equipment.EOperation.SelectByCodeForLocal(new Guid(dr["Code"].ToString()), LocalTransaction, LocalConnection);
                        SelectedOperation.ProductCode = Code;
                        if (!SelectedOperation.Insert(_transaction, _connection))
                        {
                            throw new System.Exception("operation failed in Arm");
                        }
                    }
                }

                if (BringSubEquips)
                {
                    if (!Atend.Base.Equipment.EContainerPackage.SentFromLocalToServer(XCode, (int)Atend.Control.Enum.ProductType.Ramp, Code, _transaction, _connection, LocalTransaction, LocalConnection))
                    {
                        throw new System.Exception("SentFromLocalToServer Arm failed");
                    }
                }

                return(true);
            }
            catch (System.Exception ex1)
            {
                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage(string.Format("Error EArm.ServerInsert : {0} \n", ex1.Message));
                return(false);
            }
        }