public void binding() { int eid; int.TryParse(Session["userid"].ToString(),out eid); string status="Ready"; DateTime date=DateTime.Today.AddDays(1); obj = service.getAllCollectionItemByDepIdStatusDate(eid, status, date); gvRep.DataSource = obj; gvRep.DataBind(); if (obj.Count > 0) { btnConfirm.Visible = true; dept = service.getDNameByEid(eid); cp = service.getAllCollectionPointByDeptID(dept.DepID); lblAddress.Text = cp.CollectionPointAddress; lblTime.Text = "Collection Time : " + cp.CollectionPointTime; lblDate.Text = "Collection Date : " + cp.CollectionPointDate; divmap.Visible = true; lblAdd.Visible = true; lblAddress.Visible = true; tot_content.Visible = true; template.Visible = true; } else { //btnConfirm.Visible = false; //divmap.Visible = false; //lblAdd.Visible = false; //lblAddress.Visible = false; tot_content.Visible = false; noContent.Visible = true; template.Visible = false; } }
public bool updateCollectionDateByCPID(int cpid,string date) { try { collectionPoint cp = new collectionPoint(); cp = (from d in cntx.collectionPoints where d.CollectionPointID == cpid select d).FirstOrDefault(); cp.CollectionPointDate = date; cntx.SaveChanges(); return true; } catch (Exception ex) { throw ex; } }