コード例 #1
0
        private void Save()
        {
            Atend.Base.Equipment.ECT ct = new Atend.Base.Equipment.ECT();
            txtName.Focus();
            ct.CT_Vol      = double.Parse(txtCT_Vol.Text);
            ct.CT_Convert  = txtCTConvert.Text;
            ct.ProductCode = Atend.Control.Common.selectedProductCode;
            ct.Comment     = txtComment.Text;
            ct.Name        = txtName.Text;
            ct.IsDefault   = IsDefault;
            ct.Code        = Code;

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            ct.EquipmentList = EPackageProduct;

            //Operation
            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            ct.OperationList = EOperation;
            if (SelectedCTXCode == Guid.Empty)
            {
                if (ct.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                ct.XCode = SelectedCTXCode;
                if (ct.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #2
0
ファイル: ERamp.cs プロジェクト: ParisaMousavi/ATEND
        //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);
            }
        }
コード例 #3
0
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.EPhusePole phusePole = new Atend.Base.Equipment.EPhusePole();
            phusePole.Amper       = Convert.ToDouble(txtAmper.Text);
            phusePole.ProductCode = Atend.Control.Common.selectedProductCode;
            phusePole.Comment     = txtComment.Text;
            phusePole.Name        = txtName.Text;
            phusePole.Mark        = txtMark.Text;
            phusePole.IsDefault   = IsDefault;
            phusePole.Code        = Code;

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            phusePole.EquipmentList = EPackageProduct;

            //Operation
            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            phusePole.OperationList = EOperation;
            if (selectedPhusePoleCode == Guid.Empty)
            {
                if (phusePole.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                phusePole.XCode = selectedPhusePoleCode;
                if (phusePole.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ذخیره سازی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #4
0
ファイル: frmBreaker02.cs プロジェクト: ParisaMousavi/ATEND
        private void BindTreeViwAndGridOpration(TreeView treeView, DataGridView dataGridView)
        {
            //dataGridView.Rows.Clear();
            //dataGridView.Update();
            ClearCheckAndGrid(tvOperation, gvOperation);
            ClearCheckAndGrid(tvOperation, gvOperation);
            dataGridView.Refresh();
            for (int i = 0; i < Atend.Base.Equipment.EBreaker.nodeKeys.Count; i++)
            {
                Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EBreaker.nodeKeys[i]);
                string s = Operation.ProductID.ToString();

                foreach (TreeNode rootnode in tvOperation.Nodes)
                {
                    if (rootnode.Tag.ToString() == s)
                    {
                        rootnode.Checked = true;
                        gvOperation.Rows.Add();
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag;
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text;
                        //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString();
                        Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString()));
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[2].Value = Unit.Name;
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[3].Value = Operation.Count;
                    }
                }
            }
        }
コード例 #5
0
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.EReCloser reCloser = new Atend.Base.Equipment.EReCloser();
            reCloser.Amper       = Convert.ToDouble(txtAmper.Text);
            reCloser.ProductCode = Atend.Control.Common.selectedProductCode;
            reCloser.Type        = Convert.ToByte(cboType.SelectedValue);
            reCloser.Comment     = txtComment.Text;
            reCloser.Name        = txtName.Text;
            reCloser.IsDefault   = IsDefault;
            reCloser.Code        = Code;

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            reCloser.EquipmentList = EPackageProduct;

            //Operation
            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            reCloser.OperationList = EOperation;
            if (SelectedRecloserCode == Guid.Empty)
            {
                if (reCloser.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                reCloser.XCode = SelectedRecloserCode;
                if (reCloser.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #6
0
        public bool AccessInsert(OleDbTransaction _oldtransaction, OleDbConnection _Oldconnection, OleDbTransaction _NewTransaction, OleDbConnection _Newconnection, bool BringOperation, bool BringSubEquips)
        {
            Editor       ed      = Application.DocumentManager.MdiActiveDocument.Editor;
            OleDbCommand command = new OleDbCommand("E_JackPanelWeekCell_Insert", _Newconnection);

            command.CommandType = CommandType.StoredProcedure;
            command.Transaction = _NewTransaction;

            command.Parameters.Add(new OleDbParameter("iXCode", XCode));
            command.Parameters.Add(new OleDbParameter("iNum", Num));
            command.Parameters.Add(new OleDbParameter("iJackPAnelWeekCode", JackPanelWeekCode));
            command.Parameters.Add(new OleDbParameter("iIsNightLight", IsNightLight));
            int oldCode = Code;

            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.AccessSelectByProductCodeType(oldCode, (int)Atend.Control.Enum.ProductType.Cell);
                    foreach (DataRow dr in operations.Rows)
                    {
                        Atend.Base.Equipment.EOperation SelectedOperation = Atend.Base.Equipment.EOperation.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()), _Oldconnection);
                        SelectedOperation.ProductCode = Code;
                        if (!SelectedOperation.AccessInsert(_NewTransaction, _Newconnection))
                        {
                            throw new System.Exception("operation failed in Cell");
                        }
                    }
                }


                if (BringSubEquips)
                {
                    ed.WriteMessage("Main Parent is Cell: {0}\n", Code);
                    if (!Atend.Base.Equipment.EContainerPackage.SentFromAccessToAccess(oldCode, (int)Atend.Control.Enum.ProductType.Cell, Code, _oldtransaction, _Oldconnection, _NewTransaction, _Newconnection))
                    {
                        throw new System.Exception("SentFromAccessToAccess Cell failed");
                    }
                }



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

                return(false);
            }
        }
コード例 #7
0
ファイル: EArm.cs プロジェクト: ParisaMousavi/ATEND
        //Hatami
        public bool LocalUpdateX(SqlTransaction _transaction, SqlConnection _connection, bool BringOperation, bool BringSubEquips, SqlTransaction ServerTransaction, SqlConnection ServerConnection)
        {
            Editor        ed         = Application.DocumentManager.MdiActiveDocument.Editor;
            SqlConnection connection = _connection;
            SqlCommand    command    = new SqlCommand("E_Arm_UpdateX", 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();

                if (BringOperation)
                {
                    if (Atend.Base.Equipment.EOperation.DeleteX(_transaction, _connection, XCode, (int)Atend.Control.Enum.ProductType.Arm))
                    {
                        DataTable operations = Atend.Base.Equipment.EOperation.SelectByProductCodeType(Code, (int)Atend.Control.Enum.ProductType.Arm, ServerTransaction, ServerConnection);
                        foreach (DataRow dr in operations.Rows)
                        {
                            Atend.Base.Equipment.EOperation SelectedOperation = Atend.Base.Equipment.EOperation.SelectByCodeForServer(new Guid(dr["Code"].ToString()), ServerConnection, ServerTransaction);
                            SelectedOperation.XCode = XCode;
                            if (!SelectedOperation.InsertX(_transaction, _connection))
                            {
                                throw new System.Exception("operation failed in Arm");
                            }
                        }
                    }
                    else
                    {
                        throw new System.Exception("Operation Failed in ARM");
                    }
                }
                ed.WriteMessage("EArm.Operation passed \n");

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

                return(true);
            }
            catch (System.Exception ex1)
            {
                ed.WriteMessage(string.Format("Error EArm.UpdateLocal : {0} \n", ex1.Message));
                return(false);
            }
        }
コード例 #8
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);
            }
        }
コード例 #9
0
        private void BindTreeViwAndGrid()
        {
            //EQUIPMENT
            ClearCheckAndGrid(tvEquipment, gvSelectedEquipment);
            gvSelectedEquipment.Refresh();
            for (int i = 0; i < Atend.Base.Equipment.EMeasuredJackPanel.nodeKeysEPackageX.Count; i++)
            {
                string s = Atend.Base.Equipment.EMeasuredJackPanel.nodeKeysEPackageX[i].ToString();
                foreach (TreeNode rootnode in tvEquipment.Nodes)
                {
                    foreach (TreeNode chileNode in rootnode.Nodes)
                    {
                        if (Atend.Base.Equipment.EMeasuredJackPanel.nodeTypeEPackageX[i].ToString() == chileNode.Name.ToString())
                        {
                            if (chileNode.Tag.ToString() == s)
                            {
                                rootnode.BackColor = Color.FromArgb(203, 214, 235);
                                chileNode.Checked = true;
                                gvSelectedEquipment.Rows.Add();
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[0].Value = chileNode.Tag;
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[1].Value = chileNode.Text;
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EMeasuredJackPanel.nodeCountEPackageX[i].ToString();
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[3].Value = chileNode.Name;
                            }
                        }
                    }
                }
            }
            //************
            //Operation
            ClearCheckAndGrid(tvOperation, gvOperation);
            gvOperation.Refresh();
            for (int i = 0; i < Atend.Base.Equipment.EMeasuredJackPanel.nodeKeys.Count; i++)
            {
                //string s = Atend.Base.Equipment.ELight.nodeKeys[i].ToString();
                Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EMeasuredJackPanel.nodeKeys[i]);
                string s = Operation.ProductID.ToString();

                foreach (TreeNode rootnode in tvOperation.Nodes)
                {
                    if (rootnode.Tag.ToString() == s)
                    {
                        rootnode.Checked = true;
                        gvOperation.Rows.Add();
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag;
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text;
                        //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString();
                        Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString()));
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[2].Value = Unit.Name;
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[3].Value = Operation.Count;

                    }

                }
            }
        }
コード例 #10
0
ファイル: EProp.cs プロジェクト: ParisaMousavi/ATEND
        //MEDHAT
        public bool LocalInsertX(SqlTransaction _transaction, SqlConnection _connection, bool BringOperation, bool BringSubEquips, SqlTransaction ServerTransaction, SqlConnection ServerConnection)
        {
            SqlConnection connection = _connection;
            SqlCommand    command    = new SqlCommand("E_Prop_InsertX", connection);

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

            XCode = Guid.NewGuid();
            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));
            command.Parameters.Add(new SqlParameter("iCode", Code));

            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.SelectByCodeType(Code, (int)Atend.Control.Enum.ProductType.Prop, ServerConnection, ServerTransaction);
                    foreach (DataRow dr in operations.Rows)
                    {
                        Atend.Base.Equipment.EOperation SelectedOperation = Atend.Base.Equipment.EOperation.SelectByCodeForServer(new Guid(dr["Code"].ToString()), ServerConnection, ServerTransaction);
                        SelectedOperation.XCode = XCode;
                        if (!SelectedOperation.InsertX(_transaction, _connection))
                        {
                            throw new System.Exception("operation failed in PROP");
                        }
                    }
                }


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


                return(true);
            }
            catch (System.Exception ex1)
            {
                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage(string.Format("Error EProp.LocalInsertX : {0} \n", ex1.Message));
                return(false);
            }
        }
コード例 #11
0
        private void BindTreeViwAndGridEquipment()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //EQUIPMENT
            ClearCheckAndGrid(tvEquipment, gvSelectedEquipment);
            ClearCheckAndGrid(tvEquipment, gvSelectedEquipment);
            gvSelectedEquipment.Refresh();
            //ed.WriteMessage("nodeKeysEPackage.Count:" + Atend.Base.Equipment.ECatOut.nodeKeysEPackage.Count.ToString() + "\n");
            for (int i = 0; i < Atend.Base.Equipment.EDisconnector.nodeKeysEPackageX.Count; i++)
            {
                string s = Atend.Base.Equipment.EDisconnector.nodeKeysEPackageX[i].ToString();
                foreach (TreeNode rootnode in tvEquipment.Nodes)
                {
                    foreach (TreeNode chileNode in rootnode.Nodes)
                    {
                        if (Atend.Base.Equipment.EDisconnector.nodeTypeEPackageX[i].ToString() == chileNode.Name.ToString())
                        {
                            if (chileNode.Tag.ToString() == s)
                            {
                                rootnode.BackColor = Color.FromArgb(203, 214, 235);
                                chileNode.Checked  = true;
                                gvSelectedEquipment.Rows.Add();
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[0].Value = chileNode.Tag;
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[1].Value = chileNode.Text;
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EDisconnector.nodeCountEPackageX[i].ToString();
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[3].Value = chileNode.Name;
                            }
                        }
                    }
                }
            }
            //************
            //Operation
            ClearCheckAndGrid(tvOperation, gvSelectedOperation);
            gvSelectedOperation.Refresh();
            for (int i = 0; i < Atend.Base.Equipment.EDisconnector.nodeKeysX.Count; i++)
            {
                Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EDisconnector.nodeKeysX[i]);
                string s = Operation.ProductID.ToString();

                foreach (TreeNode rootnode in tvOperation.Nodes)
                {
                    if (rootnode.Tag.ToString() == s)
                    {
                        rootnode.Checked = true;
                        gvSelectedOperation.Rows.Add();
                        gvSelectedOperation.Rows[gvSelectedOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag;
                        gvSelectedOperation.Rows[gvSelectedOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text;
                        Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString()));
                        gvSelectedOperation.Rows[gvSelectedOperation.Rows.Count - 1].Cells[2].Value = Unit.Name;
                        gvSelectedOperation.Rows[gvSelectedOperation.Rows.Count - 1].Cells[3].Value = Operation.Count;
                    }
                }
            }
        }
コード例 #12
0
ファイル: EProp.cs プロジェクト: ParisaMousavi/ATEND
        public bool AccessInsert(OleDbTransaction _OldTransaction, OleDbConnection _OldConnection, OleDbTransaction _NewTransaction, OleDbConnection _NewConnection, bool BringOperation, bool BringSubEquips)
        {
            OleDbConnection connection = _NewConnection;
            OleDbCommand    command    = new OleDbCommand("E_Prop_Insert", connection);

            command.CommandType = CommandType.StoredProcedure;
            command.Transaction = _NewTransaction;

            command.Parameters.Add(new OleDbParameter("iXCode", XCode));
            command.Parameters.Add(new OleDbParameter("iProductCode", ProductCode));
            command.Parameters.Add(new OleDbParameter("iName", Name));
            int OldCode = Code;

            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.AccessSelectByProductCodeType(OldCode, (int)Atend.Control.Enum.ProductType.Prop);
                    foreach (DataRow dr in operations.Rows)
                    {
                        Atend.Base.Equipment.EOperation SelectedOperation = Atend.Base.Equipment.EOperation.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()), _OldConnection);
                        SelectedOperation.ProductCode = Code;
                        if (!SelectedOperation.AccessInsert(_NewTransaction, _NewConnection))
                        {
                            throw new System.Exception("operation failed in airpost");
                        }
                    }
                }


                if (BringSubEquips)
                {
                    if (!Atend.Base.Equipment.EContainerPackage.SentFromAccessToAccess(OldCode, (int)Atend.Control.Enum.ProductType.Prop, Code, _OldTransaction, _OldConnection, _NewTransaction, _NewConnection))
                    {
                        throw new System.Exception("SentFromLocalToAccess Prop failed");
                    }
                }


                return(true);
            }
            catch (System.Exception ex1)
            {
                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage(string.Format("Error EProp.AccessInsert : {0} \n", ex1.Message));
                return(false);
            }
        }
コード例 #13
0
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.EMeasuredJackPanel MeasuredJackPanel = new Atend.Base.Equipment.EMeasuredJackPanel();
            MeasuredJackPanel.ProductCode = Atend.Control.Common.selectedProductCode;
            MeasuredJackPanel.Comment = txtComment.Text;
            MeasuredJackPanel.Name = txtName.Text;
            MeasuredJackPanel.IsDefault = IsDefault;
            MeasuredJackPanel.Code = Code;
            MeasuredJackPanel.Count = Convert.ToInt32(nudCount.Value);

            //Equipment
            ArrayList EPackageProduct = new ArrayList();
            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            MeasuredJackPanel.EquipmentList = EPackageProduct;

            //Operation
            ArrayList EOperation = new ArrayList();
            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            MeasuredJackPanel.OperationList = EOperation;
            if (selectedmjackpanel == Guid.Empty)
            {
                if (MeasuredJackPanel.InsertX())
                    Reset();
                else
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");

            }
            else
            {
                MeasuredJackPanel.XCode = selectedmjackpanel;
                if (MeasuredJackPanel.UpdateX())
                    Reset();
                else
                    MessageBox.Show("امکان ذخیره سازی اطلاعات نمی باشد", "خطا");
            }
        }
コード例 #14
0
ファイル: EArm.cs プロジェクト: ParisaMousavi/ATEND
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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);
            }
        }
コード例 #15
0
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.ESelfKeeper selfKeeper = new Atend.Base.Equipment.ESelfKeeper();
            selfKeeper.Alastisity = Convert.ToDouble(txtAlsticity.Text);
            selfKeeper.Alpha      = Convert.ToDouble(txtAlpha.Text);

            selfKeeper.CrossSectionAreaConductor = Convert.ToDouble(txtCrossSectionArea.Text);

            selfKeeper.CrossSectionKeeper    = Convert.ToDouble(txtCrossSectionSelfKeeper.Text);;
            selfKeeper.Diagonal              = Convert.ToDouble(txtDiagonal.Text);
            selfKeeper.NamedVoltage          = Convert.ToDouble(txtNamedVoltage.Text);
            selfKeeper.MaterialConductorCode = Convert.ToInt32(cboMaterialConductor.SelectedValue);
            selfKeeper.MaterialDamperCode    = Convert.ToInt32(cboMaterialInsulator.SelectedValue);
            selfKeeper.MaxCurrent            = Convert.ToDouble(txtMaxCurrent.Text);
            selfKeeper.ProductCode           = Atend.Control.Common.selectedProductCode;
            selfKeeper.Reactance             = Convert.ToDouble(txtReactance.Text);
            selfKeeper.Resistance            = Convert.ToDouble(txtResistance.Text);
            selfKeeper.UTS               = Convert.ToDouble(txtUTS.Text);
            selfKeeper.Weight            = Convert.ToDouble(txtWC.Text);
            selfKeeper.GMR               = Convert.ToDouble(txtGMR.Text);
            selfKeeper.Weight            = Convert.ToDouble(txtWC.Text);
            selfKeeper.Comment           = txtComment.Text;
            selfKeeper.Name              = txtName.Text;
            selfKeeper.Capacitance       = Convert.ToDouble(txtCapacitance.Text);
            selfKeeper.IsDefault         = IsDefault;
            selfKeeper.MaxCurrent1Second = Convert.ToDouble(txtMaxCurrent1Second.Text);
            selfKeeper.Code              = Code;

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            selfKeeper.EquipmentList = EPackageProduct;

            //Operation
            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            selfKeeper.OperationList = EOperation;
            if (SelectConductor == Guid.Empty)
            {
                if (selfKeeper.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                selfKeeper.XCode = SelectConductor;
                if (selfKeeper.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #16
0
ファイル: frmKhazan02.cs プロジェクト: ParisaMousavi/ATEND
        private void Save()
        {
            txtName.Focus();
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //ed.WriteMessage("Enter Save \n");
            Atend.Base.Equipment.EKhazan khazan = new Atend.Base.Equipment.EKhazan();
            ArrayList EOperation = new ArrayList();

            khazan.Capacity    = Convert.ToDouble(txtCapacity.Text);
            khazan.Comment     = txtComment.Text;
            khazan.Maker       = txtMaker.Text;
            khazan.Name        = txtName.Text;
            khazan.Amper       = Convert.ToInt32(txtAmper.Text);
            khazan.ProductCode = Atend.Control.Common.selectedProductCode;
            khazan.Vol         = Convert.ToDouble(cboVol.Text);
            //ed.WriteMessage("After\n");
            khazan.IsDefault = IsDefault;
            khazan.Code      = Code;

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            khazan.EquipmentList = EPackageProduct;

            //Operation
            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }

            khazan.OperationList = EOperation;

            if (SelectedKhazanCode == Guid.Empty)
            {
                if (khazan.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }

                //MessageBox.Show(Atend.Control.Messages.Read("Insert_Error"));
            }
            else
            {
                khazan.XCode = SelectedKhazanCode;
                if (khazan.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #17
0
        private void Save()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            txtName.Focus();
            ArrayList EPackageProduct = new ArrayList();
            ArrayList EOperation      = new ArrayList();

            Atend.Base.Equipment.ECatOut catout = new Atend.Base.Equipment.ECatOut();
            catout.Amper       = Convert.ToDouble(txtAmper.Text);
            catout.ProductCode = Atend.Control.Common.selectedProductCode;
            catout.Type        = Convert.ToByte(cboType.SelectedValue);
            catout.Vol         = Convert.ToDouble(cboVol.Text);
            catout.Comment     = txtComment.Text;
            catout.Name        = txtName.Text;
            catout.IsDefault   = IsDefault;
            catout.Code        = Code;
            //Equipment
            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                //ed.WriteMessage("Begin 1\n");
                _EProductPackage.XCode = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                //ed.WriteMessage("Begin 2\n" + gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());

                _EProductPackage.Count = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                //ed.WriteMessage("Value:" + gvSelectedEquipment.Rows[j].Cells[3].Value.ToString() + "\n");
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
                //ed.WriteMessage("aaa \n");
            }
            catout.EquipmentList = EPackageProduct;
            //************

            //Operation

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }

            catout.OperationList = EOperation;

            //**********



            //if (Atend.Control.Common.selectedProductCode != -1)
            //{
            if (SelectedCatoutXCode == Guid.Empty)
            {
                if (catout.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                catout.XCode = SelectedCatoutXCode;
                if (catout.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
            //}
            //else
            //{
            //    MessageBox.Show("لطفا ابتدا یک کالا را از پشتیبان انتخاب کنید","خطا");
            //}
        }
コード例 #18
0
        private void BindTreeViwAndGridEquipment()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;


            ClearCheckAndGrid(tvProduct, gvSelectedProduct);
            ClearCheckAndGrid(tvProduct, gvSelectedProduct);
            gvSelectedProduct.Refresh();

            for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX.Count; i++)
            {
                string s = Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i].ToString();
                foreach (TreeNode rootnode in tvProduct.Nodes)
                {
                    foreach (TreeNode chileNode in rootnode.Nodes)
                    {
                        //ed.WriteMessage("nodeTypeEPackage:" + Atend.Base.Equipment.EGroundPost.nodeTypeEPackage[i].ToString() + "\n");
                        //ed.WriteMessage("rootnode.Tag:" + rootnode.Tag.ToString() + "\n");
                        if (Atend.Base.Equipment.EGroundPost.nodeTypeEPackageX[i].ToString() == chileNode.Name.ToString())
                        {
                            //ed.WriteMessage(string.Format(" child tag : {0} , s: {1} \n", chileNode.Tag.ToString(), s));
                            if (chileNode.Tag.ToString() == s)
                            {
                                //ed.WriteMessage("I am in the if \n");
                                rootnode.BackColor = Color.FromArgb(203, 214, 235);
                                chileNode.Checked  = true;
                                gvSelectedProduct.Rows.Add();
                                //ed.WriteMessage("Child tag : " + chileNode.Tag.ToString() + "\n");
                                gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[0].Value = chileNode.Tag;
                                //ed.WriteMessage("Child tag : " + chileNode.Text.ToString() + "\n");
                                gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[1].Value = chileNode.Text;
                                gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EGroundPost.nodeCountEPackageX[i].ToString();
                                gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[3].Value = chileNode.Name;
                                gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[4].Value = rootnode.Tag;
                            }
                        }
                    }
                }
            }


            //(((((((((((((((
            ClearCheckAndGrid(tvOperation, gvOperation);
            gvOperation.Refresh();
            for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeysX.Count; i++)
            {
                Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EGroundPost.nodeKeysX[i]);
                string s = Operation.ProductID.ToString();

                foreach (TreeNode rootnode in tvOperation.Nodes)
                {
                    //ed.WriteMessage("RootNode.Tag= " + rootnode.Tag.ToString() + "\n");
                    if (rootnode.Tag.ToString() == s)
                    {
                        //ed.WriteMessage("I Am In IF" + "rootnode.Tag:= " + rootnode.Tag.ToString() + "S =" + s + "\n");
                        rootnode.Checked = true;
                        gvOperation.Rows.Add();
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag;
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text;
                        //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString();
                        Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString()));
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[2].Value = Unit.Name;
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[3].Value = Operation.Count;
                    }
                }
            }
            //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

            // dt.Rows.Clear();
            // foreach (DataRow drGround in Atend.Base.Equipment.EGroundPost.groundPostSubEquip.Rows)
            // {
            //     DataRow dr = dt.NewRow();
            //     dr["productCode"] = Convert.ToInt32(drGround["productCode"].ToString());
            //     dr["Cell"] = Convert.ToInt32(drGround["Cell"].ToString());
            //     dr["count"] = Convert.ToInt32(drGround["count"].ToString());
            //     dr["TableType"] = Convert.ToInt32(drGround["TableType"].ToString());
            //     dt.Rows.Add(dr);
            // }
            ////EventArgs e=new EventArgs();
            //// cboNumCount_SelectedIndexChanged(cboNumCount,e);
            // //Opeartion
            // ClearCheckAndGrid(tvOperation, gvOperation);
            // gvOperation.Refresh();
            // for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeys.Count; i++)
            // {
            //     string s = Atend.Base.Equipment.EGroundPost.nodeKeys[i].ToString();
            //     //MessageBox.Show(Atend.Base.Equipment.EGroundPost.nodeKeys[i].ToString());
            //     foreach (TreeNode rootnode in tvOperation.Nodes)
            //     {

            //         //foreach (TreeNode chileNode in rootnode.Nodes)
            //         //{
            //         ed.WriteMessage("RootNOde.Tag= "+rootnode.Tag.ToString()+"  NodeKey = "+Atend.Base.Equipment.EGroundPost.nodeKeys[i].ToString()+"\n");
            //         if (rootnode.Tag.ToString() == s)
            //         {
            //             ed.WriteMessage("I Am In The IF");
            //             rootnode.Checked = true;
            //             gvOperation.Rows.Add();
            //             gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag;
            //             gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text;
            //             //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString();

            //         }

            //     }
            // }
            //******
        }
コード例 #19
0
ファイル: frmBreaker02.cs プロジェクト: ParisaMousavi/ATEND
        private void Save()
        {
            txtAmper.Focus();
            btnInsert.Focus();
            ArrayList EPackageProduct = new ArrayList();
            Editor    ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            Atend.Base.Equipment.EBreaker breaker = new Atend.Base.Equipment.EBreaker();
            breaker.Amper       = Convert.ToDouble(txtAmper.Text);
            breaker.ProductCode = Atend.Control.Common.selectedProductCode;
            breaker.Type        = Convert.ToByte(cboType.SelectedValue);
            breaker.Comment     = txtComment.Text;
            breaker.Name        = txtName.Text;
            breaker.IsDefault   = IsDefault;
            breaker.Code        = Code;
            //Equipment
            for (int j = 0; j < gvEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                //ed.WriteMessage("Begin 1\n");
                //_EProductPackage.ProductCode = 0;// Convert.ToInt32(gvEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.XCode = new Guid(gvEquipment.Rows[j].Cells[0].Value.ToString());

                //ed.WriteMessage("Begin 2\n" + gvEquipment.Rows[j].Cells[2].Value.ToString());

                _EProductPackage.Count = Convert.ToInt32(gvEquipment.Rows[j].Cells[2].Value.ToString());
                //ed.WriteMessage("Value:" + gvEquipment.Rows[j].Cells[3].Value.ToString() + "\n");
                _EProductPackage.TableType = Convert.ToInt16(gvEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
                //ed.WriteMessage("aaa \n");
            }
            breaker.EquipmentList = EPackageProduct;
            //Operation
            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            breaker.OperationList = EOperation;
            //************

            if (SelectedBreakerXCode == Guid.Empty)
            {
                if (breaker.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                breaker.XCode = new Guid(SelectedBreakerXCode.ToString());
                if (breaker.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #20
0
ファイル: frmPole02.cs プロジェクト: ParisaMousavi/ATEND
        private void Save()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            btnInsert.Focus();
            ed.WriteMessage("Start Save\n");
            Atend.Base.Equipment.EPole Pole = new Atend.Base.Equipment.EPole();
            ArrayList EOperation            = new ArrayList();

            //ArrayList EPackage = new ArrayList();
            //ArrayList EContainer = new ArrayList();
            Pole.ProductCode = Atend.Control.Common.selectedProductCode;
            Pole.Height      = double.Parse(txtHeight.Text);
            Pole.Power       = double.Parse(txtPower.Text);
            //Pole.Wc = double.Parse(txtWC.Text);
            ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~PoleType={0}\n", cboPoleType.SelectedIndex.ToString());
            Pole.Type = Convert.ToByte(cboPoleType.SelectedIndex);
            Pole.TopCrossSectionArea    = double.Parse(txtTopCrossSectionArea.Text);
            Pole.ButtomCrossSectionArea = double.Parse(txtButtomCrossSectionArea.Text);
            //Pole.ContainerCode = SelectedPoleCode;
            Pole.Name      = txtName.Text;
            Pole.Comment   = txtComment.Text;
            Pole.Shape     = Convert.ToByte(cboShape.SelectedIndex);
            Pole.IsDefault = IsDefault;
            Pole.Code      = code;
            //saveOperation

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            Pole.EquipmentList = EPackageProduct;

            //Operation
            for (int i = 0; i < gvSelectedProduct.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvSelectedProduct.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvSelectedProduct.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }


            Pole.OperationList = EOperation;
            //if (Atend.Control.Common.selectedProductCode != -1)
            //{
            if (SelectedPoleCode == Guid.Empty)
            {
                if (Pole.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                Pole.XCode = SelectedPoleCode;
                //MessageBox.Show("go to update method : " + Pole.Code + "\n");
                if (Pole.UpdateX())
                {
                    ed.WriteMessage("Finish Updated\n");
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
            //}
            //else
            //{
            //    MessageBox.Show("لطفا ابتدا یک کالا را از پشتیبان انتخاب کنید", "خطا");
            //}
        }
コード例 #21
0
        private void Save()
        {
            txtName.Focus();
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //ed.WriteMessage("I Am In The Save\n");
            Atend.Base.Equipment.EMiniatorKey miniatorKey = new Atend.Base.Equipment.EMiniatorKey();
            miniatorKey.Amper       = Convert.ToDouble(txtAmper.Text);
            miniatorKey.Mark        = txtMark.Text;
            miniatorKey.ProductCode = Atend.Control.Common.selectedProductCode;
            miniatorKey.Comment     = txtComment.Text;
            miniatorKey.Name        = txtName.Text;
            miniatorKey.IsDefault   = IsDefault;
            miniatorKey.Code        = Code;

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            miniatorKey.EquipmentList = EPackageProduct;

            //Operation
            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            miniatorKey.OperationList = EOperation;
            if (selectedMiniatorkeyXCode == Guid.Empty)
            {
                if (miniatorKey.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                miniatorKey.XCode = selectedMiniatorkeyXCode;
                if (miniatorKey.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ذخیره سازی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #22
0
ファイル: frmInsulator02.cs プロジェクト: ParisaMousavi/ATEND
        private void BindTreeViwAndGridEquipment(TreeView treeView, DataGridView dataGridView)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //EQUIPMENT
            ClearCheckAndGrid(tvEquipment, gvSelectedEquipment);
            ClearCheckAndGrid(tvEquipment, gvSelectedEquipment);
            dataGridView.Refresh();
            //ed.WriteMessage("nodeKeysEPackage.Count:" + Atend.Base.Equipment.EInsulator.nodeKeysEPackage.Count.ToString() + "\n");
            for (int i = 0; i < Atend.Base.Equipment.EInsulator.nodeKeysEPackageX.Count; i++)
            {
                string s = Atend.Base.Equipment.EInsulator.nodeKeysEPackageX[i].ToString();
                foreach (TreeNode rootnode in tvEquipment.Nodes)
                {
                    foreach (TreeNode chileNode in rootnode.Nodes)
                    {
                        //ed.WriteMessage("nodeTypeEPackage:" + Atend.Base.Equipment.EInsulator.nodeTypeEPackage[i].ToString() + "\n");
                        //ed.WriteMessage("rootnode.Tag:" + rootnode.Tag.ToString() + "\n");
                        if (Atend.Base.Equipment.EInsulator.nodeTypeEPackageX[i].ToString() == chileNode.Name.ToString())
                        {
                            //ed.WriteMessage(string.Format(" child tag : {0} , s: {1} \n", chileNode.Tag.ToString(), s));
                            if (chileNode.Tag.ToString() == s)
                            {
                                //ed.WriteMessage("I am in the if \n");
                                rootnode.BackColor = Color.FromArgb(203, 214, 235);
                                chileNode.Checked  = true;
                                gvSelectedEquipment.Rows.Add();
                                //ed.WriteMessage("Child tag : " +  chileNode.Tag.ToString() + "\n");
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[0].Value = chileNode.Tag;
                                //ed.WriteMessage("Child tag : " + chileNode.Text.ToString() + "\n");
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[1].Value = chileNode.Text;
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EInsulator.nodeCountEPackageX[i].ToString();
                                gvSelectedEquipment.Rows[gvSelectedEquipment.Rows.Count - 1].Cells[3].Value = chileNode.Name;
                            }
                        }
                    }
                }
            }
            //************
            //Operation
            ClearCheckAndGrid(tvOperation, gvOperation);
            dataGridView.Refresh();
            for (int i = 0; i < Atend.Base.Equipment.EInsulator.nodeKeysX.Count; i++)
            {
                Atend.Base.Equipment.EOperation Operation = ((Atend.Base.Equipment.EOperation)Atend.Base.Equipment.EInsulator.nodeKeysX[i]);
                string s = Operation.ProductID.ToString();

                foreach (TreeNode rootnode in tvOperation.Nodes)
                {
                    //ed.WriteMessage("RootNode.Tag= " + rootnode.Tag.ToString() + "\n");
                    if (rootnode.Tag.ToString() == s)
                    {
                        //ed.WriteMessage("I Am In IF" + "rootnode.Tag:= " + rootnode.Tag.ToString() + "S =" + s + "\n");
                        rootnode.Checked = true;
                        gvOperation.Rows.Add();
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[0].Value = rootnode.Tag;
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[1].Value = rootnode.Text;
                        //gvSelectedProduct.Rows[gvSelectedProduct.Rows.Count - 1].Cells[2].Value = Atend.Base.Equipment.EPole.nodeCount[i].ToString();
                        Atend.Base.Base.BUnit Unit = Atend.Base.Base.BUnit.Select_ByProductID(Convert.ToInt32(rootnode.Tag.ToString()));
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[2].Value = Unit.Name;
                        gvOperation.Rows[gvOperation.Rows.Count - 1].Cells[3].Value = Operation.Count;
                    }
                }
            }
        }
コード例 #23
0
        private void Save()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            txtName.Focus();
            btnInsert.Focus();
            ArrayList EPackageProduct = new ArrayList();
            ArrayList cellPackage     = new ArrayList();

            Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = new Atend.Base.Equipment.EJackPanelWeek();
            jackPanelWeek.Name           = txtName.Text;
            jackPanelWeek.AutoKey3pXCode = new Guid(cboAutoKey.SelectedValue.ToString());
            jackPanelWeek.Comment        = txtComment.Text;
            jackPanelWeek.FeederCount    = Convert.ToInt32(nudCountFeeder.Value);
            jackPanelWeek.ProductCode    = Atend.Control.Common.selectedProductCode;
            jackPanelWeek.IsDefault      = IsDefault;
            jackPanelWeek.Code           = Code;
            jackPanelWeek.BusXCode       = new Guid(cboBus.SelectedValue.ToString());
            //ed.WriteMessage("Begin \n");

            ////Operation
            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            jackPanelWeek.OperationList = EOperation;
            ////******

            Atend.Base.Equipment.EJackPanelWeekCell _cell = new Atend.Base.Equipment.EJackPanelWeekCell();
            foreach (DataRow dr in dt.Rows)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                //_cell = new Atend.Base.Equipment.EJackPanelWeekCell();
                //ed.WriteMessage("Begin 1\n");
                // _EProductPackage.ProductCode = 0;// Convert.ToInt32(dr["productCode"]);
                _EProductPackage.XCode = new Guid(dr["XCode"].ToString());
                //ed.WriteMessage("Begin 2\n");

                _EProductPackage.Count = Convert.ToInt32(dr["Count"]);
                //ed.WriteMessage("Value:" + "\n");
                _EProductPackage.TableType = Convert.ToInt16(dr["TableType"]);
                //_cell.Num = Convert.ToInt32(dr["cell"]);
                //_cell.IsNightLight = Convert.ToBoolean(dr["IsNightLight"]);
                EPackageProduct.Add(_EProductPackage);
                //cellPackage.Add(_cell);
                //ed.WriteMessage("aaa \n");
            }

            //for (int i = 1; i <= jackPanelWeek.FeederCount; i++)
            //{
            //    _cell = new Atend.Base.Equipment.EJackPanelWeekCell();
            //    DataRow[] dr = dt.Select("Cell='" + i.ToString() + "'");
            //    _cell.Num = Convert.ToInt32(dr[0]["cell"]);
            //    _cell.IsNightLight = Convert.ToBoolean(dr[0]["IsNightLight"]);
            //    cellPackage.Add(_cell);
            //}

            ed.WriteMessage("*********dtcell.rows.count={0}", dtCell.Rows.Count);
            foreach (DataRow dr in dtCell.Rows)
            {
                _cell              = new Atend.Base.Equipment.EJackPanelWeekCell();
                _cell.Num          = Convert.ToInt32(dr["cellNum"]);
                _cell.IsNightLight = Convert.ToBoolean(dr["IsNight"]);
                cellPackage.Add(_cell);
            }

            jackPanelWeek.EquipmentList = EPackageProduct;
            jackPanelWeek.CellList      = cellPackage;
            jackPanelWeek.dtglobal      = dt;
            //ed.WriteMessage("selectedJackPanelweek" + selectedJackPanelWeek.ToString());
            if (selectedJackPanelWeekXCode == Guid.Empty)
            {
                if (jackPanelWeek.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                jackPanelWeek.XCode = selectedJackPanelWeekXCode;
                //ed.WriteMessage("consol.code:" + selectedConsol.ToString());
                //MessageBox.Show("GoToUpdate");
                //ed.WriteMessage("Go To Update\n");
                if (jackPanelWeek.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #24
0
ファイル: frmDB03.cs プロジェクト: 15831944/ATEND
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.EDB DB = new Atend.Base.Equipment.EDB();
            ArrayList EOperation        = new ArrayList();

            //DB.InputPhuse = -1;//Convert.ToInt32(cboInputPhuse.SelectedValue);
            DB.InputCount  = Convert.ToInt32(nudInputCount.Value);
            DB.OutputCount = Convert.ToInt32(nudOutputCount.Value);
            DB.ProductCode = Atend.Control.Common.selectedProductCode;
            DB.Comment     = txtComment.Text;
            DB.Name        = txtName.Text;
            //DB.ShemshCount = -1;// Convert.ToInt32(nudInputCount.Value);
            DB.IsDefault = IsDefault;
            DB.Code      = Code;
            txtComment.Focus();
            int i;

            //Atend.Base.Equipment.EDBPhuse DBPhuse = new Atend.Base.Equipment.EDBPhuse();
            //سه فاز

            if (!Atend.Base.Equipment.EDBPhuse.DeleteX(selectedDBCode))
            {
                MessageBox.Show("ثبت کردن اطلاعات امکانپذیر نمیباشد", "خطا");
                return;
            }
            dtInputFeeder  = (DataTable)gvInputFeeder.DataSource;
            dtOutputFeeder = (DataTable)gvOutputFeeder.DataSource;
            foreach (DataRow dr in dtInputFeeder.Rows)
            {
                Atend.Base.Equipment.EDBPhuse DBPhuse = new Atend.Base.Equipment.EDBPhuse();
                DBPhuse.FeederNum  = Convert.ToInt32(dr["FeederNum"].ToString());
                DBPhuse.ShemshNum  = 0;
                DBPhuse.PhuseXCode = new Guid(dr["PhuseXCode"].ToString());
                Atend.Base.Equipment.EPhuse phuse = Atend.Base.Equipment.EPhuse.SelectByXCode(DBPhuse.PhuseXCode);
                DBPhuse.PhuseType = 1;
                DBPhuse.IOType    = true;
                DB.SubEquipment.Add(DBPhuse);
            }
            foreach (DataRow dr in dtOutputFeeder.Rows)
            {
                Atend.Base.Equipment.EDBPhuse DBPhuse = new Atend.Base.Equipment.EDBPhuse();
                DBPhuse.FeederNum  = Convert.ToInt32(dr["FeederNum"].ToString());
                DBPhuse.ShemshNum  = 0;
                DBPhuse.PhuseXCode = new Guid(dr["PhuseXCode"].ToString());
                Atend.Base.Equipment.EPhuse phuse = Atend.Base.Equipment.EPhuse.SelectByXCode(DBPhuse.PhuseXCode);
                DBPhuse.PhuseType = 0;
                DBPhuse.IOType    = false;
                DB.SubEquipment.Add(DBPhuse);
            }
            ////for (i = 0; i < gvInputFeeder.Rows.Count; i++)
            ////{
            ////    Atend.Base.Equipment.EDBPhuse DBPhuse = new Atend.Base.Equipment.EDBPhuse();
            ////    DBPhuse.FeederNum = Convert.ToInt32(gvInputFeeder.Rows[i].Cells[0].Value.ToString());
            ////    DBPhuse.ShemshNum = 0;// Convert.ToByte(gvInputFeeder.Rows[i].Cells[1].Value.ToString());
            ////    DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvInputFeeder.Rows[i].Cells[2];
            ////    DBPhuse.PhuseXCode = new Guid(c.Value.ToString());
            ////    Atend.Base.Equipment.EPhuse phuse = Atend.Base.Equipment.EPhuse.SelectByXCode(DBPhuse.PhuseXCode);
            ////    DBPhuse.PhuseType = 1;
            ////    DBPhuse.IOType = true;
            ////    ed.WriteMessage("@@ feedernum:{0},phusexcode:{1}\n", DBPhuse.FeederNum, DBPhuse.PhuseXCode);
            ////    DB.SubEquipment.Add(DBPhuse);
            ////}

            ////for (i = 0; i < gvOutputFeeder.Rows.Count; i++)
            ////{
            ////    Atend.Base.Equipment.EDBPhuse DBPhuse = new Atend.Base.Equipment.EDBPhuse();
            ////    DBPhuse.FeederNum = Convert.ToInt32(gvOutputFeeder.Rows[i].Cells[0].Value.ToString());
            ////    DBPhuse.ShemshNum = 0;// Convert.ToByte(gvInputFeeder.Rows[i].Cells[1].Value.ToString());
            ////    DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvOutputFeeder.Rows[i].Cells[2];
            ////    DBPhuse.PhuseXCode = new Guid(c.Value.ToString());
            ////    Atend.Base.Equipment.EPhuse phuse = Atend.Base.Equipment.EPhuse.SelectByXCode(DBPhuse.PhuseXCode);
            ////    DBPhuse.PhuseType = 0;
            ////    DBPhuse.IOType = false;
            ////    DB.SubEquipment.Add(DBPhuse);
            ////}

            // تک فاز
            //for (int i = 0; i < gvFeeder1.Rows.Count; i++)
            //{
            //    DBPhuse.PhuseType = 1;
            //    DBPhuse.FeederNum = Convert.ToInt32(gvFeeder1.Rows[i].Cells[0].Value.ToString());
            //    DataGridViewComboBoxCell cShemsh = (DataGridViewComboBoxCell)gvFeeder1.Rows[i].Cells[1];
            //    DBPhuse.ShemshNum = Convert.ToByte(cShemsh.Value);
            //    DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvFeeder1.Rows[i].Cells[1];
            //    DBPhuse.PhuseCode = Convert.ToInt32(c.Value);
            //    DB.SubEquipment.Add(DBPhuse);
            //    //ed.WriteMessage("aaa \n");
            //}

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            DB.EquipmentList = EPackageProduct;

            //Operation
            for (i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }

            DB.OperationList = EOperation;

            //**********
            //ed.WriteMessage("selectedDBCode" + selectedDBCode + "\n");
            if (selectedDBCode == Guid.Empty)
            {
                if (DB.InsertX())
                {
                    Reset();
                    //ed.WriteMessage("طلاعات به درستی ثبت شد\n");
                }
                else
                {
                    MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                DB.XCode = selectedDBCode;
                if (DB.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #25
0
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.EHeaderCabel headerCabel = new Atend.Base.Equipment.EHeaderCabel();
            ArrayList EOperation = new ArrayList();

            headerCabel.CrossSectionArea = Convert.ToDouble(cboCrossSectionArea.Text);
            headerCabel.Material         = Convert.ToByte(cboMat.SelectedValue);
            headerCabel.ProductCode      = Atend.Control.Common.selectedProductCode;
            headerCabel.Type             = Convert.ToByte(cboType.SelectedValue);
            headerCabel.Comment          = txtComment.Text;
            headerCabel.Name             = txtName.Text;
            headerCabel.Voltage          = Convert.ToDouble(cboVol.Text);
            headerCabel.IsDefault        = IsDefault;
            headerCabel.Code             = Code;

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            headerCabel.EquipmentList = EPackageProduct;

            //Operation
            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            headerCabel.OperationList = EOperation;

            if (SelectedHeaderCabelCode == Guid.Empty)
            {
                if (headerCabel.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }

                //MessageBox.Show(Atend.Control.Messages.Read("Insert_Error"));
            }
            else
            {
                headerCabel.XCode = SelectedHeaderCabelCode;
                if (headerCabel.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #26
0
ファイル: frmAirPost02.cs プロジェクト: ParisaMousavi/ATEND
        private void Save()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            txtName.Focus();
            btnInsertEquip.Focus();
            Atend.Base.Equipment.EAirPost airPost = new Atend.Base.Equipment.EAirPost();
            ArrayList EEquipment = new ArrayList();

            //ArrayList EContainer = new ArrayList();
            airPost.Capacity = Convert.ToDouble(txtCapacity.Text);
            //airPost.OutPutFeederCount = Convert.ToInt32(nudOutputFeeder.Value);
            airPost.ProductCode = productCode;
            airPost.Comment     = txtComment.Text;
            //airPost.XCode = selectedPostXCode;
            //airPost.ContainerCode = 0;
            airPost.Name      = txtName.Text;
            airPost.Code      = Code;
            airPost.IsDefault = IsDefault;
            //ed.WriteMessage("aaab \n");
            //SaveEquipment
            for (int j = 0; j < gvSelectedEquip.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();

                //_EProductPackage.ProductCode = 0;
                _EProductPackage.XCode     = new Guid(gvSelectedEquip.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquip.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquip.Rows[j].Cells[3].Value.ToString());
                EEquipment.Add(_EProductPackage);
                //ed.WriteMessage("aaa \n");
            }
            airPost.EquipmentList = EEquipment;
            //Operation
            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            airPost.OperationList = EOperation;
            airPost.Image         = null;
            FileStream fs;

            if (txtImage.Text != String.Empty)
            {
                fs = new FileStream(txtImage.Text, FileMode.Open);
            }
            else
            {
                fs = new FileStream(Atend.Control.Common.fullPath + "\\Consol1.jpg", FileMode.Open);
            }
            BinaryReader br = new BinaryReader(fs);

            airPost.Image = br.ReadBytes((Int32)br.BaseStream.Length);
            fs.Dispose();
            if (selectedPostXCode == Guid.Empty)
            {
                if (airPost.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                airPost.XCode = selectedPostXCode;
                //airPost.Code = SelectedPostCode;

                if (airPost.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #27
0
        private void Save()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            txtName.Focus();
            btnInsert.Focus();

            ArrayList EPackageProduct = new ArrayList();
            ArrayList cellPackage     = new ArrayList();
            ArrayList EOperation      = new ArrayList();

            Atend.Base.Equipment.EGroundPost groundpost = new Atend.Base.Equipment.EGroundPost();
            groundpost.Name        = txtName.Text;
            groundpost.GroundType  = Convert.ToByte(cboGroundType.SelectedIndex);
            groundpost.Type        = Convert.ToByte(cboType.SelectedIndex);
            groundpost.AdvanceType = Convert.ToByte(cboAdvanceType.SelectedIndex);
            groundpost.Capacity    = Convert.ToInt32(txtCapacity.Text);
            groundpost.Comment     = txtComment.Text;
            groundpost.IsDefault   = IsDefault;
            groundpost.Code        = Code;

            //Operation
            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                //ed.WriteMessage("In Add OperationToArray");
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();

                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);

                EOperation.Add(_EOperation);
            }

            groundpost.OperationList = EOperation;
            //******

            for (int j = 0; j < gvSelectedProduct.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();

                //_EProductPackage.ProductCode = 0;// Convert.ToInt32(gvSelectedProduct.Rows[j].Cells[0].Value.ToString());
                //MessageBox.Show(gvSelectedProduct.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.XCode     = new Guid(gvSelectedProduct.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedProduct.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedProduct.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
                //ed.WriteMessage("aaa \n");
            }
            //foreach (DataRow dr in dt.Rows)
            //{
            //    Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
            //   //Atend.Base.Equipment.EGroundPostCell   _cell=new Atend.Base.Equipment.EGroundPostCell();
            //   ed.WriteMessage("Begin 1\n");
            //    _EProductPackage.ProductCode = Convert.ToInt32(dr["productCode"]);
            //    ed.WriteMessage("Begin 2\n");

            //    _EProductPackage.Count = Convert.ToInt32(dr["Count"]);
            //    ed.WriteMessage("Value:" + "\n");
            //    _EProductPackage.TableType = Convert.ToInt16(dr["TableType"]);
            //    //_cell.Num = Convert.ToInt32(dr["cell"]);
            //    EPackageProduct.Add(_EProductPackage);
            //    //cellPackage.Add(_cell);
            //    ed.WriteMessage("aaa \n");
            //}

            groundpost.EquipmentList = EPackageProduct;
            //groundpost.CellList = cellPackage;
            //ed.WriteMessage("selectedgroundPost" + selectedGroundPost.ToString());

            groundpost.Image = null;
            FileStream fs;

            if (txtImage.Text != String.Empty)
            {
                fs = new FileStream(txtImage.Text, FileMode.Open);
            }
            else
            {
                fs = new FileStream(Atend.Control.Common.fullPath + "\\Consol1.jpg", FileMode.Open);
            }
            BinaryReader br = new BinaryReader(fs);

            groundpost.Image = br.ReadBytes((Int32)br.BaseStream.Length);
            fs.Dispose();

            if (selectedGroundPostXCode == Guid.Empty)
            {
                if (groundpost.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                groundpost.XCode = selectedGroundPostXCode;
                //ed.WriteMessage("consol.code:" + selectedConsol.ToString());
                //MessageBox.Show("GoToUpdate");
                if (groundpost.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #28
0
        private void Save()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            txtName.Focus();
            Atend.Base.Equipment.ERod Rod = new Atend.Base.Equipment.ERod();

            Rod.ProductCode = Atend.Control.Common.selectedProductCode;
            Rod.Amper       = Convert.ToDouble(txtAmper.Text);
            Rod.Vol         = Convert.ToDouble(cboVol.Text);
            Rod.Comment     = txtComment.Text;
            Rod.Type        = Convert.ToByte(cboType.SelectedValue);
            Rod.Name        = txtName.Text;
            Rod.IsDefault   = IsDefault;
            Rod.Code        = Code;
            //ed.WriteMessage("Code :=" + Code +"\n");
            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            Rod.EquipmentList = EPackageProduct;

            //Operation
            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            Rod.OperationList = EOperation;

            if (SelectedRodCode == Guid.Empty)
            {
                if (Rod.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                Rod.XCode = SelectedRodCode;
                if (Rod.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #29
0
ファイル: frmCell02.cs プロジェクト: ParisaMousavi/ATEND
        private void Save()
        {
            txtName.Focus();
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            //ArrayList EPackageProduct = new ArrayList();
            ArrayList equipmentlist = new ArrayList();

            Atend.Base.Equipment.ECell cell = new Atend.Base.Equipment.ECell();


            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage productPackage = new Atend.Base.Equipment.EProductPackage();
                productPackage.Count = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                //productPackage.ProductCode = 0;// Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                productPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                productPackage.TableType = Convert.ToByte(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());

                //cellsub.ProductCode = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                //cellsub.Count = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                ////cellsub.CellCode = cell.Code;

                /*MessageBox.Show("0>>" + gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                 * MessageBox.Show("1>>" + gvSelectedEquipment.Rows[j].Cells[1].Value.ToString());
                 * MessageBox.Show("2>>" + gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                 * MessageBox.Show("3>>" + gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                 */
                equipmentlist.Add(productPackage);
            }
            cell.EquipmentList = equipmentlist;

            cell.Type      = Convert.ToByte(cboKind.SelectedValue);
            cell.Name      = txtName.Text;
            cell.IsDefault = IsDefault;
            cell.Code      = Code;

            ArrayList EOperation = new ArrayList();

            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            cell.OperationList = EOperation;
            if (SelectedCellCode == Guid.Empty)
            {
                if (cell.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                cell.XCode = SelectedCellCode;
                if (cell.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
コード例 #30
0
        private void Save()
        {
            txtName.Focus();
            //ed.WriteMessage("I aM In sve Method");
            Atend.Base.Equipment.EGroundCabel middleGroundCabel = new Atend.Base.Equipment.EGroundCabel();
            ArrayList EOperation = new ArrayList();

            middleGroundCabel.ProductCode = Atend.Control.Common.selectedProductCode;
            middleGroundCabel.Vol         = double.Parse(cboVol.Text);
            middleGroundCabel.Type        = Convert.ToInt16(cboType.SelectedValue.ToString());;
            middleGroundCabel.Code        = Code;
            //if (nudNumString.SelectedIndex == 0 | nudNumString.SelectedIndex == 1 | cboNumString.SelectedIndex == 2 | cboNumString.SelectedIndex == 3 | cboNumString.SelectedIndex == 4)
            //{
            //    middleGroundCabel.NumString = Convert.ToInt32(cboNumString.Text);
            //}
            //else
            //{
            //    middleGroundCabel.NumString = 6;
            //}
            middleGroundCabel.NumString = Convert.ToInt32(nudNumString.Value);
            middleGroundCabel.Name      = txtName.Text;
            //if (cboNumString.SelectedIndex == 0 | cboNumString.SelectedIndex == 1 | cboNumString.SelectedIndex == 2 | cboNumString.SelectedIndex == 3 | cboNumString.SelectedIndex == 4)
            //{
            //    middleGroundCabel.CrossSectionArea =Convert.ToDouble(cboCrossSectionArea.Text);
            //}
            //else
            //{
            //    middleGroundCabel.CrossSectionArea = Convert.ToDouble(CrossSectionValue1[cboCrossSectionArea.SelectedIndex]);
            //}
            middleGroundCabel.CrossSectionArea  = Convert.ToDouble(txtCrossSectionArea.Text);
            middleGroundCabel.Comment           = txtComment.Text;
            middleGroundCabel.IsDefault         = IsDefault;
            middleGroundCabel.MaxCurrent        = Convert.ToDouble(txtMaxCurrent.Text);
            middleGroundCabel.Reactance         = Convert.ToDouble(txtReactance.Text);
            middleGroundCabel.Resistance        = Convert.ToDouble(txtResistance.Text);
            middleGroundCabel.Capacitance       = Convert.ToDouble(txtCapacitance.Text);
            middleGroundCabel.Size              = Convert.ToInt32(txtSize.Text);
            middleGroundCabel.MaxCurrent1Second = Convert.ToDouble(txtMaxCurrent1Second.Text);
            //saveOperation
            //ed.WriteMessage("I aM In sve Opearation");

            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            middleGroundCabel.EquipmentList = EPackageProduct;

            //Operation
            for (int i = 0; i < gvOperation.Rows.Count; i++)
            {
                Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation();
                _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value);
                _EOperation.Count     = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value);
                EOperation.Add(_EOperation);
            }
            middleGroundCabel.OperationList = EOperation;

            if (SelectedCabelCode == Guid.Empty)
            {
                if (middleGroundCabel.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                middleGroundCabel.XCode = SelectedCabelCode;
                //MessageBox.Show("go to update method : " + Pole.Code + "\n");
                if (middleGroundCabel.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }