public bool Add(DonationProject newModel,string goodyName, string goodyDesc, string goodyNum, string goodyPrice, string ddlCurrency)
 {
     if (null == newModel)
     {
         return false;
     }
     else
     {
         IDonationProjectRepository iProjectRepos = IoCContext.Container.Resolve<IDonationProjectRepository>();
         AddProjectGoody(goodyName, goodyDesc, goodyNum, goodyPrice, ddlCurrency, newModel);
         int count = iProjectRepos.Add(newModel, false);
         return count > 0;
     }
 }
Beispiel #2
0
        private void FixupDonationProject(DonationProject previousValue, bool skipKeys = false)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.Goodies.Contains(this))
            {
                previousValue.Goodies.Remove(this);
            }

            if (DonationProject != null)
            {
                if (!DonationProject.Goodies.Contains(this))
                {
                    DonationProject.Goodies.Add(this);
                }

                ProjectId = DonationProject.ProjectId;
            }
            else if (!skipKeys)
            {
                ProjectId = null;
            }

            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("DonationProject")
                    && (ChangeTracker.OriginalValues["DonationProject"] == DonationProject))
                {
                    ChangeTracker.OriginalValues.Remove("DonationProject");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("DonationProject", previousValue);
                }
                if (DonationProject != null && !DonationProject.ChangeTracker.ChangeTrackingEnabled)
                {
                    DonationProject.StartTracking();
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the DonationProjects EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDonationProjects(DonationProject donationProject)
 {
     base.AddObject("DonationProjects", donationProject);
 }
Beispiel #4
0
 /// <summary>
 /// Create a new DonationProject object.
 /// </summary>
 /// <param name="projectId">Initial value of the ProjectId property.</param>
 public static DonationProject CreateDonationProject(global::System.Int32 projectId)
 {
     DonationProject donationProject = new DonationProject();
     donationProject.ProjectId = projectId;
     return donationProject;
 }
        internal void AddProjectGoody(string goodyName, string goodyDesc, string goodyNum, string goodyPrice, string ddlCurrency,DonationProject projectModel)
        {
            if (!string.IsNullOrEmpty(goodyName)
                && !string.IsNullOrEmpty(goodyDesc)
                && !string.IsNullOrEmpty(goodyNum)
                && !string.IsNullOrEmpty(goodyPrice)
                && !string.IsNullOrEmpty(ddlCurrency)
               )
            {

                string[] arrayName = goodyName.Split(',');
                string[] arrayDesc = goodyDesc.Split(',');
                string[] arrayNum = goodyNum.Split(',');
                string[] arrayPrice = goodyPrice.Split(',');

                for (int i = 0; i < arrayNum.Length; i++)
                {
                    int num = 0;
                    bool isLimited = false;
                    if (int.TryParse(arrayNum[i], out num))
                    {
                        isLimited = true;
                    }
                    Goody model = new Goody
                    {

                        Num = num,
                        Price = decimal.Parse(arrayPrice[i]),
                        Title = arrayName[i],
                        CurrencyStr = ddlCurrency,
                        ProjectId = projectModel.ProjectId,
                        Description = arrayDesc[i],
                        SaleNum = 0,
                        IsLimit = isLimited
                    };
                    projectModel.Goodies.Add(model);
                }
            }
        }