/// <summary> /// 页面加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(HouseRentForm), Page); if (!IsPostBack) { frmRoomID.Style.Add("width", "130px"); frmbID.Style.Add("width", "118px"); frmbuild_id.Style.Add("width", "113px"); frmbuild_room.Style.Add("width", "123px"); if (Request.QueryString["todo"] == "1") { frmBackUpDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); frmEntrust_Date.Text = DateTime.Now.ToString("yyyy-MM-dd"); } if (Entity.HouseID > 0) { #region frmStateID.SelectedValue = Entity.StateID.Value.ToString(); if (Entity.aType == 1) { PriceFollowUp.Visible = false; } houseID = Entity.HouseID.ToString(); Prices.Text = Entity.Ohter2ID.ToString(); button_follow.Attributes.Add("onclick", "fbwshow(" + Entity.HouseID + "1)"); if (CheckRolePermission("修改", Entity.OwnerEmployeeID.ToDecimal())) { btnSaveRent.Append("<li><div class=\"buttonActive\"><div class=\"buttonContent\"><button onclick=\"return ClickButs('" + Entity.HouseID.ToString() + "')\" id=\"hf_Buttom\" type=\"button\">保存</button></div></div></li>"); frmMin_priceb.Attributes.Add("onfocus", "show_money('" + Entity.HouseID + "')"); } if (CheckRolePermission("查看实价")) { frmMin_priceb.Attributes.Add("onfocus", "show_money('" + Entity.HouseID + "')"); } BillCs = Entity.BillCode; if (Entity.OwnerEmployeeID > 0) { Employee em = Employee.FindByEmployeeID(Entity.OwnerEmployeeID); frmOperName.Text = "(" + em.Em_id + ")" + em.Em_name; } fexe_date.Text = Entity.Exe_date.ToString(); frmlandlord_tel2.ReadOnly = true; #endregion showAHouse.Attributes.Add("onclick", "ShowRemark('" + Entity.HouseID.ToString() + "');"); showAHouse.Attributes.Add("href", "House/HouseTelForm.aspx?HouseID=" + Entity.HouseID + "&doType=LookTel&NavTabId=" + NavTabId); showAHouse.Attributes.Add("target", "dialog"); showAHouse.Attributes.Add("rel", "TelLookHouseList" + Entity.HouseID.ToString()); showAHouse.Attributes.Add("title", Entity.Shi_id); htlA.HRef = "House/HouseTelForm.aspx?HouseID=" + Entity.HouseID + "&doType=LookTel&NavTabId=" + NavTabId; htlA.Target = "dialog"; htlA.Attributes.Add("onclick", "ShowRemark('" + Entity.HouseID.ToString() + "');"); htlA.Attributes.Add("rel", "TelLookHouseList" + Entity.HouseID.ToString()); htlA.Attributes.Add("title", Entity.Shi_id); if (Current.RoleNames.Contains("信息")) { btnDel.Attributes["style"] = "display:block"; btnDel.HRef += "?OperType=6&doAjax=true&LSH=1&NavTabId=" + NavTabId + "&HouseID=" + Entity.HouseID; } else { frmHouseDicName.ReadOnly = true; } //委托单号判断 if (!CheckRolePermission("修改委托单号", Entity.OwnerEmployeeID.ToDecimal())) { frmorderNum.ReadOnly = true; } } else { #region if (CheckRolePermission("添加")) { btnSaveRent.Append("<li id=\"AddBtnHouseFrom\"><div class=\"buttonActive\"><div class=\"buttonContent\"><button onclick=\"return ClickButs('" + Entity.HouseID.ToString() + "')\" id=\"hf_Buttom\" type=\"button\">保存</button></div></div></li>"); } else { frmHouseDicName.ReadOnly = true; } shi_ids = H_houseinfor.NewHouseCode(); frmshi_id.Text = shi_ids; frmOperName.Text = "(" + Employee.Current.Em_id + ")" + Employee.Current.Em_name; fexe_date.Text = DateTime.Now.ToString(); frmform_bedroom.SelectedIndex = 0; frmform_foreroom.SelectedIndex = 0; BillCs = Employee.Current.OrgCode; #endregion } string OperType = Request.QueryString["OperType"]; string P_LSH = Request.QueryString["LSH"]; string P_HouseID = Request.QueryString["HouseID"]; #region 除操作 if (OperType != null && P_LSH != null) { switch (OperType) { case "1": //删除图片/户型图 h_PicList model_h_PicList = h_PicList.FindByLsh(P_LSH.ToDecimal().Value); h_PicListDel model_h_PicListDel = new h_PicListDel(); model_h_PicListDel.ComID = model_h_PicList.ComID; model_h_PicListDel.EmployeeID = model_h_PicList.EmployeeID; model_h_PicListDel.Exe_date = model_h_PicList.exe_date; model_h_PicListDel.HouseID = model_h_PicList.HouseID; model_h_PicListDel.PicTypeID = model_h_PicList.PicTypeID; model_h_PicListDel.PicURL = model_h_PicList.PicURL; model_h_PicListDel.OrgID = model_h_PicList.OrgID; model_h_PicListDel.DelEmployeeID = Current.EmployeeID.ToInt32(); model_h_PicListDel.DelOrgID = Current.OrgID.ToInt32(); model_h_PicListDel.DelDate = DateTime.Now; model_h_PicListDel.Insert(); Log log = new Log(); log.Action = "删除"; log.Category = "删除房源照片"; log.IP = HttpContext.Current.Request.UserHostAddress; log.OccurTime = DateTime.Now; log.UserID = Convert.ToInt32(Employee.Current.EmployeeID); log.UserName = Employee.Current.Em_name; log.Remark = "房源ID=" + P_HouseID; log.Insert(); DbHelperSQL.ExecuteSql("delete from h_PicList where LSH= " + P_LSH); if (h_PicList.FindCount("HouseID", P_HouseID) <= 0) { H_houseinfor.Meta.Query("update H_houseinfor set HasImage=0 where HouseID=" + P_HouseID); } else { //判断当前人员上传的房源照片(不包括户型图)是否小于5张,如果小于,则需要删除该人员的照片积分 string sql = string.Format("SELECT count(1) FROM h_PicList Where PicTypeID>1 And EmployeeID=" + model_h_PicList.EmployeeID + " And HouseID={0}", P_HouseID); if (Convert.ToInt32(DbHelperSQL.GetSingle(sql)) < 5) { UpdateIntegral("删除房源照片", model_h_PicList.EmployeeID.ToInt32().Value, DateTime.Now, "H_houseinfor", "HouseID", P_HouseID); //判断是否有其他人员上传照片满5张,如果有,则增加照片积分 sql = "select * from h_PicList where EmployeeID<>" + model_h_PicList.EmployeeID + " and HouseID =" + P_HouseID + " and PicTypeID> 1 order by exe_date desc"; List <h_PicList> list_h_PicList = h_PicList.FindAll(sql); if (list_h_PicList.Count >= 5) { if (Entity != null && Entity.Renovation != "毛坯") { UpdateIntegral("上传5张房源照片(租)", list_h_PicList[0].EmployeeID.ToInt32().Value, DateTime.Now, "H_houseinfor", "HouseID", P_HouseID); } } } } StringBuilder sb = new StringBuilder(); sb.Append("<script>$(\"#div_" + P_LSH + "\").hide();alertMsg.correct(\"操作成功!\")</script>"); Response.Write(sb.ToString()); Response.End(); break; case "4": //删除录音 DbHelperSQL.ExecuteSql("update i_InternetPhone set recordUrlDel=0 where phoneID= " + P_LSH); Log l = new Log(); l.Action = "删除"; l.Category = "拨号录音"; l.OccurTime = DateTime.Now; l.Remark = "房源编号:" + Entity.Shi_id; l.Insert(); Response.Write("<script>alertMsg.correct(\"操作成功!\")</script>"); Response.End(); break; case "6": //删除全部照片 List <h_PicList> list_h_PicList_All = h_PicList.FindAllByHouseID(P_HouseID.ToDecimal().Value); foreach (h_PicList item in list_h_PicList_All) { h_PicListDel list_h_PicListDel = new h_PicListDel(); list_h_PicListDel.ComID = item.ComID; list_h_PicListDel.EmployeeID = item.EmployeeID; list_h_PicListDel.Exe_date = item.exe_date; list_h_PicListDel.HouseID = item.HouseID; list_h_PicListDel.PicTypeID = item.PicTypeID; list_h_PicListDel.PicURL = item.PicURL; list_h_PicListDel.OrgID = item.OrgID; list_h_PicListDel.DelEmployeeID = Current.EmployeeID.ToInt32(); list_h_PicListDel.DelOrgID = Current.OrgID.ToInt32(); list_h_PicListDel.DelDate = DateTime.Now; list_h_PicListDel.Insert(); } DbHelperSQL.ExecuteSql("delete from h_PicList where HouseID= " + P_HouseID); H_houseinfor.Update("HasImage=0", "HouseID=" + P_HouseID); Log log1 = new Log(); log1.Action = "删除"; log1.Category = "删除房源照片"; log1.IP = HttpContext.Current.Request.UserHostAddress; log1.OccurTime = DateTime.Now; log1.UserID = Convert.ToInt32(Employee.Current.EmployeeID); log1.UserName = Employee.Current.Em_name; log1.Remark = "房源ID=" + P_HouseID; log1.Insert(); StringBuilder sb1 = new StringBuilder(); sb1.Append("<script>$(\"#div_" + P_LSH + "\").hide();alertMsg.correct(\"操作成功!\")</script>"); Response.Write(sb1.ToString()); Response.End(); break; default: break; } } #endregion DataBinds(); if (frmBackUpDate.Text != "") { frmBackUpDate.Text = Convert.ToDateTime(frmBackUpDate.Text).ToString("yyyy-MM-dd"); } if (frmEntrust_Date.Text != "") { frmEntrust_Date.Text = Convert.ToDateTime(frmEntrust_Date.Text).ToString("yyyy-MM-dd"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["Name"] != null) { //照片分类ID string PicTypeID = Request["PicTypeID"].ToString(); //上传的文件夹 string Path = Request["Path"].ToString(); //上传文件名 string Name = Request["Name"].ToString(); //房源ID string HouseID = Request["HouseID"].ToString(); //人员ID string EmployeeID = Request["EmployeeID"]; if (PicTypeID != "0") { string suburl = ImageHelper.GetDbPath(Path, Name); string allurl = ImageHelper.GetUrl(suburl); h_PicList h_PicList = new h_PicList(); h_PicList.PicURL = suburl; h_PicList.PicTypeID = PicTypeID.ToDecimal().Value; if (string.IsNullOrEmpty(EmployeeID) || EmployeeID == "0") { h_PicList.OrgID = Current.OrgID.ToInt32().Value; h_PicList.EmployeeID = Current.EmployeeID.ToInt32().Value; } else { h_PicList.OrgID = int.Parse(Employee.FindByEmployeeID(Convert.ToDecimal(EmployeeID)).OrgID.ToString()); h_PicList.EmployeeID = int.Parse(EmployeeID); } h_PicList.HouseID = HouseID.ToDecimal().Value; h_PicList.Insert(); Log log1 = new Log(); log1.Action = "上传房源照片"; log1.Category = "上传房源照片"; log1.IP = HttpContext.Current.Request.UserHostAddress; log1.OccurTime = DateTime.Now; log1.UserID = Convert.ToInt32(Employee.Current.EmployeeID); log1.UserName = Employee.Current.Em_name; log1.Remark = string.Format("房源ID={0},房源编号={1}", HouseID, H_houseinfor.FindByHouseID(HouseID.ToInt32()).Shi_id); log1.Insert(); H_houseinfor hh = H_houseinfor.FindByHouseID(HouseID.ToDecimal().Value); if (hh != null) { hh.Update_date = DateTime.Now; hh.HasImage = true; hh.Update(); #region 出租积分 上传满5张照片即有积分 //租房并且不是毛坯有积分 if (hh.aType == 1 && hh.Renovation != "毛坯") { string sql = string.Format(@"SELECT count(1) FROM h_PicList Where PicTypeID>1 And EmployeeID={0} And HouseID={1}", Employee.Current.EmployeeID, HouseID); if (EntityUtils.DBUtility.DbHelperSQL.GetSingle(sql).ToInt32() >= 5) { UpdateIntegral("上传5张房源照片(租)", DateTime.Now, "H_houseinfor", "HouseID", HouseID); } } #endregion } Response.Write(allurl + "|" + Employee.Current.OrgCode + Employee.Current.OrgName + "-" + Employee.Current.Em_id + Employee.Current.Em_name + " 日期:" + DateTime.Now.ToString()); } else { //if (CheckRolePermission("上传全景照片")) //{ //h_PicList.Meta.Query("insert into h_AllViewPic(Url,EmployeeID,HouseID) values('/UploadFiles/housePIC/" + Request["Name"] + "'," + Employee.Current.EmployeeID + "," + Request["HouseID"] + ")"); //H_houseinfor.Meta.Query("update H_houseinfor set HasImage=1 where HouseID=" + Request["HouseID"]); //h_FollowUp En = new h_FollowUp(); //En.HouseID = Convert.ToDecimal(Request["HouseID"]); //En.EmployeeID = Employee.Current.EmployeeID; //En.FollowUpText = "添加全景照片"; //En.exe_Date = DateTime.Now; //En.Insert(); //UpdateIntegral("添加全景照片", DateTime.Now, "h_AllViewPic", "HouseID", Request["HouseID"]); //Response.Write(Employee.Current.OrgCode + Employee.Current.OrgName + "-" + Employee.Current.Em_id + Employee.Current.Em_name + " 日期:" + DateTime.Now.ToString()); //} //else //{ Response.Write("2"); //} } } } }