private void tsbShare_Click(object sender, EventArgs e) { if (selectedLight != Guid.Empty) { if (Atend.Base.Equipment.EContainerPackage.ShareOnServer(Convert.ToInt32(Atend.Control.Enum.ProductType.Light), selectedLight)) { Atend.Base.Equipment.ELight Light = Atend.Base.Equipment.ELight.SelectByXCode(selectedLight); Code = Light.Code; MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد"); } else { MessageBox.Show("خطا در به اشتراک گذاری ."); } } else { MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید"); } //if (selectedLight != Guid.Empty) //{ // if (Atend.Base.Equipment.ELight.ShareOnServer(selectedLight)) // { // Atend.Base.Equipment.ELight l1 = Atend.Base.Equipment.ELight.SelectByXCode(selectedLight); // Code = l1.Code; // MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد"); // } // else // MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید"); //} //else // MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید"); }
private void Save() { txtName.Focus(); Atend.Base.Equipment.ELight light = new Atend.Base.Equipment.ELight(); light.ProductCode = Atend.Control.Common.selectedProductCode; light.Comment = txtComment.Text; light.Name = txtName.Text; light.IsDefault = IsDefault; light.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); } light.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); } light.OperationList = EOperation; if (selectedLight == Guid.Empty) { if (light.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { light.XCode = selectedLight; if (light.UpdateX()) { Reset(); } else { MessageBox.Show("امکان ذخیره سازی اطلاعات نمی باشد", "خطا"); } } }
public void BindDataToOwnControl(Guid XCode) { selectedLight = XCode; Atend.Base.Equipment.ELight light = Atend.Base.Equipment.ELight.SelectByXCode(XCode); Atend.Control.Common.selectedProductCode = light.ProductCode; SelectProduct(); txtName.Text = light.Name; txtComment.Text = light.Comment; tsbIsDefault.Checked = light.IsDefault; Code = light.Code; BindTreeViwAndGrid(); }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { Atend.Base.Equipment.ELight Light = new Atend.Base.Equipment.ELight(); bool useAccess = false; if (Convert.ToBoolean(gvLight.Rows[gvLight.CurrentRow.Index].Cells[3].Value) == false) { Light = Atend.Base.Equipment.ELight.AccessSelectByCode(Convert.ToInt32(gvLight.Rows[gvLight.CurrentRow.Index].Cells[0].Value.ToString())); useAccess = true; } else if (Convert.ToBoolean(gvLight.Rows[gvLight.CurrentRow.Index].Cells[3].Value) == true) { Light = Atend.Base.Equipment.ELight.SelectByXCode(new Guid(gvLight.Rows[gvLight.CurrentRow.Index].Cells[1].Value.ToString())); useAccess = false; } Atend.Base.Acad.AcadGlobal.LightData.eLight = Light; Atend.Base.Acad.AcadGlobal.LightData.UseAccess = useAccess; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist1.SelectedValue)); Atend.Base.Acad.AcadGlobal.LightData.Existance = status.ACode; if (cboProjCode1.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.LightData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.LightData.ProjectCode = Convert.ToInt32(cboProjCode1.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist1.SelectedValue.ToString()); if (cboProjCode1.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode1.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { AllowClose = false; } }
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 (selectedLight == Guid.Empty && IsDefault) { MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا"); return(false); } else { Atend.Base.Equipment.ELight Equip = Atend.Base.Equipment.ELight.SelectByXCode(selectedLight); if (Equip.IsDefault || IsDefault) { MessageBox.Show("کاربر گرامی شما اجازه ویرایش تجهیز به صورت پیش فرض ندارید", "خطا"); return(false); } } } return(true); }