protected void btDelete_Click(object sender, EventArgs e)
        {
            ArrayList        pkArray = null;
            InspectDeviceBLL bll     = null;

            try
            {
                bll = BLLFactory.CreateBLL <InspectDeviceBLL>();

                pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0);

                foreach (object key in pkArray)
                {
                    bll.Delete(new InspectDeviceEntity {
                        Id = key.ToString()
                    });
                }

                this.BindData();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void btSave_Click(object sender, EventArgs e)
        {
            InspectDeviceEntity info = new InspectDeviceEntity();
            InspectDeviceBLL    bll  = null;

            try
            {
                UIBindHelper.BindModelByControls(this.Page, info);

                bll = BLLFactory.CreateBLL <InspectDeviceBLL>();

                if (this.hiID.Value == "")
                {
                    bll.Insert(info);
                }
                else
                {
                    info.Id = this.hiID.Value;
                    bll.Update(info);
                }

                ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void BindData()
        {
            string              Id   = Request.QueryString["Id"];
            InspectDeviceBLL    bll  = null;
            InspectDeviceEntity info = new InspectDeviceEntity();

            try
            {
                bll = BLLFactory.CreateBLL <InspectDeviceBLL>();
                if (string.IsNullOrEmpty(Id) == false)
                {
                    info.Id = Id;
                    info    = bll.Get(info);

                    UIBindHelper.BindForm(this.Page, info);
                    this.hiID.Value      = info.Id;
                    this.DeviceCode.Text = info.DeviceCode;
                    this.DeviceName.Text = info.DeviceName;
                    this.DeviceIP.Text   = info.DeviceIP;
                    this.DevicePort.Text = info.DevicePort + "";
                    this.LanIP.Text      = info.LanIP;
                    this.LanPort.Text    = info.LanPort + "";
                    if (!"0001/1/1 0:00:00".Equals(info.LastLoginTime + ""))
                    {
                        this.LastLoginTime.Text = info.LastLoginTime + "";
                    }
                    else
                    {
                        this.LastLoginTime.Text = "";
                    }
                    if (!"0001/1/1 0:00:00".Equals(info.LastRegisterTime + ""))
                    {
                        this.LastRegisterTime.Text = info.LastRegisterTime + "";
                    }
                    else
                    {
                        this.LastRegisterTime.Text = "";
                    }
                    this.Lon.Text           = info.Lon + "";
                    this.Lat.Text           = info.Lat + "";
                    this.OrganID.Text       = info.OrganID + "";
                    this.DeviceType.Text    = info.DeviceType + "";
                    this.Remark.Text        = info.Remark;
                    this.HiCREATEUSER.Value = info.CreateUser;
                    this.HiCREATETIME.Value = info.CreateTime.ToString();
                }
                else
                {
                    info = new InspectDeviceEntity();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentEncoding = Encoding.UTF8;
            context.Response.ContentType     = "application/json";
            string OrganID            = context.Request.QueryString["OrganID"];
            string DeviceType         = context.Request.QueryString["DeviceType"];
            InspectDeviceEntity param = new InspectDeviceEntity();

            param.OrganID    = OrganID;
            param.DeviceType = DeviceType;

            InspectDeviceBLL           bll  = BLLFactory.CreateBLL <InspectDeviceBLL>();
            List <InspectDeviceEntity> list = bll.GetAllDeviceByOrgAndType(param);

            context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(list));
        }
        private void BindData()
        {
            InspectDeviceBLL    bll       = null;
            DataPage            dp        = new DataPage();
            InspectDeviceEntity condition = new InspectDeviceEntity();

            try
            {
                bll = BLLFactory.CreateBLL <InspectDeviceBLL>();
                condition.DeviceCode = this.DeviceCode.Text;
                condition.DeviceName = this.DeviceName.Text;
                condition.OrganID    = this.OrganID.Text;

                PagerHelper.InitPageControl(this.AspNetPager1, dp, true);
                dp = bll.GetList(condition, dp);

                List <InspectDeviceEntity> list = dp.Result as List <InspectDeviceEntity>;

                CommonDropdown  commonDropdown = new CommonDropdown();
                List <DictInfo> typeList       = commonDropdown.getInspectDeviceType();
                foreach (InspectDeviceEntity ide in list)
                {
                    var temp = typeList.Find(p => p.ID == ide.DeviceType);
                    if (temp != null && temp.Des != null)
                    {
                        ide.DeviceTypeName = temp.Des;
                    }
                }

                this.GvList.DataSource = list;
                this.GvList.DataBind();

                for (int i = 0; i < this.GvList.Rows.Count; i++)
                {
                    string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["Id"].ToString());

                    (this.GvList.Rows[i].Cells[14].Controls[0] as WebControl).Attributes.Add("onclick", click);
                }
                PagerHelper.SetPageControl(AspNetPager1, dp, true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }