Ejemplo n.º 1
0
        private void callback_Callback(object source, CallbackEventArgs e)
        {
            String[]    p      = e.Parameter.Split('|');
            Object      key    = TypeDescriptor.GetConverter(ObjectTypeInfo.KeyMember.MemberType).ConvertFromString(p[0]);
            IMemberInfo member = ObjectTypeInfo.FindMember(p[1]);
            Object      value  = null;

            if (typeof(IXPSimpleObject).IsAssignableFrom(member.MemberType))
            {
                Type memberKeyType = XafTypesInfo.Instance.FindTypeInfo(member.MemberType).KeyMember.MemberType;
                int  index1        = p[2].LastIndexOf("(", StringComparison.Ordinal);
                int  index2        = p[2].LastIndexOf(")", StringComparison.Ordinal);
                if (index1 > 0 && index2 > index1)
                {
                    string memberKeyText = p[2].Substring(index1 + 1, index2 - index1 - 1);
                    value = ObjectSpace.GetObjectByKey(member.MemberType,
                                                       Convert.ChangeType(memberKeyText, memberKeyType));
                }
            }
            else
            {
                value = TypeDescriptor.GetConverter(member.MemberType).ConvertFromString(p[2]);
            }
            object obj = ObjectSpace.GetObjectByKey(ObjectTypeInfo.Type, key);

            member.SetValue(obj, value);
            ObjectSpace.CommitChanges();
        }
Ejemplo n.º 2
0
        private void GridForm_Save(GridForm m, SaveLayoutEventArgs e)
        {
            ReportCentral           rc         = (ReportCentral)View.CurrentObject;
            ReportCentralLayoutData layoutData = this.ObjectSpace.CreateObject <ReportCentralLayoutData>();
            bool IsOkay = false;

            if (rc.ReportCentralLayoutData.Count > 0)
            {
                foreach (ReportCentralLayoutData layout in rc.ReportCentralLayoutData)
                {
                    if (layout.Owner.Oid.ToString() == SecuritySystem.CurrentUserId.ToString())
                    {
                        IsOkay            = true;
                        layout.GridLayout = e.LayoutXML;
                    }
                }
            }
            if (!IsOkay)
            {
                layoutData.Owner      = ObjectSpace.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);
                layoutData.GridLayout = e.LayoutXML;
                rc.ReportCentralLayoutData.Add(layoutData);
            }
            ObjectSpace.CommitChanges();
        }
Ejemplo n.º 3
0
        private void GorevAl_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            var            SelectedObject    = e.SelectedObjects[0];
            string         sSelectedObject   = SelectedObject.ToString();
            string         sSelectedObjectId = sSelectedObject.Substring(46, 36);
            var            oCurrentUser      = ObjectSpace.GetObjectByKey <Users>(SecuritySystem.CurrentUserId);
            string         sCurrentUser      = oCurrentUser.ToString();
            string         sConnectionString = @"Data Source=TOSHIBA-L850\SQLEXPRESS;Initial Catalog=deneme2;User ID=sa;Password=1;";
            string         sCommandText      = "SELECT oid FROM PermissionPolicyUser WHERE UserName= '******'";
            DataTable      dtable            = new DataTable("tbl");
            SqlConnection  connection        = new SqlConnection(sConnectionString);
            SqlCommand     command           = new SqlCommand(sCommandText, connection);
            SqlDataAdapter adap = new SqlDataAdapter(command);

            connection.Open();
            adap.Fill(dtable);
            connection.Close();
            DataRow drow           = dtable.Rows[0];
            string  sCurrentUserID = drow["Oid"].ToString();
            //sCurentUserID, sSelectedObjectId
            string sUpdateText = "UPDATE TaskDefinitions SET WorkingUser=CONVERT(uniqueidentifier,'" + sCurrentUserID + "')"
                                 + "where Oid=CONVERT(uniqueidentifier,'" + sSelectedObjectId + "')";
            SqlCommand UpdateCommand = new SqlCommand(sUpdateText, connection);

            connection.Open();
            UpdateCommand.ExecuteNonQuery();
            connection.Close();
            View.ObjectSpace.Refresh(); //verileri yenile
        }
Ejemplo n.º 4
0
        private void JVPostAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            foreach (JournalVoucher jv in View.SelectedObjects)
            {
                foreach (JournalEntry je in jv.Entries)
                {
                    GLBudget generalLedger = ObjectSpace.FindObject <GLBudget>(CriteriaOperator.Parse("Account=? And PeriodYear=?", je.Account, jv.PeriodYear));
                    if (generalLedger == null)
                    {
                        generalLedger            = ObjectSpace.CreateObject <GLBudget>();
                        generalLedger.PeriodYear = jv.PeriodYear;
                        generalLedger.Account    = ObjectSpace.GetObjectByKey <GLAccount>(je.Account.AccountNumber);
                    }

                    GLTotal gLTotal = ObjectSpace.FindObject <GLTotal>(CriteriaOperator.Parse("Account=? And PeriodYear=?", je.Account, jv.PeriodYear));
                    if (gLTotal == null)
                    {
                        gLTotal            = ObjectSpace.CreateObject <GLTotal>();
                        gLTotal.PeriodYear = jv.PeriodYear;
                        gLTotal.Account    = ObjectSpace.GetObjectByKey <GLAccount>(je.Account.AccountNumber);
                    }
                }
                jv.Posted = true;
            }

            ObjectSpace.CommitChanges();
        }
Ejemplo n.º 5
0
        public void resetButton()
        {
            this.PQCopyFromPR.Active.SetItemValue("Enabled", false);
            this.PQCopyToPO.Active.SetItemValue("Enabled", false);
            PurchaseQuotation selectobject = (PurchaseQuotation)View.CurrentObject;
            SystemUsers       user         = ObjectSpace.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId);

            switch (selectobject.DocStatus.CurrDocStatus)
            {
            case DocStatus.Cancelled:
            case DocStatus.Closed:
            case DocStatus.Posted:
            case DocStatus.Accepted:
            case DocStatus.Submited:
                break;

            default:
                this.PQCopyFromPR.Active.SetItemValue("Enabled", true);
                break;
            }
            switch (selectobject.DocStatus.CurrDocStatus)
            {
            case DocStatus.Accepted:
                if (user.Roles.Where(pp => pp.Name == DocTypeCodes.PurchaseOrder).Count() > 0)
                {
                    this.PQCopyToPO.Active.SetItemValue("Enabled", true);
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 6
0
 private void OnCarChanged(object sender, ObjectChangedEventArgs e)
 {
     if (e.PropertyName == "Driver")
     {
         AssignCarParametersObject param = (AssignCarParametersObject)View.CurrentObject;
         param.DesignatedCar = ObjectSpace.GetObjectByKey <Car>(param.DesignatedDriver.Car.Oid);
     }
 }
Ejemplo n.º 7
0
        private void CopyToSTR_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            CopyToAction p = (CopyToAction)e.PopupWindow.View.CurrentObject;

            if (p.IsErr)
            {
                return;
            }

            string      company    = "";
            SystemUsers CreateUser = ObjectSpace.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId);

            if (CreateUser.Company is null)
            {
                company = "-";
            }
            else
            {
                company = CreateUser.Company.BoCode;
            }

            int cnt = 0;
            StockTransferRequest obj = null;
            IObjectSpace         os  = null;

            foreach (vwSAP_ITEM_AVAILABILITY dtl in ((ListView)View).SelectedObjects)
            {
                cnt++;
                if (cnt == 1)
                {
                    os  = Application.CreateObjectSpace();
                    obj = os.CreateObject <StockTransferRequest>();
                }
                StockTransferRequestDetail dtlobj = os.CreateObject <StockTransferRequestDetail>();
                dtlobj.Oid      = cnt * -1;
                dtlobj.VisOrder = cnt;
                dtlobj.ItemCode = os.FindObject <vwItemMasters>(CriteriaOperator.Parse("ItemCode=? and CompanyCode=?", dtl.ItemCode, company));
                if (p.ParamAction == CopyToEnum.CopyAvailableQty)
                {
                    dtlobj.FromWhsCod = os.FindObject <vwWarehouses>(CriteriaOperator.Parse("WhsCode=? and CompanyCode=?", dtl.WhsCode, company));
                    //dtlobj.WhsCode = os.FindObject<vwWarehouses>(CriteriaOperator.Parse("WhsCode=? and CompanyCode=?", obj.ToWhsCode.WhsCode, company));
                    if (dtl.OnHand - dtl.IsCommited + dtl.OnOrder > 0)
                    {
                        dtlobj.Quantity = dtl.OnHand - dtl.IsCommited + dtl.OnOrder;
                    }
                }
                else if (p.ParamAction == CopyToEnum.CopyOnhandQty)
                {
                    dtlobj.FromWhsCod = os.FindObject <vwWarehouses>(CriteriaOperator.Parse("WhsCode=? and CompanyCode=?", dtl.WhsCode, company));
                    //dtlobj.WhsCode = os.FindObject<vwWarehouses>(CriteriaOperator.Parse("WhsCode=? and CompanyCode=?", obj.ToWhsCode.WhsCode, company));
                    dtlobj.Quantity = dtl.OnHand;
                }
                obj.StockTransferRequestDetail.Add(dtlobj);
            }
            gen.openNewView(os, obj, ViewEditMode.Edit);
            return;
        }
Ejemplo n.º 8
0
        private void btnIniciarTarefa_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            if (View.Id == "SubTarefa_ListView")
            {
                SubTarefa subT = (SubTarefa)e.CurrentObject;
                //se status pendente seta data inicio se não continua a mesma
                if (subT.StatusSubTarefa == StatusSubTarefaEnum.Pendente)
                {
                    subT.DataInicio = DateTime.Now;
                }
                if (subT.DataInicio == null)
                {
                    subT.DataInicio = DateTime.Now;
                }


                TempoTarefa _tempoTarefa = ObjectSpace.CreateObject <TempoTarefa>();

                _tempoTarefa.Data       = DateTime.Now.Date;
                _tempoTarefa.HoraInicio = DateTime.Now.TimeOfDay;
                //Pega User da Sessão pela Id
                _tempoTarefa.User = ObjectSpace.GetObjectByKey <Usuario>(SecuritySystem.CurrentUserId);
                subT.HistoricoTempo.Add(_tempoTarefa);


                //Se Status do Projeto = Pendente o mesmo passa para EmExecução
                if (subT?.Tarefa?.Projeto?.StatusProjeto == StatusProjetoEnum.Pendente)
                {
                    subT.Tarefa.Projeto.StatusProjeto = StatusProjetoEnum.EmExecução; subT.Save();
                }
                //Se Status Tarefa = Pendente Ou Pausado O mesmo passa para EmExecução
                if (!subT.EmTeste)
                {
                    subT.StatusSubTarefa = StatusSubTarefaEnum.EmDesenvolvimento; subT.Save();
                    if (subT?.Tarefa?.StatusTarefa == StatusTarefaEnum.Pendente || subT?.Tarefa?.StatusTarefa == StatusTarefaEnum.Pausado)
                    {
                        subT.Tarefa.StatusTarefa = StatusTarefaEnum.EmDesenvolvimento; subT.Save();
                    }
                }

                if (subT.EmTeste)
                {
                    subT.StatusSubTarefa = StatusSubTarefaEnum.EmTeste;
                }

                subT.Correcao = false;

                ////TEMPORAIO PARA TESTE
                //if (subT?.StatusSubTarefa == StatusSubTarefaEnum.Finalizado)
                //{
                //    subT.StatusSubTarefa = StatusSubTarefaEnum.EmDesenvolvimento; subT.Save();
                //}
                ObjectSpace.CommitChanges();
            }
            View.Refresh();
        }
Ejemplo n.º 9
0
        public ActionResult Delete(Guid key)
        {
            Employee existing = ObjectSpace.GetObjectByKey <Employee>(key);

            if (existing != null)
            {
                ObjectSpace.Delete(existing);
                ObjectSpace.CommitChanges();
                return(NoContent());
            }
            return(NotFound());
        }
Ejemplo n.º 10
0
        private void AddRecipientByRankGroupAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            Announcement currentAnnouncement = (Announcement)View.CurrentObject;

            View.ObjectSpace.SetModified(currentAnnouncement);
            foreach (RankGroup selected in e.PopupWindow.View.SelectedObjects)
            {
                ICollection tempEmployee;
                DevExpress.Xpo.Metadata.XPClassInfo        employeeClass;
                DevExpress.Data.Filtering.CriteriaOperator criteria;
                DevExpress.Xpo.SortingCollection           sortProps;
                DevExpress.Xpo.Session session;
                DevExpress.Xpo.Generators.CollectionCriteriaPatcher patcher;

                session = currentAnnouncement.Session;
                //session.ConnectionString = XpoDefault.ConnectionString;

                // Obtain the persistent object class info required by the GetObjects method
                employeeClass = session.GetClassInfo(typeof(Employee));
                // Create criteria to get objects
                criteria = CriteriaOperator.Parse("StructuralPosition.RankGroup.Oid = ? And IsActive = true", selected.Oid);
                // Create a sort list if objects must be processed in a specific order
                sortProps = new SortingCollection(null);
                sortProps.Add(new SortProperty("FirstName", DevExpress.Xpo.DB.SortingDirection.Ascending));

                // Create criteria patcher to filter out the objects marked as "deleted"
                // and to support loading of inherited objects of a given base persistent class
                patcher = new DevExpress.Xpo.Generators.CollectionCriteriaPatcher(false, session.TypesManager);

                // Call GetObjects


                //tempEmployee = session.GetObjects(employeeClass, criteria, sortProps, 0, patcher, selectDeleted:false, force: false);
                tempEmployee = session.GetObjects(employeeClass, criteria, sortProps, 0, 0, false, true);

                foreach (Employee emp in tempEmployee)
                {
                    if (emp.IsActive == true)
                    {
                        Employee nEmp = ObjectSpace.GetObjectByKey <Employee>(emp.Oid);
                        AnnouncementRecepients nRec = new AnnouncementRecepients(currentAnnouncement.Session);
                        nRec.Employee = nEmp;
                        nRec.Email    = nEmp.CorporateEmail;
                        currentAnnouncement.AnnouncementRecepients.Add(nRec);
                    }
                }
            }
            if (View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View)
            {
                View.ObjectSpace.CommitChanges();
            }
        }
Ejemplo n.º 11
0
        private void PostAPInvoiceAcction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            int invCount = 0;

            foreach (APInvoice invoice in View.SelectedObjects)
            {
                invCount += 1;
                SystemSetting setting = ObjectSpace.FindObject <SystemSetting>(null);

                JournalVoucher journalVoucher = ObjectSpace.CreateObject <JournalVoucher>();
                journalVoucher.VoucherDate = DateTime.Now;
                journalVoucher.PeriodMonth = invoice.PeriodMonth;
                journalVoucher.PeriodYear  = invoice.PeriodYear;
                journalVoucher.Source      = BusinessObjects.ETC.Enums.JournalVoucherSource.APInvoice;
                journalVoucher.Description = string.Format("AP Invoice {0} - {1}", invoice.InvoiceNumber, invoice.Vendor.Name);

                JournalEntry entryAP = ObjectSpace.CreateObject <JournalEntry>();
                entryAP.Account = ObjectSpace.GetObjectByKey <GLAccount>(invoice.Vendor.Currency.AccountsPayable.AccountNumber);
                entryAP.Amount  = invoice.Amount * -1;
                journalVoucher.Entries.Add(entryAP);
                decimal TotalAmount = 0;
                foreach (APInvoiceItem item in invoice.Items)
                {
                    JournalEntry entry = ObjectSpace.CreateObject <JournalEntry>();
                    entry.Account = ObjectSpace.GetObjectByKey <GLAccount>(item.GLAccount.AccountNumber);
                    if (invoice.Vendor.Currency.ExchangeRate > 0)
                    {
                        entry.Amount = item.Amount * invoice.Vendor.Currency.ExchangeRate;
                    }
                    else
                    {
                        entry.Amount = item.Amount;
                    }
                    TotalAmount += entry.Amount;

                    journalVoucher.Entries.Add(entry);
                }
                if (setting.DefaultCurrency != invoice.Vendor.Currency)
                {
                    JournalEntry entry = ObjectSpace.CreateObject <JournalEntry>();
                    entry.Account = ObjectSpace.GetObjectByKey <GLAccount>(invoice.Vendor.Currency.GainLossOnExchange.AccountNumber);
                    entry.Amount  = ((invoice.Amount * invoice.Vendor.Currency.ExchangeRate) - invoice.Amount) * -1;

                    journalVoucher.Entries.Add(entry);
                }
                invoice.Posted = true;
            }
            ObjectSpace.CommitChanges();
            Application.ShowViewStrategy.ShowMessage(string.Format("{0} invoice was created, please check AP Invoice to adjust the invoices and post the invoices to Journal Vouchers", invCount), InformationType.Success, 5000, InformationPosition.Bottom);
        }
        private void AddObjectToUserBOs(bool commitChanges)
        {
            MySimpleUser currentUser   = ObjectSpace.GetObjectByKey <MySimpleUser>(SecuritySystem.CurrentUserId);
            BaseClass    currentObject = (BaseClass)View.CurrentObject;

            if (currentObject.Users.IndexOf(currentUser) == -1)
            {
                currentObject.Users.Add(currentUser);
                if (commitChanges)
                {
                    ObjectSpace.CommitChanges();
                }
            }
        }
Ejemplo n.º 13
0
 private void DashboardViewer_ConfigureDataConnection(object sender, DashboardConfigureDataConnectionEventArgs e)
 {
     if (e.ConnectionParameters is ExtractDataSourceConnectionParameters extractParameters)
     {
         if (Guid.TryParse(extractParameters.FileName, out var id))
         {
             var extract = ObjectSpace.GetObjectByKey <DashboardDataExtract>(id);
             if (extract != null)
             {
                 extract.ConfigureConnectionParameters(extractParameters);
             }
         }
     }
 }
Ejemplo n.º 14
0
        private void PostAPPaymentAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            int invCount = 0;

            foreach (APPayment payment in View.SelectedObjects)
            {
                SystemSetting setting = ObjectSpace.FindObject <SystemSetting>(null);

                JournalVoucher journalVoucher = ObjectSpace.CreateObject <JournalVoucher>();
                journalVoucher.VoucherDate = DateTime.Now;
                journalVoucher.PeriodMonth = payment.PeriodMonth;
                journalVoucher.PeriodYear  = payment.PeriodYear;
                journalVoucher.Source      = BusinessObjects.ETC.Enums.JournalVoucherSource.APPayment;
                journalVoucher.Description = string.Format("AP Paynebt Ref. {0}", payment.Reference);

                JournalEntry entryAP = ObjectSpace.CreateObject <JournalEntry>();
                entryAP.Account = ObjectSpace.GetObjectByKey <GLAccount>(payment.Bank.GLAccount.AccountNumber);
                entryAP.Amount  = payment.Amount * -1;
                journalVoucher.Entries.Add(entryAP);

                foreach (APPaymentItem item in payment.Items)
                {
                    JournalEntry entry = ObjectSpace.CreateObject <JournalEntry>();
                    entry.Account = ObjectSpace.GetObjectByKey <GLAccount>(payment.Vendor.Currency.AccountsPayable.AccountNumber);
                    if (payment.Vendor.Currency.ExchangeRate > 0)
                    {
                        entry.Amount = item.Payment * payment.Vendor.Currency.ExchangeRate;
                    }
                    else
                    {
                        entry.Amount = item.Payment;
                    }
                    journalVoucher.Entries.Add(entry);
                }
                if (setting.DefaultCurrency != payment.Vendor.Currency)
                {
                    JournalEntry entry = ObjectSpace.CreateObject <JournalEntry>();
                    entry.Account = ObjectSpace.GetObjectByKey <GLAccount>(payment.Vendor.Currency.GainLossOnExchange.AccountNumber);
                    entry.Amount  = ((payment.Amount * payment.Vendor.Currency.ExchangeRate) - payment.Amount);

                    journalVoucher.Entries.Add(entry);
                }
                invCount      += 1;
                payment.Posted = true;
            }

            ObjectSpace.CommitChanges();
            Application.ShowViewStrategy.ShowMessage(string.Format("{0} payments was posted, please check JV Voucher to adjust the JVs and post the JVs to General Ledger", invCount), InformationType.Success, 5000, InformationPosition.Bottom);
        }
Ejemplo n.º 15
0
        private void ShowRelatedCustomerAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            News news = (News)View.CurrentObject;

            foreach (Organization org in e.PopupWindowView.SelectedObjects)
            {
                Organization nOrg = ObjectSpace.GetObjectByKey <Organization>(org.Oid);
                news.RelatedOrganizations.Add(nOrg);
            }
            news.UpdateRelatedOrganization(true);
            if (View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View)
            {
                View.ObjectSpace.CommitChanges();
            }
        }
Ejemplo n.º 16
0
        private void ApprovalAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            if (((LogisticRequisitionApprovalParametersObject)e.PopupWindow.View.CurrentObject).Approve == LogisticRequisitionApprovalParametersObject.LogisticApproval.Undefined)
            {
                throw new UserFriendlyException("You have to select Approve or Not Approve!");
            }
            Employee            currentUser        = ObjectSpace.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);
            LogisticRequisition currentRequisition = (LogisticRequisition)View.CurrentObject;

            currentRequisition.AuthorizationDate = DateTime.Now;
            currentRequisition.AuthorizationNote = ((LogisticRequisitionApprovalParametersObject)e.PopupWindow.View.CurrentObject).Comment;
            currentRequisition.Status            = (RequisitonStatus)((LogisticRequisitionApprovalParametersObject)e.PopupWindow.View.CurrentObject).Approve;
            currentRequisition.AuthorizedBy      = currentUser;
            View.ObjectSpace.CommitChanges();
        }
Ejemplo n.º 17
0
        private void AddCategory_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            ResourceLibrary currentResource = (ResourceLibrary)View.CurrentObject;

            View.ObjectSpace.SetModified(currentResource);
            foreach (ResourceCategory emp in e.PopupWindow.View.SelectedObjects)
            {
                ResourceCategory nEmp = ObjectSpace.GetObjectByKey <ResourceCategory>(emp.Oid);
                currentResource.ResourceCategories.Add(nEmp);
            }
            if (View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View)
            {
                View.ObjectSpace.CommitChanges();
                Frame.View.ObjectSpace.Refresh();
            }
        }
Ejemplo n.º 18
0
        private void CopyFromSO_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            DeliveryOrder currentObject = (DeliveryOrder)View.CurrentObject;

            foreach (SalesOrderDetail item in e.PopupWindow.View.SelectedObjects)
            {
                DeliveryOrderDetail deliveriDetail = ObjectSpace.CreateObject <DeliveryOrderDetail>();

                deliveriDetail.BaseObj  = "Order";
                deliveriDetail.BaseLine = item.Oid;
                deliveriDetail.Item     = ObjectSpace.GetObjectByKey <Items>(item.Item.Oid);
                deliveriDetail.Quantity = item.OpenQuantity;
                deliveriDetail.Price    = item.Price;

                currentObject.OrderDetail.Add(deliveriDetail);
            }
        }
Ejemplo n.º 19
0
        private void ConvertCurrency()
        {
            var cf = (CashFlow)View.CurrentObject;

            if (cf.Account == null)
            {
                throw new UserFriendlyException("Account must be specified");
            }

            var functionalCurrency = ObjectSpace.GetObjectByKey <Currency>(SetOfBooks.CachedInstance.FunctionalCurrency.Oid);

            var rateObj = ForexRate.GetForexRateObject(cf.Account.Currency, functionalCurrency, (DateTime)cf.TranDate);

            string message = string.Format("rate = {0}", rateObj.ConversionRate);

            var messageBox = new Xafology.ExpressApp.SystemModule.GenericMessageBox(message);
        }
        public void resetButton()
        {
            this.CopyFromPO.Active.SetItemValue("Enabled", false);
            this.CopyToGR.Active.SetItemValue("Enabled", false);

            PurchaseDelivery selectobject = (PurchaseDelivery)View.CurrentObject;
            SystemUsers      user         = ObjectSpace.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId);

            switch (selectobject.DocStatus.CurrDocStatus)
            {
            case DocStatus.Cancelled:
            case DocStatus.Closed:
            case DocStatus.Posted:
            case DocStatus.Accepted:
            case DocStatus.Submited:
                break;

            default:
                this.CopyFromPO.Active.SetItemValue("Enabled", true);
                break;
            }
            switch (selectobject.DocStatus.CurrDocStatus)
            {
            case DocStatus.Accepted:
            case DocStatus.Posted:
                if (user.Roles.Where(pp => pp.Name == DocTypeCodes.PurchaseReturn).Count() > 0)
                {
                    if (GeneralValues.LiveWithPost)
                    {
                        if (selectobject.VerNo == selectobject.PostVerNo && selectobject.DocStatus.CurrDocStatus == DocStatus.Posted)
                        {
                            this.CopyToGR.Active.SetItemValue("Enabled", true);
                        }
                    }
                    else
                    {
                        this.CopyToGR.Active.SetItemValue("Enabled", true);
                    }
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 21
0
        private void AddInternalParticipantAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            Schedule currentSchedule = (Schedule)View.CurrentObject;

            View.ObjectSpace.SetModified(currentSchedule);
            foreach (Employee emp in e.PopupWindow.View.SelectedObjects)
            {
                Employee            nEmp   = ObjectSpace.GetObjectByKey <Employee>(emp.Oid);
                ScheduleParticipant partic = ObjectSpace.CreateObject <ScheduleParticipant>();
                partic.Participant = (People)nEmp;
                currentSchedule.ScheduleParticipants.Add(partic);
            }
            currentSchedule.UpdateParticipants(true);
            if (View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View)
            {
                View.ObjectSpace.CommitChanges();
            }
        }
Ejemplo n.º 22
0
        private void AssignCarAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            Schedule currentSchedule = (Schedule)View.CurrentObject;
            Employee currentUser     = ObjectSpace.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);

            View.ObjectSpace.SetModified(currentSchedule);
            currentSchedule.AssignedCar       = ObjectSpace.GetObjectByKey <Car>(((AssignCarParametersObject)e.PopupWindow.View.CurrentObject).DesignatedCar.Oid);
            currentSchedule.AssignedDriver    = ObjectSpace.GetObjectByKey <Driver>(((AssignCarParametersObject)e.PopupWindow.View.CurrentObject).DesignatedDriver.Oid);
            currentSchedule.CarAssignmentNote = ((AssignCarParametersObject)e.PopupWindow.View.CurrentObject).Comment;
            currentSchedule.CarAssignedBy     = currentUser;
            currentSchedule.CarAssignedDate   = DateTime.Now;
            currentSchedule.IsCarAssigned     = true;

            if (View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View)
            {
                View.ObjectSpace.CommitChanges();
            }
        }
Ejemplo n.º 23
0
        protected override void OnActivated()
        {
            base.OnActivated();
            string             condition   = CriteriaOperator.And(CriteriaOperator.Parse("[gioCong] Is Null")).ToString();
            CriteriaOperator   criteria    = CriteriaOperator.Parse(condition);
            IList <CheckInOut> checkInOuts = ObjectSpace.GetObjects <CheckInOut>(criteria);

            foreach (CheckInOut checkInOut in checkInOuts)
            {
                CheckInOut       check            = ObjectSpace.GetObjectByKey <CheckInOut>(checkInOut.Id);
                CriteriaOperator criteriaOperator = CriteriaOperator.And(CriteriaOperator.Parse("[nguoiChamCong] = ?", check.nguoiChamCong), CriteriaOperator.Parse("[ngay.ngayChamCong] = ?", check.NgayCham));
                GioCong          gio = ObjectSpace.FindObject <GioCong>(criteriaOperator);
                check.gioCong = gio;
            }
            ObjectSpace.CommitChanges();
            ObjectSpace.Refresh();
            View.Refresh();
        }
Ejemplo n.º 24
0
        //btnReprovar Tarefa
        private void btnReprovarPoP_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            //subT.Desenvolvedor.Email = "A tarefa {0} - SubTarefa {1} Foi reprovada pelo Motivo: {2}.";subT.Save();

            //subT.EmTeste = false;subT.Save();
            //subT.Correcao = true;subT.Save();
            //subT.StatusSubTarefa = StatusSubTarefaEnum.Reprovado;subT.Save();
            //SubTarefa subT = (SubTarefa)e.CurrentObject;
            //Acumula em View Objeto da Janela Pop Fazendo Casting para ComentarioAdd por ser Objeto da mesma intancia
            var view = (ComentarioAdd)e.PopupWindowViewCurrentObject;
            //Intancia Do Objeto ComentarioTeste Onde será Setado no banco
            ComentarioTeste comentario = ObjectSpace.CreateObject <ComentarioTeste>();

            //acumulou em Comentario.Sub tarefa o Objecto SubTarefa com o Oid da Sessão Pop
            comentario.SubTarefa = ObjectSpace.GetObjectByKey <SubTarefa>(view.Oid);
            //Acumula em ComentarioTeste.comentario Motivo da Janela PoP
            comentario.Comentario = view.Motivo;
            //Hora da Execução do btn Ok
            comentario.DataHora = DateTime.Now;
            //salva Alterarções do Comentario
            comentario.Save();
            //Add Cometario em Sub tarefa
            view.SubTarefa.Testes.Add(comentario);
            //Seta status da Sub Tarefa
            view.SubTarefa.StatusSubTarefa = StatusSubTarefaEnum.Reprovado;
            //
            if (view.SubTarefa.EmTeste)
            {
                view.SubTarefa.Tarefa.StatusTarefa = StatusTarefaEnum.Pendente;
            }

            comentario.SubTarefa.EmTeste  = false;
            comentario.SubTarefa.Correcao = true;

            //Salva Alterações no Banco
            ObjectSpace.CommitChanges();
            string titulo = $"Sub Tarefa {comentario.SubTarefa.Codigo} reprovada. Necessário Atenção especial";
            string msg    = $"A Tarefa {comentario.SubTarefa.Codigo} foi reprovada pelo motivo: {comentario.Comentario}";

            //Parametros.Configuracoes.EnviadoDe = comentario.SubTarefa.Teste.Email;
            Email.EnviarEmail(comentario?.SubTarefa?.Desenvolvedor?.Email, msg, titulo);
            //Atualiza View
            View.Refresh();
        }
Ejemplo n.º 25
0
 private void Load(IList <Technology> list, string data)
 {
     list.Clear();
     if (data != null)
     {
         foreach (var s in data.Split(','))
         {
             Guid key;
             if (Guid.TryParse(s, out key))
             {
                 var obj = ObjectSpace.GetObjectByKey <Technology>(key);
                 if (obj != null)
                 {
                     list.Add(obj);
                 }
             }
         }
     }
 }
Ejemplo n.º 26
0
        private void RemoveRelatedOrganizationAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            News currentNews = (News)View.CurrentObject;

            View.ObjectSpace.SetModified(currentNews);

            foreach (Organization emp in e.PopupWindow.View.SelectedObjects)
            {
                Organization nEmp = ObjectSpace.GetObjectByKey <Organization>(emp.Oid);
                currentNews.RelatedOrganizations.Remove(nEmp);
            }

            currentNews.UpdateRelatedOrganization(true);

            if (View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View)
            {
                View.ObjectSpace.CommitChanges();
            }
        }
Ejemplo n.º 27
0
        private void ApproveOffiveLeaveAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            IObjectSpace objectSpace = Application.CreateObjectSpace();
            Employee     currentUser = objectSpace.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);

            OfficeLeave officeLeave = (OfficeLeave)View.CurrentObject;

            View.ObjectSpace.SetModified(officeLeave);
            if (officeLeave.Employee.Manager.Oid == currentUser.Oid)
            {
                officeLeave.Manager             = ObjectSpace.GetObjectByKey <Employee>(currentUser.Oid);
                officeLeave.ManagerApproval     = ((OfficeLeaveApprovalParametersObject)e.PopupWindow.View.CurrentObject).Approval;
                officeLeave.ManagerComment      = ((OfficeLeaveApprovalParametersObject)e.PopupWindow.View.CurrentObject).Comment;
                officeLeave.ManagerApprovalDate = DateTime.Now;
            }

            SystemSetting setting = objectSpace.FindObject <SystemSetting>(null);

            foreach (MarbidRole role in currentUser.MarbidRoles)
            {
                if (setting.HRRole == role)
                {
                    officeLeave.HRPersonnel    = ObjectSpace.GetObjectByKey <Employee>(currentUser.Oid);
                    officeLeave.HRApproval     = ((OfficeLeaveApprovalParametersObject)e.PopupWindow.View.CurrentObject).Approval;
                    officeLeave.HRComment      = ((OfficeLeaveApprovalParametersObject)e.PopupWindow.View.CurrentObject).Comment;
                    officeLeave.HRApprovalDate = DateTime.Now;
                }
            }

            if (officeLeave.Employee.Directorate.Manager.Oid == currentUser.Oid)
            {
                officeLeave.Director             = ObjectSpace.GetObjectByKey <Employee>(currentUser.Oid);
                officeLeave.DirectorApproval     = ((OfficeLeaveApprovalParametersObject)e.PopupWindow.View.CurrentObject).Approval;
                officeLeave.DirectorComment      = ((OfficeLeaveApprovalParametersObject)e.PopupWindow.View.CurrentObject).Comment;
                officeLeave.DirectorApprovalDate = DateTime.Now;
            }

            if (View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View)
            {
                View.ObjectSpace.CommitChanges();
            }
        }
Ejemplo n.º 28
0
        private void replyFeedbackPopupWindowShowAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            Feedback currentFeedback = (Feedback)View.CurrentObject;

            View.ObjectSpace.SetModified(currentFeedback);
            Employee currentUser = ObjectSpace.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);

            string currentDescription = currentFeedback.Description;

            currentDescription                     += string.Format("<BR><HR><BR>Reply From: {0}<BR>Reply Date: {1}<BR>Reply Content:<BR>{2}", currentUser.FullName, DateTime.Now, ((ReplyParametersObject)e.PopupWindow.View.CurrentObject).Reply);
            currentFeedback.Description             = currentDescription;
            currentFeedback.LastDescription         = ((ReplyParametersObject)e.PopupWindow.View.CurrentObject).Reply;
            currentFeedback.LastDescriptionEmployee = currentUser;
            currentFeedback.LastDescriptionDate     = DateTime.Now;

            if (View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View)
            {
                View.ObjectSpace.CommitChanges();
            }
        }
        public void resetButton()
        {
            this.CopyToPO.Active.SetItemValue("Enabled", false); // PR cannot copy to
            PurchaseRequest selectobject = (PurchaseRequest)View.CurrentObject;
            SystemUsers     user         = ObjectSpace.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId);

            // PR cannot copy to
            //switch (selectobject.DocStatus.CurrDocStatus)
            //{
            //    case DocStatus.Draft:
            //    case DocStatus.Submited:
            //    case DocStatus.Cancelled:
            //        break;
            //    default:
            //        if (user.Roles.Where(pp => pp.Name == DocTypeCodes.PurchaseOrder).Count() > 0)
            //        {
            //            //this.CopyToPO.Active.SetItemValue("Enabled", true);
            //        }
            //        break;
            //}
        }
Ejemplo n.º 30
0
        public void resetButton()
        {
            this.CopyFromDO.Active.SetItemValue("Enabled", false);

            PurchaseReturn selectobject = (PurchaseReturn)View.CurrentObject;
            SystemUsers    user         = ObjectSpace.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId);

            switch (selectobject.DocStatus.CurrDocStatus)
            {
            case DocStatus.Cancelled:
            case DocStatus.Closed:
            case DocStatus.Posted:
            case DocStatus.Accepted:
            case DocStatus.Submited:
                break;

            default:
                this.CopyFromDO.Active.SetItemValue("Enabled", true);
                break;
            }
        }
 public void Capture(ObjectSpace objectSpace) {
     var objectType = XafTypesInfo.Instance.FindBussinessObjectType<ISequenceReleasedObject>();
     var objectByKey = objectSpace.GetObjectByKey(objectType, _sequenceReleasedObjectKey);
     if (objectByKey != null)
         objectSpace.Delete(objectByKey);
 }