Пример #1
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        public void Bind()
        {
            try
            {
                string LocationId = "";
                string UserId     = Session["UserID"].ToString();
                if (Client.Session["Role"].ToString() == "SMOSECAdmin")
                {
                    var user = _autofacConfig.coreUserService.GetUserByID(UserId);
                    LocationId = user.USER_LOCATIONID;
                }

                DataTable assInventoryList = _autofacConfig.ConInventoryService.GetConInventoryList(Client.Session["Role"].ToString() == "SMOSECUser" ? Client.Session["UserID"].ToString() : "", LocationId);
                listView.Rows.Clear();
                if (assInventoryList.Rows.Count > 0)
                {
                    listView.DataSource = assInventoryList;
                    listView.DataBind();
                }
                foreach (var row in listView.Rows)
                {
                    frmConInventoryLayout layout = (frmConInventoryLayout)row.Control;
                    switch (layout.label1.Text)
                    {
                    case "盘点结束":
                        layout.label1.ForeColor = Color.FromArgb(43, 125, 43);
                        break;

                    case "盘点中":
                        layout.label1.ForeColor = Color.FromArgb(43, 140, 255);
                        layout.btnStart.Text    = "继续盘点";
                        break;

                    case "盘点未开始":
                        layout.label1.ForeColor = Color.FromArgb(211, 215, 217);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Пример #2
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        public void Bind()
        {
            try
            {
                string LocationId = "";
                string UserId     = Session["UserID"].ToString();
                if (Client.Session["Role"].ToString() == "SMOWMSAdmin")
                {
                    var user = _autofacConfig.coreUserService.GetUserByID(UserId);
                    LocationId = user.USER_LOCATIONID;
                }

                DataTable assInventoryList = _autofacConfig.ConInventoryService.GetConInventoryList(Client.Session["Role"].ToString() == "SMOWMSUser" ? Client.Session["UserID"].ToString() : "", LocationId);
                listView.Rows.Clear();
                if (assInventoryList.Rows.Count > 0)
                {
                    listView.DataSource = assInventoryList;
                    listView.DataBind();
                }
                foreach (var row in listView.Rows)
                {
                    frmConInventoryLayout layout = (frmConInventoryLayout)row.Control;
                    if (layout.lblStatus.Text == "盘点中")
                    {
                        layout.lblStatus.ForeColor = Color.FromArgb(77, 216, 101);
                        layout.ibEdit.Visible      = false;
                    }
                    else if (layout.lblStatus.Text == "盘点结束")
                    {
                        layout.lblStatus.ForeColor = Color.FromArgb(3, 58, 82);
                        layout.ibEdit.Visible      = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }