Example #1
0
        protected override void OnOpenRecord(long Id)
        {
            try
            {
                base.OnOpenRecord(Id);

                if (Id != -1)
                {
                    Essential.BaseForm childform = null;

                    switch (Type)
                    {
                    case BL.ORG.ORG_Type.Customer:
                        childform = new Customer.CustomerForm(Id);
                        break;

                    case BL.ORG.ORG_Type.Supplier:
                        childform = new Supplier.SupplierForm(Id);
                        break;
                    }

                    ShowForm(childform);
                }
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }
Example #2
0
 protected override void OnNewRecord()
 {
     base.OnNewRecord();
     Essential.BaseForm child = null;
     switch (DocumentType)
     {
     case BL.SYS.SYS_DOC_Type.TransferRequest:
         //child = new Document.Customer.BackOrderForm();
         break;
     }
     ShowForm(child);
 }
Example #3
0
        protected override void OnOpenRecord(long Id)
        {
            base.OnOpenRecord(Id);

            if (DocumentType == null)
            {
                XDB.SYS_DOC_Header entry = ((XDB.ORG_TRX_Header)((DevExpress.Data.Async.Helpers.ReadonlyThreadSafeProxyForObjectFromAnotherThread)(GridView.GetFocusedRow())).OriginalRow).HeaderId;
                DocumentType = ((BL.SYS.SYS_DOC_Type)entry.TypeId.Id);
            }
            Essential.BaseForm child = null;

            switch (DocumentType)
            {
            case BL.SYS.SYS_DOC_Type.Quote:
                child = new Document.Customer.QuoteForm(Id);
                break;

            case BL.SYS.SYS_DOC_Type.SalesOrder:
                child = new Document.Customer.SalesOrderForm(Id);
                break;

            case BL.SYS.SYS_DOC_Type.TAXInvoice:
                child = new Document.Customer.TAXInvoiceForm(Id);
                break;

            case BL.SYS.SYS_DOC_Type.CreditNote:
                child = new Document.Customer.CreditNoteForm(Id);
                break;

            case BL.SYS.SYS_DOC_Type.PurchaseOrder:
                child = new Document.Supplier.PurchaseOrderForm(Id);
                break;

            case BL.SYS.SYS_DOC_Type.GoodsReceived:
                child = new Document.Supplier.GoodsReceivedForm(Id);
                break;

            case BL.SYS.SYS_DOC_Type.GoodsReturned:
                child = new Document.Supplier.GoodsReturnedForm(Id);
                break;

            case BL.SYS.SYS_DOC_Type.BackOrder:
                child = new Document.Customer.BackOrderForm(Id);
                break;

            case BL.SYS.SYS_DOC_Type.JobQuote:
                child = new Document.Customer.JobQuoteForm(Id);
                break;
            }
            ShowForm(child);
        }
Example #4
0
        protected override void OnNewRecord()
        {
            base.OnNewRecord();

            Essential.BaseForm child = null;

            switch (DocumentType)
            {
            case BL.SYS.SYS_DOC_Type.Quote:
                child = new Document.Customer.QuoteForm();
                break;

            case BL.SYS.SYS_DOC_Type.SalesOrder:
                child = new Document.Customer.SalesOrderForm();
                break;

            case BL.SYS.SYS_DOC_Type.TAXInvoice:
                //Werner: Cannot create TAX Invoice from scratch
                child = new Document.Customer.SalesOrderForm();
                break;

            case BL.SYS.SYS_DOC_Type.CreditNote:
                child = new Document.Customer.CreditNoteForm();
                break;

            case BL.SYS.SYS_DOC_Type.PurchaseOrder:
                child = new Document.Supplier.PurchaseOrderForm();
                break;

            case BL.SYS.SYS_DOC_Type.GoodsReceived:
                child = new Document.Supplier.GoodsReceivedForm();
                break;

            case BL.SYS.SYS_DOC_Type.GoodsReturned:
                child = new Document.Supplier.GoodsReturnedForm();
                break;

            case BL.SYS.SYS_DOC_Type.BackOrder:
                child = new Document.Customer.BackOrderForm();
                break;

            case BL.SYS.SYS_DOC_Type.JobQuote:
                child = new Document.Customer.JobQuoteForm();
                break;
            }

            ShowForm(child);
        }
Example #5
0
        protected override void OnOpenRecord(long Id)
        {
            base.OnOpenRecord(Id);
            if (DocumentType == null)
            {
                DB.VW_StockDocument entry = (DB.VW_StockDocument)((DevExpress.Data.Async.Helpers.ReadonlyThreadSafeProxyForObjectFromAnotherThread)(GridView.GetFocusedRow())).OriginalRow;
                DocumentType = ((BL.SYS.SYS_DOC_Type)entry.TypeId);
            }
            Essential.BaseForm child = null;
            switch (DocumentType)
            {
            case BL.SYS.SYS_DOC_Type.InventoryAdjustment:
                child = new InventoryAdjustmentForm(Id);
                break;

            case BL.SYS.SYS_DOC_Type.TransferRequest:
                //child = new Document.Customer.BackOrderForm(Id);
                break;
            }
            ShowForm(child);
        }
Example #6
0
        protected override void OnStart()
        {
            try
            {
                base.OnStart();
                BindingSource.DataSource = recoveryItems;

                foreach (string item in System.IO.Directory.EnumerateFileSystemEntries(Environment.CurrentDirectory + @"\Recovery"))
                {
                    try
                    {
                        List <BindingSource> bindingSources = new List <BindingSource>();

                        int    lineCount    = 0;
                        string description  = string.Empty;
                        string assemblyName = string.Empty;
                        foreach (string line in System.IO.File.ReadLines(item))
                        {
                            //Skip blank lines
                            if (line == string.Empty)
                            {
                                continue;
                            }

                            switch (lineCount)
                            {
                            //First line should hav the Form Assembly Name
                            case 0:
                                assemblyName = line;
                                lineCount++;
                                continue;

                            //Second line should hafe the Forms Namespace
                            case 1:
                                description = line;
                                lineCount++;
                                continue;
                            }


                            if (line == string.Empty)
                            {
                                continue;
                            }

                            var  dassembly = System.Reflection.Assembly.Load("CDS.Client.DataAccessLayer");
                            Type dtype;
                            if (line.Split('|')[0].StartsWith("System.Collections.Generic.List"))
                            {
                                dtype = typeof(List <>);
                                Type typeArg = dassembly.GetType(line.Split('|')[0].Split(new char[] { '[', ']' })[1]);
                                dtype = dtype.MakeGenericType(typeArg);
                                var bs = new System.Windows.Forms.BindingSource();
                                bs.DataSource = Newtonsoft.Json.JsonConvert.DeserializeObject(line.Split('|')[1], dtype);
                                //bs.DataSource = (System.Collections.IList)Activator.CreateInstance(dtype);
                                bindingSources.Add(bs);
                                //bindingSources.AddRange(Newtonsoft.Json.JsonConvert.DeserializeObject(line.Split('|')[1], dtype));
                                //System.Collections.IList list = (System.Collections.IList)Activator.CreateInstance(dtype);
                            }
                            else
                            {
                                dtype = dassembly.GetType(line.Split('|')[0], true);
                                var bs = new System.Windows.Forms.BindingSource();
                                //bs.DataSource = ((System.Collections.IList)Newtonsoft.Json.JsonConvert.DeserializeObject(line.Split('|')[1], (typeof(System.Collections.Generic.List<>)).MakeGenericType(dtype)))[0];
                                //Werner : Try this on monday (2014-10-17)
                                bs.DataSource = Newtonsoft.Json.JsonConvert.DeserializeObject(line.Split('|')[1], dtype);
                                bindingSources.Add(bs);
                            }
                        }

                        if (assemblyName == string.Empty)
                        {
                            continue;
                        }

                        //item.Split(',')[1]
                        var assembly = System.Reflection.Assembly.Load(assemblyName);
                        var type     = assembly.GetType(item.Split(',')[1], true);

                        Essential.BaseForm form = Activator.CreateInstance(type) as Essential.BaseForm;
                        recoveryItems.Add(new RecoveryItem()
                        {
                            Recover = false, Description = description, BindingSources = bindingSources, Form = form
                        });
                    }
                    catch (Exception ex)
                    {
                    }

                    //List<BindingSource> BindingSources = item.Split('/n');


                    // BindingSource.Add(new RecoveryItem() { Recover = false, Description = "", BindingSources = bindingSources });
                }
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }