//工长加入装修案例 public int AddWebBuiding(WebBuiding webBuiding) { using (AIYunNetContext context = new AIYunNetContext()) { context.WebBuiding.Add(webBuiding); DecDemand dec = context.DecDemand.Find(webBuiding.DemandID); if (dec != null) { dec.IsPlan = true; } context.SaveChanges(); if (webBuiding.constructionstageID != null) { WebBuiding org = GetWebBuidingByDemandID(webBuiding.DemandID); List <string> listid = webBuiding.constructionstageID.Split(',').Where(c => c != "").ToList(); List <string> listStage = webBuiding.constructionstage.Split(',').Where(c => c != "").ToList(); int i = 0; foreach (string id in listid) { WebBuidingStages stage = new WebBuidingStages { WebBuidingID = org.BuidingID, StageID = Convert.ToInt32(id), StageName = listStage[i], sortID = i }; context.WebBuidingStages.Add(stage); i++; } context.SaveChanges(); } return(1); } }
//选他装修 public int SelectWorker(int id) { using (AIYunNetContext context = new AIYunNetContext()) { DecTender tender = new DecTender(); DemandService denSer = new DemandService(); tender = context.DecTender.Find(id); if (tender != null) { tender.IsAccept = 1; DecDemand demand = context.DecDemand.FirstOrDefault(c => c.Guid == tender.Guid); demand.IsAccept = 0; demand.GetUserID = tender.UserID; demand.GetUserType = "WebUser"; demand.EditOn = DateTime.Now; List <DecTender> list = context.DecTender.Where(c => c.Guid == tender.Guid && c.UserID != tender.UserID).ToList(); if (list != null) { foreach (var item in list) { item.IsAccept = 2; item.EditOn = DateTime.Now; } } context.SaveChanges(); return(1); } else { return(0); } } }
public ActionResult TenderPersonList(string guid) { DecDemand demand = deSer.GetDecDemandByGuID(guid); List <DecTender> list = tenSer.GetDecTenderList(guid); ViewBag.list = list; return(View(demand)); }
public ActionResult mTogetherBuidingDetail(int BuidingID = 0, int StageID = 0, int togetherid = 0) { WebBuiding buiding = buidSer.GetWebBuidingByID(BuidingID); WebBuidingStages stage = stageSer.GetBuidingStageByBuidingIDAndStageID(BuidingID, StageID); DecDemand demand = deSer.GetDecDemandByGuID(buiding.Guid); ViewBag.stage = stage; ViewBag.demand = demand; return(View(buiding)); }
public ActionResult WorkerTenderDetail(string guid) { DecDemand demand = deSer.GetDecDemandByGuID(guid); ViewBag.demand = demand; int userid = Convert.ToInt32(SessionHelper.Get("UserID")); DecTender tender = tenSer.GetTender(guid, userid); ViewBag.tender = tender; return(View()); }
public ActionResult DemandIndex(int id = 0) { DecDemand demand = demandSer.GetDecDemandByID(id); if (demand.PublishuserID != 0) { WebUser user = UserSer.GetWebUserByID(demand.PublishuserID); ViewBag.user = user; } return(View(demand)); }
public DecDemand GetDecDemandByID(int id) { using (AIYunNetContext context = new AIYunNetContext()) { DecDemand model = new DecDemand(); if (id != 0) { model = context.DecDemand.Find(id); } return(model); } }
public DecDemand GetDecDemandByGuID(string guid) { using (AIYunNetContext context = new AIYunNetContext()) { DecDemand model = new DecDemand(); if (guid != "") { model = context.DecDemand.FirstOrDefault(c => c.Guid == guid); } return(model); } }
public ActionResult updateAndAddDemand(DecDemand demand) { int ret = 0; if (demand.id > 0) { ret = DeSer.UpdateDecDemand(demand); } else { ret = DeSer.AddDecDemand(demand); } return(Json(new { RetCode = ret })); }
public ActionResult updateDemandDetail(DecDemand dec) { int ret = 0; if (dec.id == 0) { ret = deSer.AddDecDemand(dec); } else { ret = deSer.UpdateDecDemand(dec); } return(Json(new { RetCode = ret })); }
public ActionResult decDemandDetail(int id = 0, string Guid = "") { DecDemand dec = new DecDemand(); if (id != 0 && Guid == "") { dec = deSer.GetDecDemandByID(id); } else if (Guid != "" && id == 0) { dec = deSer.GetDecDemandByGuID(Guid); } return(View(dec)); }
//只修改GetUserID public int UpdateDecDemandGetUser(DecDemand DecDemand) { using (AIYunNetContext context = new AIYunNetContext()) { DecDemand old = context.DecDemand.Find(DecDemand.id); if (old != null) { old.GetUserID = DecDemand.GetUserID; old.GetUserType = DecDemand.GetUserType; context.SaveChanges(); } return(1); } }
public JsonResult DeleteDemand(int id) { int ret = 0; DecDemand dec = DeSer.GetDecDemandByID(id); if (dec.IsPlan) { ret = 2; } else { ret = DeSer.DeleteDecDemand(id); } return(Json(new { RetCode = ret })); }
public ActionResult DecWorkerBuidingDetail(int WorkerID = 0, int BuidingID = 0) { WebWorker worker = webworkerService.GetWebWorkerByID(WorkerID); //WebBuidingSingle buidingSingle = WebBuidingSingleSer.GetWebBuidingSingleByID(BuidingSingleID); WebBuiding buiding = webbuidingSer.GetWebBuidingByID(BuidingID); DecDemand demand = DemandSer.GetDecDemandByID(buiding.DemandID); //工人在constructionstageID中只有单个id WebBuidingStages buidingstage = WebBuidingStagesSer.GetWebBuidingStagesByID(BuidingID, Convert.ToInt32(buiding.constructionstageID.Replace(",", ""))); ViewBag.buiding = buiding; ViewBag.buidingstage = buidingstage; ViewBag.demand = demand; ViewBag.worker = worker; return(View(worker)); }
public int DeleteDecDemand(int id) { using (AIYunNetContext context = new AIYunNetContext()) { DecDemand original = context.DecDemand.Find(id); if (original != null) { original.IsDelete = true; original.DeleteOn = DateTime.Now; context.SaveChanges(); return(1); } else { return(0); } } }
//只修改GetUserID public int UpdateIsAccept(DecDemandAccept acc) { using (AIYunNetContext context = new AIYunNetContext()) { DecDemandAccept old = context.DecDemandAccept.FirstOrDefault(c => c.DemandGuid == acc.DemandGuid); if (old != null) { old.IsAccept = acc.IsAccept; } DecDemand dec = context.DecDemand.FirstOrDefault(c => c.Guid == acc.DemandGuid); dec.GetUserType = "WebUser"; dec.GetUserID = acc.GetUserID; dec.IsAccept = acc.IsAccept; context.SaveChanges(); return(1); } }
public ActionResult BuidingDetailUser(int BuidingID = 0, string Guid = "") { WebBuiding buiding = new WebBuiding(); if (BuidingID != 0) { buiding = buidSer.GetWebBuidingByID(BuidingID); } if (Guid != "") { buiding = buidSer.GetWebBuidingByGuID(Guid); } List <WebBuidingStages> stageslist = stageSer.GetWebBuidingStagesListByBuiding(buiding.BuidingID); DecDemand demand = deSer.GetDecDemandByGuID(buiding.Guid); ViewBag.stageslist = stageslist; ViewBag.demand = demand; return(View(buiding)); }
public int IsOutByGuID(int GetUserID, string guid) { using (AIYunNetContext context = new AIYunNetContext()) { DecDemand model = new DecDemand(); if (guid != "") { model = context.DecDemand.FirstOrDefault(c => c.Guid == guid); } model.IsOut = true; WebBuiding buiding = context.WebBuiding.FirstOrDefault(c => c.Guid == guid); if (buiding != null) { context.WebBuiding.Remove(buiding); } context.SaveChanges(); return(1); } }
//添加需求时同时添加对谁的需求 public int AddDecDemand(DecDemand DecDemand) { using (AIYunNetContext context = new AIYunNetContext()) { if (DecDemand.GetUserID != 0) { DecDemandAccept acc = new DecDemandAccept(); acc.DemandGuid = DecDemand.Guid; acc.GetUserID = DecDemand.GetUserID; acc.PublicUserID = DecDemand.PublishuserID; acc.IsAccept = 0; DecDemandAcceptService ser = new DecDemandAcceptService(); ser.AddDecDemandAccept(acc); } DecDemand.IsAccept = 0; DecDemand.GetUserID = DecDemand.GetUserID; DecDemand.GetUserType = ""; context.DecDemand.Add(DecDemand); context.SaveChanges(); return(1); } }
//案例详情 // GET: MobileApp/MoblieBuiding public ActionResult mBuidingDetail(int id) { WebBuiding buiding = buidSer.GetWebBuidingByID(id); DecDemand demand = DemandSer.GetDecDemandByID(buiding.DemandID); WebBuidingStages buidingstage = new WebBuidingStages(); //工人在constructionstageID中只有单个id if (buiding.constructionstageID != "" && buiding.constructionstageID != null) { buidingstage = WebBuidingStagesSer.GetWebBuidingStagesByID(id, Convert.ToInt32(buiding.constructionstageID.Replace(",", ""))); } if (buidingstage == null) { buidingstage = new WebBuidingStages(); } List <WebBuidingStages> stageslist = WebBuidingStagesSer.GetWebBuidingStagesListByBuiding(buiding.BuidingID); ViewBag.stageslist = stageslist; //ViewBag.buidingstage = buidingstage; ViewBag.demand = demand; return(View(buiding)); }
public ActionResult OrderDetail(string guid) { DecDemand demand = deSer.GetDecDemandByGuID(guid); return(View(demand)); }
public ActionResult Demanddetail(int id) { DecDemand demand = DeSer.GetDecDemandByID(id); return(View(demand)); }
public ActionResult updateAndAddDemand(int id = 0) { DecDemand demand = DeSer.GetDecDemandByID(id); return(View(demand)); }
public int UpdateDecDemand(DecDemand DecDemand) { using (AIYunNetContext context = new AIYunNetContext()) { DecDemand old = context.DecDemand.Find(DecDemand.id); DecDemandAcceptService ser = new DecDemandAcceptService(); DecDemandAccept accold = ser.GetAcceptByGuid(DecDemand.Guid); WebBuidingService buidingSer = new WebBuidingService(); if (old != null) { if (DecDemand.GetUserID != 0) { if (accold != null) { DecDemandAccept oldacc = context.DecDemandAccept.FirstOrDefault(c => c.DemandGuid == accold.DemandGuid); oldacc.GetUserID = DecDemand.GetUserID; oldacc.PublicUserID = DecDemand.PublishuserID; oldacc.IsAccept = 0; } else { DecDemandAccept acc = new DecDemandAccept(); acc.DemandGuid = DecDemand.Guid; acc.GetUserID = DecDemand.GetUserID; acc.PublicUserID = DecDemand.PublishuserID; acc.IsAccept = 0; ser.AddDecDemandAccept(acc); } } old.IsAccept = 0; old.GetUserID = DecDemand.GetUserID; old.ownername = DecDemand.ownername; old.ownertel = DecDemand.ownertel; old.ProvinceID = DecDemand.ProvinceID; old.ProvinceName = DecDemand.ProvinceName; old.OneSentence = DecDemand.OneSentence; old.IsPublish = DecDemand.IsPublish; old.Info = DecDemand.Info; old.EditOn = DateTime.Now; old.DemandType = DecDemand.DemandType; old.DemandTypeName = DecDemand.DemandTypeName; old.CityID = DecDemand.CityID; old.CityName = DecDemand.CityName; old.buidingSpace = DecDemand.buidingSpace; old.buidingname = DecDemand.buidingname; old.HouseType = DecDemand.HouseType; old.IsPlan = false; old.IsOut = false; WebBuiding buiding = buidingSer.GetWebBuidingByGuID(DecDemand.Guid); if (buiding != null) { buidingSer.DeleteWebBuiding(buiding.BuidingID); } context.SaveChanges(); } return(1); } }