コード例 #1
0
        public List <EventEntryEntity> Get(int userid)
        {
            List <EventEntryEntity> list = new List <EventEntryEntity>();

            using (var db = new EventDBEntities())
            {
                var records = db.EventEntryMasters.Where(x => x.IsActive == true).ToList();
                foreach (var item in records)
                {
                    EventEntryEntity entity = new EventEntryEntity();
                    entity.Id          = item.Id;
                    entity.TotalAmount = item.TotalAmount;
                    entity.Eventdate   = item.Eventdate;
                    EventEntity event_ = new EventEntity();
                    if (item.EventMaster != null)
                    {
                        event_.Id          = item.EventMaster.Id;
                        event_.Eventname   = item.EventMaster.Eventname;
                        entity.EventMaster = event_;
                    }
                    var isexist = db.EventCustomers.Where(x => x.Eventcustomerid == userid && x.Evententryid == item.Id).FirstOrDefault();
                    if (isexist != null)
                    {
                        list.Add(entity);
                    }
                }
            }

            return(list);
        }
コード例 #2
0
        public bool Update(EventEntryEntity entity)
        {
            bool isupdated = false;

            using (var db = new EventDBEntities())
            {
            }

            return(isupdated);
        }
コード例 #3
0
        public ActionResult Create(FormCollection frm)
        {
            EventEntryEntity entity = new EventEntryEntity();


            entity.Createddate = DateTime.Now;
            entity.Createdby   = Helper.Helper.CurrentLoggedUser.Id;
            entity.Eventid     = Convert.ToInt64(frm["eventid"]);
            entity.Location    = frm["Location"].ToString();
            entity.TotalAmount = Convert.ToDecimal(frm["TotalAmount"]);
            entity.IsActive    = true;

            string eventdatestr = frm["entrydate"].ToString();

            if (eventdatestr != "")
            {
                DateTime evdate = DateTime.ParseExact(eventdatestr, "dd/MM/yyyy", CultureInfo.InvariantCulture);

                entity.Eventdate = evdate;
            }
            List <EventCustomerentity> eventcustlist = new List <EventCustomerentity>();
            var customerlist = frm["rowstr"].ToString();

            if (customerlist != null)
            {
                string[] custstr = customerlist.Split('#');

                foreach (var cust in custstr)
                {
                    var custarr = cust.Split('~');
                    EventCustomerentity eventcustentity = new EventCustomerentity();
                    eventcustentity.Eventcustomerid = Convert.ToInt32(custarr[0]);
                    eventcustentity.Paidamount      = Convert.ToDecimal(custarr[1]);
                    eventcustlist.Add(eventcustentity);
                }
            }

            entity.customerlist = eventcustlist;
            var inserted = obj.Insert(entity);

            if (inserted)
            {
                return(RedirectToAction("Index"));
            }


            return(View());
        }
コード例 #4
0
        public EventEntryEntity Getbyid(int id)
        {
            EventEntryEntity entity = new EventEntryEntity();

            using (var db = new EventDBEntities())
            {
                var record = db.EventEntryMasters.Find(id);
                entity.Id          = record.Id;
                entity.Location    = record.Location;
                entity.TotalAmount = record.TotalAmount;
                entity.Eventid     = record.Eventid;
                entity.Eventdate   = record.Eventdate;


                var custrecords = db.EventCustomers.Where(x => x.Evententryid == id).ToList();
                List <EventCustomerentity> eventcustlist = new List <EventCustomerentity>();
                if (custrecords != null)
                {
                    if (custrecords.Count > 0)
                    {
                        foreach (var item in custrecords)
                        {
                            EventCustomerentity eventcustentity = new EventCustomerentity();
                            eventcustentity.Eventcustomerid = item.Eventcustomerid;
                            UserEntity userentity = new UserEntity();
                            if (item.UserMaster != null)
                            {
                                userentity.Id              = item.UserMaster.Id;
                                userentity.Fullname        = item.UserMaster.Fullname;
                                eventcustentity.UserMaster = userentity;
                            }
                            eventcustentity.Evententryid = item.Evententryid;
                            eventcustentity.Paidamount   = item.Paidamount;
                            eventcustlist.Add(eventcustentity);
                        }
                    }
                    entity.customerlist = eventcustlist;
                }
            }
            return(entity);
        }
コード例 #5
0
        public bool Insert(EventEntryEntity entity)
        {
            bool isinserted = false;

            using (var db = new EventDBEntities())
            {
                EventEntryMaster record = new EventEntryMaster();
                record.Eventid     = entity.Eventid;
                record.Eventdate   = entity.Eventdate;
                record.Createddate = entity.Createddate;
                record.Createdby   = entity.Createdby;
                record.TotalAmount = entity.TotalAmount;
                record.Location    = entity.Location;
                record.Id          = entity.Id;
                record.IsActive    = true;
                db.EventEntryMasters.Add(record);
                db.SaveChanges();
                long evenentryid = record.Id;

                if (evenentryid > 0)
                {
                    if (entity.customerlist != null)
                    {
                        foreach (var item in entity.customerlist)
                        {
                            EventCustomer eventcustrecord = new EventCustomer();
                            eventcustrecord.Eventcustomerid = item.Eventcustomerid;
                            eventcustrecord.Paidamount      = item.Paidamount;
                            eventcustrecord.IsActive        = true;
                            eventcustrecord.Evententryid    = evenentryid;
                            db.EventCustomers.Add(eventcustrecord);
                            db.SaveChanges();
                        }
                    }
                }

                isinserted = true;
            }
            return(isinserted);
        }