Exemple #1
0
        /// <summary>
        /// Main app entry point.
        /// </summary>
        /// <param name="args">Command line arguments, can be used to override the configuration json file in the Dependency Injection example.</param>
        /// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
        protected static async Task Main(string[] args)
        {
            var choice = RenderAndSelectSampleChoice();

            switch (choice)
            {
            case SampleChoice.SimpleLookup:
                var simpleLookup = new SimpleLookup();
                await simpleLookup.ExecuteAsync();

                break;

            case SampleChoice.DependencyInjection:
                var diLookup = new DependencyInjectionLookup();
                await diLookup.ExecuteAsync(args);

                break;

            default:
                Console.WriteLine("Could not figure out selection, exiting.");
                break;
            }

            Console.WriteLine("Complete, press a key to quit");
            Console.ReadKey();
        }
Exemple #2
0
        public void TestFormatOwner()
        {
            String entityName = "Sage.SalesLogix.Entities.Contact";

            using (var sess = new SessionScopeWrapper())
            {
                SessionFactoryImpl      sf        = (SessionFactoryImpl)sess.SessionFactory;
                AbstractEntityPersister persister = (AbstractEntityPersister)(sf.GetEntityPersister(entityName));
                Assert.AreEqual("Owner.OwnerDescription", SimpleLookup.DecomposePath(sf, persister, "SECCODEID", "8"));
            }
        }
Exemple #3
0
        public void TestFormatUserName()
        {
            String entityName = "Sage.SalesLogix.Entities.Contact";

            using (var sess = new SessionScopeWrapper())
            {
                SessionFactoryImpl      sf        = (SessionFactoryImpl)sess.SessionFactory;
                AbstractEntityPersister persister = (AbstractEntityPersister)(sf.GetEntityPersister(entityName));
                Assert.AreEqual("AccountManager.UserInfo.UserName", SimpleLookup.DecomposePath(sf, persister, "ACCOUNTMANAGERID", "6"));
            }
        }
Exemple #4
0
        public void BindCombo(DropDownList ddl, LookupTypeEnum luType, string defaultText, string dataTextField, string dataValueField)
        {
            ddl.Items.Clear();
            ddl.Items.Add(new ListItem(defaultText, string.Empty));
            ddl.AppendDataBoundItems = true;
            List <LookupValue> ds = SimpleLookup.Lookup(luType).GetList();

            ds.Sort(CompareByString);
            ddl.DataSource     = ds;
            ddl.DataTextField  = dataTextField;
            ddl.DataValueField = dataValueField;
            ddl.DataBind();
        }
Exemple #5
0
        public void TestDecomposePath()
        {
            String entityName = "Sage.SalesLogix.Entities.Contact";

            using (var sess = new SessionScopeWrapper())
            {
                SessionFactoryImpl      sf        = (SessionFactoryImpl)sess.SessionFactory;
                AbstractEntityPersister persister = (AbstractEntityPersister)(sf.GetEntityPersister(entityName));
                Assert.AreEqual("LastName", SimpleLookup.DecomposePath(sf, persister, "LASTNAME", "0"));
                Assert.AreEqual("Address.PostalCode", SimpleLookup.DecomposePath(sf, persister, "ADDRESSID=ADDRESSID.ADDRESS!POSTALCODE", "0"));
                Assert.AreEqual("AccountManager.UserInfo.UserName", SimpleLookup.DecomposePath(sf, persister, "ACCOUNTMANAGERID>USERID.USERINFO!USERNAME", "0"));
            }
        }
Exemple #6
0
        public static CascadingDropDownNameValue[] GetZone(string selectedRegion)
        {
            List <CascadingDropDownNameValue> lst;
            List <LookupValue>      lus;
            Predicate <LookupValue> p = new Predicate <LookupValue>(l => l.RegionID == new Guid(selectedRegion));

            lus = SimpleLookup.Lookup(LookupTypeEnum.Zones).GetList(p);
            lst = new List <CascadingDropDownNameValue>();
            foreach (LookupValue l in lus)
            {
                lst.Add(new CascadingDropDownNameValue(l.Description, l.ID.ToString()));
            }
            return(lst.ToArray());
        }
Exemple #7
0
        public void BindCombo(DropDownList ddl, LookupTypeEnum luType, Predicate <LookupValue> criteria, string defaultText)
        {
            ddl.Items.Clear();

            ddl.Items.Add(new ListItem(defaultText, string.Empty));
            ddl.AppendDataBoundItems = true;

            List <LookupValue> ds = SimpleLookup.Lookup(luType).GetList(criteria);

            ds.Sort(CompareByString);
            ddl.DataSource     = ds;
            ddl.DataTextField  = "Description";
            ddl.DataValueField = "ID";
            ddl.DataBind();
        }
 public OrganizationalStructure AddSubUnit(SimpleLookup unitType, string unitName, bool canAddSubUnit)
 {
     if (!CanAddSubUnit)
     {
         throw new ArgumentOutOfRangeException();
     }
     return(new OrganizationalStructure(Guid.NewGuid())
     {
         OrganizationId = this.OrganizationId,
         Code = this.Code + "." + ShortGuid.GenerateCode(2),
         Name = unitName,
         ParentId = this.Id,
         StructureType = unitType,
         CanAddSubUnit = canAddSubUnit
     });
 }
Exemple #9
0
        /// <summary>
        /// Populates existing information for update purpose, if it is text box then it fills the value
        /// if it is dropdown list then it chooses from one of the alternatives supplied by FillControls() method
        /// </summary>
        private void PopulateExistingData()
        {
            //if (theArrival.IsNew) return;
            GRNStatusNew GRNStatus;

            GRNStatusNew.TryParse(theArrival.GRNStatus.ToString(), out GRNStatus);
            if (GRNStatus == GRNStatusNew.New || GRNStatus == GRNStatusNew.NotCreated)
            {
                btnSave.Enabled = true;
            }
            else
            {
                btnSave.Enabled = false;
                btnSave.ToolTip = "Can't Update Arrival because this step is at " + GRNStatus.ToString() + " Stage";
            }
            if (theArrival.WarehouseID != WarehouseBLL.CurrentWarehouse.WarehouseId)
            {
                Response.Redirect("ErrorPage.aspx");
            }
            try
            {
                lblClient.Text             = theArrival.ClientName;
                lblWarehouse.Text          = WarehouseBLL.CurrentWarehouse.WarehouseName;
                isNonTruck.Checked         = theArrival.IsNonTruck;
                cboCommodity.SelectedValue = theArrival.CommodityID.ToString();
                //chkIsSourceDetermined.Checked = theArrival.IsLocationKnown;
                if (!theArrival.IsLocationKnown)
                {
                    cboRegion.SelectedValue = Guid.Empty.ToString();
                }
                else
                {
                    LookupValue lv = SimpleLookup.Lookup(LookupTypeEnum.Woredas).GetDictionary()[theArrival.WoredaID];
                    cboRegion.SelectedValue = lv.RegionID.ToString();
                    cboRegion_SelectedIndexChanged(this, EventArgs.Empty);
                    cboZone.SelectedValue = lv.ZoneID.ToString();
                    cboZone_SelectedIndexChanged(this, EventArgs.Empty);
                    cboWoreda.SelectedValue = theArrival.WoredaID.ToString();
                    txtSpecificArea.Text    = theArrival.SpecificArea;
                }
                cboProductionYear.SelectedValue = theArrival.ProductionYear.ToString();
                txtProcessingCenter.Text        = theArrival.ProcessingCenter;
                txtNumberOfBags.Text            = theArrival.NumberofBags.ToString() == "0" ? "" : theArrival.NumberofBags.ToString();
                txtWeight.Text = theArrival.VoucherWeight.ToString() == "0" ? "" : theArrival.VoucherWeight.ToString();

                if ("1/1/1901" == theArrival.DateTimeReceived.ToShortDateString() || theArrival.DateTimeReceived.ToShortDateString() == "1/1/0001")
                {
                    txtArrivalDate.Text = "";
                    txtTimeArrival.Text = "";
                }
                else
                {
                    txtArrivalDate.Text = theArrival.DateTimeReceived.ToShortDateString();
                    txtTimeArrival.Text = theArrival.DateTimeReceived.ToShortTimeString();
                }
                txtRemark.Text = theArrival.Remark;
                if (!theArrival.IsNonTruck)
                {
                    chkIsTruckInCompound.Checked = theArrival.IsTruckInCompound;
                    txtDriverName.Text           = theArrival.DriverName;
                    txtLicenseNo.Text            = theArrival.LicenseNumber;
                    txtPlaceIssued.Text          = theArrival.LicenseIssuedPlace;
                    txtPlateNo.Text         = theArrival.TruckPlateNumber;
                    txtTrailerPlateNo.Text  = theArrival.TrailerPlateNumber;
                    txtNoPlomps.Text        = theArrival.VoucherNumberOfPlomps.ToString() == "0" ? "" : theArrival.VoucherNumberOfPlomps.ToString();
                    txtTrailerNoPlomps.Text = theArrival.VoucherNumberOfPlompsTrailer.ToString() == "0" ? "" : theArrival.VoucherNumberOfPlompsTrailer.ToString();
                }
                txtVoucherNo.Text   = theArrival.VoucherNumber;
                hdnHasVoucher.Value = theArrival.HasVoucher.ToString();
                //chkIsBiProduct.Checked = theArrival.IsBiProduct;
                if (Guid.Empty == theArrival.VoucherCommodityTypeID || string.IsNullOrEmpty(theArrival.VoucherCommodityTypeID.ToString()))
                {
                    cboCommodityType.SelectedIndex = 0;
                    cboCommodityType.Enabled       = false;
                }
                else
                {
                    cboCommodityType.SelectedValue = theArrival.VoucherCommodityTypeID.ToString();
                }
            }
            catch (Exception ex)
            {
                //lblMessage.Text = "Failed to populate existing data!";

                Messages.SetMessage("Existing data cannot be retrieved.  Please try again.", WarehouseApplication.Messages.MessageType.Error);
            }
        }
Exemple #10
0
 public void TestGetLookupProperties()
 {
     SimpleLookup.GetLookupProperties("ACCOUNT:Account", "Sage.SalesLogix.Entities.Account, Sage.SalesLogix.Entities");
 }