public ActionResult DeleteInfo() { string ids = Request["ids"]; try { string strwhere = " id in(" + ids + ")"; Business.Sys_FlowerTreatment Sys_FlowerTreatment = new Business.Sys_FlowerTreatment(); List <Model.FlowerTreatment> list = Sys_FlowerTreatment.FlowerTreatmentList(strwhere); foreach (var item in list) { if (Sys_FlowerTreatment.DeleteInfo(item.id.ToString())) { if (item.Photo != null && !string.IsNullOrEmpty(item.Photo)) { DeleteFlowerPhoto(item.Photo); } if (item.ChangePhoto != null && !string.IsNullOrEmpty(item.ChangePhoto)) { DeleteFlowerPhoto(item.ChangePhoto); } } } return(Content("1")); } catch (Exception ex) { return(Content("0")); } }
/// <summary> /// 养护记录更多 /// </summary> /// <returns></returns> public ActionResult GetMobleListMore() { Business.Sys_FlowerTreatment Sys_FlowerTreatment = new Business.Sys_FlowerTreatment(); StringBuilder sb = new StringBuilder(); Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin(); Model.UserAdmin UserAdmin = Sys_UserAdmin.GetUserAdminByUserId(Utility.ChangeText.GetUsersId()); if (UserAdmin.RoleCode != "Customer") { sb.Append(" and UsersId='" + Utility.ChangeText.GetUsersId() + "'"); } else if (Utility.ChangeText.GetUserName() != "admin") { sb.Append(" and OwnedUsersId='" + Utility.ChangeText.GetUsersId() + "'"); } Utility.Log.WriteTextLog("testsql", "养护", "GetMobleListMore", Request["page"], sb.ToString()); int page = int.Parse(Request["page"]); //(@pagesize*(@pagenumber-1)+1) and (@pagesize*@pagenumber)按第几页 if (page > 1) { page = (page - 1) * 10 + 1;//按偏移量 } List <Model.FlowerTreatment> List = Sys_FlowerTreatment.FlowerTreatmentList(10, Convert.ToInt32(page), sb.ToString()); return(Json(List, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 手机端养护记录 /// </summary> /// <returns></returns> public ActionResult MIndex() { Business.Sys_FlowerTreatment Sys_FlowerTreatment = new Business.Sys_FlowerTreatment(); StringBuilder sb = new StringBuilder(); Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin(); Model.UserAdmin UserAdmin = Sys_UserAdmin.GetUserAdminByUserId(Utility.ChangeText.GetUsersId()); if (UserAdmin.RoleCode != "Customer") { sb.Append(" and UsersId='" + Utility.ChangeText.GetUsersId() + "'"); } else if (Utility.ChangeText.GetUserName() != "admin") { sb.Append(" and OwnedUsersId='" + Utility.ChangeText.GetUsersId() + "'"); } return(View(Sys_FlowerTreatment.FlowerTreatmentList(10, 1, sb.ToString()))); }
/// <summary> /// 养护花卉列表 /// </summary> /// <param name="limit">条数</param> /// <param name="offset">偏移量</param> /// <param name="UsersSelectItems">养护人</param> /// <param name="deptSelectItems">养护客户的名称</param> /// <returns></returns> public ActionResult GetList(int limit, int offset, string UsersSelectItems, string deptSelectItems, string time) { Business.Sys_FlowerTreatment Sys_FlowerTreatment = new Business.Sys_FlowerTreatment(); StringBuilder sb = new StringBuilder(); //sb.Append(" and OwnedUsersId='"+Utility.ChangeText.GetUsersId()+"' "); if (!string.IsNullOrEmpty(UsersSelectItems)) { sb.Append(" and UsersId='" + UsersSelectItems + "'"); } if (!string.IsNullOrEmpty(deptSelectItems)) { sb.Append(" and OwnedUsersId='" + deptSelectItems + "'"); } if (!string.IsNullOrEmpty(time)) { sb.Append(" and substring(Convert(varchar,time,120),1,10)='" + time + "'"); } return(Json(new { total = Sys_FlowerTreatment.GetFlowerTreatmentListCount(sb.ToString()), rows = Sys_FlowerTreatment.FlowerTreatmentList(limit, offset, sb.ToString()) }, JsonRequestBehavior.AllowGet)); }
public ActionResult ConservationFlowers(Model.FlowerTreatment FlowerTreatment) { try { string x = string.Empty, y = string.Empty, strReturn = string.Empty; string apiurl = "http://api.map.baidu.com/geoconv/v1/?coords=" + Request["longitude"] + "," + Request["latitude"] + "&from=1&to=5&ak=Kl3rqGn6gECfy7mH5rS3fkGkaWYiyVlr"; string detail = Utility.PostData.GetData(apiurl); ERP.MobleControllers.MMainController.BaiDuCoordinates jd = JsonConvert.DeserializeObject <ERP.MobleControllers.MMainController.BaiDuCoordinates>(detail); List <ERP.MobleControllers.MMainController.bc_result> result = jd.result; foreach (var item in result) { x = item.x; y = item.y; } apiurl = "http://api.map.baidu.com/geocoder/v2/?ak=Kl3rqGn6gECfy7mH5rS3fkGkaWYiyVlr&callback=renderReverse&location=" + y + "," + x + "&output=json&pois=1"; detail = Utility.PostData.GetData(apiurl); detail = detail.Replace("renderReverse&&renderReverse(", ""); detail = detail.TrimEnd(')'); ERP.MobleControllers.MMainController.GetAddressNew GetAddress = JsonConvert.DeserializeObject <ERP.MobleControllers.MMainController.GetAddressNew>(detail); Utility.Log.WriteTextLog("返回定位", "花卉养护当前地址", GetAddress.result.formatted_address, "detail", detail); Business.Sys_UserAdmin Sys_UserAdmin = new Business.Sys_UserAdmin(); Business.Sys_FlowerTreatment Sys_FlowerTreatment = new Business.Sys_FlowerTreatment(); int userid = Utility.ChangeText.GetUsersId(); FlowerTreatment.FlowerTreatmentType = "养护花卉"; FlowerTreatment.UsersId = userid; FlowerTreatment.OwnedUsersId = Request["deptSelectItems"]; FlowerTreatment.UserRealName = Utility.ChangeText.GetRealName(); FlowerTreatment.FlowerTreatmentAddress = GetAddress.result.formatted_address; Model.UserAdmin UserAdmin = Sys_UserAdmin.GetUserAdminByUserId(Convert.ToInt32(FlowerTreatment.OwnedUsersId)); FlowerTreatment.OwnedUsersRealName = UserAdmin.RealName; FlowerTreatment.OwnedCompany = UserAdmin.OwnedCompany; FlowerTreatment.LogoPhoto = UserAdmin.LogoPhoto; //同一登录人,同一公司,一天只能提交一次 StringBuilder stb = new StringBuilder(); if (userid != 0) { stb.Append(" t.UsersId=" + userid + ""); } if (!string.IsNullOrEmpty(FlowerTreatment.OwnedUsersId)) { stb.Append(" and t.OwnedUsersId='" + FlowerTreatment.OwnedUsersId + "'"); } string dt = DateTime.Now.ToShortDateString(); { stb.Append(" and time>'" + dt + "'"); } if (Sys_FlowerTreatment.FlowerTreatmentList(stb.ToString()).Count == 0) { Sys_FlowerTreatment.InsertFlowerTreatment(FlowerTreatment); return(Content("1")); } else { return(Content("0")); } } catch (Exception ex) { Utility.Log.WriteTextLog("返回定位错误", "ConservationFlowers", "养护花卉", "post方法", ex.ToString()); return(View()); } }