private void bteThuongVien_KeyDown(object sender, KeyEventArgs e)
 {
     UtilFunctions.bteNhanVien_KeyDown(sender, e, bteThuongVien, -1);
 }
 private void bteTaiKhoanQuy_KeyDown(object sender, KeyEventArgs e)
 {
     UtilFunctions.bteTaiKhoanQuy_KeyDown(sender, e, bteTaiKhoanQuy, (nguoiDung.SupperUser == 1 ? -1 : nguoiDung.IdTrungTamHachToan));
 }
 private void bteKhachHang_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     UtilFunctions.bteKhachHang_ButtonClick(sender, e, bteKhachHang, IdLoaiDTSelected);
 }
Exemple #4
0
 private void bteQLTrucTiep_TextChanged(object sender, EventArgs e)
 {
     UtilFunctions.bteItem_TextChanged(sender, e, bteTrungTam);
 }
 private void bteThuNgan_KeyDown(object sender, KeyEventArgs e)
 {
     UtilFunctions.bteNhanVien_KeyDown(sender, e, bteThuNgan, IdKho);
 }
Exemple #6
0
 private void bteTrungTam_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     UtilFunctions.bteTrungTam_ButtonClick(sender, e, bteTrungTam, -1);
 }
Exemple #7
0
 private void bteQLTrucTiep_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     UtilFunctions.bteNhanVien_ButtonClick(sender, e, bteQLTrucTiep, -1);
 }
        /// <summary>
        /// Process the Display Service execute event
        /// </summary>
        protected virtual void ProcessExecuteServiceTriggered(object sender, TriggerEventArgs e)
        {
            // Before executing the DisplaySet Service it is needed to check for pending changes in associated Service IU.
            IUQueryController queryController = Parent as IUQueryController;

            if (queryController != null && !queryController.CheckPendingChanges(false, true))
            {
                return;
            }
            if (CurrentDisplaySet.ServiceInfo == null)
            {
                return;
            }

            // Gets modified rows from the viewer
            DataTable modifiedRows = Viewer.GetModifiedRows();

            if (modifiedRows == null)
            {
                return;
            }

            // Validate the modified data
            if (!ValidateModifiedRows(modifiedRows))
            {
                return;
            }

            // Error datatable
            DataTable errorReport = new DataTable();
            // Column for the OID
            string instanceColumnsName = CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentAlias;

            errorReport.Columns.Add(instanceColumnsName);
            // Column for the error message
            string lReportMessage = CultureManager.TranslateString(LanguageConstantKeys.L_MULTIEXE_EXECUTION, LanguageConstantValues.L_MULTIEXE_EXECUTION);

            errorReport.Columns.Add(lReportMessage);

            IUServiceContext lServiceContext = null;

            // For every modified row do...
            foreach (DataRow rowValues in modifiedRows.Rows)
            {
                // Create new IUServiceContext.
                lServiceContext = new IUServiceContext(null, CurrentDisplaySet.ServiceInfo.ClassServiceName, CurrentDisplaySet.ServiceInfo.ServiceName, null);
                // Add argunment this to the service context.
                List <Oid> instanceOIDs = new List <Oid>();
                Oid        instanceOID  = Adaptor.ServerConnection.GetOid(modifiedRows, rowValues);
                instanceOIDs.Add(instanceOID);
                lServiceContext.InputFields.Add(CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentName, new IUContextArgumentInfo(CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentName, instanceOIDs, true, null));

                // Fill the collections for the other inbound arguments.
                foreach (DisplaySetServiceArgumentInfo argumentInfo in CurrentDisplaySet.ServiceInfo.ArgumentDisplaySetPairs.Values)
                {
                    object value = rowValues[argumentInfo.DSElementName];
                    if (value.GetType() == typeof(System.DBNull))
                    {
                        value = null;
                    }
                    //Add input arguments with context.
                    lServiceContext.InputFields.Add(argumentInfo.Name, new IUContextArgumentInfo(argumentInfo.Name, value, true, null));
                }
                try
                {
                    // Execute service.
                    Logic.ExecuteService(lServiceContext);
                }
                catch (Exception exc)
                {
                    string lAlternateKeyName = CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentAlternateKeyName;
                    if (lAlternateKeyName != string.Empty)
                    {
                        instanceOID = Logic.GetAlternateKeyFromOid(instanceOID, lAlternateKeyName);
                    }

                    // Add a new row in the error datatable.
                    DataRow newReportRow = errorReport.NewRow();
                    newReportRow[lReportMessage]      = exc.Message;
                    newReportRow[instanceColumnsName] = UtilFunctions.OidFieldsToString(instanceOID, ' ');
                    errorReport.Rows.Add(newReportRow);
                }
            }

            // If errors have been found, show them
            if (errorReport.Rows.Count > 0)
            {
                // Show error message to the user
                ScenarioManager.LaunchMultiExecutionReportScenario(errorReport, CurrentDisplaySet.ServiceInfo.ServiceAlias, null, null);
            }

            // Remove the Pending changes mark
            PendingChanges = false;

            // Refresh the data
            OnExecuteCommand(new ExecuteCommandRefreshEventArgs(null));
        }
        /// <summary>
        /// Validates the modified rows values. Not Null and datatype
        /// </summary>
        /// <param name="modifiedRows"></param>
        /// <returns></returns>
        private bool ValidateModifiedRows(DataTable modifiedRows)
        {
            // Error datatable
            DataTable errorReport = new DataTable();
            // Column for the OID
            string instanceColumnsName = CurrentDisplaySet.ServiceInfo.SelectedInstanceArgumentAlias;

            errorReport.Columns.Add(instanceColumnsName);
            // Column for the error message
            string lReportMessage = CultureManager.TranslateString(LanguageConstantKeys.L_MULTIEXE_EXECUTION, LanguageConstantValues.L_MULTIEXE_EXECUTION);

            errorReport.Columns.Add(lReportMessage);

            // Not null and Datatype validation
            foreach (DataRow rowValues in modifiedRows.Rows)
            {
                Oid instanceOID = Adaptor.ServerConnection.GetOid(modifiedRows, rowValues);
                foreach (DisplaySetServiceArgumentInfo argumentInfo in CurrentDisplaySet.ServiceInfo.ArgumentDisplaySetPairs.Values)
                {
                    object value = rowValues[argumentInfo.DSElementName];

                    // Null validation
                    if (value.GetType() == typeof(System.DBNull))
                    {
                        if (!argumentInfo.AllowsNull)
                        {
                            // Add a nuw row in the error datatable
                            DataRow  newReportRow   = errorReport.NewRow();
                            string   nameInScenario = argumentInfo.Alias;
                            object[] lArgs          = new object[1];
                            lArgs[0] = nameInScenario;
                            string lErrorMessage = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_VALIDATION_NECESARY, LanguageConstantValues.L_VALIDATION_NECESARY, lArgs);
                            newReportRow[lReportMessage]      = lErrorMessage;
                            newReportRow[instanceColumnsName] = UtilFunctions.OidFieldsToString(instanceOID, ' ');
                            errorReport.Rows.Add(newReportRow);
                        }
                    }
                    else
                    {
                        // Data type validation
                        if (!DefaultFormats.CheckDataType(value.ToString(), argumentInfo.DataType, false))
                        {
                            // Add a nuw row in the error datatable
                            DataRow  newReportRow = errorReport.NewRow();
                            string   lMask        = DefaultFormats.GetHelpMask(argumentInfo.DataType, string.Empty);
                            object[] lArgs        = new object[1];
                            lArgs[0] = lMask;
                            string lErrorMessage = argumentInfo.Alias + ":  ";
                            lErrorMessage += CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_VALIDATION_INVALID_FORMAT_MASK, LanguageConstantValues.L_VALIDATION_INVALID_FORMAT_MASK, lArgs);
                            newReportRow[lReportMessage]      = lErrorMessage;
                            newReportRow[instanceColumnsName] = UtilFunctions.OidFieldsToString(instanceOID, ' ');
                            errorReport.Rows.Add(newReportRow);
                        }
                    }
                }
            }

            // If errors have been found, show them
            if (errorReport.Rows.Count > 0)
            {
                // Show error message to the user
                ScenarioManager.LaunchMultiExecutionReportScenario(errorReport, CurrentDisplaySet.ServiceInfo.ServiceAlias, null, null);
                return(false);
            }

            return(true);
        }
Exemple #10
0
        private void txtKhoNhap_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            int idTrungTam = txtTrungTam.Tag != null ? ((DMTrungTamInfor)txtTrungTam.Tag).IdTrungTam : 0;

            UtilFunctions.bteKhoXuat_ButtonClick(sender, e, txtKhoNhap, idTrungTam, nguoiDung.IdNhanVien);
        }
Exemple #11
0
        private void txtKhoNhap_KeyDown(object sender, KeyEventArgs e)
        {
            int idTrungTam = txtTrungTam.Tag != null ? ((DMTrungTamInfor)txtTrungTam.Tag).IdTrungTam : 0;

            UtilFunctions.bteKhoXuat_KeyDown(sender, e, txtKhoNhap, idTrungTam, nguoiDung.IdNhanVien);
        }
Exemple #12
0
 private void bteTrungTam_KeyDown(object sender, KeyEventArgs e)
 {
     UtilFunctions.bteTrungTam_KeyDown(sender, e, bteTrungTam, nguoiDung.IdNhanVien);
 }
        /// <summary>
        /// Initialize the inbound arguments based in the context information.
        /// </summary>
        /// <param name="context">Current service context.</param>
        public static void ExecuteLoadFromContext(IUServiceContext context)
        {
            int depRulesCounter = Properties.Settings.Default.DependencyRulesCounter;
            DependencyRulesCache depRulesCache = new DependencyRulesCache();

            // If Exchange information does not exist, none initialization can be done.
            if (context == null || context.ExchangeInformation == null)
            {
                return;
            }

            // Argument previous value. Common for all of them.
            object previousValue;


            #region 'this' initialization
            // Argument 'this' initialization: 'p_thisPasajeroAeronave'.
            List <Oid>         lSelectedOids = null;
            ExchangeInfoAction lInfoAction   = context.ExchangeInformation as ExchangeInfoAction;
            if (lInfoAction != null)
            {
                lSelectedOids = lInfoAction.SelectedOids;
            }

            // Check if the selected Oid is an Oid of the 'this' argument class.
            if (UtilFunctions.OidsBelongToClass(lSelectedOids, "PasajeroAeronave"))
            {
                if (!context.GetInputFieldMultiSelectionAllowed("p_thisPasajeroAeronave") && lSelectedOids.Count > 1)
                {
                    lSelectedOids.RemoveRange(1, lSelectedOids.Count - 1);
                }
                previousValue = context.GetInputFieldValue("p_thisPasajeroAeronave");
                context.SetInputFieldValue("p_thisPasajeroAeronave", lSelectedOids);
                // Check SetValue dependency rules.
                context.SelectedInputField = "p_thisPasajeroAeronave";
                ExecuteDependencyRules(context, previousValue, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                // Check SetEnabled dependency rules.
                context.SetInputFieldEnabled("p_thisPasajeroAeronave", false);
                context.SelectedInputField = "p_thisPasajeroAeronave";
                ExecuteDependencyRules(context, true, DependencyRulesEventLogic.SetActive, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                context.SelectedInputField = string.Empty;
            }
            #endregion 'this' initialization

            #region Aggregation relationships initializations
            // Obtain data from the last navigation, in order to initialize object-valued arguments that represent aggregation relationships.
            string lLastNavigationRole = context.ExchangeInformation.GetLastNavigationRole();

            if (lLastNavigationRole != "")
            {
            }
            #endregion Aggregation relationships initializations

            #region Manual initializations
            // Search in context for initializations done by programmers, in order to achieve special behaviours.
            foreach (KeyValuePair <string, object> argument in context.ExchangeInformation.CustomData)
            {
                previousValue = context.GetInputFieldValue(argument.Key);

                object lCustomArgumentValue = argument.Value;


                context.SetInputFieldValue(argument.Key, lCustomArgumentValue);
                // Check SetValue dependency rules
                context.SelectedInputField = argument.Key;
                ExecuteDependencyRules(context, previousValue, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                context.SelectedInputField = string.Empty;
            }
            #endregion Manual initializations

            #region Arguments initializations taking into account context information
            // Initialize object-valued arguments using information in the context stack, only if the argument has not value.
            List <Oid> lArgumentValue = null;
            // 'p_thisPasajeroAeronave' argument.
            previousValue = context.GetInputFieldValue("p_thisPasajeroAeronave");
            if (previousValue == null)
            {
                // Search an Oid of the argument class: 'PasajeroAeronave'.
                lArgumentValue = context.ExchangeInformation.GetOidsOfClass("PasajeroAeronave");
                if (lArgumentValue != null)
                {
                    context.SetInputFieldValue("p_thisPasajeroAeronave", lArgumentValue);
                    // Check SetValue dependency rules.
                    context.SelectedInputField = "p_thisPasajeroAeronave";
                    ExecuteDependencyRules(context, null, DependencyRulesEventLogic.SetValue, DependencyRulesAgentLogic.Internal, ref depRulesCounter, depRulesCache);
                    context.SelectedInputField = string.Empty;
                }
            }

            #endregion Arguments initializations taking into account context information
        }
 private void bteKhachHang_KeyDown(object sender, KeyEventArgs e)
 {
     UtilFunctions.bteKhachHang_KeyDown(sender, e, bteKhachHang, IdLoaiDTSelected);
 }
 private void txtKhachHang_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     UtilFunctions.bteKhachHang_ButtonClick(sender, e, txtKhachHang, Declare.IdLoaiKhachHang);
 }
 private void txtKhachHang_TextChanged(object sender, EventArgs e)
 {
     UtilFunctions.bteItem_TextChanged(sender, e, txtKhachHang);
 }
 private void txtKhachHang_KeyDown(object sender, KeyEventArgs e)
 {
     UtilFunctions.bteKhachHang_KeyDown(sender, e, txtKhachHang, Declare.IdLoaiKhachHang);
 }
 private void bteKhoXuat_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     UtilFunctions.bteKhoXuat_ButtonClick(sender, e, bteKhoXuat, -1, nguoiDung.IdNhanVien);
 }
Exemple #19
0
 private void bteTrungTam_KeyDown(object sender, KeyEventArgs e)
 {
     UtilFunctions.bteTrungTam_KeyDown(sender, e, bteTrungTam, 1);
 }
 private void bteKhoXuat_KeyDown(object sender, KeyEventArgs e)
 {
     UtilFunctions.bteKhoXuat_KeyDown(sender, e, bteKhoXuat, -1, nguoiDung.IdNhanVien);
 }
Exemple #21
0
 private void bteQLTrucTiep_KeyDown(object sender, KeyEventArgs e)
 {
     UtilFunctions.bteNhanVien_KeyDown(sender, e, bteQLTrucTiep, -1);
 }
        private void bteKhachLe_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            int idDoiTuongCha = txtKhachHang != null ? ((DMDoiTuongInfo)txtKhachHang.Tag).IdDoiTuong : -1;

            UtilFunctions.bteKhachLe_ButtonClick(sender, e, bteKhachLe, idDoiTuongCha);
        }
 private void bteThuNgan_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     UtilFunctions.bteNhanVien_ButtonClick(sender, e, bteThuNgan, IdKho);
 }
        private void bteKhachLe_KeyDown(object sender, KeyEventArgs e)
        {
            int idDoiTuongCha = txtKhachHang != null ? ((DMDoiTuongInfo)txtKhachHang.Tag).IdDoiTuong : -1;

            UtilFunctions.bteKhachLe_KeyDown(sender, e, bteKhachLe, idDoiTuongCha);
        }
 private void bteThuNgan_TextChanged(object sender, EventArgs e)
 {
     UtilFunctions.bteItem_TextChanged(sender, e, bteThuNgan);
 }
 private void bteKhachLe_TextChanged(object sender, EventArgs e)
 {
     UtilFunctions.bteItem_TextChanged(sender, e, bteKhachLe);
 }
 private void bteTaiKhoanQuy_TextChanged(object sender, EventArgs e)
 {
     UtilFunctions.bteItem_TextChanged(sender, e, bteTaiKhoanQuy);
 }
        async void ReadOIOUBL()
        {
            readingOIOUBL = true;
#if !SILVERLIGHT
            try
            {
                var sfd = UtilDisplay.LoadOpenFileDialog;
                sfd.Filter = UtilFunctions.GetFilteredExtensions(FileextensionsTypes.XML);

                var userClickedSave = sfd.ShowDialog();
                if (userClickedSave != true)
                {
                    return;
                }

                using (var stream = File.Open(sfd.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    var sr         = new StreamReader(stream);
                    var oioublText = sr.ReadToEnd();

                    var order = await OIOUBL.ReadInvoiceCreditNoteOrOrder(oioublText, creditors, api, true);

                    if (order == null)
                    {
                        ClearFields(initialOrder);
                        return;
                    }

                    order.SetMaster(api.CompanyEntity);
                    //PriceLookup?.OrderChanged(order);

                    var orderLines = order.Lines;
                    order.Lines = null;

                    ClearFields(order);

                    int countLine = 0;
                    foreach (var line in orderLines)
                    {
                        line.SetMaster(order);
                        line._LineNumber = ++countLine;
                    }

                    dgCreditorOrderLineGrid.ItemsSource = orderLines;

                    if (order.DocumentRef != 0)
                    {
                        UpdateVoucher(Order);
                    }
                }
                readingOIOUBL = false;
            }
            catch (Exception e)
            {
                readingOIOUBL = false;
                if (e.StackTrace.IndexOf("xmlserializer", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    UnicontaMessageBox.Show("The file is not a valid XSD schemas. For more information (validation info) use www.oioubl.net/validator/", Uniconta.ClientTools.Localization.lookup("Information"));
                }
                else
                {
                    UnicontaMessageBox.Show(e, Uniconta.ClientTools.Localization.lookup("Information"));
                }
            }
#endif
        }