Esempio n. 1
0
        /// <summary>保存成功</summary>
        protected virtual void SaveFormSuccess()
        {
            if (OnSaveSuccess != null)
            {
                var e = new EntityFormEventArgs()
                {
                    Cancel = false
                };
                OnSaveSuccess(this, e);
                if (e.Cancel)
                {
                    return;
                }
            }

            // 这个地方需要考虑一个问题,就是列表页查询之后再打开某记录进行编辑,编辑成功后,如果强行的reload列表页,浏览器会循环是否重新提交
            // 经测试,可以找到列表页的那个查询按钮,模拟点击一次它,实际上就是让ASP.Net列表页回发一次,可以解决这个问题
            Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", @"alert('成功!');
(function(){
    var load=window.onload;
    window.onload=function(){
        try{
            if(load) load();
            parent.Dialog.CloseAndRefresh(frameElement);
        }catch(e){};
    };
})();
", true);
        }
Esempio n. 2
0
 void EntityForm_OnGetForm(object sender, EntityFormEventArgs e)
 {
     if (!String.IsNullOrEmpty(frmPassword.Text))
     {
         EntityForm.Entity.SetItem("Password", DataHelper.Hash(frmPassword.Text));
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 扩展表单执行事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected override void OnOtherSaveForm(object sender, EntityFormEventArgs e)
 {
     if (EntityForm.IsAjaxAction && EntityForm.AjaxAction == "delall")
     {
         if (!String.IsNullOrEmpty(Request["Followids"]))
         {
             foreach (string s in Request["Followids"].Split(','))
             {
                 //判断权限
                 if (!CheckRolePermission("删除", h_FollowUp.FindByFollowUpID(decimal.Parse(s)).EmployeeID))
                 {
                     Page.ClientScript.RegisterStartupScript(this.GetType(), "Deljs", "<script>alertMsg.error('你无权删除!');</script>");
                     return;
                 }
                 else
                 {
                     h_FollowUp.Delete(new String[] { "FollowUpID" }, new String[] { s });
                 }
             }
         }
     }
     else
     {
         base.OnOtherSaveForm(sender, e);
     }
 }
Esempio n. 4
0
        /// <summary>验证表单,返回是否有效数据,决定是否保存表单数据</summary>
        /// <returns></returns>
        public virtual Boolean ValidForm()
        {
            foreach (FieldItem item in Factory.Fields)
            {
                Control control = FindControlByField(item);
                if (control == null)
                {
                    continue;
                }

                if (!ValidFormItem(item, control))
                {
                    return(false);
                }
            }

            if (OnValid != null)
            {
                var e = new EntityFormEventArgs()
                {
                    Cancel = false
                };
                OnValid(this, e);
                if (e.Cancel)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 5
0
        protected override void OnSaveSuccess(object sender, EntityFormEventArgs e)
        {
            //if (Request.Form["GU_IDS"] != "")
            //{
            //    TCode.EntityList<h_HouseTelList> hh = h_HouseTelList.FindAll("GU_ID", Request.Form["GU_IDS"]);
            //    foreach (h_HouseTelList ht in hh)
            //    {
            //        ht.GU_ID = null;
            //        ht.HouseID = Entity.HouseID;
            //        ht.Update();
            //    }
            //}

            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\":\"" + EntityForm.NavTabId + "\", \r\n");
            sb.Append("   \"rel\":\"" + Entity.FollowID + "\", \r\n");
            if (EntityForm.AjaxAction == "addoredit")
            {
                sb.Append("   \"callbackType\":\"closeCurrent\",\r\n");
            }
            sb.Append("   \"forwardUrl\":\"\"\r\n");
            sb.Append("}\r\n");

            Response.Write(sb.ToString());
            //Response.End();
        }
Esempio n. 6
0
    void EntityForm_OnSaveSuccess(object sender, EntityFormEventArgs e)
    {
        e.Cancel = true;
        WebHelper.AlertAndRedirect("成功", "Menu.aspx");

        //Response.Redirect("Menu.aspx");
    }
Esempio n. 7
0
        protected override void OnSetForm(object sender, EntityFormEventArgs e)
        {
            H_houseinfor hh = H_houseinfor.FindByHouseID(Entity.houseID);

            houseid.Value        = hh.HouseID.ToString();
            employeeID_Pro.Value = hh.OwnerEmployeeID.ToString();

            if (hh != null)
            {
                frmshi_id.Text = hh.Shi_id;
            }

            if (Entity.hProID > 0)
            {
                //房源核验
                frmh_Check.Checked = Entity.h_Check.ToBool();
                //户型图
                frmh_hxt.Checked = Entity.h_hxt.ToBool();
                //室内外图
                frmh_pic.Checked = Entity.h_pic.ToBool();

                employeeID_Finish.Value = Current.EmployeeID.ToString();
                Employee ee = Employee.FindByEmployeeID(Current.EmployeeID);
                frmemployeeID_FinishName.Text = ee.Em_name;

                tr1.Visible = tr2.Visible = true;
            }
            else
            {
                tr1.Visible = tr2.Visible = false;
            }

            base.OnSetForm(sender, e);
        }
Esempio n. 8
0
 void Form_EntityCommand(object sender, EntityFormEventArgs e)
 {
     if (e.CommandName == "Edit")
     {
         Navigator.Go("Edit", Command.TypeName, "ID", e.CommandArgument.ToString());
     }
 }
Esempio n. 9
0
 void EntityForm_OnGetForm(object sender, EntityFormEventArgs e)
 {
     if (!String.IsNullOrEmpty(frmPassword_.Text))
     {
         EntityForm.Entity.SetItem("Password", SecurityHelper.MD5(frmPassword_.Text, null));
     }
 }
Esempio n. 10
0
        protected override void OnSaving(object sender, EntityFormEventArgs e)
        {
            if (Entity.hProID > 0)
            {
                Entity.updateDate = DateTime.Now;
                if (Request.Form["frmremark"] != null && Request.Form["frmremark"] != string.Empty)
                {
                    Entity.remark   = Request.Form["frmremark"].ToString();
                    Entity.isFinish = "1";
                }
                Entity.employeeID_Finish = Request.Form["employeeID_Finish"].ToInt32();
            }
            else
            {
                if (Request.Form["houseid"] != null)
                {
                    Entity.houseID = Request.Form["houseid"].ToInt32();
                }
                //质疑人
                Entity.employeeID = Current.EmployeeID.ToString().ToInt32();
                //被质疑人
                Entity.employeeID_Pro = Request.Form["employeeID_Pro"].ToInt32();
                //是否处理
                Entity.isFinish = "0";
                Entity.exe_Date = DateTime.Now;
            }

            base.OnSaving(sender, e);
        }
Esempio n. 11
0
        protected override void OnSetForm(object sender, EntityFormEventArgs e)
        {
            base.OnSetForm(sender, e);
            string HouseID = Request.QueryString["HouseID"];

            Hid.Value = HouseID;
        }
Esempio n. 12
0
        /// <summary>保存失败</summary>
        /// <param name="ex"></param>
        protected virtual void SaveFormFailure(Exception ex)
        {
            if (OnSaveFailure != null)
            {
                var e = new EntityFormEventArgs()
                {
                    Cancel = false, Error = ex
                };
                OnSaveFailure(this, e);
                if (e.Cancel)
                {
                    return;
                }
            }

            // 如果是参数异常,参数名可能就是字段名,可以定位到具体控件
            ArgumentException ae = ex as ArgumentException;

            if (ae != null && !String.IsNullOrEmpty(ae.ParamName))
            {
                Control control = FindControl(ItemPrefix + ae.ParamName);
                if (control != null && !(control is HiddenField))
                {
                    control.Focus();
                }
            }

            WebHelper.Alert("失败!" + ex.Message);
        }
Esempio n. 13
0
        private void SaveFormWithTrans()
        {
            var session = Factory.Session;

            session.BeginTrans();
            Exception _ex = null;

            try
            {
                Boolean cancel = false;
                if (OnSaving != null)
                {
                    var e = new EntityFormEventArgs()
                    {
                        Cancel = false
                    };
                    //表单OnSaving事件取消仅仅是用于用户已经提前保存过表单,防止重复保存的情况
                    //所以即使取消保存,依然会正常的进如数据保存成功提示
                    //如果需要进行数据校验,请在OnValid中进行
                    OnSaving(this, e);
                    if (e.Cancel)
                    {
                        cancel = true;
                    }
                }

                if (!cancel)
                {
                    SaveForm();
                }

                session.Commit();
            }
            catch (Exception ex)
            {
                session.Rollback();
                _ex = ex;
            }
            try
            {
                if (_ex == null)
                {
                    SaveFormSuccess();
                }
                else
                {
                    SaveFormFailure(_ex);
                }
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SaveFormError",
                                                        "alert('保存后触发" + _ex == null ? "完成" : "失败" + "事件发生了异常,请检查日志!');",
                                                        true);
            }
        }
Esempio n. 14
0
 protected override void OnSetForm(object sender, EntityFormEventArgs e)
 {
     if (Entity.House.HouseID > 0)
     {
         frmOldPrice.Text     = Entity.House.Min_price.ToString();
         frmNewPrice.Text     = Entity.House.Min_price.ToString();
         frmOldPrice_Sum.Text = Entity.House.Sum_price.ToString();
         frmNewPrice_Sum.Text = Entity.House.Sum_price.ToString();
     }
 }
Esempio n. 15
0
 protected override void OnSetForm(object sender, EntityFormEventArgs e)
 {
     if (!IsPostBack)
     {
         //修改
         if (Request["ID"] != null)
         {
             frmRemark.Text = Entity.Remark;
         }
     }
 }
Esempio n. 16
0
 protected override void OnSaving(object sender, EntityFormEventArgs e)
 {
     if (Entity.ID > 0)
     {
     }
     else                          //添加
     {
         Entity.EmployeeID = Employee.Current.EmployeeID;
         Entity.AddDate    = DateTime.Now;
     }
     base.OnSaving(sender, e);
 }
Esempio n. 17
0
        protected override void OnSaving(object sender, EntityFormEventArgs e)
        {
            if (Request.Form["frmImgPic"] != "")
            {
                if (Request.Form["Hid"] != null)
                {
                    decimal      cid = Convert.ToDecimal(Request.Form["C.CustomerID"]);
                    int          hid = Convert.ToInt32(Request.Form["Hid"]);
                    H_houseinfor h   = H_houseinfor.FindByHouseID(hid);
                    if (h != null)
                    {
                        //带看凭证
                        Entity.ImgPic = Request.Form["frmImgPic"];
                        //操作人
                        Entity.EmployeeID = Employee.Current.EmployeeID;
                        //状态、
                        Entity.HouseState = int.Parse(ffrmHouseState.SelectedValue);
                        //房源ID
                        Entity.HouseID = hid;
                        //责任人
                        Entity.ZRempID = Request.Form["f.frmEscortEmployeeID1"].ToDecimal();
                        //时间
                        Entity.Exe_date = DateTime.Now;
                        Entity.Update();

                        //房源状态改为选择的状态
                        h.EntrustTypeID = Entity.HouseState;
                        h.Update();
                    }
                    else
                    {
                        Response.Write("<script>alertMsg.error('参数错误,请重新操作')</script>");
                        //取消执行
                        e.Cancel = true;
                        return;
                    }
                }
                else
                {
                    Response.Write("<script>alertMsg.error('参数错误,请重新操作')</script>");
                    //取消执行
                    e.Cancel = true;
                    return;
                }
            }
            else
            {
                Response.Write("<script>alertMsg.error('操作失败!请上传带看凭证')</script>");
                //取消执行
                e.Cancel = true;
                return;
            }
        }
Esempio n. 18
0
        protected override void OnSaving(object sender, EntityFormEventArgs e)
        {
            if (rdout.Checked)      // 拿走
            {
                Entity.IsIn = false;
            }
            else if (rdin.Checked)  // 拿入
            {
                Entity.IsIn = true;
            }
            Entity.EmployeeID = Convert.ToInt32(Employee.Current.EmployeeID);
            Entity.HouseID    = Convert.ToDecimal(Request.Form["id"]);

            base.OnSaving(sender, e);
        }
Esempio n. 19
0
        protected override void OnSaving(object sender, EntityFormEventArgs e)
        {
            if (Request.Form["rb1"] != null)
            {
                //查找此房源有没有 有录音待审核的记录,如果有,则无法申请开盘
                string sql = string.Format(@"SELECT count(*)
                                                FROM h_houseinfor_ZBCheck
                                                WHERE phoneid is NOT null
                                                        AND audit_Date is null
                                                        AND isDel=0
                                                        AND houseid={0}",
                                           houseID);
                if (Convert.ToInt32(DbHelperSQL.GetSingle(sql)) > 0)
                {
                    ShowMsg(AlertType.error, "保存失败,已有其他经纪人上传开盘录音");
                    return;
                }

                h_houseinfor_ZBCheck entity = new h_houseinfor_ZBCheck();
                entity.houseID       = houseID;
                entity.exe_Date      = DateTime.Now;
                entity.employeeID    = Convert.ToInt32(Current.EmployeeID);
                entity.phoneID       = Convert.ToInt32(Request.Form["rb1"]);
                entity.state_ZBCheck = (int)CheckState.待认证;
                entity.comID         = Current.ComID;

                entity.Insert();

                //找出此房源所有未审核,未上传开盘录音的记录,将其清空
                List <h_houseinfor_ZBCheck> listZB = h_houseinfor_ZBCheck.FindAll(string.Format(@"select * from h_houseinfor_ZBCheck
		                                                                                                where houseid={0}
		                                                                                                and phoneID is null 
		                                                                                                and employee_auditID is null
		                                                                                                and isDel=0"        ,
                                                                                                houseID));

                if (listZB.Count > 0)
                {
                    DbHelperSQL.ExecuteSql("update h_houseinfor_ZBCheck set isdel=1 where id in(" + string.Join(",", listZB.Select(x => x.ID).ToArray()) + ")");
                }

                ShowMsg(AlertType.correct, "保存成功");
            }
            else
            {
                ShowMsg(AlertType.error, "保存失败,请先选择录音");
            }
        }
Esempio n. 20
0
        protected override void OnSaving(object sender, EntityFormEventArgs e)
        {
            string r = HttpGetUTF(baseurl + "/erp/BindEfwUser?username="******"&pwd=" + frmshPwd.Text + "&erpid=" + Employee.Current.EmployeeID + "&erpname=" + Base64Encode(Employee.Current.Em_name) + "");

            if (r == "1")
            {
                base.OnSaving(sender, e);
                ShowMsg(AlertType.correct, "绑定成功!", false, false);
            }
            else
            {
                ShowMsg(AlertType.error, "绑定失败!", false);
            }
            //SaveValid();
            //Entity.shPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(frmshpwd.Text, "MD5").ToLower();
        }
 void Form_EntityCommand(object sender, EntityFormEventArgs e)
 {
     using (LogGroup logGroup = LogGroup.Start("Handling entity form command.", NLog.LogLevel.Debug))
     {
         if (e.CommandName == "Save")
         {
             Save();
         }
         else if (e.CommandName == "Update")
         {
             Update();
         }
         else
         {
             throw new InvalidOperationException("Command name not supported: " + e.CommandName);
         }
     }
 }
Esempio n. 22
0
 protected override void OnSaving(object sender, EntityFormEventArgs e)
 {
     if (Entity.ID > 0)
     {
     }
     else                          //添加
     {
         Entity.EmployeeID = Employee.Current.EmployeeID;
         Entity.ShareTotal = 0;
         Entity.AddDate    = DateTime.Now;
         Entity.Type       = Convert.ToInt32(this.Type.Value);
     }
     base.OnSaving(sender, e);
     //if (!string.IsNullOrEmpty(Request.Form["frmContents"]))
     //{
     //    if (Request.Form["frmContents"].Split("<img").Length <= 5)
     //    {
     //        e.Cancel = true;
     //    }
     //}
 }
Esempio n. 23
0
        protected override void OnSaveSuccess(object sender, EntityFormEventArgs e)
        {
            //拿入并且不是其他中介,则增加排序积分
            if (rdin.Checked && !Entity.InOhterCompany)
            {
                //增加排序积分
                s_SysParam ss = s_SysParam.FindByParamCode("houseKey");
                //获取分隔符的值,第一个为分值,第二是否有 有效期,第三为有效期值
                string[] ssValue = ss.Value.Split('|');

                e_Integral ei = new e_Integral();
                ei.employeeID    = Convert.ToInt32(Current.EmployeeID);
                ei.Type          = (int)integral_Type.房源与经纪人;
                ei.tableName     = "h_houseinfor";
                ei.coloumnName   = "HouseID";
                ei.keyID         = Convert.ToInt32(Entity.HouseID);
                ei.integralParam = "houseKey";
                ei.integralValue = ssValue[0].ToInt32();
                ei.integralDay   = ssValue[1] == "1" ? ssValue[2].ToInt32() : 0;
                ei.exe_Date      = DateTime.Now;
                ei.Insert();
            }
        }
Esempio n. 24
0
 void EntityForm_OnSetForm(object sender, EntityFormEventArgs e)
 {
     frmPassword.Text = null;
 }
Esempio n. 25
0
 void EntityForm_OnGetForm(object sender, EntityFormEventArgs e)
 {
     if (!String.IsNullOrEmpty(frmPassword.Text)) EntityForm.Entity.SetItem("Password", DataHelper.Hash(frmPassword.Text));
 }
Esempio n. 26
0
    void EntityForm_OnSaveSaving(object sender, EntityFormEventArgs e)
    {
        EntityForm.Entity.SetItem("EndTime", frmBiddingLimitTime.Value);

        //Response.Redirect("Menu.aspx");
    }
Esempio n. 27
0
        private void SaveFormWithTrans()
        {
            var eop = Factory;
            eop.BeginTransaction();
            try
            {
                Boolean cancel = false;
                if (OnSaving != null)
                {
                    var e = new EntityFormEventArgs() { Cancel = false };
                    OnSaving(this, e);
                    if (e.Cancel) cancel = true;
                }

                if (!cancel) SaveForm();

                eop.Commit();

                SaveFormSuccess();
            }
            catch (Exception ex)
            {
                eop.Rollback();

                SaveFormFailure(ex);
            }
        }
Esempio n. 28
0
        /// <summary>
        /// 插入之前执行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void OnSaving(object sender, EntityFormEventArgs e)
        {
            if (Entity.HouseID > 0)
            {
                //判断是否委托单号大于0,并且和原先的委托单号不同
                if (Entity.orderNum > 0 && Entity.orderNum != orderNum_old.Value.ToInt32())
                {
                    string sql = string.Format(@"IF EXISTS(SELECT 1 
                                                    FROM   h_houseinfor 
                                                    WHERE  atype = 1 
                                                            AND ordernum = {0}) 
                                                    SELECT 1 
                                                ELSE 
                                                    SELECT 0 ",
                                               Entity.orderNum);
                    if (DbHelperSQL.GetSingle(sql).ToInt16() == 1)
                    {
                        ShowMsg(AlertType.error, "已存在该委托单号,请重新输入!");
                    }
                }

                Entity.CurrentEmployee = Employee.Current.EmployeeID;
            }
            else
            {
                //判断是否委托单号大于0,
                if (Entity.orderNum > 0)
                {
                    string sql = string.Format(@"IF EXISTS(SELECT 1 
                                                    FROM   h_houseinfor 
                                                    WHERE  atype = 1 
                                                            AND ordernum = {0}) 
                                                    SELECT 1 
                                                ELSE 
                                                    SELECT 0 ",
                                               Entity.orderNum);
                    if (DbHelperSQL.GetSingle(sql).ToInt16() == 1)
                    {
                        ShowMsg(AlertType.error, "已存在该委托单号,请重新输入!");
                    }
                }

                Entity.Shi_id          = H_houseinfor.NewHouseCode();
                Entity.OrgID           = Convert.ToInt32(Employee.Current.OrgID);
                Entity.OwnerEmployeeID = Convert.ToInt32(Employee.Current.EmployeeID);
                Entity.OperatorID      = Convert.ToInt32(Employee.Current.EmployeeID);
                //新增时默认状态为委托中
                //Entity.StateID = 2;
            }
            Entity.UnitID     = Request.Form["frmUnitID"].ToInt32();
            Entity.RoomID     = Request.Form["frmRoomID"].ToInt32();
            Entity.Rent_Price = Request.Form["frmRent_Price"].ToDecimal();
            Entity.SanjakID   = Request.Form["ddlSanjakID"].ToInt32();
            Entity.Facility   = Request.Form["F.frmFacility"];

            if (Request.Form["h.frmbuild_id"].TrimStart('0').Length > 0)
            {
                Entity.Build_id = Request.Form["h.frmbuild_id"].TrimStart('0');
            }
            else
            {
                Entity.Build_id = "0";
            }
            if (Request.Form["h.frmbuild_room"].TrimStart('0').Length > 0)
            {
                Entity.Build_room = Request.Form["h.frmbuild_room"].TrimStart('0');
            }
            else
            {
                Entity.Build_room = "0";
            }

            if (Request.Form["frmSum_price"] != "")
            {
                Entity.Sum_price = Convert.ToDecimal(Request.Form["frmSum_price"]);
            }
            Entity.Ohter2ID = Request.Form["Prices"].ToInt32();

            string s_LinkTel1 = "(1)所有房间的朝向 (2)房内设施情况 (3)装修保养情况 (4)目前是否有人居住";
            string s_note     = "是否有车位、什么时候可腾房等";
            string s_Remarks  = "钥匙是否在外中介或其他地方的位置";

            if (Request.Form["frmLinkTel1"].ToString().Trim().Equals(s_LinkTel1))
            {
                Entity.LinkTel1 = string.Empty;
            }
            if (Request.Form["frmnote"].ToString().Trim().Equals(s_note))
            {
                Entity.Note = string.Empty;
            }
            if (Request.Form["frmRemarks"].ToString().Trim().Equals(s_Remarks))
            {
                Entity.Remarks = string.Empty;
            }

            base.OnSaving(sender, e);
        }
Esempio n. 29
0
        /// <summary>
        /// 表单数据赋值前
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void OnSetForm(object sender, EntityFormEventArgs e)
        {
            base.OnSetForm(sender, e);
            if (!IsPostBack)
            {
                string s_LinkTel1 = "(1)所有房间的朝向 (2)房内设施情况 (3)装修保养情况 (4)目前是否有人居住";
                string s_note     = "是否有车位、什么时候可腾房等";
                string s_Remarks  = "钥匙是否在外中介或其他地方的位置";

                if (Entity.LinkTel1.IsNullOrWhiteSpace())
                {
                    frmLinkTel1.ForeColor = System.Drawing.Color.Gray;
                    frmLinkTel1.Text      = s_LinkTel1;
                }
                if (Entity.Note.IsNullOrWhiteSpace())
                {
                    frmnote.ForeColor = System.Drawing.Color.Gray;
                    frmnote.Text      = s_note;
                }
                if (Entity.Remarks.IsNullOrWhiteSpace())
                {
                    frmRemarks.ForeColor = System.Drawing.Color.Gray;
                    frmRemarks.Text      = s_Remarks;
                }

                frmLinkTel1.Attributes.Add("onfocus", "if(this.value=='" + s_LinkTel1 + "')this.value='';this.style.color='#000'");
                frmnote.Attributes.Add("onfocus", "if(this.value=='" + s_note + "')this.value='';this.style.color='#000'");
                frmRemarks.Attributes.Add("onfocus", "if(this.value=='" + s_Remarks + "')this.value='';this.style.color='#000'");

                frmLinkTel1.Attributes.Add("onblur", " this.style.color='#000';if(this.value==''){this.value='" + s_LinkTel1 + "';this.style.color='#999'}");
                frmnote.Attributes.Add("onblur", "this.style.color='#000';if(this.value==''){this.value='" + s_note + "';this.style.color='#999'}");
                frmRemarks.Attributes.Add("onblur", "this.style.color='#000';if(this.value==''){this.value='" + s_Remarks + "';this.style.color='#999'}");

                frmbID.Attributes.Add("onchange", "GetUnitItems_Rent(" + Entity.HouseID + ");");
                //this.frmUnitID.Attributes.Add("onchange", "GetRoomItems_Rent(" + Entity.HouseID + ");");
                frmRoomID.Attributes.Add("onchange", "GetDoorItems_Rent(" + Entity.HouseID + ");");
                //this.frmBuild_area.Attributes.Add("onblur", "GetPrices('" + Entity.HouseID + "')");
                //this.frmSum_price.Attributes.Add("onblur", "GetPrices('" + Entity.HouseID + "')");
                PriceFollowUp.Attributes.Add("href", "House/FollowUpPriceEditor.aspx?NavTabId=" + NavTabId + "&doAjax=true&HouseID=" + Entity.HouseID);
                PriceFollowUp.Attributes.Add("title", "增加压价跟进");
                if (Entity.HouseID > 0)
                {
                    //委托单号
                    orderNum_old.Value = Entity.orderNum.ToString();

                    //跟进
                    ligjRent.Visible = true;
                    if (Current.RoleNames.Contains("信息"))
                    {
                        //积分
                        lijf.Visible = true;
                    }

                    if (!Current.RoleNames.Contains("超级") && !Current.RoleNames.Contains("信息"))
                    {
                        //栋号不能修改
                        frmbID.Enabled = false;
                        frmbuild_id.Attributes.Add("ReadOnly", "true");
                        //室号不能修改
                        frmRoomID.Enabled = false;
                        frmbuild_room.Attributes.Add("ReadOnly", "true");
                    }

                    if (Entity.HouseDicType == "1")
                    {
                        frmbuild_room.CssClass = "Hinput frmbuild_room";
                        if (Entity.Bid.HasValue && Entity.Bid.Value > 0 && Entity.RoomID.HasValue && Entity.RoomID.Value > 0)
                        {
                            List <s_Seat> seatList = s_Seat.FindAll(string.Format(@"select SeatID,SeatName
                                                                                from s_Seat
                                                                                where HouseDicID={0}", Entity.HouseDicID));

                            frmbID.DataSource     = seatList;
                            frmbID.DataTextField  = "SeatName";
                            frmbID.DataValueField = "SeatID";
                            frmbID.DataBind();
                            frmbID.SelectedValue = Entity.Bid.Value.ToString();
                            frmbuild_id.Text     = frmbID.SelectedItem.Text;

                            List <s_Door> doorList = s_Door.FindAll(string.Format(@"select DoorID,DoorNam
                                                                                    from s_Door
                                                                                    where SeatID={0}
                                                                                    and DoorID not in(select RoomID
                                                                                                        from h_houseinfor
                                                                                                        where bID={0}
                                                                                                        and RoomID<>{1}
                                                                                                        and aType=0
                                                                                                        and DelType=0
                                                                                                        and RoomID>0)
                                                                                    order by DoorNam",
                                                                                  Entity.Bid.Value,
                                                                                  Entity.RoomID.Value));

                            frmRoomID.DataSource     = doorList;
                            frmRoomID.DataTextField  = "DoorNam";
                            frmRoomID.DataValueField = "DoorID";
                            frmRoomID.DataBind();
                            frmRoomID.SelectedValue = Entity.RoomID.Value.ToString();
                            frmbuild_room.Text      = frmRoomID.SelectedItem.Text;
                        }
                    }

                    frmlandlord_tel2.Text = "点击查看隐藏信息!";

                    #region 暂时无用 2017-07-14 10:32:15
                    //if (Entity.Bid.HasValue && Entity.Bid > 0)
                    //{
                    //    //var list_s_Seat = s_Seat.Find(string.Format("HouseDicID={0} and SeatID={1}", Entity.HouseDicID, Entity.Bid));
                    //    //frmbID.DataSource = list_s_Seat;
                    //    //frmbID.DataTextField = "SeatName";
                    //    //frmbID.DataValueField = "SeatID";
                    //    //frmbID.DataBind();
                    //    //this.frmUnitID.DataSource = s_Unit.FindAll("SeatID", Entity.Bid);
                    //    //this.frmUnitID.DataTextField = "UnitNam";
                    //    //this.frmUnitID.DataValueField = "UnitID";
                    //    //this.frmUnitID.DataBind();
                    //    //foreach (ListItem li in frmUnitID.Items)
                    //    //{
                    //    //    if (li.Text == Entity.Build_unit)
                    //    //        li.Selected = true;
                    //    //}
                    //}
                    //else
                    //{
                    //    frmbID.Items.Add(new ListItem(Entity.Build_id, "0"));
                    //    //this.frmUnitID.Items.Add(new ListItem(Entity.Build_unit, "0"));
                    //}

                    //if (Entity.UnitID.HasValue && Entity.UnitID > 0)
                    //{
                    //    //List<s_Door> list_s_Door = s_Door.FindAll("UnitID", Entity.UnitID);
                    //    //list_s_Door.OrderBy(x => x.DoorNam);
                    //    //this.frmRoomID.DataSource = list_s_Door;
                    //    //this.frmRoomID.DataTextField = "DoorNam";
                    //    //this.frmRoomID.DataValueField = "DoorID";
                    //    //this.frmRoomID.DataBind();
                    //    //foreach (ListItem li in frmRoomID.Items)
                    //    //{
                    //    //    if (li.Text == Entity.Build_room)
                    //    //        li.Selected = true;
                    //    //}
                    //}
                    //else
                    //    frmRoomID.Items.Add(new ListItem(Entity.Build_room, "0"));
                    #endregion
                }

                if (!CheckRolePermission("不隐号"))
                {
                    //frmNotarizationNum.Text = "***";
                    if (Entity.IsBeiAn.HasValue && Entity.IsBeiAn.Value)
                    {
                        frmbuild_id.Text = "***";
                        //frmbuild_unit.Text = "***";
                        frmbuild_room.Text = "***";
                        this.frmbID.Items.Add(new ListItem("", "***"));
                        //this.frmUnitID.Items.Add(new ListItem("", "***"));
                        frmRoomID.Items.Add(new ListItem("", "***"));
                    }
                }

                //如果没有权限,则委托方式不能修改
                if (!CheckRolePermission("修改委托"))
                {
                    if (Entity.EntrustTypeID.HasValue)
                    {
                        frmEntrustTypeID.SelectedValue = Entity.EntrustTypeID.Value.ToString();
                        ListItem li = frmEntrustTypeID.SelectedItem;
                        frmEntrustTypeID.Items.Clear();
                        frmEntrustTypeID.Items.Add(li);
                    }
                    else
                    {
                        frmEntrustTypeID.Items.Clear();
                        frmEntrustTypeID.Items.Insert(0, new ListItem("一般委托", "1"));
                    }
                }

                frmRemarks.Text    = "***";
                frmMin_priceb.Text = "***";

                if (Entity.SanjakID > 0)
                {
                    s_Sanjak model_s_Sanjak = s_Sanjak.FindBySanjakID(Entity.SanjakID);
                    if (model_s_Sanjak != null)
                    {
                        ddlSanjakID.Items.Add(new ListItem(model_s_Sanjak.Name, model_s_Sanjak.SanjakID.ToString()));

                        s_Area model_s_Area = s_Area.FindByAreaID(model_s_Sanjak.AreaID);

                        if (model_s_Area != null)
                        {
                            ddlArea.Items.Add(new ListItem(model_s_Area.Name, model_s_Area.AreaID.ToString()));
                        }
                    }
                }
            }
        }
Esempio n. 30
0
        /// <summary>保存成功</summary>
        protected virtual void SaveFormSuccess()
        {
            if (OnSaveSuccess != null)
            {
                var e = new EntityFormEventArgs() { Cancel = false };
                OnSaveSuccess(this, e);
                if (e.Cancel) return;
            }

            // 这个地方需要考虑一个问题,就是列表页查询之后再打开某记录进行编辑,编辑成功后,如果强行的reload列表页,浏览器会循环是否重新提交
            // 经测试,可以找到列表页的那个查询按钮,模拟点击一次它,实际上就是让ASP.Net列表页回发一次,可以解决这个问题
            Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", @"alert('成功!');
(function(){
    var load=window.onload;
    window.onload=function(){
        try{
            if(load) load();
            parent.Dialog.CloseAndRefresh(frameElement);
        }catch(e){};
    };
})();
", true);
        }
Esempio n. 31
0
        /// <summary>保存失败</summary>
        /// <param name="ex"></param>
        protected virtual void SaveFormFailure(Exception ex)
        {
            if (OnSaveFailure != null)
            {
                var e = new EntityFormEventArgs() { Cancel = false, Error = ex };
                OnSaveFailure(this, e);
                if (e.Cancel) return;
            }

            // 如果是参数异常,参数名可能就是字段名,可以定位到具体控件
            ArgumentException ae = ex as ArgumentException;
            if (ae != null && !String.IsNullOrEmpty(ae.ParamName))
            {
                Control control = FindControl(ItemPrefix + ae.ParamName);
                if (control != null && !(control is HiddenField)) control.Focus();
            }

            WebHelper.Alert("失败!" + ex.Message);
        }
Esempio n. 32
0
 protected override void OnSetForm(object sender, EntityFormEventArgs e)
 {
     base.OnSetForm(sender, e);
     frmEmployeeID.Value = Employee.Current.EmployeeID.ToString();
 }
Esempio n. 33
0
        protected override void OnOtherSaveForm(object sender, EntityFormEventArgs e)
        {
            //验证数据合法性
            if (Entity.NewPrice == 0 || Entity.NewPrice_Sum == 0)
            {
                ShowMsg(AlertType.error, "跟进实价或总价不能为0!");
                return;
            }
            //经纪人必须上传录音
            if (Current.RoleNames.Contains("经纪人") && (Request.Form["rb1"] == null || Request.Form["rb1"] == ""))
            {
                ShowMsg(AlertType.error, "请选择压价录音!");
                return;
            }

            h_PriceFollowUp.Meta.BeginTrans();
            try
            {
                //改房源实价和平均价格
                decimal NewPrice     = Entity.NewPrice;
                decimal NewPrice_Sum = Entity.NewPrice_Sum;
                if (NewPrice > Entity.House.Sum_price)
                {
                    NewPrice_Sum = NewPrice;
                }

                //写一条房源跟进
                h_FollowUp hfo = new h_FollowUp();
                hfo.HouseID      = Entity.HouseID;
                hfo.EmployeeID   = Employee.Current.EmployeeID;
                hfo.FollowUpText = "压价跟进[实价]:" + Entity.House.Min_price + "→" + NewPrice + ",[总价]:" + Entity.House.Sum_price + "→" + NewPrice_Sum;
                hfo.exe_Date     = DateTime.Now;
                hfo.Insert();

                Entity.OldPrice     = Entity.House.Min_price;
                Entity.OldPrice_Sum = Entity.House.Sum_price;

                //decimal AddIntegral = Math.Abs(Math.Round(((Entity.NewPrice - Entity.OldPrice) * 10000 / 1000), 0));

                //保存
                Entity.EmployeeID = hfo.EmployeeID;
                Entity.AddDate    = hfo.exe_Date;
                //Entity.Integral = AddIntegral.ToInt32().Value;
                Entity.Integral = 0;
                Entity.State    = 0;
                if (Current.RoleNames.Contains("经纪人"))
                {
                    //获取此房源历史最低价格,如果新实价比历史最低价降低3%,则更改价格维护人
                    decimal minNewPrice = DbHelperSQL.GetSingle(string.Format(@"select isnull(min(NewPrice),0) from h_PriceFollowUp where HouseID ={0}", Entity.HouseID)).ToDecimal().Value;
                    if ((minNewPrice - NewPrice) >= (minNewPrice * 0.03.ToDecimal()))
                    {
                        Entity.State = 1;

                        //增加排序积分
                        s_SysParam ss = s_SysParam.FindByParamCode("housePrice");
                        //获取分隔符的值,第一个为分值,第二是否有 有效期,第三为有效期值
                        string[] ssValue = ss.Value.Split('|');

                        e_Integral ei = new e_Integral();
                        ei.employeeID    = Convert.ToInt32(Current.EmployeeID);
                        ei.Type          = (int)integral_Type.房源与经纪人;
                        ei.tableName     = "h_houseinfor";
                        ei.coloumnName   = "HouseID";
                        ei.keyID         = Convert.ToInt32(Entity.HouseID);
                        ei.integralParam = "housePrice";
                        ei.integralValue = ssValue[0].ToInt32();
                        ei.integralDay   = ssValue[1] == "1" ? ssValue[2].ToInt32() : 0;
                        ei.exe_Date      = DateTime.Now;
                        ei.Insert();
                    }
                }

                if (Request.Form["rb1"] != null && Request.Form["rb1"] != "")
                {
                    Entity.RecFilePath = Request.Form["rb1"].ToString();
                }

                //单价
                int Ohter2ID = Convert.ToInt32(Entity.NewPrice_Sum * 10000 / Entity.House.Build_area);

                string sql = string.Format(@"update h_houseinfor set Min_price={0},Ohter2ID={1},Sum_price={2}
                                            where HouseID={3}",
                                           NewPrice,
                                           Ohter2ID,
                                           NewPrice_Sum,
                                           Entity.HouseID);

                h_PriceFollowUp.Meta.Execute(sql);

                Entity.Save();

                h_PriceFollowUp.Meta.Commit();

                //判断是否修改价格维护人,需要推送给原价格维护人
                if (Entity.State == 1)
                {
                    sql = string.Format(@"SELECT TOP 1 employeeid 
                                            FROM   h_pricefollowup 
                                            WHERE  state = 1 
                                                    AND employeeid != {0} 
                                                    AND houseid = {1} 
                                            ORDER  BY adddate DESC ",
                                        Entity.EmployeeID,
                                        Entity.HouseID);

                    object empID = DbHelperSQL.GetSingle(sql);
                    //判断此房源是否有前一个价格维护人
                    if (empID != null)
                    {
                        string msg = "房源编号:【" + Entity.House.Shi_id + "】的价格维护人修改为【" + Current.Em_name + "】";

                        h_PriceComplaint hpc = new h_PriceComplaint();
                        hpc.h_PriceFollowUpID = Entity.ID;
                        hpc.houseID           = Entity.HouseID.ToInt32().Value;
                        hpc.createTime        = DateTime.Now;
                        hpc.Context           = msg;
                        hpc.priceEditEmpID    = Entity.EmployeeID.ToInt32().Value;
                        hpc.priceEmpID        = empID.ToInt32().Value;
                        hpc.Insert();

                        Common.MsgPush.PushMsg(msg, new string[] { Entity.EmployeeID.ToString() }, (int)Common.msgType.价格维护);
                    }
                }
            }
            catch
            {
                h_PriceFollowUp.Meta.Rollback();
            }
        }
Esempio n. 34
0
 void EntityForm_OnSetForm(object sender, EntityFormEventArgs e)
 {
     frmPassword.Text = null;
 }
Esempio n. 35
0
        /// <summary>验证表单,返回是否有效数据,决定是否保存表单数据</summary>
        /// <returns></returns>
        public virtual Boolean ValidForm()
        {
            foreach (FieldItem item in Factory.Fields)
            {
                Control control = FindControlByField(item);
                if (control == null) continue;

                if (!ValidFormItem(item, control)) return false;
            }

            if (OnValid != null)
            {
                var e = new EntityFormEventArgs() { Cancel = false };
                OnValid(this, e);
                if (e.Cancel) return false;
            }

            return true;
        }
Esempio n. 36
0
 protected override void OnSaveSuccess(object sender, EntityFormEventArgs e)
 {
     JSDo_UserCallBack_Success("", "操作成功!", false);
     return;
     //base.OnSaveSuccess(sender, e);
 }