private void tsbShare_Click(object sender, EventArgs e) { if (SelectedCellCode != Guid.Empty) { if (Atend.Base.Equipment.EContainerPackage.ShareOnServer(Convert.ToInt32(Atend.Control.Enum.ProductType.Cell), SelectedCellCode)) { Atend.Base.Equipment.ECell Cell = Atend.Base.Equipment.ECell.SelectByXCode(SelectedCellCode); Code = Cell.Code; MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد"); } else { MessageBox.Show("خطا در به اشتراک گذاری ."); } } else { MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید"); } //if (SelectedCellCode != Guid.Empty) //{ // if (Atend.Base.Equipment.ECell.ShareOnServer(SelectedCellCode)) // { // Atend.Base.Equipment.ECell c1 = Atend.Base.Equipment.ECell.SelectByXCode(SelectedCellCode); // Code = c1.Code; // MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد"); // } // else // MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید"); //} //else // MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید"); }
public void BindDataToOwnControl(Guid XCode) { SelectedCellCode = XCode; Atend.Base.Equipment.ECell cell = Atend.Base.Equipment.ECell.SelectByXCode(XCode); txtName.Text = cell.Name; cboKind.SelectedValue = cell.Type; tsbIsDefault.Checked = cell.IsDefault; Code = cell.Code; BindTreeViwAndGridEquipment(); }
private bool CheckStatuseOfAccessChangeDefault() { Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; //ed.WriteMessage("AccessChangeDefault={0}\n", Atend.Control.Common.AccessChangeDefault); if (!Atend.Control.Common.AccessChangeDefault) { if (SelectedCellCode == Guid.Empty && IsDefault) { MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا"); return(false); } else { Atend.Base.Equipment.ECell Equip = Atend.Base.Equipment.ECell.SelectByXCode(SelectedCellCode); if (Equip.IsDefault || IsDefault) { MessageBox.Show("کاربر گرامی شما اجازه ویرایش تجهیز به صورت پیش فرض ندارید", "خطا"); return(false); } } } return(true); }
private void btnSelect_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; #region Select this.Hide(); PromptEntityOptions peo = new PromptEntityOptions("\nSelect MiddleJackPanel:\n"); PromptEntityResult per = ed.GetEntity(peo); if (per.Status == PromptStatus.OK) { ObjectId GroupOI = Atend.Global.Acad.Global.GetEntityGroup(per.ObjectId); if (GroupOI != ObjectId.Null) { Atend.Base.Acad.AT_INFO GroupInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(GroupOI); if (GroupInfo.ParentCode != "NONE" && GroupInfo.NodeType == (int)Atend.Control.Enum.ProductType.MiddleJackPanel) { ObjectIdCollection OIC = Atend.Global.Acad.UAcad.GetGroupSubEntities(GroupOI); foreach (ObjectId oi in OIC) { Atend.Base.Acad.AT_INFO SubInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(oi); if (SubInfo.ParentCode != "NONE" && SubInfo.NodeType == (int)Atend.Control.Enum.ProductType.Cell) { //ed.WriteMessage("NodeCode:{0} , CellOI:{1}\n", SubInfo.NodeCode, oi); //MyDic.Add(new Guid(SubInfo.NodeCode), oi); System.Data.DataRow NewRow1 = CellAndKey.NewRow(); NewRow1["CellGuid"] = new Guid(SubInfo.NodeCode); NewRow1["CellObjectId"] = oi.ToString().Substring(1, oi.ToString().Length - 2); Atend.Base.Acad.AT_SUB CellSub = Atend.Base.Acad.AT_SUB.SelectBySelectedObjectId(oi); foreach (ObjectId oii in CellSub.SubIdCollection) { Atend.Base.Acad.AT_INFO KeyInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(oii); if (KeyInfo.ParentCode != "NONE" && KeyInfo.NodeType == (int)Atend.Control.Enum.ProductType.Key) { NewRow1["KeyObjectId"] = oii.ToString().Substring(1, oii.ToString().Length - 2); } } CellAndKey.Rows.Add(NewRow1); } } //foreach (System.Data.DataRow dr in CellAndKey.Rows) //{ // ed.WriteMessage("CG:{0},\nCOI:{1},\nKOI:{2}\n", dr["CellGuid"], dr["CellObjectId"], dr["KeyObjectId"]); //} NodeCode = new Guid(GroupInfo.NodeCode); dtCell = Atend.Base.Design.DCellStatus.AccessSelectByJackPanelCode(NodeCode); System.Data.DataColumn dcName = new System.Data.DataColumn("Name"); dtCell.Columns.Add(dcName); foreach (DataRow dr in dtCell.Rows) { //ed.WriteMessage("CellCode:{0}\n", dr["CellCode"]); Atend.Base.Design.DPackage package = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(dr["CellCode"].ToString()));// SelectByCode(new Guid(dr["CellCode"].ToString())); Atend.Base.Equipment.ECell cell = Atend.Base.Equipment.ECell.AccessSelectByCode(package.ProductCode); dr["Name"] = cell.Name; } gvCellJAckPAnel.AutoGenerateColumns = false; gvCellJAckPAnel.DataSource = dtCell; //Atend.Calculating.frmTest t = new Atend.Calculating.frmTest(); //t.dataGridView5.DataSource = dtCell; //t.ShowDialog(); } } } this.Show(); #endregion }
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("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }