示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string act = string.Empty;
                if (CheckRolePermission("还原"))
                {
                    act += "<li><a class=\"add\" href=\"House/HouseRecover.aspx?NavTabId=" + NavTabId + "&doAjax=true&doType=del&ID={ID}\" rel=\"ids\" target=\"selectedTodo\" title=\"确定要还原房源吗?\"><span>房源还原</span></a></li>";
                }
                this.LiteralID.Text = act;
                if (Request.QueryString["doType"] != null)
                {
                    if (Request.QueryString["doType"] == "del")
                    {
                        if (CheckRolePermission("还原"))
                        {
                            if (!String.IsNullOrEmpty(Request["ids"]))
                            {
                                foreach (string s in Request["ids"].Split(','))
                                {
                                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                                    H_houseinfor h = H_houseinfor.FindByHouseID(Convert.ToDecimal(s));
                                    if (h != null && CheckRolePermission("还原", h.OwnerEmployeeID.ToDecimal()))
                                    {
                                        h.DelType = false;
                                        h.Update();
                                    }
                                }
                            }
                            JSDo_UserCallBack_Success(" formFind();$(\".HouseRecover:eq(0)\").submit();", "操作成功");
                        }
                        else
                        {
                            JSDo_UserCallBack_Success(" formFind();$(\".HouseRecover:eq(0)\").submit();", "操作失败,您没有还原房源的权限!");
                        }
                    }
                }
                FullDropListData(typeof(h_State), this.ffrmStateID, "Name", "StateID", null, null);
                FullAreaDropListData(mysfrmAreaID, "-请选择-", "");
                FullDropListData(typeof(h_Year), this.ffrmYearID, "Name", "YearID", "");
                FullDropListData(typeof(h_Fitment), this.myffrmFitmentID, "Name", "FitmentID", "");
                FullDropListData(typeof(h_Type), this.ffrmTypeCode, "Name", "TypeCode", "");
                string OperType = Request.QueryString["OperTypes"];
                if (OperType != null)
                {
                    string HouseID = Request["HouseID"];
                    if (HouseID == null)
                    {
                        HouseID = "";
                    }
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    switch (OperType)
                    {
                    case "3":     //推见房源
                        s_SysParam ss = s_SysParam.FindByParamCode("RecommendNum");
                        TCode.DataAccessLayer.SelectBuilder sbs = new TCode.DataAccessLayer.SelectBuilder();
                        sbs.Table = "h_Recommend";
                        sbs.Where = "CONVERT(varchar,exe_date,112)=CONVERT(varchar,getdate(),112) and EmployeeID=" + Employee.Current.EmployeeID.ToString();
                        int hrs = h_Recommend.Meta.QueryCount(sbs);
                        if (hrs < Convert.ToInt32(ss.Value))
                        {
                            H_houseinfor.Meta.Query("update h_houseInfor set update_date=getdate() where HouseID = " + HouseID);
                            h_Recommend Hr = new h_Recommend();
                            Hr.EmployeeID = Employee.Current.EmployeeID;
                            Hr.HouseID    = Convert.ToDecimal(HouseID);
                            Hr.Insert();
                        }
                        else
                        {
                            sb.Append("{\r\n");
                            sb.Append("   \"statusCode\":\"300\", \r\n");
                            sb.Append("   \"message\":\"操作失败,您今天房源的推荐数已满请明天再试!\" \r\n");
                            sb.Append("}\r\n");
                            Response.Write(sb.ToString());
                            Response.End();
                        }
                        break;

                    case "4":     //收藏房源
                        H_houseinfor.Meta.Query("if not exists(select 1 from h_HouseCollect where HouseID=" +
                                                HouseID + " and EmployeeID=" +
                                                HouseMIS.EntityUtils.Employee.Current.EmployeeID.ToString() + ") insert into h_HouseCollect(HouseID,EmployeeID) Values(" +
                                                HouseID + "," + HouseMIS.EntityUtils.Employee.Current.EmployeeID.ToString() + ")");
                        break;

                    case "5":     //取消收藏房源
                        H_houseinfor.Meta.Query("delete from h_HouseCollect where HouseID=" +
                                                HouseID + " and EmployeeID=" +
                                                HouseMIS.EntityUtils.Employee.Current.EmployeeID.ToString());
                        break;
                        //case "6": //查看钥匙
                        //    DataTable dt = h_HouseKey.Meta.Query("SELECT TOP 1 H.IsIn,S.Name,H.InOhterCompany FROM h_HouseKey H LEFT JOIN s_Organise S ON S.OrgID = H.OrgID WHERE H.HouseID = " + HouseID + " ORDER BY H.exe_date DESC").Tables[0];

                        //    if (dt.Rows.Count > 0)
                        //    {
                        //        if (Convert.ToBoolean(dt.Rows[0][0]) == true)
                        //        {
                        //            if (dt.Rows[0]["InOhterCompany"].ToString() == "True")
                        //                //Response.Write("<script>alertMsg.correct('钥匙在其他中介')</script>");
                        //                JSDo_UserCallBack_Success("", "钥匙在其他中介");
                        //            else
                        //                //Response.Write("<script>alertMsg.correct('钥匙在" + dt.Rows[0][1] + "')</script>");
                        //                JSDo_UserCallBack_Success("", "钥匙在" + dt.Rows[0][1]);
                        //        }
                        //        else
                        //            //Response.Write("<script>alertMsg.correct('该房源没有拿钥匙!')</script>");
                        //            JSDo_UserCallBack_Error("", "该房源没有拿钥匙");
                        //    }
                        //    else
                        //    {
                        //        //Response.Write("<script>alertMsg.correct('该房源没有拿钥匙!')</script>");
                        //        JSDo_UserCallBack_Error("", "该房源没有拿钥匙");
                        //    }

                        //    //Response.End();
                        //    break;
                    }
                    sb.Append("{\r\n");
                    sb.Append("   \"statusCode\":\"200\", \r\n");
                    sb.Append("   \"message\":\"操作成功!\" \r\n");
                    sb.Append("}\r\n");
                    Response.Write(sb.ToString());
                    Response.End();
                }
                if (Request.QueryString["doType"] != null)
                {
                    if (Request.QueryString["doType"] == "del")
                    {
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        H_houseinfor.Meta.Query("delete from h_houseinfor where HouseID=" + Request["HouseID"]);
                        sb.Append("{\r\n");
                        sb.Append("   \"statusCode\":\"200\", \r\n");
                        sb.Append("   \"message\":\"操作成功!\" \r\n");
                        sb.Append("}\r\n");
                        Response.Write(sb.ToString());
                        Response.End();
                    }
                }
            }
        }
示例#2
0
        //public s_SysParam hsc = s_SysParam.FindByParamCode("HouseStateColor");

        //protected String GetColStyle(object SeeHouseType)
        //{
        //    if (hsc != null)
        //    {
        //        string[] ss = hsc.Value.Split(',');
        //        foreach (string sv in ss)
        //        {
        //            string[] str = sv.Split('|');
        //            if (str[0] == SeeHouseType.ToString() && str[1] != "")
        //            {
        //                return " style=\"color:#" + str[1] + "\" ";
        //            }
        //        }
        //    }
        //    return null;
        //}

        /// <summary>
        /// 页面状态下拉框绑定
        /// </summary>
        /// <returns></returns>
        //public void HouseState()
        //{
        //    IEntityList ls = h_State.FindAll();
        //    this.ffrmState.Items.Clear();
        //    ffrmState.Items.Add(new ListItem("请选择", ""));
        //    if (ls != null)
        //    {
        //        for (int i = 0; i < ls.Count; i++)
        //        {
        //            ffrmState.Items.Add(new ListItem(ls[i]["Name"].ToString(), ls[i]["StateID"].ToString()));
        //        }
        //    }
        //}

        //protected void FullSubGroup()
        //{
        //EntityList<e_SubGroup> list = e_SubGroup.FindAll();
        //myffrmSubGroupID.Items.Add(new ListItem("", ""));
        //foreach (e_SubGroup es in list)
        //{
        //    myffrmSubGroupID.Items.Add(new ListItem(es.People, es.SubGroupID.ToString()));
        //}
        //}

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(HouseCheck), this.Page);
                if (!CheckRolePermission("查看"))
                {
                    Response.End();
                }

                //if (Request.QueryString["AssessStateID"] != null)
                //{
                //    if (!String.IsNullOrEmpty(Request["hcids"]))
                //        foreach (string s in Request["hcids"].Split(','))
                //        {
                //            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                //            H_houseinfor hh = H_houseinfor.FindByHouseID(Convert.ToDecimal(s));
                //            h_AssessState ha = h_AssessState.Find(h_AssessState._.AssessStateID, Request.QueryString["AssessStateID"]);
                //            if (ha != null && hh != null && ha.aType == hh.aType)
                //            {
                //                hh.AssessStateID = Request.QueryString["AssessStateID"].ToInt32();
                //                hh.Update();

                //                #region 刷新当前页[抓取当页导航数字onclick事件]

                //                // 当前页
                //                // 翻页  dwzPageBreak({ targetType: targetType, rel: rel, data: { pageNum: event.data.pageNum} });
                //                //String JavaScript = "alert('" + Request["selectPage"] + "');";
                //                String JavaScript = " dwzPageBreak({ targetType: \"navTab\", rel: \"\", data: { pageNum: " + Request["selectPage"] + "},callback:ShowNote });";
                //                JSDo_UserCallBack_Success(JavaScript, "操作成功");

                //                #endregion 刷新当前页[抓取当页导航数字onclick事件]
                //            }
                //            else
                //            {
                //                JSDo_UserCallBack_Error("", "租售状态不一致");
                //            }
                //        }
                //}
                FullDropListData(typeof(h_State), this.ffrmStateID, "Name", "StateID", "");

                string OperType = Request.QueryString["OperTypes"];
                if (OperType != null)
                {
                    string HouseID = Request["HouseID"];
                    if (HouseID == null)
                    {
                        HouseID = "";
                    }
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    switch (OperType)
                    {
                    case "3":     //推见房源
                        s_SysParam ss  = s_SysParam.FindByParamCode("RecommendNum");
                        int        hrs = Convert.ToInt32(DbHelperSQL.GetSingle("select count(*) from h_Recommend where CONVERT(varchar,exe_date,112)=CONVERT(varchar,getdate(),112)"));
                        if (hrs < Convert.ToInt32(ss.Value))
                        {
                            DbHelperSQL.ExecuteSql(string.Format("update h_houseInfor set update_date=getdate() where HouseID = {0}", HouseID));
                            h_Recommend Hr = new h_Recommend();
                            Hr.EmployeeID = Employee.Current.EmployeeID;
                            Hr.HouseID    = Convert.ToDecimal(HouseID);
                            Hr.Insert();
                        }
                        else
                        {
                            sb.Append("{\r\n");
                            sb.Append("   \"statusCode\":\"300\", \r\n");
                            sb.Append("   \"message\":\"操作失败,您今天房源的推荐数已满请明天再试!\", \r\n");
                            sb.Append("   \"navTabId\":\"" + NavTabId + "\", \r\n");
                            sb.Append("   \"rel\":\"1\", \r\n");
                            sb.Append("   \"forwardUrl\":\"\"\r\n");
                            sb.Append("}\r\n");
                            Response.Write(sb.ToString());
                            Response.End();
                        }
                        break;

                    case "4":     //收藏房源
                        string sql = string.Format(@"if NOT EXISTS
                                                            (SELECT 1
                                                            FROM h_HouseCollect
                                                            WHERE HouseID={0}
                                                                    AND EmployeeID={1}) insert into h_HouseCollect(HouseID,EmployeeID) Values({0},{1})", HouseID, Employee.Current.EmployeeID);
                        DbHelperSQL.ExecuteSql(sql);
                        break;

                    case "5":     //取消收藏房源
                        h_HouseCollect houseCollect = h_HouseCollect.Find(new String[] { "HouseID", "EmployeeID" }, new Object[] { HouseID, Employee.Current.EmployeeID });
                        if (houseCollect != null)
                        {
                            houseCollect.Delete();
                        }
                        break;

                    case "6":     //查看钥匙
                        DataTable dt = DbHelperSQL.Query(string.Format(@"SELECT TOP 1 H.IsIn
                                                                                FROM h_HouseKey H
                                                                                WHERE H.HouseID ={0}
                                                                                        AND h.isDel=0
                                                                                ORDER BY  H.exe_date DESC",
                                                                       HouseID)).Tables[0];
                        sb.Append("{\r\n");
                        sb.Append("   \"statusCode\":\"200\", \r\n");
                        if (dt.Rows.Count > 0)
                        {
                            if (Convert.ToBoolean(dt.Rows[0][0]) == true)
                            {
                                sb.Append("   \"message\":\"该房源已经拿到钥匙\", \r\n");
                            }
                            else
                            {
                                sb.Append("   \"message\":\"该房源没有拿钥匙\", \r\n");
                            }
                        }
                        else
                        {
                            sb.Append("   \"message\":\"该房源没有拿钥匙\", \r\n");
                        }
                        sb.Append("}\r\n");
                        Response.Write(sb.ToString());
                        Response.End();
                        break;
                    }
                    sb.Append("{\r\n");
                    sb.Append("   \"statusCode\":\"200\", \r\n");
                    sb.Append("   \"message\":\"操作成功!\", \r\n");
                    sb.Append("}\r\n");
                    Response.Write(sb.ToString());
                    Response.End();
                }
                if (Request.QueryString["doType"] != null)
                {
                    if (Request.QueryString["doType"] == "del")
                    {
                        if (CheckRolePermission("删除房源"))
                        {
                            if (!String.IsNullOrEmpty(Request["hcids"]))
                            {
                                foreach (string s in Request["hcids"].Split(','))
                                {
                                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                                    H_houseinfor h = H_houseinfor.FindByHouseID(Convert.ToDecimal(s));
                                    if (h != null && CheckRolePermission("删除房源", h.OwnerEmployeeID.ToDecimal()))
                                    {
                                        //删除房源进入回收站
                                        h.DelType       = true;
                                        h.DelEmployeeID = Convert.ToInt32(Employee.Current.EmployeeID);
                                        h.DelDate       = System.DateTime.Now;
                                        h.Update();
                                    }
                                }
                            }
                            JSDo_UserCallBack_Success(" formFind();$(\".houseCheck:eq(0)\").submit();", "操作成功");
                        }
                        else
                        {
                            JSDo_UserCallBack_Success(" formFind();$(\".houseCheck:eq(0)\").submit();", "操作失败,您没有删除该房源的权限!");
                        }
                    }
                }
                if (Request.QueryString["StateID"] != null)
                {
                    if (!String.IsNullOrEmpty(Request["hcids"]))
                    {
                        foreach (string s in Request["hcids"].Split(','))
                        {
                            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                            H_houseinfor hh = H_houseinfor.FindByHouseID(Convert.ToDecimal(s));

                            if (H_houseinfor.Meta.Execute("exec dbo.h_update_HouseState " + Request.QueryString["StateID"] + ", " + hh.HouseID + ", " + Employee.Current.EmployeeID.ToString()) > 0)
                            {
                                string StateName = h_State.Find("StateID", Request.QueryString["StateID"]).Name;

                                #region 大积分添加处

                                //if (s_SysParam.FindByParamCode("UseBigPoint").Value == "1")
                                //{
                                //    //无效房源减分
                                //    if (StateName != "有效" && StateName != "我售")
                                //    {
                                //        I_IntegralLog.DeleteLog("添加房源积分", "h_houseinfor", hh.HouseID.ToString());
                                //    }
                                //    else
                                //    {
                                //        if (hh.SeeHouseType != "有效" && hh.SeeHouseType != "我售")
                                //        {
                                //            H_houseinfor.UpdateJF(hh.Sum_price, hh.OwnerEmployeeID, hh.HouseID, "添加房源积分");
                                //        }
                                //    }
                                //}

                                #endregion 大积分添加处

                                if (hh.Shi_id.IndexOf("KZ") > 0 || hh.Shi_id.IndexOf("MWZ") > 0)
                                {
                                }
                                else
                                {
                                    if (StateName == "重复")
                                    {
                                        if (hh.StateID.ToString() != Request.QueryString["StateID"].ToString())
                                        {
                                            TimeSpan ts = DateTime.Now - hh.Exe_date;
                                            if (ts.Days == 0)
                                            {
                                                e_Rewards er = new e_Rewards();
                                                er.AwardTypeID = 15;
                                                er.Cause       = "重复房源扣款暂存-房源号:" + hh.Shi_id;
                                                //e_SubGroupDetail es = e_SubGroupDetail.Find("OrgID", hh.OrgID);
                                                er.EmployeeID   = 0;
                                                er.OperID       = 2;
                                                er.OrgID        = hh.OrgID;
                                                er.Moneys       = 5;
                                                er.Rewards_Date = DateTime.Now;
                                                er.Active_Date  = DateTime.Now;
                                                er.Insert();
                                                e_Rewards ers = new e_Rewards();
                                                ers.AwardTypeID  = 15;
                                                ers.Cause        = "重复房源扣款-房源号:" + hh.Shi_id;
                                                ers.EmployeeID   = hh.OperatorID;
                                                ers.OperID       = 2;
                                                ers.OrgID        = hh.OrgID;
                                                ers.Moneys       = -5;
                                                ers.Rewards_Date = DateTime.Now;
                                                ers.Active_Date  = DateTime.Now;
                                                ers.Insert();
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (h_State.Find("StateID", hh.StateID).Name == "重复")
                                        {
                                            TimeSpan ts = DateTime.Now - hh.Exe_date;
                                            if (ts.Days == 0)
                                            {
                                                DataSet ds = e_Rewards.Meta.Query("select * from e_Rewards where Cause ='重复房源扣款暂存-房源号:" + hh.Shi_id + "'");
                                                if (ds.Tables[0].Rows.Count > 0)
                                                {
                                                    e_Rewards er = e_Rewards.Find("RewardsID", ds.Tables[0].Rows[0]["RewardsID"]);
                                                    if (er != null)
                                                    {
                                                        er.Delete();
                                                    }
                                                }
                                                DataSet dsa = e_Rewards.Meta.Query("select * from e_Rewards where Cause ='重复房源扣款-房源号:" + hh.Shi_id + "'");
                                                if (dsa.Tables[0].Rows.Count > 0)
                                                {
                                                    e_Rewards er = e_Rewards.Find("RewardsID", dsa.Tables[0].Rows[0]["RewardsID"]);
                                                    if (er != null)
                                                    {
                                                        er.Delete();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            H_houseinfor.Meta.Execute("update h_houseinfor set update_date=getdate() where HouseID=" + hh.HouseID);
                        }
                    }

                    //保存搜索条件再刷一次列表
                    //JSDo_UserCallBack_Success(" $(\".houseCheck:eq(0)\").submit();", "操作成功");

                    #region  刷列表,只刷新状态单元格

                    //h_State state = h_State.FindByStateID(Request.QueryString["StateID"].ToDecimal().Value);
                    //String JavaScript = "$(\"#check_" + Request.QueryString["HouseID"] + "\").html('"+state.Name+"');";
                    //JavaScript += "ReloadHouseCheck('" + Request.QueryString["HouseID"] + "')";
                    //JSDo_UserCallBack_Success(JavaScript, "操作成功");

                    #endregion  刷列表,只刷新状态单元格

                    #region 刷新当前页[抓取当页导航数字onclick事件]

                    // 当前页
                    // 翻页  dwzPageBreak({ targetType: targetType, rel: rel, data: { pageNum: event.data.pageNum} });
                    //String JavaScript = "alert('" + Request["selectPage"] + "');";
                    String JavaScript = " dwzPageBreak({ targetType: \"navTab\", rel: \"\", data: { pageNum: " + Request["selectPage"] + "} });";
                    JSDo_UserCallBack_Success(JavaScript, "操作成功");

                    #endregion 刷新当前页[抓取当页导航数字onclick事件]

                    //System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    //sb.Append("{\r\n");
                    //sb.Append("   \"statusCode\":\"200\", \r\n");
                    //sb.Append("   \"message\":\"操作成功!\", \r\n");
                    //sb.Append("   \"navTabId\":\"" + NavTabId + "\", \r\n");
                    //sb.Append("   \"rel\":\"1\", \r\n");
                    //sb.Append("   \"forwardUrl\":\"\"\r\n");
                    //sb.Append("}\r\n");
                    //Response.Write(sb.ToString());
                    //Response.End();
                }
            }
        }