Example #1
0
    //删除数据
    protected void BtnDel_Click(object sender, DirectEventArgs e)
    {
        int Success = 0, Failed = 0;
        RowSelectionModel sm = CL_Grid.SelectionModel.Primary as RowSelectionModel;

        foreach (SelectedRow row in sm.SelectedRows)
        {
            Y_CareLabel _Y_CareLabel = new Y_CareLabel();
            _Y_CareLabel = WMSFactory.Y_CareLabel.FindById(row.RecordID);
            if (WMSFactory.Y_CareLabel.Del(_Y_CareLabel))
            {
                if (File.Exists(Server.MapPath("XMimg/" + _Y_CareLabel.LbUrl)))
                {
                    File.Delete(Server.MapPath("XMimg/" + _Y_CareLabel.LbUrl));
                }
                //删除所有关联的图片
                WMSFactory.Y_StyleCareLabel.DelByConditions("LbId=" + _Y_CareLabel.Id);
                Success++;
            }
            else
            {
                Failed++;
            }
        }
        CL_Grid.Reload();
        if (Failed > 0)
        {
            MsgBox.MessageShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK");
        }
        else
        {
            MsgBox.NotifiShow("删除操作完成,成功" + Success.ToString() + "条,失败" + Failed.ToString() + "条!", "OK");
        }
    }
Example #2
0
    //保存洗唛图片
    protected void BtnSave_Click(object sender, DirectEventArgs e)
    {
        Y_CareLabel _Y_CareLabel = new Y_CareLabel();
        string      filename     = UpFile.PostedFile.FileName;

        if (Hid.Text.Length > 0)
        {
            _Y_CareLabel = WMSFactory.Y_CareLabel.FindById(Hid.Text);
        }
        else
        {
            if (string.IsNullOrEmpty(filename))
            {
                X.Msg.Alert("失败", "请选择图片文件!").Show();
                return;
            }
        }
        if (!string.IsNullOrEmpty(filename))
        {
            string ext = Path.GetExtension(filename).ToLower();
            if (ext != ".png" && ext != ".jpg")
            {
                X.Msg.Notify("失败", "<font color='red'>文件格式不正确,仅支持png,jpg格式文件!</font>").Show();
                return;
            }
            filename = DateTime.Now.ToString("yyyyMMddHHmmss") + ext;
            UpFile.PostedFile.SaveAs(Server.MapPath("XMimg/" + filename));

            if (File.Exists(Server.MapPath("XMimg/" + _Y_CareLabel.LbUrl)))
            {
                File.Delete(Server.MapPath("XMimg/" + _Y_CareLabel.LbUrl));
            }
            _Y_CareLabel.LbUrl = filename;    //图标地址
        }
        _Y_CareLabel.LbName = TxtLbName.Text; //图标名称

        bool isok = false;

        if (Hid.Text.Length > 0)
        {
            isok = WMSFactory.Y_CareLabel.Update(_Y_CareLabel);
        }
        else
        {
            isok = WMSFactory.Y_CareLabel.Add(_Y_CareLabel);
        }
        if (isok)
        {
            CL_WinEdit.Hide();
            CL_Grid.Reload();
            MsgBox.NotifiShow("恭喜您,操作成功!", "OK");
        }
        else
        {
            MsgBox.MessageShow("操作失败,请您重试!", "ERROR");
        }
    }
Example #3
0
    private void Start()
    {
        // Find the 'Grid' reference in the hierarchy
        grid = GameObject.Find("Grid").GetComponent <CL_Grid>();

        // States initialization
        cellState      = CellState.DEAD;
        cellHoverState = CellHoverState.IDLE;

        // Grid sprite color initialization
        this.gameObject.GetComponent <SpriteRenderer>().color = spriteColorDead;

        // Neighbours list initialization
        liveNeighbours = new List <CL_Cell>();
    }